From: Arun Iyengar <[email protected]>

In a DisplayID Type VII timing data block of revision 2 or later, bit 7
of the timing options means YCbCr 4:2:0 support, not preferred timing.
Only treat it as preferred in Type I and older Type VII blocks.

Fixes: 80ecb5d7c0f2 ("drm/edid: Support type 7 timings")
Cc: [email protected] # v5.18+
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Arun Iyengar <[email protected]>
---
edid-decode reads bit 7 the same way. Local KUnit case: a Type VII
revision 2 timing with bit 7 set was preferred before and is not after;
Type I and Type VII revisions 0 and 1 are unchanged. No such display tested.

If "drm/edid: Add the modes of CTA Type VII video timing data blocks"
lands first, I will send a new version that passes the revision there too.

Developed with Claude (Anthropic), which wrote the code and commit message; I 
reviewed it.
---
Changes in v2:
- int block_rev, check the revision before the flag, Cc stable (Jani)
- Link to v1: 
https://patch.msgid.link/[email protected]
---
 drivers/gpu/drm/drm_edid.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b8f882a17c8f..93e7b1fb8e46 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -7053,7 +7053,7 @@ static void update_display_info(struct drm_connector 
*connector,
 
 static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device 
*dev,
                                                            const struct 
displayid_detailed_timings_1 *timings,
-                                                           bool type_7)
+                                                           bool type_7, int 
block_rev)
 {
        struct drm_display_mode *mode;
        unsigned int pixel_clock = (timings->pixel_clock[0] |
@@ -7091,7 +7091,8 @@ static struct drm_display_mode 
*drm_mode_displayid_detailed(struct drm_device *d
        mode->flags |= vsync_positive ? DRM_MODE_FLAG_PVSYNC : 
DRM_MODE_FLAG_NVSYNC;
        mode->type = DRM_MODE_TYPE_DRIVER;
 
-       if (timings->flags & 0x80)
+       /* Type VII block revision 2+ uses bit 7 for YCbCr 4:2:0, not preferred 
*/
+       if ((!type_7 || block_rev < 2) && (timings->flags & 0x80))
                mode->type |= DRM_MODE_TYPE_PREFERRED;
        drm_mode_set_name(mode);
 
@@ -7115,7 +7116,8 @@ static int add_displayid_detailed_1_modes(struct 
drm_connector *connector,
        for (i = 0; i < num_timings; i++) {
                struct displayid_detailed_timings_1 *timings = &det->timings[i];
 
-               newmode = drm_mode_displayid_detailed(connector->dev, timings, 
type_7);
+               newmode = drm_mode_displayid_detailed(connector->dev, timings, 
type_7,
+                                                     block->rev & 0x7);
                if (!newmode)
                        continue;
 

---
base-commit: c408466a4dfaee4b12587e926c5b85e68c8b3c40
change-id: 20261130-displayid-t7-y420-058c00501fb0

Best regards,
--  
Arun Iyengar <[email protected]>


Reply via email to