diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-20 09:14:39 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-20 09:14:39 +0100 |
commit | 1bdd376dbd57de8925244f0808f974d6d8cff39d (patch) | |
tree | 4eacba99068b381f658862428fc89a0090434ce6 | |
parent | 3cfa3a5c8daf03aaad6fc30d275709f6eb717d29 (diff) |
radeon: Only sync to hardware when really necessary with EXA.
In particular, don't sync again after accelerated DownloadFromScreen, which
syncs implicitly. This avoids calling into the kernel when it's not necessary,
which can be relevant in some situations.
-rw-r--r-- | src/radeon.h | 2 | ||||
-rw-r--r-- | src/radeon_exa_funcs.c | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/radeon.h b/src/radeon.h index 8d0115e9..ce2fe191 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -497,6 +497,8 @@ typedef struct { #ifdef USE_EXA ExaDriverPtr exa; + int exaSyncMarker; + int exaMarkerSynced; int engineMode; #define EXA_ENGINEMODE_UNKNOWN 0 #define EXA_ENGINEMODE_2D 1 diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index 0d847d1c..c356de7c 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -59,14 +59,30 @@ #include "exa.h" +static int +FUNC_NAME(RADEONMarkSync)(ScreenPtr pScreen) +{ + RINFO_FROM_SCREEN(pScreen); + + TRACE; + + return ++info->exaSyncMarker; +} + static void FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + TRACE; - FUNC_NAME(RADEONWaitForIdle)(xf86Screens[pScreen->myNum]); + if (info->exaMarkerSynced != marker) { + FUNC_NAME(RADEONWaitForIdle)(pScrn); + info->exaMarkerSynced = marker; + } - RADEONPTR(xf86Screens[pScreen->myNum])->engineMode = EXA_ENGINEMODE_UNKNOWN; + RADEONPTR(pScrn)->engineMode = EXA_ENGINEMODE_UNKNOWN; } static Bool @@ -444,6 +460,8 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h, drmCommandWriteRead(info->drmFD, DRM_RADEON_INDIRECT, &indirect, sizeof(drmRadeonIndirect)); + info->exaMarkerSynced = info->exaSyncMarker; + return TRUE; } #endif @@ -504,6 +522,7 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen) info->exa->Copy = FUNC_NAME(RADEONCopy); info->exa->DoneCopy = FUNC_NAME(RADEONDoneCopy); + info->exa->MarkSync = FUNC_NAME(RADEONMarkSync); info->exa->WaitMarker = FUNC_NAME(RADEONSync); info->exa->UploadToScreen = FUNC_NAME(RADEONUploadToScreen); info->exa->DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen); |