All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>, intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, Lyude Paul <lyude@redhat.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v3 05/11] drm/i915/dp_mst: Expose a connector to kernel users after it's properly initialized
Date: Thu, 12 Dec 2024 12:13:35 +0200	[thread overview]
Message-ID: <878qslxl80.fsf@intel.com> (raw)
In-Reply-To: <20241211230328.4012496-6-imre.deak@intel.com>

On Thu, 12 Dec 2024, Imre Deak <imre.deak@intel.com> wrote:
> After a connector is added to the drm_mode_config::connector_list, it's
> visible to any in-kernel users looking up connectors via the above list.
> Make sure that the connector is properly initialized before such
> look-ups, by initializing the connector with
> drm_connector_dynamic_register() - which doesn't add the connector to
> the list - and registering it with drm_connector_dynamic_register() -
> which adds the connector to the list - after the initialization is
> complete.
>
> v2: Rebase on the change which moves adding the connector to the
>     connector list only later when calling
>     drm_connector_dynamic_register().
>
> Cc: Lyude Paul <lyude@redhat.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (v1)
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 27 +++++++--------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 123c4ece62688..debe4d0eee11f 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -1731,6 +1731,8 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr,
>  	if (!intel_connector)
>  		return NULL;
>  
> +	connector = &intel_connector->base;
> +
>  	intel_connector->get_hw_state = mst_connector_get_hw_state;
>  	intel_connector->sync_state = intel_dp_connector_sync_state;
>  	intel_connector->mst_port = intel_dp;
> @@ -1739,30 +1741,19 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr,
>  
>  	intel_dp_init_modeset_retry_work(intel_connector);
>  
> -	/*
> -	 * TODO: The following drm_connector specific initialization belongs
> -	 * to DRM core, however it happens atm too late in
> -	 * drm_connector_init(). That function will also expose the connector
> -	 * to in-kernel users, so it can't be called until the connector is
> -	 * sufficiently initialized; init the device pointer used by the
> -	 * following DSC setup, until a fix moving this to DRM core.
> -	 */
> -	intel_connector->base.dev = mgr->dev;
> -
> -	intel_connector->dp.dsc_decompression_aux = drm_dp_mst_dsc_aux_for_port(port);
> -	intel_dp_mst_read_decompression_port_dsc_caps(intel_dp, intel_connector);
> -	intel_connector->dp.dsc_hblank_expansion_quirk =
> -		detect_dsc_hblank_expansion_quirk(intel_connector);
> -
> -	connector = &intel_connector->base;
> -	ret = drm_connector_init(display->drm, connector, &mst_connector_funcs,
> -				 DRM_MODE_CONNECTOR_DisplayPort);
> +	ret = drm_connector_dynamic_init(display->drm, connector, &mst_connector_funcs,
> +					 DRM_MODE_CONNECTOR_DisplayPort, NULL);
>  	if (ret) {
>  		drm_dp_mst_put_port_malloc(port);
>  		intel_connector_free(intel_connector);
>  		return NULL;
>  	}
>  
> +	intel_connector->dp.dsc_decompression_aux = drm_dp_mst_dsc_aux_for_port(port);
> +	intel_dp_mst_read_decompression_port_dsc_caps(intel_dp, intel_connector);
> +	intel_connector->dp.dsc_hblank_expansion_quirk =
> +		detect_dsc_hblank_expansion_quirk(intel_connector);
> +
>  	drm_connector_helper_add(connector, &mst_connector_helper_funcs);
>  
>  	for_each_pipe(display, pipe) {

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-12-12 10:13 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 23:03 [PATCH v3 0/7] drm/connector: Expose only a properly inited connector Imre Deak
2024-12-11 23:03 ` [PATCH v3 01/11] drm/connector: Add a way to init/add a connector in separate steps Imre Deak
2024-12-12  0:33   ` Lyude Paul
2024-12-12 10:16     ` Simona Vetter
2024-12-12 10:04   ` Jani Nikula
2024-12-12 11:45     ` Imre Deak
2024-12-16 12:22   ` Maxime Ripard
2024-12-11 23:03 ` [PATCH v3 02/11] drm/connector: Add FIXME for GETRESOURCES ioctl wrt. uninited connectors Imre Deak
2024-12-12 10:06   ` Jani Nikula
2024-12-13 12:02     ` Imre Deak
2024-12-11 23:03 ` [PATCH v3 03/11] drm/connector: Add deprication notes for drm_connector_register/unregister Imre Deak
2024-12-12 10:10   ` Jani Nikula
2024-12-12 12:02     ` Imre Deak
2024-12-16 14:37       ` Simona Vetter
2024-12-11 23:03 ` [PATCH v3 04/11] drm/dp_mst: Register connectors via drm_connector_dynamic_register() Imre Deak
2024-12-12 10:12   ` Jani Nikula
2024-12-13 12:06     ` Imre Deak
2024-12-16 11:03       ` Jani Nikula
2024-12-16 12:14         ` Imre Deak
2024-12-16 12:23   ` Imre Deak
2024-12-17  8:02     ` Lin, Wayne
2024-12-11 23:03 ` [PATCH v3 05/11] drm/i915/dp_mst: Expose a connector to kernel users after it's properly initialized Imre Deak
2024-12-12 10:13   ` Jani Nikula [this message]
2024-12-11 23:03 ` [PATCH v3 06/11] drm/amd/dp_mst: " Imre Deak
2024-12-12 10:14   ` Jani Nikula
2024-12-16 12:45   ` Imre Deak
2024-12-16 18:26     ` Alex Deucher
2024-12-11 23:03 ` [PATCH v3 07/11] drm/nouveau/dp_mst: " Imre Deak
2024-12-12 10:14   ` Jani Nikula
2024-12-11 23:03 ` [PATCH v3 08/11] drm/connector: Warn if a connector is registered/added incorrectly Imre Deak
2024-12-12 10:15   ` Jani Nikula
2024-12-11 23:03 ` [PATCH v3 09/11] drm/tests: Add tests for drm_connector_dynamic_init()/register() Imre Deak
2024-12-16 12:22   ` Maxime Ripard
2024-12-11 23:03 ` [PATCH v3 10/11] drm/i915/dp_mst: Fix error handling while adding a connector Imre Deak
2024-12-12 10:16   ` Jani Nikula
2024-12-11 23:03 ` [PATCH v3 11/11] drm/i915/dp_mst: Use intel_connector vs. drm_connector pointer in intel_dp_mst.c Imre Deak
2024-12-12 10:25   ` Jani Nikula
2024-12-12 12:23     ` Imre Deak
2024-12-11 23:33 ` ✗ Fi.CI.CHECKPATCH: warning for drm/connector: Expose only a properly inited connector Patchwork
2024-12-11 23:33 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-12-11 23:57 ` ✓ i915.CI.BAT: success " Patchwork
2024-12-12  7:33 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-13 15:41   ` Imre Deak
2024-12-16 12:22 ` [PATCH v3 0/7] " Imre Deak
2024-12-16 12:39   ` Maxime Ripard
2024-12-17 14:47 ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qslxl80.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.