OSDN Git Service

drm/edid: fix CTA data block collection size for CTA version 3
authorJani Nikula <jani.nikula@intel.com>
Wed, 8 Jun 2022 07:50:31 +0000 (10:50 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 13 Jun 2022 09:30:16 +0000 (12:30 +0300)
commitfc67615f4ecc3b66bd458840927272aa131eface
tree2309a35f84d8b7d563a4786002c919bedba4a3c8
parentf4e3a12bf2d1983b8f352b7719794c52be7e0990
drm/edid: fix CTA data block collection size for CTA version 3

The CTA Data Block Collection is valid only for CTA extension version
3. In versions 1 and 2, it is a reserved block, which we ignore.

The DTD start offset (byte 2, or d in CTA-861 spec), which determines
the CTA Data Block Collection size, is specified slightly differently
for different versions:

Version 1:
    d = offset for the byte following the reserved data block. If no
    data is provided in the reserved data block, then d=4. If no DTDs
    are provided, then d=0

Version 2:
    d = offset for the byte following the reserved data block. If no
    data is provided in the reserved data block, then d=4. If d=0, then
    no detailed timing descriptors are provided, and no data is provided
    in the reserved data block.

Version 3:
    d = offset for the byte following the data block collection. If no
    data is provided in the data block collection, then d=4. If d=0,
    then no detailed timing descriptors are provided, and no data is
    provided in the data block collection.

Ever since commit 9e50b9d55e9c ("drm: edid: Add some bounds checking"),
we've interpreted 0 to mean there are no DTDs but it's all Data
Blocks. Per the spec, Data Blocks are only valid for version 3, where we
should interpret 0 to mean there are no data blocks.

Follow the spec (and hope the EDIDs follow it too).

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2a4c94417f024cbafc5d4ca0a74e4617fc4325d1.1654674560.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c