diff options
author | Eric Anholt <eric@anholt.net> | 2006-11-01 12:42:56 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2006-11-01 12:42:56 -0800 |
commit | 7971c401554c218c84a8c45335c9b31bbccfece7 (patch) | |
tree | 21924c06732726f0edac0906bc84cbd212345625 | |
parent | fb94c1210966f7875e5f034f10ea31c06c502c3a (diff) |
Attempt to pull monitor physical size information out of DDC EDID data.
-rw-r--r-- | src/i830.h | 8 | ||||
-rw-r--r-- | src/i830_crt.c | 1 | ||||
-rw-r--r-- | src/i830_modes.c | 13 | ||||
-rw-r--r-- | src/i830_randr.c | 8 |
4 files changed, 23 insertions, 7 deletions
@@ -272,6 +272,8 @@ struct _I830OutputRec { /** * Query the device for the modes it provides. * + * This function may also update MonInfo, mm_width, and mm_height. + * * \return singly-linked list of modes or NULL if no modes found. */ DisplayModePtr (*get_modes)(ScrnInfoPtr pScrn, I830OutputPtr output); @@ -283,7 +285,13 @@ struct _I830OutputRec { * compatible modes added later. */ DisplayModePtr probed_modes; + + /** EDID monitor information */ xf86MonPtr MonInfo; + + /** Physical size of the output currently attached. */ + int mm_width, mm_height; + I2CBusPtr pI2CBus; I2CBusPtr pDDCBus; struct _I830DVODriver *i2c_drv; diff --git a/src/i830_crt.c b/src/i830_crt.c index 407ebe3d..0225727b 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -32,6 +32,7 @@ #include "xf86.h" #include "i830.h" #include "i830_xf86Modes.h" + static void i830_crt_dpms(ScrnInfoPtr pScrn, I830OutputPtr output, int mode) { diff --git a/src/i830_modes.c b/src/i830_modes.c index d6866ad8..0bb17a54 100644 --- a/src/i830_modes.c +++ b/src/i830_modes.c @@ -641,6 +641,7 @@ i830_ddc_get_modes(ScrnInfoPtr pScrn, I830OutputPtr output) { xf86MonPtr ddc_mon; DisplayModePtr ddc_modes, mode; + int i; ddc_mon = xf86DoEDID_DDC2(pScrn->scrnIndex, output->pDDCBus); if (ddc_mon == NULL) @@ -666,7 +667,17 @@ i830_ddc_get_modes(ScrnInfoPtr pScrn, I830OutputPtr output) } i830xf86PruneInvalidModes(pScrn, &ddc_modes, TRUE); - xfree(ddc_mon); + /* Pull out a phyiscal size from a detailed timing if available. */ + for (i = 0; i < 4; i++) { + if (ddc_mon->det_mon[i].type == DT && + ddc_mon->det_mon[i].section.d_timings.h_size != 0 && + ddc_mon->det_mon[i].section.d_timings.v_size != 0) + { + output->mm_width = ddc_mon->det_mon[i].section.d_timings.h_size; + output->mm_height = ddc_mon->det_mon[i].section.d_timings.v_size; + break; + } + } return ddc_modes; } diff --git a/src/i830_randr.c b/src/i830_randr.c index 69063a8b..59ebcc08 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -698,12 +698,8 @@ I830RandRSetInfo12 (ScreenPtr pScreen) return FALSE; RROutputSetCrtc (randrp->outputs[i], crtc); - - /* We should pull info out of EDID to get the output physical - * size when available. - */ - RROutputSetPhysicalSize(randrp->outputs[i], 0, 0); - + RROutputSetPhysicalSize(randrp->outputs[i], pI830->output[i].mm_width, + pI830->output[i].mm_height); RROutputSetPossibleOptions (randrp->outputs[i], possibleOptions); RROutputSetCurrentOptions (randrp->outputs[i], currentOptions); nmode = 0; |