diff options
-rw-r--r-- | src/radeon_dri.c | 3 | ||||
-rw-r--r-- | src/radeon_driver.c | 28 | ||||
-rw-r--r-- | src/radeon_reg.h | 1 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c index 22062ec..450895b 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -1328,6 +1328,9 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) < RADEON_MAX_DRAWABLES ? SAREA_MAX_DRAWABLES : RADEON_MAX_DRAWABLES); + /* kill DRIAdjustFrame. We adjust sarea frame info ourselves to work + correctly with pageflip + mergedfb/color tiling */ + pDRIInfo->wrap.AdjustFrame = NULL; #ifdef PER_CONTEXT_SAREA /* This is only here for testing per-context SAREAs. When used, the diff --git a/src/radeon_driver.c b/src/radeon_driver.c index c2a12d8..340ba3b 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -74,6 +74,7 @@ #define _XF86DRI_SERVER_ #include "radeon_dri.h" #include "radeon_sarea.h" +#include "sarea.h" #endif #include "fb.h" @@ -5352,6 +5353,11 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif + if(info->MergedFB) { + /* need this here to fix up sarea values */ + RADEONAdjustFrameMerged(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + } + info->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = RADEONBlockHandler; @@ -6823,12 +6829,10 @@ static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, ? RADEON_CRTC2_V_SYNC_POL : 0)); - /* We must make sure Tiling is disabled. It seem all other fancy - * options in there can be safely disabled too + /* It seems all fancy options apart from pflip can be safely disabled */ save->crtc2_offset = 0; - save->crtc2_offset_cntl = 0; - + save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL) & RADEON_CRTC_OFFSET_FLIP_CNTL; /* this should be right */ if (info->MergedFB) { @@ -7513,6 +7517,7 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int clone) int reg, Base; #ifdef XF86DRI RADEONSAREAPrivPtr pSAREAPriv; + XF86DRISAREAPtr pSAREA; #endif if (info->showCache && y) { @@ -7543,12 +7548,23 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int clone) #ifdef XF86DRI if (info->directRenderingEnabled) { - - pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); + /* note cannot use pScrn->pScreen since this is unitialized when called from + RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */ + pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]); + /* can't get at sarea in a semi-sane way? */ + pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec)); if (clone || info->IsSecondary) { pSAREAPriv->crtc2_base = Base; } + else { + pSAREA->frame.x = (Base / info->CurrentLayout.pixel_bytes) + % info->CurrentLayout.displayWidth; + pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes) + / info->CurrentLayout.displayWidth; + pSAREA->frame.width = pScrn->frameX1 - x + 1; + pSAREA->frame.height = pScrn->frameY1 - y + 1; + } if (pSAREAPriv->pfCurrentPage == 1) { Base += info->backOffset; diff --git a/src/radeon_reg.h b/src/radeon_reg.h index 28a3dae..cba64bb 100644 --- a/src/radeon_reg.h +++ b/src/radeon_reg.h @@ -352,6 +352,7 @@ # define RADEON_CRTC_TILE_LINE_RIGHT_SHIFT 4 # define RADEON_CRTC_TILE_EN_RIGHT (1 << 14) # define RADEON_CRTC_TILE_EN (1 << 15) +# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) # define RADEON_CRTC_STEREO_OFFSET_EN (1 << 17) #define RADEON_CRTC2_OFFSET_CNTL 0x0328 |