Message ID | 20240706034004.801329-10-mwen@igalia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid | expand |
On 2024-07-05 21:35, Melissa Wen wrote: > instead of parsing struct edid. A more informative commit message will be helpful. > > Signed-off-by: Melissa Wen <mwen@igalia.com> > --- > .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 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 7657b1051c54..45c04de08c65 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 > @@ -97,7 +97,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > const struct drm_edid *drm_edid = aconnector->drm_edid; > struct drm_edid_product_id product_id; > struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; > - struct cea_sad *sads; > int sad_count, sadb_count; > int i = 0; > uint8_t *sadb = NULL; > @@ -127,18 +126,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > > apply_edid_quirks(&product_id, edid_caps); > > - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); > + sad_count = drm_eld_sad_count(connector->eld); > if (sad_count <= 0) > return result; > > edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT); > for (i = 0; i < edid_caps->audio_mode_count; ++i) { > - struct cea_sad *sad = &sads[i]; > + struct cea_sad sad; > > - edid_caps->audio_modes[i].format_code = sad->format; > - edid_caps->audio_modes[i].channel_count = sad->channels + 1; > - edid_caps->audio_modes[i].sample_rate = sad->freq; > - edid_caps->audio_modes[i].sample_size = sad->byte2; > + if (drm_eld_sad_get(connector->eld, i, &sad) < 0) > + continue; > + > + edid_caps->audio_modes[i].format_code = sad.format; > + edid_caps->audio_modes[i].channel_count = sad.channels + 1; > + edid_caps->audio_modes[i].sample_rate = sad.freq; > + edid_caps->audio_modes[i].sample_size = sad.byte2; > } > > sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); > @@ -153,7 +155,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > else > edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION; > > - kfree(sads); > kfree(sadb); > > return result;
On 07/25, Alex Hung wrote: > > > On 2024-07-05 21:35, Melissa Wen wrote: > > instead of parsing struct edid. > > A more informative commit message will be helpful. sure. I'll improve it in the next version. > > > > > Signed-off-by: Melissa Wen <mwen@igalia.com> > > --- > > .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 17 +++++++++-------- > > 1 file changed, 9 insertions(+), 8 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 7657b1051c54..45c04de08c65 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 > > @@ -97,7 +97,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > > const struct drm_edid *drm_edid = aconnector->drm_edid; > > struct drm_edid_product_id product_id; > > struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; > > - struct cea_sad *sads; > > int sad_count, sadb_count; > > int i = 0; > > uint8_t *sadb = NULL; > > @@ -127,18 +126,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > > apply_edid_quirks(&product_id, edid_caps); > > - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); > > + sad_count = drm_eld_sad_count(connector->eld); > > if (sad_count <= 0) > > return result; > > edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT); > > for (i = 0; i < edid_caps->audio_mode_count; ++i) { > > - struct cea_sad *sad = &sads[i]; > > + struct cea_sad sad; > > - edid_caps->audio_modes[i].format_code = sad->format; > > - edid_caps->audio_modes[i].channel_count = sad->channels + 1; > > - edid_caps->audio_modes[i].sample_rate = sad->freq; > > - edid_caps->audio_modes[i].sample_size = sad->byte2; > > + if (drm_eld_sad_get(connector->eld, i, &sad) < 0) > > + continue; > > + > > + edid_caps->audio_modes[i].format_code = sad.format; > > + edid_caps->audio_modes[i].channel_count = sad.channels + 1; > > + edid_caps->audio_modes[i].sample_rate = sad.freq; > > + edid_caps->audio_modes[i].sample_size = sad.byte2; > > } > > sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); > > @@ -153,7 +155,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > > else > > edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION; > > - kfree(sads); > > kfree(sadb); > > return result;
On 2024-07-28 20:02, Melissa Wen wrote: > On 07/25, Alex Hung wrote: >> >> >> On 2024-07-05 21:35, Melissa Wen wrote: >>> instead of parsing struct edid. >> >> A more informative commit message will be helpful. > > sure. I'll improve it in the next version. A soft reminder - a few other patches need improved commit messages too. >> >>> >>> Signed-off-by: Melissa Wen <mwen@igalia.com> >>> --- >>> .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 17 +++++++++-------- >>> 1 file changed, 9 insertions(+), 8 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 7657b1051c54..45c04de08c65 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 >>> @@ -97,7 +97,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( >>> const struct drm_edid *drm_edid = aconnector->drm_edid; >>> struct drm_edid_product_id product_id; >>> struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; >>> - struct cea_sad *sads; >>> int sad_count, sadb_count; >>> int i = 0; >>> uint8_t *sadb = NULL; >>> @@ -127,18 +126,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps( >>> apply_edid_quirks(&product_id, edid_caps); >>> - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); >>> + sad_count = drm_eld_sad_count(connector->eld); >>> if (sad_count <= 0) >>> return result; >>> edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT); >>> for (i = 0; i < edid_caps->audio_mode_count; ++i) { >>> - struct cea_sad *sad = &sads[i]; >>> + struct cea_sad sad; >>> - edid_caps->audio_modes[i].format_code = sad->format; >>> - edid_caps->audio_modes[i].channel_count = sad->channels + 1; >>> - edid_caps->audio_modes[i].sample_rate = sad->freq; >>> - edid_caps->audio_modes[i].sample_size = sad->byte2; >>> + if (drm_eld_sad_get(connector->eld, i, &sad) < 0) >>> + continue; >>> + >>> + edid_caps->audio_modes[i].format_code = sad.format; >>> + edid_caps->audio_modes[i].channel_count = sad.channels + 1; >>> + edid_caps->audio_modes[i].sample_rate = sad.freq; >>> + edid_caps->audio_modes[i].sample_size = sad.byte2; >>> } >>> sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); >>> @@ -153,7 +155,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( >>> else >>> edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION; >>> - kfree(sads); >>> kfree(sadb); >>> return result;
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 7657b1051c54..45c04de08c65 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 @@ -97,7 +97,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( const struct drm_edid *drm_edid = aconnector->drm_edid; struct drm_edid_product_id product_id; struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; - struct cea_sad *sads; int sad_count, sadb_count; int i = 0; uint8_t *sadb = NULL; @@ -127,18 +126,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps( apply_edid_quirks(&product_id, edid_caps); - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); + sad_count = drm_eld_sad_count(connector->eld); if (sad_count <= 0) return result; edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT); for (i = 0; i < edid_caps->audio_mode_count; ++i) { - struct cea_sad *sad = &sads[i]; + struct cea_sad sad; - edid_caps->audio_modes[i].format_code = sad->format; - edid_caps->audio_modes[i].channel_count = sad->channels + 1; - edid_caps->audio_modes[i].sample_rate = sad->freq; - edid_caps->audio_modes[i].sample_size = sad->byte2; + if (drm_eld_sad_get(connector->eld, i, &sad) < 0) + continue; + + edid_caps->audio_modes[i].format_code = sad.format; + edid_caps->audio_modes[i].channel_count = sad.channels + 1; + edid_caps->audio_modes[i].sample_rate = sad.freq; + edid_caps->audio_modes[i].sample_size = sad.byte2; } sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); @@ -153,7 +155,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( else edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION; - kfree(sads); kfree(sadb); return result;
instead of parsing struct edid. Signed-off-by: Melissa Wen <mwen@igalia.com> --- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)