linux/drivers/gpu/drm
Daniel Vetter ca91a2758f drm/fb-helper: Support deferred setup
FB helper code falls back to a 1024x768 mode if no outputs are connected
or don't report back any modes upon initialization. This can be annoying
because outputs that are added to FB helper later on can't be used with
FB helper if they don't support a matching mode.

The fallback is in place because VGA connectors can happen to report an
unknown connection status even when they are in fact connected.

Some drivers have custom solutions in place to defer FB helper setup
until at least one output is connected. But the logic behind these
solutions is always the same and there is nothing driver-specific about
it, so a better alterative is to fix the FB helper core and add support
for all drivers automatically.

This patch adds support for deferred FB helper setup. It checks all the
connectors for their connection status, and if all of them report to be
disconnected marks the FB helper as needing deferred setup. Whet setup
is deferred, the FB helper core will automatically retry setup after a
hotplug event, and it will keep trying until it succeeds.

v2: Rebase onto my entirely reworked fbdev helper locking. One big
difference is that this version again drops&reacquires the fbdev lock
(which is now fb_helper->lock, but before this patch series it was
mode_config->mutex), because register_framebuffer must be able to
recurse back into fbdev helper code for the initial screen setup.

v3: __drm_fb_helper_initial_config must hold fb_helper->lock upon
return, I've fumbled that in the deferred setup case (Liviu).

v4: I was blind, redo this all. __drm_fb_helper_initial_config
shouldn't need to reacquire fb_helper->lock, that just confuses
callers. I myself got confused by kernel_fb_helper_lock and somehow
thought it's the same as fb_helper->lock. Tsk.

Also simplify the logic a bit (we don't need two functions to probe
connectors), we can stick much closer to the existing code. And update
some comments I've spotted that are outdated.

v5: Don't pass -EAGAIN to drivers, it's just an internal error code
(Liviu).

v6: Add _and_unlock suffix to clarify locking (Maarten)

Cc: Liviu Dudau <liviu@dudau.co.uk>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com> (v1)
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com>
Reviewed-by: Liviu Dudau <liviu@dudau.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170706130023.28417-3-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-07-26 13:45:07 +02:00
..
amd Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
arc drm: Convert atomic drivers from CRTC .disable() to .atomic_disable() 2017-06-30 14:53:15 +02:00
arm drm/mali: Use new atomic iterator macros 2017-07-13 09:54:12 +02:00
armada drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
ast drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
atmel-hlcdc drm/atmel-hlcdc: Handle drm_atomic_helper_swap_state failure 2017-07-26 13:22:41 +02:00
bochs drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
bridge Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
cirrus drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
etnaviv main drm pull for v4.13 2017-07-09 18:48:37 -07:00
exynos drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
fsl-dcu drm: Add old state pointer to CRTC .enable() helper function 2017-06-30 14:53:14 +02:00
gma500 drm/gma500: remove an unneeded NULL check 2017-06-28 19:17:38 +02:00
hisilicon drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
i2c drm: handle HDMI 2.0 VICs in AVI info-frames 2017-07-14 21:23:54 +03:00
i810 drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
i915 Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
imx drm/imx: Use atomic iterator macros 2017-07-13 09:54:48 +02:00
lib
mediatek drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
meson drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
mga Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
mgag200 drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
msm drm/msm: Handle drm_atomic_helper_swap_state failure 2017-07-26 13:22:42 +02:00
mxsfb drm/mxsfb: Use gem_free_object_unlocked 2017-07-18 08:40:54 +02:00
nouveau Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
omapdrm drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
panel drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
pl111 drm/pl111: Use gem_free_object_unlocked 2017-07-18 08:40:54 +02:00
qxl drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
r128 drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
radeon Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
rcar-du drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
rockchip drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
savage drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
selftests
shmobile drm/shmob: Drop drm_vblank_cleanup 2017-06-22 08:41:15 +02:00
sis drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
sti drm: handle HDMI 2.0 VICs in AVI info-frames 2017-07-14 21:23:54 +03:00
stm drm/stm: ltdc: Add panel-bridge support 2017-07-18 12:06:42 +05:30
sun4i drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
tdfx drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
tegra drm/tegra: Handle drm_atomic_helper_swap_state failure 2017-07-26 13:22:42 +02:00
tilcdc drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
tinydrm drm/tinydrm: Add RePaper e-ink driver 2017-07-14 19:30:08 +02:00
ttm drm/ttm: Fix use-after-free in ttm_bo_clean_mm 2017-07-03 16:25:43 -04:00
udl drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
vc4 drm/vc4: Handle drm_atomic_helper_swap_state failure 2017-07-26 13:22:43 +02:00
vgem drm/vgem: add compat_ioctl support 2017-07-17 21:08:31 +02:00
via drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
virtio drm/<drivers>: Drop fbdev info flags 2017-07-26 13:22:40 +02:00
vmwgfx Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
zte drm/zte: Use gem_free_object_unlocked 2017-07-18 08:40:54 +02:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic_helper.c drm/atomic: Allow drm_atomic_helper_swap_state to fail 2017-07-26 13:22:43 +02:00
drm_atomic.c drm: rename, adjust and export drm_atomic_replace_property_blob 2017-07-14 15:53:06 +02:00
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bufs.c switch compat_drm_mapbufs() to drm_ioctl_kernel() 2017-07-04 13:16:26 -04:00
drm_cache.c
drm_color_mgmt.c drm: More links for gamma support helpers 2017-06-20 12:13:11 +02:00
drm_connector.c Linux 4.12-rc7 2017-06-27 08:28:30 +10:00
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h
drm_crtc.c
drm_debugfs_crc.c drm/crc: Only open CRC on atomic drivers when the CRTC is active. 2017-07-17 16:34:51 +02:00
drm_debugfs.c
drm_dma.c
drm_dp_aux_dev.c drm_dp_aux_dev: switch to read_iter/write_iter 2017-07-08 20:51:46 -04:00
drm_dp_dual_mode_helper.c
drm_dp_helper.c
drm_dp_mst_topology.c drm/dp/mst: Use memchr_inv() instead of memcmp() against a zeroed array 2017-07-13 19:28:43 +03:00
drm_drv.c drm: inhibit drm drivers register to uninitialized drm core 2017-07-11 12:03:11 +02:00
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c drm/edid: parse ycbcr 420 deep color information 2017-07-14 21:23:54 +03:00
drm_encoder_slave.c
drm_encoder.c
drm_fb_cma_helper.c drm: Convert CMA fbdev console suspend helpers to use bool 2017-06-20 16:23:40 +02:00
drm_fb_helper.c drm/fb-helper: Support deferred setup 2017-07-26 13:45:07 +02:00
drm_file.c Merge remote-tracking branch 'airlied/drm-next' into drm-misc-next 2017-06-27 09:18:17 -04:00
drm_flip_work.c
drm_fourcc.c
drm_framebuffer.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_gem_cma_helper.c drm: Update docs around gem_free_object 2017-07-26 13:22:39 +02:00
drm_gem.c drm: Don't complain too much about struct_mutex. 2017-07-18 09:17:22 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_ioc32.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_ioctl.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_irq.c drm/doc: Polish irq helper documentation 2017-06-01 08:02:14 +02:00
drm_kms_helper_common.c
drm_legacy.h switch compat_drm_mapbufs() to drm_ioctl_kernel() 2017-07-04 13:16:26 -04:00
drm_lock.c
drm_memory.c
drm_mipi_dsi.c drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
drm_panel.c
drm_pci.c drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
drm_plane_helper.c
drm_plane.c
drm_prime.c
drm_print.c
drm_probe_helper.c drm: add helper to validate YCBCR420 modes 2017-07-14 21:23:54 +03:00
drm_property.c drm: rename, adjust and export drm_atomic_replace_property_blob 2017-07-14 15:53:06 +02:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_simple_kms_helper.c drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled. 2017-07-13 09:44:51 +02:00
drm_syncobj.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_vm.c
drm_vma_manager.c
Kconfig
Makefile Merge tag 'drm-misc-next-2017-06-15' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-06-16 09:33:43 +10:00