forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drm: allow loading an EDID as firmware to override broken monitor
Broken monitors and/or broken graphic boards may send erroneous or no EDID data. This also applies to broken KVM devices that are unable to correctly forward the EDID data of the connected monitor but invent their own fantasy data. This patch allows to specify an EDID data set to be used instead of probing the monitor for it. It contains built-in data sets of frequently used screen resolutions. In addition, a particular EDID data set may be provided in the /lib/firmware directory and loaded via the firmware interface. The name is passed to the kernel as module parameter of the drm_kms_helper module either when loaded options drm_kms_helper edid_firmware=edid/1280x1024.bin or as kernel commandline parameter drm_kms_helper.edid_firmware=edid/1280x1024.bin It is also possible to restrict the usage of a specified EDID data set to a particular connector. This is done by prepending the name of the connector to the name of the EDID data set using the syntax edid_firmware=[<connector>:]<edid> such as, for example, edid_firmware=DVI-I-1:edid/1920x1080.bin in which case no other connector will be affected. The built-in data sets are Resolution Name -------------------------------- 1024x768 edid/1024x768.bin 1280x1024 edid/1280x1024.bin 1680x1050 edid/1680x1050.bin 1920x1080 edid/1920x1080.bin They are ignored, if a file with the same name is available in the /lib/firmware directory. The built-in EDID data sets are based on standard timings that may not apply to a particular monitor and even crash it. Ideally, EDID data of the connected monitor should be used. They may be obtained through the drm/cardX/cardX-<connector>/edid entry in the /sys/devices PCI directory of a correctly working graphics adapter. It is even possible to specify the name of an EDID data set on-the-fly via the /sys/module interface, e.g. echo edid/myedid.bin >/sys/module/drm_kms_helper/parameters/edid_firmware The new screen mode is considered when the related kernel function is called for the first time after the change. Such calls are made when the X server is started or when the display settings dialog is opened in an already running X server. Signed-off-by: Carsten Emde <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
- Loading branch information
Showing
16 changed files
with
792 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
1024x768.S: EDID data set for standard 1024x768 60 Hz monitor | ||
Copyright (C) 2011 Carsten Emde <[email protected]> | ||
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. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/* EDID */ | ||
#define VERSION 1 | ||
#define REVISION 3 | ||
|
||
/* Display */ | ||
#define CLOCK 65000 /* kHz */ | ||
#define XPIX 1024 | ||
#define YPIX 768 | ||
#define XY_RATIO XY_RATIO_4_3 | ||
#define XBLANK 320 | ||
#define YBLANK 38 | ||
#define XOFFSET 8 | ||
#define XPULSE 144 | ||
#define YOFFSET (63+3) | ||
#define YPULSE (63+6) | ||
#define DPI 72 | ||
#define VFREQ 60 /* Hz */ | ||
#define TIMING_NAME "Linux XGA" | ||
#define ESTABLISHED_TIMINGS_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */ | ||
#define HSYNC_POL 0 | ||
#define VSYNC_POL 0 | ||
#define CRC 0x55 | ||
|
||
#include "edid.S" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
1280x1024.S: EDID data set for standard 1280x1024 60 Hz monitor | ||
Copyright (C) 2011 Carsten Emde <[email protected]> | ||
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. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/* EDID */ | ||
#define VERSION 1 | ||
#define REVISION 3 | ||
|
||
/* Display */ | ||
#define CLOCK 108000 /* kHz */ | ||
#define XPIX 1280 | ||
#define YPIX 1024 | ||
#define XY_RATIO XY_RATIO_5_4 | ||
#define XBLANK 408 | ||
#define YBLANK 42 | ||
#define XOFFSET 48 | ||
#define XPULSE 112 | ||
#define YOFFSET (63+1) | ||
#define YPULSE (63+3) | ||
#define DPI 72 | ||
#define VFREQ 60 /* Hz */ | ||
#define TIMING_NAME "Linux SXGA" | ||
#define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
#define HSYNC_POL 1 | ||
#define VSYNC_POL 1 | ||
#define CRC 0xa0 | ||
|
||
#include "edid.S" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
1680x1050.S: EDID data set for standard 1680x1050 60 Hz monitor | ||
Copyright (C) 2012 Carsten Emde <[email protected]> | ||
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. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/* EDID */ | ||
#define VERSION 1 | ||
#define REVISION 3 | ||
|
||
/* Display */ | ||
#define CLOCK 146250 /* kHz */ | ||
#define XPIX 1680 | ||
#define YPIX 1050 | ||
#define XY_RATIO XY_RATIO_16_10 | ||
#define XBLANK 560 | ||
#define YBLANK 39 | ||
#define XOFFSET 104 | ||
#define XPULSE 176 | ||
#define YOFFSET (63+3) | ||
#define YPULSE (63+6) | ||
#define DPI 96 | ||
#define VFREQ 60 /* Hz */ | ||
#define TIMING_NAME "Linux WSXGA" | ||
#define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
#define HSYNC_POL 1 | ||
#define VSYNC_POL 1 | ||
#define CRC 0x26 | ||
|
||
#include "edid.S" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
1920x1080.S: EDID data set for standard 1920x1080 60 Hz monitor | ||
Copyright (C) 2012 Carsten Emde <[email protected]> | ||
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. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/* EDID */ | ||
#define VERSION 1 | ||
#define REVISION 3 | ||
|
||
/* Display */ | ||
#define CLOCK 148500 /* kHz */ | ||
#define XPIX 1920 | ||
#define YPIX 1080 | ||
#define XY_RATIO XY_RATIO_16_9 | ||
#define XBLANK 280 | ||
#define YBLANK 45 | ||
#define XOFFSET 88 | ||
#define XPULSE 44 | ||
#define YOFFSET (63+4) | ||
#define YPULSE (63+5) | ||
#define DPI 96 | ||
#define VFREQ 60 /* Hz */ | ||
#define TIMING_NAME "Linux FHD" | ||
#define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
#define HSYNC_POL 1 | ||
#define VSYNC_POL 1 | ||
#define CRC 0x05 | ||
|
||
#include "edid.S" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
In the good old days when graphics parameters were configured explicitly | ||
in a file called xorg.conf, even broken hardware could be managed. | ||
|
||
Today, with the advent of Kernel Mode Setting, a graphics board is | ||
either correctly working because all components follow the standards - | ||
or the computer is unusable, because the screen remains dark after | ||
booting or it displays the wrong area. Cases when this happens are: | ||
- The graphics board does not recognize the monitor. | ||
- The graphics board is unable to detect any EDID data. | ||
- The graphics board incorrectly forwards EDID data to the driver. | ||
- The monitor sends no or bogus EDID data. | ||
- A KVM sends its own EDID data instead of querying the connected monitor. | ||
Adding the kernel parameter "nomodeset" helps in most cases, but causes | ||
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 (1024x768, 1280x1024, 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". | ||
|
||
If you want to create your own EDID file, copy the file 1024x768.S and | ||
replace the settings with your own data. The CRC value in the last line | ||
#define CRC 0x55 | ||
is a bit tricky. After a first version of the binary data set is | ||
created, it must be be checked with the "edid-decode" utility which will | ||
most probably complain about a wrong CRC. Fortunately, the utility also | ||
displays the correct CRC which must then be inserted into the source | ||
file. After the make procedure is repeated, the EDID data set is ready | ||
to be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
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: %.o | ||
@objcopy -Obinary $^ $@ | ||
|
||
%.bin.ihex: %.o | ||
@objcopy -Oihex $^ $@ | ||
@dos2unix $@ 2>/dev/null | ||
|
||
%.c: %.bin | ||
@echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@ |
Oops, something went wrong.