mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-24 01:24:43 +00:00
Fix context switching on Radeons and build problem when XF86DRI is not
defined (Bug #922, Eric Anholt).
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -313,12 +313,11 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn)
|
||||
OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000);
|
||||
OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff);
|
||||
|
||||
#ifdef RENDER
|
||||
if (info->RenderAccel)
|
||||
RADEONInit3DEngineForRender(pScrn);
|
||||
#endif
|
||||
|
||||
RADEONWaitForIdleMMIO(pScrn);
|
||||
|
||||
#ifdef RENDER
|
||||
info->RenderInited3D = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the acceleration hardware */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user