From 5a060002487e16c53dc96e32af72cd1bfcf6a227 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 4 Oct 2006 18:43:07 -0700 Subject: Add mode origins for randr --- src/i830_modes.c | 14 +++++++------- src/i830_randr.c | 26 +++++++++++++++++++++----- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/i830_modes.c b/src/i830_modes.c index da1ccde8..ac7c4c51 100644 --- a/src/i830_modes.c +++ b/src/i830_modes.c @@ -290,7 +290,10 @@ i830GetDDCModes(ScrnInfoPtr pScrn, xf86MonPtr ddc) new->Clock = d_timings->clock / 1000; new->Flags = (d_timings->interlaced ? V_INTERLACE : 0); new->status = MODE_OK; - new->type = M_T_DEFAULT; + if (PREFERRED_TIMING_MODE(ddc->features.msc)) + new->type = M_T_PREFERRED; + else + new->type = M_T_DRIVER; i830xf86SetModeDefaultName(new); @@ -419,7 +422,7 @@ i830FPNativeMode(ScrnInfoPtr pScrn) new->VTotal = new->VSyncEnd + 1; new->Clock = pI830->panel_fixed_clock; - new->type = M_T_USERDEF; + new->type = M_T_PREFERRED; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No valid mode specified, force to native mode\n"); @@ -475,7 +478,7 @@ i830GetLVDSModes(ScrnInfoPtr pScrn, char **ppModeName) } new = i830GetGTF(width, height, 60.0, FALSE, FALSE); - new->type |= M_T_USERDEF; + new->type |= M_T_DEFAULT; new->next = NULL; new->prev = last; @@ -510,10 +513,7 @@ i830GetLVDSModes(ScrnInfoPtr pScrn, char **ppModeName) } if (!tmp) { new = i830GetGTF(p->HDisplay, p->VDisplay, 60.0, FALSE, FALSE); - if (ppModeName[i] == NULL) - new->type |= M_T_USERDEF; - else - new->type |= M_T_DEFAULT; + new->type |= M_T_DEFAULT; I830xf86SortModes(new, &first, &last); diff --git a/src/i830_randr.c b/src/i830_randr.c index 7abfb3b4..37bd6a10 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -542,7 +542,7 @@ I830RandRCrtcSet (ScreenPtr pScreen, int y, Rotation rotation, int numOutputs, - RROutputPtr *outputs) + RROutputConfigPtr outputs) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -603,7 +603,6 @@ I830RandRSetInfo12 (ScreenPtr pScreen) int nclone; RRCrtcPtr crtcs[MAX_DISPLAY_PIPES]; int ncrtc; - RRModePtr *modes; int nmode; struct _I830OutputRec *output; int i; @@ -617,6 +616,8 @@ I830RandRSetInfo12 (ScreenPtr pScreen) DisplayModePtr modes, mode; xRRModeInfo modeInfo; RRModePtr rrmode, *rrmodes; + CARD32 possibleOptions = 0; + CARD32 currentOptions = 0; if (randrp->virtualX == -1 || randrp->virtualY == -1) { @@ -655,6 +656,10 @@ I830RandRSetInfo12 (ScreenPtr pScreen) clone_types = (1 << I830_OUTPUT_LVDS); pipe_type = PIPE_LFP; subpixel = SubPixelHorizontalRGB; + possibleOptions = (RROutputOptionScaleNone| + RROutputOptionScaleMaxAspect | + RROutputOptionScaleMax); + currentOptions = RROutputOptionScaleMax; break; case I830_OUTPUT_TVOUT: crtc_types = ((1 << 0) | @@ -692,11 +697,14 @@ I830RandRSetInfo12 (ScreenPtr pScreen) RROutputSetCrtc (randrp->outputs[i], crtc); + RROutputSetPossibleOptions (randrp->outputs[i], possibleOptions); + RROutputSetCurrentOptions (randrp->outputs[i], currentOptions); nmode = 0; rrmodes = NULL; if (pipe >= 0) { - modes = pI830->pipeMon[pipe]->Modes; + MonPtr mon = pI830->pipeMon[pipe]; + modes = mon->Modes; for (mode = modes; mode; mode = mode->next) nmode++; @@ -725,6 +733,16 @@ I830RandRSetInfo12 (ScreenPtr pScreen) modeInfo.vSyncEnd = mode->VSyncEnd; modeInfo.vTotal = mode->VTotal; modeInfo.modeFlags = mode->Flags; + if (mode->type & M_T_PREFERRED) + modeInfo.origin = RRModeOriginPreferred; + else if (mode->type & M_T_DRIVER) + modeInfo.origin = RRModeOriginDetailed; + else if (mode->type & M_T_USERDEF) + modeInfo.origin = RRModeOriginConfig; + else if (mode->type & M_T_DEFAULT) + modeInfo.origin = RRModeOriginVESA; + else + modeInfo.origin = RRModeOriginOther; rrmode = RRModeGet (pScreen, &modeInfo, mode->name); rrmode->devPrivate = mode; @@ -776,8 +794,6 @@ static Bool I830RandRGetInfo12 (ScreenPtr pScreen, Rotation *rotations) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - int found_crt; I830ValidateXF86ModeList(pScrn, FALSE); return I830RandRSetInfo12 (pScreen); -- cgit v1.2.3