OpenCloudOS-Kernel/drivers/gpu/drm/msm
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
..
adreno drm/msm: Fix error about comments within a comment block 2020-01-13 16:06:00 -08:00
disp Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
dsi drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
edp drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
hdmi drm/bridge: Extend bridge API to disable connector creation 2020-02-26 13:31:23 +02:00
Kconfig drm/msm/gpu: add ocmem init/cleanup functions 2019-10-07 08:17:39 -07:00
Makefile drm/msm: add atomic traces 2019-09-03 16:17:02 -07:00
NOTES
msm_atomic.c drm/msm: add atomic traces 2019-09-03 16:17:02 -07:00
msm_atomic_trace.h drm/msm: add atomic traces 2019-09-03 16:17:02 -07:00
msm_atomic_tracepoints.c drm/msm: add atomic traces 2019-09-03 16:17:02 -07:00
msm_debugfs.c drm/msm: fix memleak on release 2019-11-13 15:34:15 -05:00
msm_debugfs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_drv.c Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
msm_drv.h Linux 5.6-rc2 2020-02-17 10:34:34 +01:00
msm_fb.c drm/msm: drop use of drmP.h 2019-09-03 16:16:57 -07:00
msm_fbdev.c drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
msm_fence.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_fence.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_gem.c drm/msm: Use the correct dma_sync calls harder 2019-09-04 10:05:05 -07:00
msm_gem.h dma-buf: rename reservation_object to dma_resv 2019-08-13 09:09:30 +02:00
msm_gem_prime.c drm/msm: drop use of drmP.h 2019-09-03 16:16:57 -07:00
msm_gem_shrinker.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_gem_submit.c drm/msm: Use dma_resv locking wrappers 2019-12-17 17:26:08 +01:00
msm_gem_vma.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_gpu.c drm/msm: include linux/sched/task.h 2019-10-07 09:29:10 -07:00
msm_gpu.h drm/msm/gpu: add support for ocmem interconnect path 2020-01-02 14:20:42 -08:00
msm_gpu_trace.h drm/msm: add atomic traces 2019-09-03 16:17:02 -07:00
msm_gpu_tracepoints.c drm/msm/gpu: Add trace events for tracking GPU submissions 2018-12-11 13:05:28 -05:00
msm_gpummu.c drm/msm: Remove unused function arguments 2019-10-07 08:25:30 -07:00
msm_iommu.c drm/msm: Remove unused function arguments 2019-10-07 08:25:30 -07:00
msm_kms.h drm/msm/dpu: async commit support 2019-09-03 16:17:01 -07:00
msm_mmu.h drm/msm: Remove unused function arguments 2019-10-07 08:25:30 -07:00
msm_perf.c drm/msm: drop use of drmP.h 2019-09-03 16:16:57 -07:00
msm_rd.c drm/msm: always dump buffer base/size 2019-11-02 09:43:24 -07:00
msm_ringbuffer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_ringbuffer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
msm_submitqueue.c drm/msm: drop use of drmP.h 2019-09-03 16:16:57 -07:00