summaryrefslogtreecommitdiff
path: root/src/radeon_render.c
diff options
context:
space:
mode:
authorKevin E Martin <kem@kem.org>2004-08-12 05:00:22 +0000
committerKevin E Martin <kem@kem.org>2004-08-12 05:00:22 +0000
commit955f2b89f94aaa20b5eafd045b01e3eeef3d29ad (patch)
tree6a921cc5fc31e85500dd00d03852a3af6c0f3706 /src/radeon_render.c
parent8f3ea53f26493a5f02410297a587d1d95c067094 (diff)
Fix context switching on Radeons and build problem when XF86DRI is notXORG-6_7_99_2
defined (Bug #922, Eric Anholt).
Diffstat (limited to 'src/radeon_render.c')
-rw-r--r--src/radeon_render.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/radeon_render.c b/src/radeon_render.c
index 073ca665..e0803716 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;