drm/edid/firmware: Remove built-in EDIDs
Subsystems (3)
Maxime Ripard
maintainerPATCH v2 1/1 drm/edid/firmware: Remove built-in EDIDs
The EDID firmware loading mechanism introduced a few built-in EDIDs that could be forced on any connector, bypassing the EDIDs it exposes.
While convenient, this limited set of EDIDs doesn't take into account the connector type, and we can end up with an EDID that is completely invalid for a given connector.
For example, the edid/800x600.bin file matches the following EDID:
edid-decode (hex):
00 ff ff ff ff ff ff 00 31 d8 00 00 00 00 00 00
05 16 01 03 6d 1b 14 78 ea 5e c0 a4 59 4a 98 25
20 50 54 01 00 00 45 40 01 01 01 01 01 01 01 01
01 01 01 01 01 01 a0 0f 20 00 31 58 1c 20 28 80
14 00 15 d0 10 00 00 1e 00 00 00 ff 00 4c 69 6e
75 78 20 23 30 0a 20 20 20 20 00 00 00 fd 00 3b
3d 24 26 05 00 0a 20 20 20 20 20 20 00 00 00 fc
00 4c 69 6e 75 78 20 53 56 47 41 0a 20 20 00 c2
----------------
Block 0, Base EDID:
EDID Structure Version & Revision: 1.3
Vendor & Product Identification:
Manufacturer: LNX
Model: 0
Made in: week 5 of 2012
Basic Display Parameters & Features:
Analog display
Signal Level Standard: 0.700 : 0.000 : 0.700 V p-p
Blank level equals black level
Sync: Separate Composite Serration
Maximum image size: 27 cm x 20 cm
Gamma: 2.20
DPMS levels: Standby Suspend Off
RGB color display
First detailed timing is the preferred timing
Color Characteristics:
Red : 0.6416, 0.3486
Green: 0.2919, 0.5957
Blue : 0.1474, 0.1250
White: 0.3125, 0.3281
Established Timings I & II:
DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz
Standard Timings:
DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz
Detailed Timing Descriptors:
DTD 1: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz (277 mm x 208 mm)
Hfront 40 Hsync 128 Hback 88 Hpol P
Vfront 1 Vsync 4 Vback 23 Vpol P
Display Product Serial Number: 'Linux #0'
Display Range Limits:
Monitor ranges (GTF): 59-61 Hz V, 36-38 kHz H, max dotclock 50 MHz
Display Product Name: 'Linux SVGA'
Checksum: 0xc2
So, an analog monitor EDID. However, if the connector was an HDMI monitor for example, it breaks the HDMI specification that requires, among other things, a digital display, the VIC 1 mode and an HDMI Forum Vendor Specific Data Block in an CTA-861 extension.
We thus end up with a completely invalid EDID, which thus might confuse HDMI-related code that could parse it.
After some discussions on IRC, we identified mainly two ways to fix this:
- We can either create more EDIDs for each connector type to provide a built-in EDID that matches the resolution passed in the name, and still be a sensible EDID for that connector type;
- Or we can just prevent the EDID to be exposed to userspace if it's built-in.
Or possibly both.
However, the conclusion was that maybe we just don't need the built-in EDIDs at all and we should just get rid of them. So here we are.
--- Documentation/admin-guide/edid.rst | 35 +-- .../admin-guide/kernel-parameters.txt | 14 +- drivers/gpu/drm/drm_edid_load.c | 160 +--------- tools/edid/1024x768.S | 43 --- tools/edid/1280x1024.S | 43 --- tools/edid/1600x1200.S | 43 --- tools/edid/1680x1050.S | 43 --- tools/edid/1920x1080.S | 43 --- tools/edid/800x600.S | 40 --- tools/edid/Makefile | 37 --- tools/edid/edid.S | 274 ------------------ tools/edid/hex | 1 - 12 files changed, 18 insertions(+), 758 deletions(-) delete mode 100644 tools/edid/1024x768.S delete mode 100644 tools/edid/1280x1024.S delete mode 100644 tools/edid/1600x1200.S delete mode 100644 tools/edid/1680x1050.S delete mode 100644 tools/edid/1920x1080.S delete mode 100644 tools/edid/800x600.S delete mode 100644 tools/edid/Makefile delete mode 100644 tools/edid/edid.S delete mode 100644 tools/edid/hex
Documentation/admin-guide/edid.rst +1 -34
@@ -24,37 +24,4 @@ restrictions later on. As a remedy for such situations, the kernel configuration item CONFIG_DRM_LOAD_EDID_FIRMWARE was introduced. It allows to provide an individually prepared or corrected EDID data set in the /lib/firmware -directory from where it is loaded via the firmware interface. The code -(see drivers/gpu/drm/drm_edid_load.c) contains built-in data sets for -commonly used screen resolutions (800x600, 1024x768, 1280x1024, 1600x1200, -1680x1050, 1920x1080) as binary blobs, but the kernel source tree does -not contain code to create these data. In order to elucidate the origin -of the built-in binary EDID blobs and to facilitate the creation of -individual data for a specific misbehaving monitor, commented sources -and a Makefile environment are given here. - -To create binary EDID and C source code files from the existing data -material, simply type "make" in tools/edid/. - -If you want to create your own EDID file, copy the file 1024x768.S, -replace the settings with your own data and add a new target to the -Makefile. Please note that the EDID data structure expects the timing -values in a different way as compared to the standard X11 format. - -X11: - HTimings: - hdisp hsyncstart hsyncend htotal - VTimings: - vdisp vsyncstart vsyncend vtotal - -EDID:: - - #define XPIX hdisp - #define XBLANK htotal-hdisp - #define XOFFSET hsyncstart-hdisp - #define XPULSE hsyncend-hsyncstart - - #define YPIX vdisp - #define YBLANK vtotal-vdisp - #define YOFFSET vsyncstart-vdisp - #define YPULSE vsyncend-vsyncstart +directory from where it is loaded via the firmware interface.
Documentation/admin-guide/kernel-parameters.txt +4 -10
@@ -1168,16 +1168,10 @@ panels may send no or incorrect EDID data sets. This parameter allows to specify an EDID data sets in the /lib/firmware directory that are used instead. - Generic built-in EDID data sets are used, if one of - edid/1024x768.bin, edid/1280x1024.bin, - edid/1680x1050.bin, or edid/1920x1080.bin is given - and no file with the same name exists. Details and - instructions how to build your own EDID data are - available in Documentation/admin-guide/edid.rst. An EDID - data set will only be used for a particular connector, - if its name and a colon are prepended to the EDID - name. Each connector may use a unique EDID data - set by separating the files with a comma. An EDID + An EDID data set will only be used for a particular + connector, if its name and a colon are prepended to + the EDID name. Each connector may use a unique EDID + data set by separating the files with a comma. An EDID data set with no connector name will be used for any connectors not explicitly specified.
drivers/gpu/drm/drm_edid_load.c +13 -147
175 lines not on this page · raw message
tools/edid/1024x768.S deleted +0 -43
43 lines not on this page · raw message
tools/edid/1280x1024.S deleted +0 -43
43 lines not on this page · raw message
tools/edid/1600x1200.S deleted +0 -43
43 lines not on this page · raw message
tools/edid/1680x1050.S deleted +0 -43
43 lines not on this page · raw message
tools/edid/1920x1080.S deleted +0 -43
43 lines not on this page · raw message
tools/edid/800x600.S deleted +0 -40
@@ -1,40 +0,0 @@ -/* - 800x600.S: EDID data set for standard 800x600 60 Hz monitor - - Copyright (C) 2011 Carsten Emde <[email protected]> - Copyright (C) 2014 Linaro Limited - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -*/ - -/* EDID */ -#define VERSION 1 -#define REVISION 3 - -/* Display */ -#define CLOCK 40000 /* kHz */ -#define XPIX 800 -#define YPIX 600 -#define XY_RATIO XY_RATIO_4_3 -#define XBLANK 256 -#define YBLANK 28 -#define XOFFSET 40 -#define XPULSE 128 -#define YOFFSET 1 -#define YPULSE 4 -#define DPI 72 -#define VFREQ 60 /* Hz */ -#define TIMING_NAME "Linux SVGA" -#define ESTABLISHED_TIMING1_BITS 0x01 /* Bit 0: 800x600 @ 60Hz */ -#define HSYNC_POL 1 -#define VSYNC_POL 1 - -#include "edid.S"
tools/edid/Makefile deleted +0 -37
@@ -1,37 +0,0 @@ - -SOURCES := $(wildcard [0-9]*x[0-9]*.S) - -BIN := $(patsubst %.S, %.bin, $(SOURCES)) - -IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES)) - -CODE := $(patsubst %.S, %.c, $(SOURCES)) - -all: $(BIN) $(IHEX) $(CODE) - -clean: - @rm -f *.o *.bin.ihex *.bin *.c - -%.o: %.S - @cc -c $^ - -%.bin.nocrc: %.o - @objcopy -Obinary $^ $@ - -%.crc: %.bin.nocrc - @list=$$(for i in `seq 1 127`; do head -c$$i $^ | tail -c1 \ - | hexdump -v -e '/1 "%02X+"'; done); \ - echo "ibase=16;100-($${list%?})%100" | bc >$@ - -%.p: %.crc %.S - @cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S - -%.bin: %.p - @objcopy -Obinary $^ $@ - -%.bin.ihex: %.p - @objcopy -Oihex $^ $@ - @dos2unix $@ 2>/dev/null - -%.c: %.bin - @echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@
tools/edid/edid.S deleted +0 -274
274 lines not on this page · raw message
tools/edid/hex deleted +0 -1
@@ -1 +0,0 @@ -"\t" 8/1 "0x%02x, " "\n"
Signature · 1 line
2.43.2
Quoted 8 lines · On Wed, 21 Feb 2024 10:26:36 +0100 Maxime Ripard <[email protected]> wrote:
The EDID firmware loading mechanism introduced a few built-in EDIDs that could be forced on any connector, bypassing the EDIDs it exposes.
While convenient, this limited set of EDIDs doesn't take into account the connector type, and we can end up with an EDID that is completely invalid for a given connector.
For example, the edid/800x600.bin file matches the following EDID:
...
Quoted 16 lines
So, an analog monitor EDID. However, if the connector was an HDMI monitor for example, it breaks the HDMI specification that requires, among other things, a digital display, the VIC 1 mode and an HDMI Forum Vendor Specific Data Block in an CTA-861 extension.
We thus end up with a completely invalid EDID, which thus might confuse HDMI-related code that could parse it.
After some discussions on IRC, we identified mainly two ways to fix this:
- We can either create more EDIDs for each connector type to provide a built-in EDID that matches the resolution passed in the name, and still be a sensible EDID for that connector type;
Quoted 7 lines
- Or we can just prevent the EDID to be exposed to userspace if it's built-in.
Or possibly both.
However, the conclusion was that maybe we just don't need the built-in EDIDs at all and we should just get rid of them. So here we are.
Sounds good to me.
If it turns out that these cannot be completely removed, then yet another option would to refuse to use these on digital connectors.
Thanks,
pq
Quoted 26 lines
Signed-off-by Maxime Ripard <[email protected]>--- Documentation/admin-guide/edid.rst | 35 +-- .../admin-guide/kernel-parameters.txt | 14 +- drivers/gpu/drm/drm_edid_load.c | 160 +--------- tools/edid/1024x768.S | 43 --- tools/edid/1280x1024.S | 43 --- tools/edid/1600x1200.S | 43 --- tools/edid/1680x1050.S | 43 --- tools/edid/1920x1080.S | 43 --- tools/edid/800x600.S | 40 --- tools/edid/Makefile | 37 --- tools/edid/edid.S | 274 ------------------ tools/edid/hex | 1 - 12 files changed, 18 insertions(+), 758 deletions(-) delete mode 100644 tools/edid/1024x768.S delete mode 100644 tools/edid/1280x1024.S delete mode 100644 tools/edid/1600x1200.S delete mode 100644 tools/edid/1680x1050.S delete mode 100644 tools/edid/1920x1080.S delete mode 100644 tools/edid/800x600.S delete mode 100644 tools/edid/Makefile delete mode 100644 tools/edid/edid.S delete mode 100644 tools/edid/hex
Jani Nikula
Acked-byQuoted 3 lines · Pekka Paalanen
Sounds good to me.
Acked-by Pekka Paalanen <[email protected]>
Quoted 2 lines
If it turns out that these cannot be completely removed, then yet another option would to refuse to use these on digital connectors.
Or provide them as binaries to the linux-firmware repo?
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel
Maxime Ripard
maintainerQuoted 11 lines · Jani Nikula
Quoted 3 lines · Pekka Paalanen
Sounds good to me.
Acked-by Pekka Paalanen <[email protected]>Acked-by Jani Nikula <[email protected]>Quoted 2 lines
If it turns out that these cannot be completely removed, then yet another option would to refuse to use these on digital connectors.
Or provide them as binaries to the linux-firmware repo?
It's pretty much the discussion we had with Dave on v1, but putting the EDID blobs in linux-firmware alone isn't equivalent if your driver is built-in.
You can embed them into the kernel image and then it would be equivalent, but there's some restrictions in licensing so I'm not sure we can do that ourselves.
Maxime
Re: (subset) [PATCH v2] drm/edid/firmware: Remove built-in EDIDs
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
The EDID firmware loading mechanism introduced a few built-in EDIDs that could be forced on any connector, bypassing the EDIDs it exposes.
While convenient, this limited set of EDIDs doesn't take into account the connector type, and we can end up with an EDID that is completely invalid for a given connector.
[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime