All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
@ 2023-09-15 22:49 ` Alex Hung
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Hung @ 2023-09-15 22:49 UTC (permalink / raw)
  To: dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, jani.nikula,
	airlied, Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira, Alex Hung,
	sunpeng.li, daniel.wheeler, aurabindo.pillai, hersenxs.wu,
	hamza.mahfooz, daniel, wayne.lin, alexander.deucher,
	harry.wentland, christian.koenig

[WHY]
edid_override and drm_edid_override_connector_update, according to drm
documentation, should not be referred outside drm_edid.

[HOW]
Remove and replace them accordingly. This can tested by IGT's
kms_hdmi_inject test.

Signed-off-by: Alex Hung <alex.hung@amd.com>
---

V2 - add comments for drm_get_edid and check edid before use.

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 5efebc06296b..b29ef87c27a9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
 static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
 {
 	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
+	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 	struct dc_link *dc_link = aconnector->dc_link;
 	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
 	struct edid *edid;
 
-	if (!connector->edid_override)
+	/*
+	 * Note: drm_get_edid gets edid in the following order:
+	 * 1) override EDID if set via edid_override debugfs,
+	 * 2) firmware EDID if set via edid_firmware module parameter
+	 * 3) regular DDC read.
+	 */
+	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
+	if (!edid) {
+		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
+		connector->force = DRM_FORCE_OFF;
 		return;
+	}
 
-	drm_edid_override_connector_update(&aconnector->base);
-	edid = aconnector->base.edid_blob_ptr->data;
 	aconnector->edid = edid;
 
 	/* Update emulated (virtual) sink's EDID */
@@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
 
 static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
 {
+	struct drm_connector *connector = &aconnector->base;
+	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
 	struct dc_sink_init_data init_params = {
 			.link = aconnector->dc_link,
 			.sink_signal = SIGNAL_TYPE_VIRTUAL
 	};
 	struct edid *edid;
 
-	if (!aconnector->base.edid_blob_ptr) {
-		/* if connector->edid_override valid, pass
-		 * it to edid_override to edid_blob_ptr
-		 */
-
-		drm_edid_override_connector_update(&aconnector->base);
-
-		if (!aconnector->base.edid_blob_ptr) {
-			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
-					aconnector->base.name);
-
-			aconnector->base.force = DRM_FORCE_OFF;
-			return;
-		}
+	/*
+	 * Note: drm_get_edid gets edid in the following order:
+	 * 1) override EDID if set via edid_override debugfs,
+	 * 2) firmware EDID if set via edid_firmware module parameter
+	 * 3) regular DDC read.
+	 */
+	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
+	if (!edid) {
+		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
+		connector->force = DRM_FORCE_OFF;
+		return;
 	}
 
-	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
-
 	aconnector->edid = edid;
 
 	aconnector->dc_em_sink = dc_link_add_remote_sink(
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
@ 2023-09-15 22:49 ` Alex Hung
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Hung @ 2023-09-15 22:49 UTC (permalink / raw)
  To: dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, jani.nikula,
	Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira, Alex Hung,
	sunpeng.li, daniel.wheeler, aurabindo.pillai, hersenxs.wu,
	hamza.mahfooz, wayne.lin, alexander.deucher, christian.koenig

[WHY]
edid_override and drm_edid_override_connector_update, according to drm
documentation, should not be referred outside drm_edid.

[HOW]
Remove and replace them accordingly. This can tested by IGT's
kms_hdmi_inject test.

Signed-off-by: Alex Hung <alex.hung@amd.com>
---

V2 - add comments for drm_get_edid and check edid before use.

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 5efebc06296b..b29ef87c27a9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
 static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
 {
 	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
+	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 	struct dc_link *dc_link = aconnector->dc_link;
 	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
 	struct edid *edid;
 
-	if (!connector->edid_override)
+	/*
+	 * Note: drm_get_edid gets edid in the following order:
+	 * 1) override EDID if set via edid_override debugfs,
+	 * 2) firmware EDID if set via edid_firmware module parameter
+	 * 3) regular DDC read.
+	 */
+	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
+	if (!edid) {
+		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
+		connector->force = DRM_FORCE_OFF;
 		return;
+	}
 
-	drm_edid_override_connector_update(&aconnector->base);
-	edid = aconnector->base.edid_blob_ptr->data;
 	aconnector->edid = edid;
 
 	/* Update emulated (virtual) sink's EDID */
@@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
 
 static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
 {
+	struct drm_connector *connector = &aconnector->base;
+	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
 	struct dc_sink_init_data init_params = {
 			.link = aconnector->dc_link,
 			.sink_signal = SIGNAL_TYPE_VIRTUAL
 	};
 	struct edid *edid;
 
-	if (!aconnector->base.edid_blob_ptr) {
-		/* if connector->edid_override valid, pass
-		 * it to edid_override to edid_blob_ptr
-		 */
-
-		drm_edid_override_connector_update(&aconnector->base);
-
-		if (!aconnector->base.edid_blob_ptr) {
-			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
-					aconnector->base.name);
-
-			aconnector->base.force = DRM_FORCE_OFF;
-			return;
-		}
+	/*
+	 * Note: drm_get_edid gets edid in the following order:
+	 * 1) override EDID if set via edid_override debugfs,
+	 * 2) firmware EDID if set via edid_firmware module parameter
+	 * 3) regular DDC read.
+	 */
+	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
+	if (!edid) {
+		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
+		connector->force = DRM_FORCE_OFF;
+		return;
 	}
 
-	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
-
 	aconnector->edid = edid;
 
 	aconnector->dc_em_sink = dc_link_add_remote_sink(
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
  2023-09-15 22:49 ` Alex Hung
@ 2023-09-18 10:25   ` Jani Nikula
  -1 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2023-09-18 10:25 UTC (permalink / raw)
  To: Alex Hung, dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, sunpeng.li,
	airlied, Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira, Alex Hung,
	daniel.wheeler, aurabindo.pillai, hersenxs.wu, hamza.mahfooz,
	daniel, wayne.lin, alexander.deucher, harry.wentland,
	christian.koenig

On Fri, 15 Sep 2023, Alex Hung <alex.hung@amd.com> wrote:
> [WHY]
> edid_override and drm_edid_override_connector_update, according to drm
> documentation, should not be referred outside drm_edid.
>
> [HOW]
> Remove and replace them accordingly. This can tested by IGT's
> kms_hdmi_inject test.
>
> Signed-off-by: Alex Hung <alex.hung@amd.com>
> ---
>
> V2 - add comments for drm_get_edid and check edid before use.
>
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
>  1 file changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 5efebc06296b..b29ef87c27a9 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>  static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
>  {
>  	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>  	struct dc_link *dc_link = aconnector->dc_link;
>  	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
>  	struct edid *edid;
>  
> -	if (!connector->edid_override)
> +	/*
> +	 * Note: drm_get_edid gets edid in the following order:
> +	 * 1) override EDID if set via edid_override debugfs,
> +	 * 2) firmware EDID if set via edid_firmware module parameter
> +	 * 3) regular DDC read.
> +	 */
> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
> +	if (!edid) {
> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
> +		connector->force = DRM_FORCE_OFF;

Drivers aren't supposed to modify connector->force.

Why would you do that anyway? This connects EDID probe success with
connector forcing, and I've been repeatedly saying these are two
separate things that should not be conflated.

Maybe the user has set connector->force, because the display probe is
flaky. This switches connector->force off if the display does not
respond, undermining one of the main purposes of the whole thing.

>  		return;
> +	}
>  
> -	drm_edid_override_connector_update(&aconnector->base);
> -	edid = aconnector->base.edid_blob_ptr->data;
>  	aconnector->edid = edid;
>  
>  	/* Update emulated (virtual) sink's EDID */
> @@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
>  
>  static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
>  {
> +	struct drm_connector *connector = &aconnector->base;
> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
>  	struct dc_sink_init_data init_params = {
>  			.link = aconnector->dc_link,
>  			.sink_signal = SIGNAL_TYPE_VIRTUAL
>  	};
>  	struct edid *edid;
>  
> -	if (!aconnector->base.edid_blob_ptr) {
> -		/* if connector->edid_override valid, pass
> -		 * it to edid_override to edid_blob_ptr
> -		 */
> -
> -		drm_edid_override_connector_update(&aconnector->base);
> -
> -		if (!aconnector->base.edid_blob_ptr) {
> -			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
> -					aconnector->base.name);
> -
> -			aconnector->base.force = DRM_FORCE_OFF;
> -			return;
> -		}
> +	/*
> +	 * Note: drm_get_edid gets edid in the following order:
> +	 * 1) override EDID if set via edid_override debugfs,
> +	 * 2) firmware EDID if set via edid_firmware module parameter
> +	 * 3) regular DDC read.
> +	 */
> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
> +	if (!edid) {
> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
> +		connector->force = DRM_FORCE_OFF;

Ditto.

BR,
Jani.

> +		return;
>  	}
>  
> -	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
> -
>  	aconnector->edid = edid;
>  
>  	aconnector->dc_em_sink = dc_link_add_remote_sink(

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
@ 2023-09-18 10:25   ` Jani Nikula
  0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2023-09-18 10:25 UTC (permalink / raw)
  To: Alex Hung, dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, sunpeng.li,
	Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira, Alex Hung,
	daniel.wheeler, aurabindo.pillai, hersenxs.wu, hamza.mahfooz,
	wayne.lin, alexander.deucher, christian.koenig

On Fri, 15 Sep 2023, Alex Hung <alex.hung@amd.com> wrote:
> [WHY]
> edid_override and drm_edid_override_connector_update, according to drm
> documentation, should not be referred outside drm_edid.
>
> [HOW]
> Remove and replace them accordingly. This can tested by IGT's
> kms_hdmi_inject test.
>
> Signed-off-by: Alex Hung <alex.hung@amd.com>
> ---
>
> V2 - add comments for drm_get_edid and check edid before use.
>
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
>  1 file changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 5efebc06296b..b29ef87c27a9 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>  static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
>  {
>  	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>  	struct dc_link *dc_link = aconnector->dc_link;
>  	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
>  	struct edid *edid;
>  
> -	if (!connector->edid_override)
> +	/*
> +	 * Note: drm_get_edid gets edid in the following order:
> +	 * 1) override EDID if set via edid_override debugfs,
> +	 * 2) firmware EDID if set via edid_firmware module parameter
> +	 * 3) regular DDC read.
> +	 */
> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
> +	if (!edid) {
> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
> +		connector->force = DRM_FORCE_OFF;

Drivers aren't supposed to modify connector->force.

Why would you do that anyway? This connects EDID probe success with
connector forcing, and I've been repeatedly saying these are two
separate things that should not be conflated.

Maybe the user has set connector->force, because the display probe is
flaky. This switches connector->force off if the display does not
respond, undermining one of the main purposes of the whole thing.

>  		return;
> +	}
>  
> -	drm_edid_override_connector_update(&aconnector->base);
> -	edid = aconnector->base.edid_blob_ptr->data;
>  	aconnector->edid = edid;
>  
>  	/* Update emulated (virtual) sink's EDID */
> @@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
>  
>  static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
>  {
> +	struct drm_connector *connector = &aconnector->base;
> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
>  	struct dc_sink_init_data init_params = {
>  			.link = aconnector->dc_link,
>  			.sink_signal = SIGNAL_TYPE_VIRTUAL
>  	};
>  	struct edid *edid;
>  
> -	if (!aconnector->base.edid_blob_ptr) {
> -		/* if connector->edid_override valid, pass
> -		 * it to edid_override to edid_blob_ptr
> -		 */
> -
> -		drm_edid_override_connector_update(&aconnector->base);
> -
> -		if (!aconnector->base.edid_blob_ptr) {
> -			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
> -					aconnector->base.name);
> -
> -			aconnector->base.force = DRM_FORCE_OFF;
> -			return;
> -		}
> +	/*
> +	 * Note: drm_get_edid gets edid in the following order:
> +	 * 1) override EDID if set via edid_override debugfs,
> +	 * 2) firmware EDID if set via edid_firmware module parameter
> +	 * 3) regular DDC read.
> +	 */
> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
> +	if (!edid) {
> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
> +		connector->force = DRM_FORCE_OFF;

Ditto.

BR,
Jani.

> +		return;
>  	}
>  
> -	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
> -
>  	aconnector->edid = edid;
>  
>  	aconnector->dc_em_sink = dc_link_add_remote_sink(

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
  2023-09-18 10:25   ` Jani Nikula
@ 2023-09-18 12:14     ` Alex Hung
  -1 siblings, 0 replies; 6+ messages in thread
From: Alex Hung @ 2023-09-18 12:14 UTC (permalink / raw)
  To: Jani Nikula, dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, sunpeng.li,
	airlied, Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira,
	daniel.wheeler, aurabindo.pillai, hersenxs.wu, hamza.mahfooz,
	daniel, wayne.lin, alexander.deucher, harry.wentland,
	christian.koenig



On 2023-09-18 04:25, Jani Nikula wrote:
> On Fri, 15 Sep 2023, Alex Hung <alex.hung@amd.com> wrote:
>> [WHY]
>> edid_override and drm_edid_override_connector_update, according to drm
>> documentation, should not be referred outside drm_edid.
>>
>> [HOW]
>> Remove and replace them accordingly. This can tested by IGT's
>> kms_hdmi_inject test.
>>
>> Signed-off-by: Alex Hung <alex.hung@amd.com>
>> ---
>>
>> V2 - add comments for drm_get_edid and check edid before use.
>>
>>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
>>   1 file changed, 25 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 5efebc06296b..b29ef87c27a9 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>>   static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
>>   {
>>   	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
>> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>>   	struct dc_link *dc_link = aconnector->dc_link;
>>   	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
>>   	struct edid *edid;
>>   
>> -	if (!connector->edid_override)
>> +	/*
>> +	 * Note: drm_get_edid gets edid in the following order:
>> +	 * 1) override EDID if set via edid_override debugfs,
>> +	 * 2) firmware EDID if set via edid_firmware module parameter
>> +	 * 3) regular DDC read.
>> +	 */
>> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
>> +	if (!edid) {
>> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
>> +		connector->force = DRM_FORCE_OFF;
> 
> Drivers aren't supposed to modify connector->force.
> 
> Why would you do that anyway? This connects EDID probe success with
> connector forcing, and I've been repeatedly saying these are two
> separate things that should not be conflated.
> 
> Maybe the user has set connector->force, because the display probe is
> flaky. This switches connector->force off if the display does not
> respond, undermining one of the main purposes of the whole thing.

Thanks. I will removed this and sent V3.

> 
>>   		return;
>> +	}
>>   
>> -	drm_edid_override_connector_update(&aconnector->base);
>> -	edid = aconnector->base.edid_blob_ptr->data;
>>   	aconnector->edid = edid;
>>   
>>   	/* Update emulated (virtual) sink's EDID */
>> @@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
>>   
>>   static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
>>   {
>> +	struct drm_connector *connector = &aconnector->base;
>> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
>>   	struct dc_sink_init_data init_params = {
>>   			.link = aconnector->dc_link,
>>   			.sink_signal = SIGNAL_TYPE_VIRTUAL
>>   	};
>>   	struct edid *edid;
>>   
>> -	if (!aconnector->base.edid_blob_ptr) {
>> -		/* if connector->edid_override valid, pass
>> -		 * it to edid_override to edid_blob_ptr
>> -		 */
>> -
>> -		drm_edid_override_connector_update(&aconnector->base);
>> -
>> -		if (!aconnector->base.edid_blob_ptr) {
>> -			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
>> -					aconnector->base.name);
>> -
>> -			aconnector->base.force = DRM_FORCE_OFF;
>> -			return;
>> -		}
>> +	/*
>> +	 * Note: drm_get_edid gets edid in the following order:
>> +	 * 1) override EDID if set via edid_override debugfs,
>> +	 * 2) firmware EDID if set via edid_firmware module parameter
>> +	 * 3) regular DDC read.
>> +	 */
>> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
>> +	if (!edid) {
>> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
>> +		connector->force = DRM_FORCE_OFF;
> 
> Ditto.
> 
> BR,
> Jani.
> 
>> +		return;
>>   	}
>>   
>> -	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
>> -
>>   	aconnector->edid = edid;
>>   
>>   	aconnector->dc_em_sink = dc_link_add_remote_sink(
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][V2] drm/amd/display: Remove unwanted drm edid references
@ 2023-09-18 12:14     ` Alex Hung
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Hung @ 2023-09-18 12:14 UTC (permalink / raw)
  To: Jani Nikula, dri-devel, amd-gfx
  Cc: stylon.wang, haoping.liu, srinivasan.shanmugam, sunpeng.li,
	Qingqing.Zhuo, Xinhui.Pan, Rodrigo.Siqueira, daniel.wheeler,
	aurabindo.pillai, hersenxs.wu, hamza.mahfooz, wayne.lin,
	alexander.deucher, christian.koenig



On 2023-09-18 04:25, Jani Nikula wrote:
> On Fri, 15 Sep 2023, Alex Hung <alex.hung@amd.com> wrote:
>> [WHY]
>> edid_override and drm_edid_override_connector_update, according to drm
>> documentation, should not be referred outside drm_edid.
>>
>> [HOW]
>> Remove and replace them accordingly. This can tested by IGT's
>> kms_hdmi_inject test.
>>
>> Signed-off-by: Alex Hung <alex.hung@amd.com>
>> ---
>>
>> V2 - add comments for drm_get_edid and check edid before use.
>>
>>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++++++++++--------
>>   1 file changed, 25 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 5efebc06296b..b29ef87c27a9 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -6444,15 +6444,24 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>>   static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
>>   {
>>   	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
>> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>>   	struct dc_link *dc_link = aconnector->dc_link;
>>   	struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
>>   	struct edid *edid;
>>   
>> -	if (!connector->edid_override)
>> +	/*
>> +	 * Note: drm_get_edid gets edid in the following order:
>> +	 * 1) override EDID if set via edid_override debugfs,
>> +	 * 2) firmware EDID if set via edid_firmware module parameter
>> +	 * 3) regular DDC read.
>> +	 */
>> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
>> +	if (!edid) {
>> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
>> +		connector->force = DRM_FORCE_OFF;
> 
> Drivers aren't supposed to modify connector->force.
> 
> Why would you do that anyway? This connects EDID probe success with
> connector forcing, and I've been repeatedly saying these are two
> separate things that should not be conflated.
> 
> Maybe the user has set connector->force, because the display probe is
> flaky. This switches connector->force off if the display does not
> respond, undermining one of the main purposes of the whole thing.

Thanks. I will removed this and sent V3.

> 
>>   		return;
>> +	}
>>   
>> -	drm_edid_override_connector_update(&aconnector->base);
>> -	edid = aconnector->base.edid_blob_ptr->data;
>>   	aconnector->edid = edid;
>>   
>>   	/* Update emulated (virtual) sink's EDID */
>> @@ -6487,30 +6496,27 @@ static int get_modes(struct drm_connector *connector)
>>   
>>   static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
>>   {
>> +	struct drm_connector *connector = &aconnector->base;
>> +	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
>>   	struct dc_sink_init_data init_params = {
>>   			.link = aconnector->dc_link,
>>   			.sink_signal = SIGNAL_TYPE_VIRTUAL
>>   	};
>>   	struct edid *edid;
>>   
>> -	if (!aconnector->base.edid_blob_ptr) {
>> -		/* if connector->edid_override valid, pass
>> -		 * it to edid_override to edid_blob_ptr
>> -		 */
>> -
>> -		drm_edid_override_connector_update(&aconnector->base);
>> -
>> -		if (!aconnector->base.edid_blob_ptr) {
>> -			DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
>> -					aconnector->base.name);
>> -
>> -			aconnector->base.force = DRM_FORCE_OFF;
>> -			return;
>> -		}
>> +	/*
>> +	 * Note: drm_get_edid gets edid in the following order:
>> +	 * 1) override EDID if set via edid_override debugfs,
>> +	 * 2) firmware EDID if set via edid_firmware module parameter
>> +	 * 3) regular DDC read.
>> +	 */
>> +	edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
>> +	if (!edid) {
>> +		DRM_ERROR("No EDID found on connector: %s, forcing to OFF!\n", connector->name);
>> +		connector->force = DRM_FORCE_OFF;
> 
> Ditto.
> 
> BR,
> Jani.
> 
>> +		return;
>>   	}
>>   
>> -	edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
>> -
>>   	aconnector->edid = edid;
>>   
>>   	aconnector->dc_em_sink = dc_link_add_remote_sink(
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-18 12:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 22:49 [PATCH][V2] drm/amd/display: Remove unwanted drm edid references Alex Hung
2023-09-15 22:49 ` Alex Hung
2023-09-18 10:25 ` Jani Nikula
2023-09-18 10:25   ` Jani Nikula
2023-09-18 12:14   ` Alex Hung
2023-09-18 12:14     ` Alex Hung

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.