Re: [PATCH 3/4] drm/i915/dp_mst: Expose a connector to kernel users after it's properly initialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Nov 2024, Imre Deak <imre.deak@xxxxxxxxx> wrote:
> On Mon, Nov 18, 2024 at 02:12:14PM +0200, Jani Nikula wrote:
>> On Fri, 15 Nov 2024, Imre Deak <imre.deak@xxxxxxxxx> 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.
>> >
>> > Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx>
>> > ---
>> >  drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 ++++++++-------------
>> >  1 file changed, 11 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 f058360a26413..d91a1d1fb26f4 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
>> > +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
>> > @@ -1719,6 +1719,8 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>> >  	if (!intel_connector)
>> >  		return NULL;
>> >  
>> > +	connector = &intel_connector->base;
>> 
>> I'd rather see a patch s/intel_connector/connector/ and using
>> &connector->base for drm_connector.
>
> Yes, thought the same and did it. However I think that should be done
> converting all the other intel_connector usage in the file. Is that ok
> with you?

Works for me.

>
>> 
>> > +
>> >  	intel_connector->get_hw_state = intel_dp_mst_get_hw_state;
>> >  	intel_connector->sync_state = intel_dp_connector_sync_state;
>> >  	intel_connector->mst_port = intel_dp;
>> > @@ -1727,30 +1729,19 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>> >  
>> >  	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, &intel_dp_mst_connector_funcs,
>> > -				 DRM_MODE_CONNECTOR_DisplayPort);
>> > +	ret = drm_connector_init_core(display->drm, connector, &intel_dp_mst_connector_funcs,
>> > +				      DRM_MODE_CONNECTOR_DisplayPort);
>> >  	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, &intel_dp_mst_connector_helper_funcs);
>> >  
>> >  	for_each_pipe(display, pipe) {
>> > @@ -1771,6 +1762,8 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>> >  		drm_dbg_kms(display->drm, "[%s:%d] HDCP MST init failed, skipping.\n",
>> >  			    connector->name, connector->base.id);
>> >  
>> > +	drm_connector_add(connector);
>> > +
>> >  	return connector;
>> >  
>> >  err:
>> 
>> -- 
>> Jani Nikula, Intel

-- 
Jani Nikula, Intel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux