[PATCH 01/17] drm/amd/display: Return if DisplayID not found in parse_amd_vsdb()

Tomasz Pakuła posted 17 patches 3 weeks ago
There is a newer version of this series
[PATCH 01/17] drm/amd/display: Return if DisplayID not found in parse_amd_vsdb()
Posted by Tomasz Pakuła 3 weeks ago
[Why]
The function would continue to try to parse EDID even if DisplayID
extension block wasn't found. Sometimes it got lucky and found AMD vsdb
in CEA extension block which made debugging harder.

[How]
Add a return if DisplayID extension block wasn't found

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

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 655c9fcb078a..a0d23853b8fc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -13113,6 +13113,9 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
 			break;
 	}
 
+	if (i == edid->extensions)
+		return false;
+
 	while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) {
 		struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
 		unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);
-- 
2.52.0

Re: [PATCH 01/17] drm/amd/display: Return if DisplayID not found in parse_amd_vsdb()
Posted by Jani Nikula 3 weeks ago
On Mon, 19 Jan 2026, Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> wrote:
> [Why]
> The function would continue to try to parse EDID even if DisplayID
> extension block wasn't found. Sometimes it got lucky and found AMD vsdb
> in CEA extension block which made debugging harder.
>
> [How]
> Add a return if DisplayID extension block wasn't found

Maybe don't use homegrown EDID parsing, but use drm_edid.c instead?

BR,
Jani.

>
> Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> 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 655c9fcb078a..a0d23853b8fc 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -13113,6 +13113,9 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
>  			break;
>  	}
>  
> +	if (i == edid->extensions)
> +		return false;
> +
>  	while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) {
>  		struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
>  		unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);

-- 
Jani Nikula, Intel
Re: [PATCH 01/17] drm/amd/display: Return if DisplayID not found in parse_amd_vsdb()
Posted by Tomasz Pakuła 2 weeks, 6 days ago
On Mon, 2026-01-19 at 15:23 +0200, Jani Nikula wrote:
> On Mon, 19 Jan 2026, Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> wrote:
> > [Why]
> > The function would continue to try to parse EDID even if DisplayID
> > extension block wasn't found. Sometimes it got lucky and found AMD vsdb
> > in CEA extension block which made debugging harder.
> > 
> > [How]
> > Add a return if DisplayID extension block wasn't found
> 
> Maybe don't use homegrown EDID parsing, but use drm_edid.c instead?
> 
> BR,
> Jani.
> 

I would be all for it but I didn't want to make even more changes. I
cannot refactor the whole amdgpu on my own :)

Plus, the generic drm code doesn't yet parse AMD vsdb. I could certainly
add such functionality, especially since it's already in projects like
edid-decode but amdgpu seems to be doing a lot of home-grown edid
parsing and I'm not really sure why, even sending stuff to firmware.

Especially confusing is the part where AMD vsdb is parsed differently if
it's in CTA extensiton block or DisplayID. They honestly are identical.

At least, here in, setting the freesync caps, getting info from generic
drm should be ok. I'll think about it and probably intoroduce AMD vsdb
parsing to drm in a separate series.

> 
Tomasz