diff --git a/src/radeon.h b/src/radeon.h index 902d1c0..605b057 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -1292,41 +1292,6 @@ do { \ #endif /* XF86DRI */ -#if defined(XF86DRI) && defined(USE_EXA) -#define RADEON_SWITCH_TO_2D() \ -do { \ - uint32_t flush = 0; \ - switch (info->accel_state->engineMode) { \ - case EXA_ENGINEMODE_UNKNOWN: \ - case EXA_ENGINEMODE_3D: \ - flush = 1; \ - case EXA_ENGINEMODE_2D: \ - break; \ - } \ - if (flush && info->directRenderingEnabled) \ - RADEONCPFlushIndirect(pScrn, 1); \ - info->accel_state->engineMode = EXA_ENGINEMODE_2D; \ -} while (0); - -#define RADEON_SWITCH_TO_3D() \ -do { \ - uint32_t flush = 0; \ - switch (info->accel_state->engineMode) { \ - case EXA_ENGINEMODE_UNKNOWN: \ - case EXA_ENGINEMODE_2D: \ - flush = 1; \ - case EXA_ENGINEMODE_3D: \ - break; \ - } \ - if (flush && info->directRenderingEnabled) \ - RADEONCPFlushIndirect(pScrn, 1); \ - info->accel_state->engineMode = EXA_ENGINEMODE_3D; \ -} while (0); -#else -#define RADEON_SWITCH_TO_2D() -#define RADEON_SWITCH_TO_3D() -#endif - static __inline__ void RADEON_MARK_SYNC(RADEONInfoPtr info, ScrnInfoPtr pScrn) { #ifdef USE_EXA diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index 62224d0..0f71e2e 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -100,8 +100,6 @@ FUNC_NAME(RADEONPrepareSolid)(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) if (!RADEONGetPixmapOffsetPitch(pPix, &dst_pitch_offset)) RADEON_FALLBACK(("RADEONGetPixmapOffsetPitch failed\n")); - RADEON_SWITCH_TO_2D(); - BEGIN_ACCEL(5); OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, RADEON_GMC_DST_PITCH_OFFSET_CNTL | @@ -148,6 +146,11 @@ FUNC_NAME(RADEONDoneSolid)(PixmapPtr pPix) OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE); FINISH_ACCEL(); + +#ifdef ACCEL_CP + if (info->directRenderingEnabled) + RADEONCPFlushIndirect(pScrn, 1); +#endif } void @@ -158,8 +161,6 @@ FUNC_NAME(RADEONDoPrepareCopy)(ScrnInfoPtr pScrn, uint32_t src_pitch_offset, RADEONInfoPtr info = RADEONPTR(pScrn); ACCEL_PREAMBLE(); - RADEON_SWITCH_TO_2D(); - BEGIN_ACCEL(5); OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, RADEON_GMC_DST_PITCH_OFFSET_CNTL | @@ -250,6 +251,12 @@ FUNC_NAME(RADEONDoneCopy)(PixmapPtr pDst) OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE); FINISH_ACCEL(); + +#ifdef ACCEL_CP + if (info->directRenderingEnabled) + RADEONCPFlushIndirect(pScrn, 1); +#endif + } static Bool @@ -283,7 +290,6 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h, int cpp = bpp / 8; ACCEL_PREAMBLE(); - RADEON_SWITCH_TO_2D(); while ((buf = RADEONHostDataBlit(pScrn, cpp, w, dst_pitch_off, &buf_pitch, x, &y, (unsigned int*)&h, &hpass)) != 0) { @@ -292,6 +298,8 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h, src += hpass * src_pitch; } + RADEONCPFlushIndirect(pScrn, 1); + exaMarkSync(pDst->drawable.pScreen); return TRUE; } @@ -406,8 +414,6 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h, drm_radeon_indirect_t indirect; ACCEL_PREAMBLE(); - RADEON_SWITCH_TO_2D(); - /* Kick the first blit as early as possible */ RADEONBlitChunk(pScrn, datatype, src_pitch_offset, scratch_pitch_offset, x, y, 0, 0, w, hpass); @@ -476,6 +482,9 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h, drmCommandWriteRead(info->dri->drmFD, DRM_RADEON_INDIRECT, &indirect, sizeof(drm_radeon_indirect_t)); + + RADEONCPFlushIndirect(pScrn, 1); + info->accel_state->exaMarkerSynced = info->accel_state->exaSyncMarker; return TRUE; diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index c75c6a5..93ae71b 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -556,8 +556,6 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op, if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE)) return FALSE; - RADEON_SWITCH_TO_3D(); - if (!info->accel_state->XInited3D) RADEONInit3DEngine(pScrn); @@ -857,8 +855,6 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE)) return FALSE; - RADEON_SWITCH_TO_3D(); - if (!info->accel_state->XInited3D) RADEONInit3DEngine(pScrn); @@ -1221,8 +1217,6 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture, if (!RADEONSetupSourceTile(pSrcPicture, pSrc, TRUE, FALSE)) return FALSE; - RADEON_SWITCH_TO_3D(); - if (!info->accel_state->XInited3D) RADEONInit3DEngine(pScrn); @@ -2134,6 +2128,11 @@ static void FUNC_NAME(RadeonDoneComposite)(PixmapPtr pDst) OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_3D_IDLECLEAN); FINISH_ACCEL(); +#ifdef ACCEL_CP + if (info->directRenderingEnabled) + RADEONCPFlushIndirect(pScrn, 1); +#endif + LEAVE_DRAW(0); } diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index 7a4ffc2..44d653f 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -124,25 +124,20 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv dstyoff = 0; #endif -#ifdef USE_EXA - if (info->useEXA) { - RADEON_SWITCH_TO_3D(); - } else -#endif - { - BEGIN_ACCEL(2); - if (IS_R300_3D || IS_R500_3D) - OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D); - else - OUT_ACCEL_REG(RADEON_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH); - /* We must wait for 3d to idle, in case source was just written as a dest. */ - OUT_ACCEL_REG(RADEON_WAIT_UNTIL, - RADEON_WAIT_HOST_IDLECLEAN | - RADEON_WAIT_2D_IDLECLEAN | - RADEON_WAIT_3D_IDLECLEAN | + if (!info->useEXA) { + BEGIN_ACCEL(2); + if (IS_R300_3D || IS_R500_3D) + OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D); + else + OUT_ACCEL_REG(RADEON_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH); + /* We must wait for 3d to idle, in case source was just written as a dest. */ + OUT_ACCEL_REG(RADEON_WAIT_UNTIL, + RADEON_WAIT_HOST_IDLECLEAN | + RADEON_WAIT_2D_IDLECLEAN | + RADEON_WAIT_3D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE); - FINISH_ACCEL(); - } + FINISH_ACCEL(); + } if (!info->accel_state->XInited3D) RADEONInit3DEngine(pScrn); @@ -1248,6 +1243,11 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_3D_IDLECLEAN); FINISH_ACCEL(); +#ifdef XF86DRI + if (info->directRenderingEnabled) + RADEONCPFlushIndirect(pScrn, 1); +#endif + DamageDamageRegion(pPriv->pDraw, &pPriv->clip); }