diff options
-rw-r--r-- | src/radeon.h | 3 | ||||
-rw-r--r-- | src/radeon_display.c | 4 | ||||
-rw-r--r-- | src/radeon_driver.c | 6 | ||||
-rw-r--r-- | src/radeon_modes.c | 36 | ||||
-rw-r--r-- | src/radeon_randr.c | 130 |
5 files changed, 131 insertions, 48 deletions
diff --git a/src/radeon.h b/src/radeon.h index e40905ab..733b9c50 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -918,6 +918,9 @@ extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName, extern int RADEONValidateFPModes(ScrnInfoPtr pScrn, char **ppModeName, DisplayModePtr *modeList); extern void RADEONSetPitch (ScrnInfoPtr pScrn); +extern Bool RADEONInit2(ScrnInfoPtr pScrn, DisplayModePtr crtc1, + DisplayModePtr crtc2, int crtc_mask, + RADEONSavePtr save); #ifdef XF86DRI #ifdef USE_XAA diff --git a/src/radeon_display.c b/src/radeon_display.c index 2521e31a..f8db2ecf 100644 --- a/src/radeon_display.c +++ b/src/radeon_display.c @@ -2476,7 +2476,8 @@ Bool RADEONAllocateControllers(ScrnInfoPtr pScrn) return FALSE; pRADEONEnt->pCrtc[0]->driver_private = pRADEONEnt->Controller[0]; - + pRADEONEnt->Controller[0]->crtc_id = 0; + if (!pRADEONEnt->HasCRTC2) return TRUE; @@ -2492,6 +2493,7 @@ Bool RADEONAllocateControllers(ScrnInfoPtr pScrn) } pRADEONEnt->pCrtc[1]->driver_private = pRADEONEnt->Controller[1]; + pRADEONEnt->Controller[1]->crtc_id = 1; return TRUE; } diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 0724fe7d..cf2af679 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -6340,9 +6340,9 @@ static void RADEONInitPalette(RADEONSavePtr save) #endif /* Define registers for a requested video mode */ -static Bool RADEONInit2(ScrnInfoPtr pScrn, DisplayModePtr crtc1, - DisplayModePtr crtc2, int crtc_mask, - RADEONSavePtr save) +Bool RADEONInit2(ScrnInfoPtr pScrn, DisplayModePtr crtc1, + DisplayModePtr crtc2, int crtc_mask, + RADEONSavePtr save) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); diff --git a/src/radeon_modes.c b/src/radeon_modes.c index 6654afe7..bd11106e 100644 --- a/src/radeon_modes.c +++ b/src/radeon_modes.c @@ -601,21 +601,23 @@ RADEONProbeOutputModes(ScrnInfoPtr pScrn) DisplayModePtr ddc_modes, mode; DisplayModePtr test; - for (i = 0; i < RADEON_MAX_CONNECTOR; i++) { - - test = pRADEONEnt->pOutput[i]->probed_modes; + for (i = 0; i < info->xf86_config.num_output; i++) { + xf86OutputPtr output = info->xf86_config.output[i]; + + test = output->probed_modes; while(test != NULL) { xf86DeleteMode(&test, test); } - pRADEONEnt->pOutput[i]->probed_modes = test; + output->probed_modes = test; + /* force reprobe */ pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN; RADEONConnectorFindMonitor(pScrn, i); /* okay we got DDC info */ - if (pRADEONEnt->pOutput[i]->MonInfo) { + if (output->MonInfo) { /* Debug info for now, at least */ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %d\n", i); xf86PrintEDID(pRADEONEnt->pOutput[i]->MonInfo); @@ -634,7 +636,7 @@ RADEONProbeOutputModes(ScrnInfoPtr pScrn) } - if (pRADEONEnt->pOutput[i]->probed_modes == NULL) { + if (output->probed_modes == NULL) { MonRec fixed_mon; DisplayModePtr modes; @@ -668,16 +670,15 @@ RADEONProbeOutputModes(ScrnInfoPtr pScrn) } } - if (pRADEONEnt->pOutput[i]->probed_modes) { + if (output->probed_modes) { RADEONxf86ValidateModesUserConfig(pScrn, - pRADEONEnt->pOutput[i]->probed_modes); - RADEONxf86PruneInvalidModes(pScrn, &pRADEONEnt->pOutput[i]->probed_modes, + output->probed_modes); + RADEONxf86PruneInvalidModes(pScrn, &output->probed_modes, FALSE); } - for (mode = pRADEONEnt->pOutput[i]->probed_modes; mode != NULL; - mode = mode->next) + for (mode = output->probed_modes; mode != NULL; mode = mode->next) { /* The code to choose the best mode per pipe later on will require * VRefresh to be set. @@ -726,10 +727,11 @@ RADEON_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn) * pScrn->modes should only be used for XF86VidMode now, which we don't * care about enough to make some sort of unioned list. */ - for (i = 0; i < RADEON_MAX_CONNECTOR; i++) { - if (pRADEONEnt->pOutput[i]->probed_modes != NULL) { + for (i = 0; i < info->xf86_config.num_output; i++) { + xf86OutputPtr output = info->xf86_config.output[i]; + if (output->probed_modes != NULL) { pScrn->modes = - RADEONxf86DuplicateModes(pScrn, pRADEONEnt->pOutput[i]->probed_modes); + RADEONxf86DuplicateModes(pScrn, output->probed_modes); break; } } @@ -750,12 +752,6 @@ RADEON_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn) FatalError("No modes left for XFree86 DDX\n"); } - pScrn->currentMode = pScrn->modes; - - xf86SetDpi(pScrn, 0, 0); - info->RADEONDPIVX = pScrn->virtualX; - info->RADEONDPIVY = pScrn->virtualY; - /* For some reason, pScrn->modes is circular, unlike the other mode lists. * How great is that? */ diff --git a/src/radeon_randr.c b/src/radeon_randr.c index fc090750..d3bd4c83 100644 --- a/src/radeon_randr.c +++ b/src/radeon_randr.c @@ -58,9 +58,6 @@ typedef struct _radeonRandRInfo { int maxY; Rotation rotation; /* current mode */ Rotation supported_rotations; /* driver supported */ -#ifdef RANDR_12_INTERFACE - DisplayModePtr modes[2]; -#endif } XF86RandRInfoRec, *XF86RandRInfoPtr; #ifdef RANDR_12_INTERFACE @@ -117,49 +114,134 @@ RADEONRandRScreenSetSize (ScreenPtr pScreen, } static Bool -RADEONRandRCrtcNotify (RRCrtcPtr crtc) +RADEONRandRCrtcNotify (RRCrtcPtr randr_crtc) { - ScreenPtr pScreen = crtc->pScreen; + ScreenPtr pScreen = randr_crtc->pScreen; XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - RRModePtr mode = NULL; - int i, j; - int numOutputs = 0; + RADEONInfoPtr info = RADEONPTR(pScrn); + RRModePtr randr_mode = NULL; int x, y; - int rotation = RR_Rotate_0; - RROutputPtr outputs[RADEON_MAX_CRTC]; - RROutputPtr rrout; + Rotation rotation; + int numOutputs; + RROutputPtr randr_outputs[RADEON_MAX_CRTC]; + RROutputPtr randr_output; + xf86CrtcPtr crtc = randr_crtc->devPrivate; + xf86OutputPtr output; + int i, j; + DisplayModePtr curMode = &crtc->curMode; - for (i = 0; i<RADEON_MAX_CONNECTOR; i++) { - - rrout = pRADEONEnt->pOutput[i]->randr_output; + x = crtc->x; + y = crtc->y; + rotation = RR_Rotate_0; + numOutputs = 0; + randr_mode = NULL; - outputs[numOutputs++] = rrout; - for (j = 0; j<rrout->numModes; j++) { - DisplayModePtr outMode = rrout->modes[j]->devPrivate; - mode = rrout->modes[j]; + for (i = 0; i < info->xf86_config.num_output; i++) { + output = info->xf86_config.output[i]; + if (output->crtc == crtc) { + + randr_output = output->randr_output; + randr_outputs[numOutputs++] = randr_output; + + for (j = 0; j < randr_output->numModes; j++) { + DisplayModePtr outMode = randr_output->modes[j]->devPrivate; + if (xf86ModesEqual(curMode, outMode)) { + randr_mode = randr_output->modes[j]; + break; + } + } } } - return RRCrtcNotify (crtc, mode, x, y, rotation, numOutputs, outputs); + return RRCrtcNotify (randr_crtc, randr_mode, x, y, rotation, numOutputs, randr_outputs); } static Bool RADEONRandRCrtcSet (ScreenPtr pScreen, - RRCrtcPtr crtc, - RRModePtr mode, + RRCrtcPtr randr_crtc, + RRModePtr randr_mode, int x, int y, Rotation rotation, int num_randr_outputs, RROutputPtr *randr_outputs) { - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - - return RADEONRandRCrtcNotify(crtc); + RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CrtcPtr crtc = randr_crtc->devPrivate; + RADEONCrtcPrivatePtr pRcrtc = crtc->driver_private; + DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL; + Bool changed = FALSE; + int o, ro; + xf86CrtcPtr save_crtcs[RADEON_MAX_CONNECTOR]; + Bool save_enabled = crtc->enabled; + int ret; + + if ((mode != NULL) != crtc->enabled) + changed = TRUE; + else if (mode && !xf86ModesEqual (&crtc->curMode, mode)) + changed = TRUE; + + for (o = 0; o < info->xf86_config.num_output; o++) { + xf86OutputPtr output = info->xf86_config.output[o]; + xf86CrtcPtr new_crtc; + + save_crtcs[o] = output->crtc; + + if (output->crtc == crtc) + new_crtc = NULL; + else + new_crtc = output->crtc; + + for (ro = 0; ro < num_randr_outputs; ro++) + if (output->randr_output == randr_outputs[ro]) { + new_crtc = crtc; + break; + } + if (new_crtc != output->crtc) { + changed = TRUE; + output->crtc = new_crtc; + } + } + + /* got to set the modes in here */ + if (changed) { + crtc->enabled = mode != NULL; + + if (info->accelOn) + RADEON_SYNC(info, pScrn); + + if (mode) { + if (pRcrtc->crtc_id == 0) + ret = RADEONInit2(pScrn, mode, NULL, 1, &info->ModeReg); + else if (pRcrtc->crtc_id == 1) + ret = RADEONInit2(pScrn, NULL, mode, 2, &info->ModeReg); + + if (!ret) { + crtc->enabled = save_enabled; + for (o = 0; o < info->xf86_config.num_output; o++) { + xf86OutputPtr output = info->xf86_config.output[o]; + output->crtc = save_crtcs[o]; + } + return FALSE; + } + crtc->desiredMode = *mode; + } + } + + if (changed) { + pScrn->vtSema = TRUE; + RADEONBlank(pScrn); + RADEONRestoreMode(pScrn, &info->ModeReg); + RADEONUnblank(pScrn); + + if (info->DispPriority) + RADEONInitDispBandwidth(pScrn); + } + return RADEONRandRCrtcNotify(randr_crtc); } |