linux/drivers/gpu/drm
Laurent Pinchart a25b988ff8 drm/bridge: Extend bridge API to disable connector creation
Most bridge drivers create a DRM connector to model the connector at the
output of the bridge. This model is historical and has worked pretty
well so far, but causes several issues:

- It prevents supporting more complex display pipelines where DRM
connector operations are split over multiple components. For instance a
pipeline with a bridge connected to the DDC signals to read EDID data,
and another one connected to the HPD signal to detect connection and
disconnection, will not be possible to support through this model.

- It requires every bridge driver to implement similar connector
handling code, resulting in code duplication.

- It assumes that a bridge will either be wired to a connector or to
another bridge, but doesn't support bridges that can be used in both
positions very well (although there is some ad-hoc support for this in
the analogix_dp bridge driver).

In order to solve these issues, ownership of the connector should be
moved to the display controller driver (where it can be implemented
using helpers provided by the core).

Extend the bridge API to allow disabling connector creation in bridge
drivers as a first step towards the new model. The new flags argument to
the bridge .attach() operation allows instructing the bridge driver to
skip creating a connector. Unconditionally set the new flags argument to
0 for now to keep the existing behaviour, and modify all existing bridge
drivers to return an error when connector creation is not requested as
they don't support this feature yet.

The change is based on the following semantic patch, with manual review
and edits.

@ rule1 @
identifier funcs;
identifier fn;
@@
 struct drm_bridge_funcs funcs = {
 	...,
 	.attach = fn
 };

@ depends on rule1 @
identifier rule1.fn;
identifier bridge;
statement S, S1;
@@
 int fn(
 	struct drm_bridge *bridge
+	, enum drm_bridge_attach_flags flags
 )
 {
 	... when != S
+	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
+		DRM_ERROR("Fix bridge driver to make connector optional!");
+		return -EINVAL;
+	}
+
 	S1
 	...
 }

@ depends on rule1 @
identifier rule1.fn;
identifier bridge, flags;
expression E1, E2, E3;
@@
 int fn(
 	struct drm_bridge *bridge,
 	enum drm_bridge_attach_flags flags
 ) {
 <...
 drm_bridge_attach(E1, E2, E3
+	, flags
 )
 ...>
 }

@@
expression E1, E2, E3;
@@
 drm_bridge_attach(E1, E2, E3
+	, 0
 )

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-10-laurent.pinchart@ideasonboard.com
2020-02-26 13:31:23 +02:00
..
amd Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
arc drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
arm Linux 5.5-rc7 2020-01-20 11:42:57 +10:00
armada
aspeed
ast drm/vram: Add helpers to validate a display mode's memory requirements 2020-02-06 10:32:54 +01:00
atmel-hlcdc drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
bochs drm/bochs: add drm_driver.release callback. 2020-02-12 10:24:08 +01:00
bridge drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
cirrus drm/cirrus: add drm_driver.release callback. 2020-02-12 10:24:08 +01:00
etnaviv drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
exynos drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
fsl-dcu drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
gma500 Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
hisilicon drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
i2c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
i810
i915 Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
imx drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
ingenic drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
lib
lima Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
mcde drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
mediatek drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
meson drm: meson: fix address type confusion 2020-01-08 13:51:56 +01:00
mga
mgag200 drm/mgag200: Add module parameter to pin all buffers at offset 0 2020-01-07 11:53:19 +01:00
msm drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
mxsfb
nouveau Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
omapdrm drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
panel drm/panel: ld9040: add MODULE_DEVICE_TABLE with SPI IDs 2020-02-22 13:16:56 +01:00
panfrost drm/panfrost: Add support for multiple power domains 2020-02-25 14:35:35 -06:00
pl111 drm/pl111: Support Integrator IM-PD1 module 2020-02-16 14:31:30 +01:00
qxl drm/qxl: replace zero-length array with flexible-array member 2020-02-13 11:11:59 +01:00
r128
radeon Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
rcar-du drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
rockchip drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
savage
scheduler drm/amdgpu: fix doc by clarifying sched_list definition 2020-01-27 16:46:44 -05:00
selftests Merge tag 'amd-drm-next-5.6-2020-01-10-dp-mst-dsc' of git://people.freedesktop.org/~agd5f/linux into drm-next 2020-01-13 17:14:34 +10:00
shmobile
sis
sti drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
stm drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
sun4i drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
tdfx
tegra drm/tegra: Fixes for v5.6-rc1 2020-02-07 12:22:30 +10:00
tidss drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
tilcdc drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
tiny drm/tiny/st7735r: No need to set ->owner for spi_register_driver() 2020-02-10 02:54:47 +01:00
ttm Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
tve200
udl drm/udl: Clear struct drm_connector_funcs.dpms 2020-02-10 09:24:09 +01:00
v3d
vboxvideo drm/vboxvideo: Implement struct drm_mode_config_funcs.mode_valid 2020-02-06 10:34:06 +01:00
vc4 drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
vgem drm/vgem: Close use-after-free race in vgem_gem_create 2020-02-06 19:04:41 +01:00
via Merge branch 'akpm' (patches from Andrew) 2020-01-31 12:16:36 -08:00
virtio drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl 2020-02-25 09:48:42 +01:00
vkms drm/vkms: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
vmwgfx Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
xen drm/xen: Explicitly disable automatic sending of vblank event 2020-01-30 09:00:51 +01:00
zte drm/zte: plane_state->fb iff plane_state->crtc 2020-01-28 15:43:58 +01:00
drm_agpsupport.c
drm_atomic_helper.c drm/bridge: Add the necessary bits to support bus format negotiation 2020-01-31 16:39:53 +01:00
drm_atomic_state_helper.c drm/atomic-helper: fix kerneldoc 2020-02-15 13:21:22 +01:00
drm_atomic_uapi.c
drm_atomic.c drm/bridge: Fix the bridge kernel doc 2020-02-18 16:50:45 +01:00
drm_auth.c drm/auth: Drop master_create/destroy hooks 2020-01-29 09:14:11 +01:00
drm_blend.c
drm_bridge.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
drm_bufs.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_cache.c
drm_client_modeset.c Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
drm_client.c
drm_color_mgmt.c
drm_connector.c drm/connector: Add helper to get a connector type name 2020-02-26 13:31:18 +02:00
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c drm: drop unused drm_crtc callback 2020-02-15 21:15:17 +01:00
drm_crtc_internal.h drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_crtc.c
drm_damage_helper.c
drm_debugfs_crc.c drm/crc: Actually allow to change the crc source 2020-01-28 16:49:22 +01:00
drm_debugfs.c drm/debugfs: also take per device driver features into account 2020-01-25 15:49:11 +02:00
drm_dma.c drm: fix parameters documentation style in drm_dma 2020-01-18 10:33:12 +01:00
drm_dp_aux_dev.c drm/dp_mst: Add MST support to DP DPCD R/W functions 2020-01-09 18:07:46 -05:00
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
drm_dp_mst_topology_internal.h
drm_dp_mst_topology.c Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
drm_drv.c drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c drm/edid: Add flag to drm_display_info to identify HDMI sinks 2020-02-26 13:31:19 +02:00
drm_encoder_slave.c
drm_encoder.c
drm_fb_cma_helper.c drm/fb-cma-helpers: Fix include issue 2020-01-09 17:33:41 +01:00
drm_fb_helper.c Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
drm_file.c drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_flip_work.c
drm_format_helper.c drm/format_helper: Dual licence the file in GPL 2 and MIT 2020-02-17 10:27:13 +01:00
drm_fourcc.c
drm_framebuffer.c drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm/vram: Add helpers to validate a display mode's memory requirements 2020-02-06 10:32:54 +01:00
drm_gem.c
drm_hashtab.c
drm_hdcp.c
drm_internal.h drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_ioc32.c
drm_ioctl.c drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_irq.c drm/irq: remove check on dev->dev_private 2020-02-11 18:39:47 +02:00
drm_kms_helper_common.c
drm_lease.c
drm_legacy_misc.c
drm_legacy.h
drm_lock.c gpu/drm: clean up white space in drm_legacy_lock_master_cleanup() 2020-01-08 19:51:11 +01:00
drm_memory.c
drm_mipi_dbi.c drm/mipi-dbi: Remove sending of vblank event 2020-01-30 09:00:45 +01:00
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c drm/modes: tag unused variables to avoid warnings 2020-01-09 17:17:28 +01:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_panel_orientation_quirks.c
drm_panel.c
drm_pci.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_plane_helper.c
drm_plane.c
drm_prime.c
drm_print.c
drm_probe_helper.c
drm_property.c
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
drm_syncobj.c drm/syncobj: Add documentation for timeline syncobj 2020-01-20 14:22:21 +01:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank.c drm: Remove legacy version of get_scanout_position() 2020-02-13 13:10:10 +01:00
drm_vm.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_vma_manager.c
drm_vram_helper_common.c
drm_writeback.c
Kconfig drm/tidss: New driver for TI Keystone platform Display SubSystem 2020-01-27 19:27:30 +02:00
Makefile drm/tidss: New driver for TI Keystone platform Display SubSystem 2020-01-27 19:27:30 +02:00