xfree86: Remove the pretense of EDID v2 support
We don't do anything with EDID v2 blocks besides publish them on the root window. Worse, the check deleted by this patch would attempt to take a checksum of arbitrary memory if the rawData array isn't 256+ bytes long (and, for the monitors mentioned, it probably is only 128). Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
8f9bdfd293
commit
777bf90abe
|
@ -33,7 +33,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
|
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
|
||||||
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
||||||
|
@ -52,59 +51,21 @@ edidMakeAtom(int i, const char *name, CARD8 *data, int size)
|
||||||
static void
|
static void
|
||||||
addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
||||||
{
|
{
|
||||||
int i, scrnIndex = pScrn->scrnIndex;
|
int scrnIndex = pScrn->scrnIndex;
|
||||||
Bool makeEDID1prop = FALSE;
|
|
||||||
Bool makeEDID2prop = FALSE;
|
|
||||||
|
|
||||||
if (DDC->flags & MONITOR_DISPLAYID) {
|
if (DDC->flags & MONITOR_DISPLAYID) {
|
||||||
/* Don't bother, use RANDR already */
|
/* Don't bother, use RANDR already */
|
||||||
return;
|
return;
|
||||||
} else if (DDC->ver.version == 1) {
|
} else if (DDC->ver.version == 1) {
|
||||||
makeEDID1prop = TRUE;
|
int size = 128 +
|
||||||
} else if (DDC->ver.version == 2) {
|
(DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
|
||||||
int checksum1;
|
|
||||||
int checksum2;
|
|
||||||
makeEDID2prop = TRUE;
|
|
||||||
|
|
||||||
/* Some monitors (eg Panasonic PanaSync4)
|
edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
|
||||||
* report version==2 because they used EDID v2 spec document,
|
|
||||||
* although they use EDID v1 data structure :-(
|
|
||||||
*
|
|
||||||
* Try using checksum to determine when we have such a monitor.
|
|
||||||
*/
|
|
||||||
checksum2 = 0;
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
checksum2 += DDC->rawData[i];
|
|
||||||
if (checksum2 % 256) {
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO, "Monitor EDID v2 checksum failed\n");
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"XFree86_DDC_EDID2_RAWDATA property may be bad\n");
|
|
||||||
checksum1 = 0;
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
checksum1 += DDC->rawData[i];
|
|
||||||
if (!(checksum1 % 256)) {
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"Monitor EDID v1 checksum passed,\n");
|
|
||||||
xf86DrvMsg(scrnIndex, X_INFO,
|
|
||||||
"XFree86_DDC_EDID1_RAWDATA property created\n");
|
|
||||||
makeEDID1prop = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
|
xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
|
||||||
DDC->ver.version, DDC->ver.revision);
|
DDC->ver.version, DDC->ver.revision);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (makeEDID1prop) {
|
|
||||||
int size = 128 +
|
|
||||||
(DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
|
|
||||||
|
|
||||||
edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (makeEDID2prop)
|
|
||||||
edidMakeAtom(scrnIndex, EDID2_ATOM_NAME, DDC->rawData, 256);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
Loading…
Reference in New Issue