Message ID | 20250411201333.151335-4-mwen@igalia.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/amd/display: more drm_edid to AMD display driver | expand |
On Fri, 11 Apr 2025, Melissa Wen <mwen@igalia.com> wrote: > We don't need to parse dc_edid to get the display name since it's > already set in drm_eld which in turn had it values updated when updating > connector with the opaque drm_edid. > > Signed-off-by: Melissa Wen <mwen@igalia.com> > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > index e93adb7e48a5..faea6b7fb3f3 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > @@ -34,7 +34,7 @@ > #include <drm/amdgpu_drm.h> > #include <drm/drm_edid.h> > #include <drm/drm_fixed.h> > - > +#include <drm/drm_eld.h> > #include "dm_services.h" > #include "amdgpu.h" > #include "dc.h" > @@ -90,6 +90,7 @@ static void apply_edid_quirks(struct drm_device *dev, struct edid *edid, struct > } > } > > +#define AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS 13 > /** > * dm_helpers_parse_edid_caps() - Parse edid caps > * > @@ -132,9 +133,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > edid_caps->manufacture_week = product_id.week_of_manufacture; > edid_caps->manufacture_year = product_id.year_of_manufacture; > > - drm_edid_get_monitor_name(edid_buf, > - edid_caps->display_name, > - AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); > + memset(edid_caps->display_name, 0, AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); > + memcpy(edid_caps->display_name, > + &connector->eld[DRM_ELD_MONITOR_NAME_STRING], > + AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS); It's not that simple. The monitor name in ELD is not fixed length (see drm_eld_mnl()) and neither is it guaranteed to be NUL terminated. BR, Jani. > > edid_caps->edid_hdmi = connector->display_info.is_hdmi;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index e93adb7e48a5..faea6b7fb3f3 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -34,7 +34,7 @@ #include <drm/amdgpu_drm.h> #include <drm/drm_edid.h> #include <drm/drm_fixed.h> - +#include <drm/drm_eld.h> #include "dm_services.h" #include "amdgpu.h" #include "dc.h" @@ -90,6 +90,7 @@ static void apply_edid_quirks(struct drm_device *dev, struct edid *edid, struct } } +#define AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS 13 /** * dm_helpers_parse_edid_caps() - Parse edid caps * @@ -132,9 +133,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->manufacture_week = product_id.week_of_manufacture; edid_caps->manufacture_year = product_id.year_of_manufacture; - drm_edid_get_monitor_name(edid_buf, - edid_caps->display_name, - AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); + memset(edid_caps->display_name, 0, AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); + memcpy(edid_caps->display_name, + &connector->eld[DRM_ELD_MONITOR_NAME_STRING], + AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS); edid_caps->edid_hdmi = connector->display_info.is_hdmi;
We don't need to parse dc_edid to get the display name since it's already set in drm_eld which in turn had it values updated when updating connector with the opaque drm_edid. Signed-off-by: Melissa Wen <mwen@igalia.com> --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)