[PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs

Ville Syrjala
2018-06-15T16:49:11Z

Apparently several drivers fill encoder->possible_clones with bogus
data, which means userspace can't trust that information at all.
Let's try to fix up some of the problems and add some sanity checks
into the core to persuade drivers to get it right from now on.
What we can't enforce is drivers actually implementing what they
advertize, so userspace would still have to take this information
with a grain of salt. But at least the information should be self
consistent.

I also figured we migth do something similar for possible_crtcs.
Although that is less important as there is no need for this to
match between two encoders. I also suspect the validation WARNs
would trip on some drivers. So we might not even want this part,
and instead we should just filter out bits for non-existing
crtcs.

Smoke tested on i915, and compile tested otherwise.

Pushed the lot here:
git://github.com/vsyrjala/linux.git possible_clones_clean

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>

Ville Syrjälä (14):
drm: Add drm_encoder_mask()
drm: Include the encoder itself in possible_clones
drm/gma500: Sanitize possible_clones
drm/sti: Remove pointless casts
drm/sti: Try to fix up the tvout possible clones
drm/exynos: Use drm_encoder_mask()
drm/imx: Remove the bogus possible_clones setup
drm: Validate encoder->possible_clones
drm/i915: Use drm_encoder_mask()
drm/i915: Populate possible_crtcs correctly
drm/i915: Fix DP-MST crtc_mask
drm/i915: Clean up encoder->crtc_mask setup
drm/i915: Simplfy LVDS crtc_mask setup
drm: Validate encoder->possible_crtcs

drivers/gpu/drm/drm_encoder.c | 66 ++++++++++++++++++++++++++++++++-
drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 +--
drivers/gpu/drm/gma500/framebuffer.c | 16 ++++----
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 4 +-
drivers/gpu/drm/i915/intel_crt.c | 4 +-
drivers/gpu/drm/i915/intel_ddi.c | 2 +-
drivers/gpu/drm/i915/intel_display.c | 20 ++++++++--
drivers/gpu/drm/i915/intel_dp.c | 6 +--
drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
drivers/gpu/drm/i915/intel_dvo.c | 2 +-
drivers/gpu/drm/i915/intel_hdmi.c | 6 +--
drivers/gpu/drm/i915/intel_lvds.c | 8 ++--
drivers/gpu/drm/i915/intel_sdvo.c | 2 +-
drivers/gpu/drm/i915/intel_tv.c | 3 +-
drivers/gpu/drm/imx/imx-drm-core.c | 2 +-
drivers/gpu/drm/sti/sti_tvout.c | 15 +++++---
include/drm/drm_encoder.h | 14 ++++++-
17 files changed, 132 insertions(+), 45 deletions(-)