From f4407962cd7b272e0860319f11f6a6583ef226c2 Mon Sep 17 00:00:00 2001 From: Csillag Kristof Date: Fri, 9 Oct 2009 18:00:09 -0400 Subject: Fix some issues with CustomEDID support - Fixes a memory allocation problem introduced with the previous version of the CustomEDID patch (now in GIT), and - Enhances the syntax of the CustomEDID option so that I can force digital output, even if the EDID was acquired over an analog link. --- src/radeon_output.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/radeon_output.c b/src/radeon_output.c index 75f63b7..0429088 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -228,12 +228,14 @@ RADEONGetHardCodedEDIDFromFile(xf86OutputPtr output) radeon_output->custom_mon = NULL; if (EDIDlist != NULL) { - unsigned char edid[128]; + unsigned char* edid = xnfcalloc(128, 1); char *name = output->name; char *outputEDID = strstr(EDIDlist, name); if (outputEDID != NULL) { char *end; + char *colon; + char *command = NULL; int fd; outputEDID += strlen(name) + 1; @@ -241,6 +243,12 @@ RADEONGetHardCodedEDIDFromFile(xf86OutputPtr output) if (end != NULL) *end = 0; + colon = strstr(outputEDID, ":"); + if (colon != NULL) { + *colon = 0; + command = colon + 1; + } + fd = open (outputEDID, O_RDONLY); if (fd >= 0) { read(fd, edid, 128); @@ -251,6 +259,27 @@ RADEONGetHardCodedEDIDFromFile(xf86OutputPtr output) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Successfully read Custom EDID data for output %s from %s.\n", name, outputEDID); + if (command != NULL) { + if (!strcmp(command, "digital")) { + struct edid_version *v = &radeon_output->custom_mon->ver; + struct disp_features *r = &radeon_output->custom_mon->features; + r->input_type = 1; + if (v->revision == 2 || v->revision == 3) { + // Nothing to do + } else if (v->revision >= 4) { + r->input_interface = 1; // Using DVI by default + r->input_bpc = 2; // 8 bits per channes by default + } + radeon_output->custom_mon->rawData[0x14] |= 0x80; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Forcing digital output for output %s.\n", name); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unknown custom EDID command: '%s'.\n", + command); + } + } + } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Custom EDID data for %s read from %s was invalid.\n", -- cgit v1.2.3