linux/include/drm
Imre Deak 1d985ddabb drm/connector: Add a way to init/add a connector in separate steps
Atm when the connector is added to the drm_mode_config::connector_list,
the connector may not be fully initialized yet. This is not a problem
for static connectors initialized/added during driver loading, for which
the driver ensures that look-ups via the above list are not possible
until all the connector and other required state is fully initialized
already. It's also not a problem for user space looking up either a
static or dynamic (see what this is below) connector, since this will be
only possible once the connector is registered.

A dynamic - atm only a DP MST - connector can be initialized and added
after the load time initialization is done. Such a connector may be
looked up by in-kernel users once it's added to the connector list. In
particular a hotplug handler could perform a detection on all the
connectors on the list and hence find a connector there which isn't yet
initialized. For instance the connector's helper hooks may be unset,
leading to a NULL dereference while the detect helper calls the
connector's drm_connector_helper_funcs::detect() or detect_ctx()
handler.

To resolve the above issue, add a way for dynamic connectors to
separately initialize the DRM core specific parts of the connector
without adding it to the connector list - by calling the new
drm_connector_dynamic_init() - and to add the connector to the list
later once all the initialization is complete and the connector is
registered - by calling the new drm_connector_dynamic_register().

Adding the above 2 functions was also motivated to make the distinction
of the interface between static and dynamic connectors clearer: Drivers
should manually initialize and register only dynamic connectors (with
the above 2 functions). A driver should only initialize a static
connector (with one of the drm_connector_init*, drmm_connector_init*
functions) while the registration of the connector will be done
automatically by DRM core.

v2: (Jani)
- Let initing DDC as well via drm_connector_init_core().
- Rename __drm_connector_init to drm_connector_init_core_and_add().

v3:
- Rename drm_connector_init_core() to drm_connector_dynamic_init().
  (Sima)
- Instead of exporting drm_connector_add(), move adding the connector
  to the registration step via a new drm_connector_dynamic_register().
  (Sima)
- Update drm_connector_dynamic_init()'s function documentation and the
  commit log according to the above changes.
- Update the commit log describing the problematic scenario during
  connector detection. (Maxime)

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (v1)
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241211230328.4012496-2-imre.deak@intel.com
2024-12-17 15:40:51 +02:00
..
bridge drm/bridge/synopsys: Add MIPI DSI2 host controller bridge 2024-12-10 23:53:04 +01:00
clients drm/client: Move public client header to clients/ subdirectory 2024-11-15 09:42:13 +01:00
display Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2024-12-09 16:35:21 +01:00
i2c drm/i2c: silence ch7006.h and sil164.h kernel-doc warnings 2024-03-11 14:29:19 +02:00
intel drm for 6.13-rc1 2024-11-21 14:56:17 -08:00
ttm drm/ttm: Fix incorrect use of kernel-doc format 2024-10-11 13:46:55 +02:00
amd_asic_type.h drm/amdgpu: make amd_asic_type.h self-contained 2024-03-07 17:17:25 +02:00
drm_accel.h drm next for 6.12-rc1 2024-09-19 10:18:15 +02:00
drm_atomic.h drm/atomic: fix kerneldoc for fake_commit field 2024-08-26 16:28:48 +02:00
drm_atomic_helper.h drm-misc-next for $kernel-version: 2023-12-19 17:07:32 +10:00
drm_atomic_state_helper.h drm/atomic-helper: Add an analog TV atomic_check implementation 2022-11-24 12:42:40 +01:00
drm_atomic_uapi.h
drm_audio_component.h drm/audio: make drm_audio_component.h self-contained 2022-11-29 14:14:51 +02:00
drm_auth.h drm: Remove source code for non-KMS drivers 2023-12-06 10:08:37 +01:00
drm_blend.h Revert "drm: Introduce pixel_source DRM plane property" 2023-12-04 21:33:10 +02:00
drm_bridge.h drm/display: bridge_connector: handle ycbcr_420_allowed 2024-10-24 22:42:25 +03:00
drm_bridge_connector.h drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd() 2023-01-05 15:08:10 +01:00
drm_buddy.h drm/buddy: Add start address support to trim function 2024-08-07 18:19:00 -04:00
drm_cache.h LoongArch: Add writecombine support for drm 2022-06-03 20:09:27 +08:00
drm_client.h drm/client: Make client support optional 2024-10-18 09:23:03 +02:00
drm_client_event.h drm/client: Make client support optional 2024-10-18 09:23:03 +02:00
drm_color_mgmt.h drm: using mul_u32_u32() requires linux/math64.h 2023-12-19 15:29:17 +02:00
drm_connector.h drm/connector: Add a way to init/add a connector in separate steps 2024-12-17 15:40:51 +02:00
drm_crtc.h drm: Remove references to removed transitional helpers 2023-07-29 21:25:16 +02:00
drm_crtc_helper.h drm/crtc-helper: Remove most include statements from drm_crtc_helper.h 2023-01-18 09:25:32 +01:00
drm_damage_helper.h
drm_debugfs.h drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm 2023-09-26 01:51:28 +02:00
drm_debugfs_crc.h drm/crc: make drm_debugfs_crc.h self-contained and fix kernel-doc 2024-03-07 17:17:25 +02:00
drm_device.h drm/vblank: add dynamic per-crtc vblank configuration support 2024-07-26 17:40:10 -04:00
drm_drv.h drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
drm_edid.h drm/edid: make drm_edid_block_valid() static 2024-08-14 12:16:34 +03:00
drm_eld.h drm/eld: add helpers to modify the SADs of an ELD 2023-11-09 16:48:27 +02:00
drm_encoder.h drm/encoder: register per-encoder debugfs dir 2023-12-04 16:07:29 +02:00
drm_encoder_slave.h drm/encoder: improve drm_encoder_slave.h kernel-doc 2024-03-11 11:47:06 +02:00
drm_exec.h Merge drm/drm-next into drm-misc-next 2024-01-29 14:20:23 +01:00
drm_fb_dma_helper.h drm/fb_dma: s/drm_panic_gem_get_scanout_buffer/drm_fb_dma_get_scanout_buffer 2024-04-15 13:50:40 -03:00
drm_fb_helper.h drm/fbdev: fix drm_fb_helper_deferred_io() build failure 2024-10-22 10:46:28 +02:00
drm_fbdev_dma.h drm/fbdev-dma: Remove obsolete setup function 2024-09-26 09:31:27 +02:00
drm_fbdev_shmem.h drm/fbdev-shmem: Remove obsolete setup function 2024-09-26 09:31:28 +02:00
drm_fbdev_ttm.h drm/fbdev-ttm: Remove obsolete setup function 2024-09-26 09:31:29 +02:00
drm_file.h drm/file: fix client_name_lock kernel-doc warning 2024-10-09 16:30:37 +02:00
drm_fixed.h drm: fixed: Don't use "proxy" headers 2024-08-13 12:13:45 +03:00
drm_flip_work.h drm: Fix flip-task docs 2023-11-14 10:23:12 +01:00
drm_format_helper.h drm: fix drm_format_helper.h kernel-doc warnings 2024-03-07 17:17:25 +02:00
drm_fourcc.h drm/fbdev-helper: Move color-mode lookup into 4CC format helper 2024-09-26 08:27:49 +02:00
drm_framebuffer.h drm: Remove legacy cursor hotspot code 2023-11-24 11:58:02 +01:00
drm_gem.h Merge tag 'drm-misc-next-2024-09-26' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next 2024-10-09 11:58:39 +10:00
drm_gem_atomic_helper.h drm/atomic-helper: Add format-conversion state to shadow-plane state 2023-11-14 10:01:14 +01:00
drm_gem_dma_helper.h fs: move FMODE_UNSIGNED_OFFSET to fop_flags 2024-08-30 08:22:36 +02:00
drm_gem_framebuffer_helper.h
drm_gem_shmem_helper.h drm/gem: Create shmem GEM object in a given mountpoint 2024-09-25 08:40:22 -03:00
drm_gem_ttm_helper.h drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2 2022-12-06 12:54:14 +01:00
drm_gem_vram_helper.h drm/gem-vram: Remove support for simple display pipelines 2024-09-06 14:41:38 +02:00
drm_gpuvm.h Merge drm/drm-next into drm-misc-next 2024-01-29 14:20:23 +01:00
drm_ioctl.h drm: Remove locking for legacy ioctls and DRM_UNLOCKED 2023-12-06 10:08:32 +01:00
drm_kunit_helpers.h drm/tests: helpers: Add helper for drm_display_mode_from_cea_vic() 2024-10-31 10:31:34 +01:00
drm_lease.h drm/lease: make drm_lease.h self-contained 2024-03-07 17:17:25 +02:00
drm_managed.h drm/managed: Add drmm_release_action 2024-01-17 10:38:39 +01:00
drm_mipi_dbi.h drm/mipi-dbi: Add support for DRM_FORMAT_RGB888 2024-06-07 16:09:05 +02:00
drm_mipi_dsi.h drm/mipi-dsi: add mipi_dsi_compression_mode_multi 2024-10-09 09:49:44 +02:00
drm_mm.h drm/mm: Remove unused drm_mm_replace_node 2024-06-06 10:24:13 -04:00
drm_mode_config.h drm: Remove struct drm_mode_config_funcs.output_poll_changed 2024-08-13 16:21:13 +02:00
drm_mode_object.h drm/drm_mode_object: increase max objects to accommodate new color props 2023-12-13 15:09:53 -05:00
drm_modes.h drm: Move drm_set_preferred_mode() helper from drm_edid to drm_modes 2024-01-05 21:14:46 +01:00
drm_modeset_helper.h
drm_modeset_helper_vtables.h drm/panic: Add a drm panic handler 2024-04-15 16:12:49 +02:00
drm_modeset_lock.h
drm_module.h
drm_of.h drm: of: Add drm_of_lvds_get_dual_link_pixel_order_sink() 2024-11-05 13:26:42 +02:00
drm_panel.h drm/panel: Fix kernel-doc typo for `follower_lock` 2023-08-03 10:21:27 +02:00
drm_panic.h drm/panic: Fix uninitialized spinlock acquisition with CONFIG_DRM_PANIC=n 2024-09-16 19:03:29 -04:00
drm_pciids.h drm: Remove some obsolete drm pciids(tdfx, mga, i810, savage, r128, sis, via) 2023-01-13 09:44:56 +01:00
drm_plane.h drm: Export drm_plane_has_format() 2024-06-24 17:08:53 +03:00
drm_plane_helper.h drm/plane-helper: Move drm_plane_helper_atomic_check() into udl 2023-12-06 10:35:49 +01:00
drm_prime.h drm: new helper: drm_gem_prime_handle_to_dmabuf() 2024-09-10 13:44:30 -04:00
drm_print.h drm/print: Introduce drm_line_printer 2024-10-07 18:34:45 -07:00
drm_privacy_screen_consumer.h
drm_privacy_screen_driver.h
drm_privacy_screen_machine.h
drm_probe_helper.h drm/ast: Automatically clean up poll helper 2024-04-02 10:40:52 +02:00
drm_property.h drm/drm_property: make replace_property_blob_from_id a DRM helper 2023-12-13 15:09:53 -05:00
drm_rect.h drm/rect: Add drm_rect_overlap() 2024-08-23 16:47:56 +02:00
drm_self_refresh_helper.h
drm_simple_kms_helper.h drm/simple-kms: Remove drm_gem_simple_display_pipe_prepare_fb() 2022-12-05 13:35:37 +01:00
drm_suballoc.h drm/suballoc: fix drm_suballoc.h kernel-doc 2024-03-07 17:17:25 +02:00
drm_syncobj.h drm/syncobj: add IOCTL to register an eventfd 2023-07-20 12:01:03 +02:00
drm_sysfs.h drm/sysfs: rename drm_sysfs_connector_status_event() 2023-06-23 15:54:00 +02:00
drm_util.h
drm_utils.h drm: Add panel backlight quirks 2024-11-21 09:28:11 -06:00
drm_vblank.h drm/vblank: add dynamic per-crtc vblank configuration support 2024-07-26 17:40:10 -04:00
drm_vblank_work.h drm: Add drm_vblank_work_flush_all(). 2024-06-24 18:03:18 +02:00
drm_vma_manager.h drm/drm_vma_manager: Add drm_vma_node_allow_once() 2023-01-19 14:16:55 +01:00
drm_writeback.h
gpu_scheduler.h drm/sched: warn about drm_sched_job_init()'s partial init 2024-10-25 18:02:04 +02:00
gud.h
spsc_queue.h
task_barrier.h drm: Spelling s/randevouz/rendez-vous/ 2023-07-29 21:11:54 +02:00