summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/radeon.h2
-rw-r--r--src/radeon_accel.c7
-rw-r--r--src/radeon_dri.c8
-rw-r--r--src/radeon_render.c36
4 files changed, 36 insertions, 17 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 1918d89..523d2b7 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -553,6 +553,7 @@ typedef struct {
/* Render */
Bool RenderAccel;
+ Bool RenderInited3D;
FBLinearPtr RenderTex;
void (*RenderCallback)(ScrnInfoPtr);
Time RenderTimeout;
@@ -626,7 +627,6 @@ extern void RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer);
extern Bool RADEONAccelInit(ScreenPtr pScreen);
extern void RADEONAccelInitMMIO(ScreenPtr pScreen, XAAInfoRecPtr a);
-extern void RADEONInit3DEngineForRender(ScrnInfoPtr pScrn);
extern void RADEONEngineInit(ScrnInfoPtr pScrn);
extern Bool RADEONCursorInit(ScreenPtr pScreen);
extern Bool RADEONDGAInit(ScreenPtr pScreen);
diff --git a/src/radeon_accel.c b/src/radeon_accel.c
index 0799033..62ce879 100644
--- a/src/radeon_accel.c
+++ b/src/radeon_accel.c
@@ -313,12 +313,11 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn)
OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000);
OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff);
+ RADEONWaitForIdleMMIO(pScrn);
+
#ifdef RENDER
- if (info->RenderAccel)
- RADEONInit3DEngineForRender(pScrn);
+ info->RenderInited3D = FALSE;
#endif
-
- RADEONWaitForIdleMMIO(pScrn);
}
/* Initialize the acceleration hardware */
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index f585ca2..c32ab18 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -343,9 +343,17 @@ static void RADEONEnterServer(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
+#ifdef RENDER
+ RADEONSAREAPrivPtr pSAREAPriv;
+#endif
if (info->accel) info->accel->NeedToSync = TRUE;
+#ifdef RENDER
+ pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
+ if (pSAREAPriv->ctxOwner != DRIGetContext(pScrn->pScreen))
+ info->RenderInited3D = FALSE;
+#endif
}
/* Called when the X server goes to sleep to allow the X server's
diff --git a/src/radeon_render.c b/src/radeon_render.c
index 073ca66..e080371 100644
--- a/src/radeon_render.c
+++ b/src/radeon_render.c
@@ -225,16 +225,22 @@ ATILog2(int val)
return bits - 1;
}
-void RADEONInit3DEngineForRender(ScrnInfoPtr pScrn)
+static void RadeonInit3DEngine(ScrnInfoPtr pScrn)
{
-#ifdef XF86DRI
RADEONInfoPtr info = RADEONPTR (pScrn);
- if (info->CPStarted)
+#ifdef XF86DRI
+ if (info->directRenderingEnabled) {
+ RADEONSAREAPrivPtr pSAREAPriv;
+
+ pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
+ pSAREAPriv->ctxOwner = DRIGetContext(pScrn->pScreen);
RadeonInit3DEngineCP(pScrn);
- else
+ } else
#endif
RadeonInit3DEngineMMIO(pScrn);
+
+ info->RenderInited3D = TRUE;
}
static void
@@ -433,11 +439,8 @@ static Bool FUNC_NAME(R100SetupTexture)(
i = height;
dst = (CARD8*)(info->FB + offset);
- if (info->accel->NeedToSync) {
+ if (info->accel->NeedToSync)
info->accel->Sync(pScrn);
- if (info->CPStarted)
- RADEONInit3DEngineForRender(pScrn);
- }
while(i--) {
memcpy(dst, src, width * tex_bytepp);
@@ -490,6 +493,9 @@ FUNC_NAME(R100SetupForCPUToScreenAlphaTexture) (
if (blend_cntl == 0)
return FALSE;
+ if (!info->RenderInited3D)
+ RadeonInit3DEngine(pScrn);
+
if (!FUNC_NAME(R100SetupTexture)(pScrn, maskFormat, alphaPtr, alphaPitch,
width, height, flags))
return FALSE;
@@ -539,6 +545,9 @@ FUNC_NAME(R100SetupForCPUToScreenTexture) (
if (blend_cntl == 0)
return FALSE;
+ if (!info->RenderInited3D)
+ RadeonInit3DEngine(pScrn);
+
if (!FUNC_NAME(R100SetupTexture)(pScrn, srcFormat, texPtr, texPitch, width,
height, flags))
return FALSE;
@@ -741,11 +750,8 @@ static Bool FUNC_NAME(R200SetupTexture)(
/* Upload texture to card. Should use ImageWrite to avoid syncing. */
i = height;
dst = (CARD8*)(info->FB + offset);
- if (info->accel->NeedToSync) {
+ if (info->accel->NeedToSync)
info->accel->Sync(pScrn);
- if (info->CPStarted)
- RADEONInit3DEngineForRender(pScrn);
- }
while(i--) {
memcpy(dst, src, width * tex_bytepp);
@@ -799,6 +805,9 @@ FUNC_NAME(R200SetupForCPUToScreenAlphaTexture) (
if (blend_cntl == 0)
return FALSE;
+ if (!info->RenderInited3D)
+ RadeonInit3DEngine(pScrn);
+
if (!FUNC_NAME(R200SetupTexture)(pScrn, maskFormat, alphaPtr, alphaPitch,
width, height, flags))
return FALSE;
@@ -849,6 +858,9 @@ FUNC_NAME(R200SetupForCPUToScreenTexture) (
if (blend_cntl == 0)
return FALSE;
+ if (!info->RenderInited3D)
+ RadeonInit3DEngine(pScrn);
+
if (!FUNC_NAME(R200SetupTexture)(pScrn, srcFormat, texPtr, texPitch, width,
height, flags))
return FALSE;