Hi all,

As I have mentioned a few days earlier, I have encountered a Samsung
214T monitor,
which is unable to properly use DDC when connected via DVI, but works
fine via VGA.

I could not get it to work with the Radeon driver, but the proprietary
NVIDIA driver
had an option to force-feed the driver with custom EDID data from a
file, instead of DDC,
so I could use the monitor with NVIDIA.

However, I wanted the Radeon driver, so I have added the same option to
the radeon driver.
It works for me; if you consider this useful, please add to the official
branch.

    * * *

Here is how I use it:

1. Connect the monitor to the PC using VGA
2. get-edid > /root/Samsung_214T.edid
3. add to xorg.conf:     Option      "CustomEDID"   
"DVI-0:/root/Samsung_214T.edid"
4. Connect the monitor to the PC using DVI
5. Restart X


... and it work.s

As far as I can tell, there is no other way to make this monitor work
with this driver,
so this is very important to me; however, I am not sure how many people are
blessed with such broken hardware, so I can not estimate the real importance
of the problem.

    * * *

Please let me know what do you think!

    Kristof Csillag
  



diff -ur xserver-xorg-video-ati-6.12.3/man/radeon.man xserver-xorg-video-ati-6.12.3.mine/man/radeon.man
--- xserver-xorg-video-ati-6.12.3/man/radeon.man	2009-09-10 04:58:47.000000000 +0200
+++ xserver-xorg-video-ati-6.12.3.mine/man/radeon.man	2009-09-11 01:57:46.000000000 +0200
@@ -302,6 +302,34 @@
 The default value is
 .B off.
 .TP 
+.BI "Option \*qCustomEDID\*q \*q" string \*q
+Forces the X driver to use the EDID data specified in a file rather
+than the display's EDID. Also overrides DDC monitor detection.
+.br
+You may specify a semicolon separated list of output name and filename pairs.
+The output name is something like "VGA-0" or "DVI-0";
+consult the Xorg log for the supported output names of any given system.
+.br
+The file must contain a raw 128-byte EDID block, as captured by
+.B
+get-edid.
+.br
+For example:
+.B
+Option \*qCustomEDID\*q \*qCRT1:/tmp/edid1.bin; DFP1:/tmp/edid2.bin\*q
+will assign the EDID from the file /tmp/edid1.bin to the output device
+CRT1, and the EDID from the file /tmp/edid2.bin to the output device
+DFP1.
+.br
+Note that a output name must always be specified,
+even if only one EDID is specified.
+.br
+.B
+Caution:
+Specifying an EDID that doesn't exactly match your display may
+damage your hardware, as it allows the driver to specify timings beyond
+the capabilities of your display. Use with care.
+.TP 
 .BI "Option \*qPanelSize\*q \*q" "string" \*q
 Should only be used when driver cannot detect the correct panel size.
 Apply to both desktop (TMDS) and laptop (LVDS) digital panels.
diff -ur xserver-xorg-video-ati-6.12.3/src/radeon_driver.c xserver-xorg-video-ati-6.12.3.mine/src/radeon_driver.c
--- xserver-xorg-video-ati-6.12.3/src/radeon_driver.c	2009-09-10 04:59:12.000000000 +0200
+++ xserver-xorg-video-ati-6.12.3.mine/src/radeon_driver.c	2009-09-11 01:12:40.000000000 +0200
@@ -158,6 +158,7 @@
 #endif
 #endif
     { OPTION_IGNORE_EDID,    "IgnoreEDID",       OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_CUSTOM_EDID,    "CustomEDID",       OPTV_ANYSTR,  {0}, FALSE },
     { OPTION_DISP_PRIORITY,  "DisplayPriority",  OPTV_ANYSTR,  {0}, FALSE },
     { OPTION_PANEL_SIZE,     "PanelSize",        OPTV_ANYSTR,  {0}, FALSE },
     { OPTION_MIN_DOTCLOCK,   "ForceMinDotClock", OPTV_FREQ,    {0}, FALSE },
diff -ur xserver-xorg-video-ati-6.12.3/src/radeon.h xserver-xorg-video-ati-6.12.3.mine/src/radeon.h
--- xserver-xorg-video-ati-6.12.3/src/radeon.h	2009-09-10 04:58:47.000000000 +0200
+++ xserver-xorg-video-ati-6.12.3.mine/src/radeon.h	2009-09-11 01:12:40.000000000 +0200
@@ -166,6 +166,7 @@
 #endif
 #endif
     OPTION_IGNORE_EDID,
+    OPTION_CUSTOM_EDID,
     OPTION_DISP_PRIORITY,
     OPTION_PANEL_SIZE,
     OPTION_MIN_DOTCLOCK,
diff -ur xserver-xorg-video-ati-6.12.3/src/radeon_output.c xserver-xorg-video-ati-6.12.3.mine/src/radeon_output.c
--- xserver-xorg-video-ati-6.12.3/src/radeon_output.c	2009-09-10 04:58:47.000000000 +0200
+++ xserver-xorg-video-ati-6.12.3.mine/src/radeon_output.c	2009-09-11 01:19:32.000000000 +0200
@@ -32,6 +32,7 @@
 
 #include <string.h>
 #include <stdio.h>
+#include <fcntl.h>
 
 /* X and server generic header files */
 #include "xf86.h"
@@ -209,6 +210,47 @@
     }
 }
 
+xf86MonPtr RADEONGetHardCodedEDIDFromFILE (xf86OutputPtr output, char *EDIDlist)
+{
+    ScrnInfoPtr pScrn = output->scrn;
+    unsigned char edid[128];
+    xf86MonPtr mon = NULL;
+    char *name = output->name;
+    char *outputEDID = strstr(EDIDlist, name);
+    if (outputEDID != NULL) {
+      outputEDID += strlen(name) + 1;      
+      char *end = strstr(outputEDID, ";");
+      if (end != NULL) {
+	*end = 0;
+      }
+      int fd = open (outputEDID, O_RDONLY);
+      if (fd >= 0) {
+	read(fd, edid, 128);
+	close(fd);
+	if (edid[1] == 0xff) {
+	  mon = xf86InterpretEDID(output->scrn->scrnIndex, edid);
+	  xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		     "Successfully read Custom EDID data from %s.\n", 
+		     outputEDID);
+	} else {
+	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		     "Custom EDID data read from %s was invalid.\n", 
+		     outputEDID);
+	}
+      } else {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "Could not read custom EDID for output %s from file %s.\n", 
+		   name, outputEDID);
+      }
+    } else {
+      xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		 "Could not find EDID file name for output %s; using auto detection.\n", 
+		 name);
+    }
+    return mon;
+}
+
+
 static RADEONMonitorType
 radeon_ddc_connected(xf86OutputPtr output)
 {
@@ -218,7 +260,11 @@
     xf86MonPtr MonInfo = NULL;
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
 
-    if (radeon_output->pI2CBus) {
+    char *edidstr = (char *)xf86GetOptValString(info->Options, OPTION_CUSTOM_EDID);
+    if (edidstr != NULL) {
+      MonInfo = RADEONGetHardCodedEDIDFromFILE(output, edidstr);
+    }
+    if ((MonInfo == NULL) && (radeon_output->pI2CBus)) {
 	if (info->get_hardcoded_edid_from_bios)
 	    MonInfo = RADEONGetHardCodedEDIDFromBIOS(output);
 	if (MonInfo == NULL) {
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to