diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2008-10-01 14:38:27 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2008-10-01 14:38:27 -0400 |
commit | 346228b20c69a965c9e7d67157f42c1d36a5b6c3 (patch) | |
tree | 5ea859ae9f108fb989f67653471b4bc8deb441b0 /src | |
parent | c359c2a31caf9f75b9fc6b6bcbc3e9dc1fe404ba (diff) |
Workaround to make initial rotation work
Acceleration needs to be initialized before setting the mode
for initial rotation to work. Changing the order in RADEONScreenInit()
doesn't work because RADEONDRIKernelInit() hangs in the ioctl to
initialize the CP if the mode is not set prior (even if the heads
are turned off after setting the mode). The workaround is to set the
modes twice, once before accel and once after.
This needs to be looked into further.
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon.h | 2 | ||||
-rw-r--r-- | src/radeon_driver.c | 33 | ||||
-rw-r--r-- | src/radeon_memory.c | 11 |
3 files changed, 30 insertions, 16 deletions
diff --git a/src/radeon.h b/src/radeon.h index 6cce7365..aec8a258 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -1304,7 +1304,7 @@ static __inline__ void RADEON_MARK_SYNC(RADEONInfoPtr info, ScrnInfoPtr pScrn) static __inline__ void RADEON_SYNC(RADEONInfoPtr info, ScrnInfoPtr pScrn) { #ifdef USE_EXA - if (info->useEXA) + if (info->useEXA && pScrn->pScreen) exaWaitSync(pScrn->pScreen); #endif #ifdef USE_XAA diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 67f70cb5..9b36ca4d 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -3311,7 +3311,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, RADEONInitMemoryMap(pScrn); /* empty the surfaces */ - { + if (info->ChipFamily < CHIP_FAMILY_R600) { unsigned char *RADEONMMIO = info->MMIO; unsigned int j; for (j = 0; j < 8; j++) { @@ -3449,13 +3449,13 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[drm] failed to enable new memory map\n"); RADEONDRICloseScreen(pScreen); - info->directRenderingEnabled = FALSE; + info->directRenderingEnabled = FALSE; } } #endif xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Initializing fb layer\n"); - + if (info->r600_shadow_fb) { info->fb_shadow = xcalloc(1, pScrn->displayWidth * pScrn->virtualY * @@ -3509,16 +3509,27 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, else if (strcmp(s, "BGR") == 0) subPixelOrder = SubPixelHorizontalBGR; else if (strcmp(s, "NONE") == 0) subPixelOrder = SubPixelNone; PictureSetSubpixelOrder (pScreen, subPixelOrder); - } + } #endif pScrn->vtSema = TRUE; - /* xf86CrtcRotate() accesses pScrn->pScreen */ - pScrn->pScreen = pScreen; - - if (!xf86SetDesiredModes (pScrn)) - return FALSE; + /* XXX + * Unless we set an initial mode here, RADEONDRIKernelInit() hangs in the ioctl + * to initialize the CP. However, we need to init the CP for accel or initial + * rotation fails so we set the mode now, then call xf86SetDesiredModes() after + * accel is initialized to set the proper rotation, etc. + */ + { + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; + for (i = 0; i < config->num_crtc; i++) { + xf86CrtcPtr crtc = config->crtc[i]; + if (crtc->enabled) + xf86CrtcSetMode (crtc, &crtc->desiredMode, RR_Rotate_0, + crtc->desiredX, crtc->desiredY); + } + } RADEONSaveScreen(pScreen, SCREEN_SAVER_ON); @@ -3652,6 +3663,10 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, } } + /* set the modes with desired rotation, etc. */ + if (!xf86SetDesiredModes (pScrn)) + return FALSE; + /* Provide SaveScreen & wrap BlockHandler and CloseScreen */ /* Wrap CloseScreen */ info->CloseScreen = pScreen->CloseScreen; diff --git a/src/radeon_memory.c b/src/radeon_memory.c index 178eed03..f965cb4f 100644 --- a/src/radeon_memory.c +++ b/src/radeon_memory.c @@ -17,12 +17,10 @@ radeon_allocate_memory(ScrnInfoPtr pScrn, int size, int align) { - ScreenPtr pScreen; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); uint32_t offset = 0; - pScreen = screenInfo.screens[pScrn->scrnIndex]; - #ifdef USE_EXA if (info->useEXA) { ExaOffscreenArea *area = *mem_struct; @@ -31,10 +29,10 @@ radeon_allocate_memory(ScrnInfoPtr pScrn, if (area->size >= size) return area->offset; - exaOffscreenFree(pScrn->pScreen, area); + exaOffscreenFree(pScreen, area); } - area = exaOffscreenAlloc(pScrn->pScreen, size, align, TRUE, + area = exaOffscreenAlloc(pScreen, size, align, TRUE, NULL, NULL); *mem_struct = area; @@ -95,6 +93,7 @@ void radeon_free_memory(ScrnInfoPtr pScrn, void *mem_struct) { + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); #ifdef USE_EXA @@ -102,7 +101,7 @@ radeon_free_memory(ScrnInfoPtr pScrn, ExaOffscreenArea *area = mem_struct; if (area != NULL) - exaOffscreenFree(pScrn->pScreen, area); + exaOffscreenFree(pScreen, area); area = NULL; } #endif /* USE_EXA */ |