summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830.h3
-rw-r--r--src/i830_dri.c2
-rw-r--r--src/i830_driver.c42
-rw-r--r--src/i830_exa.c16
-rw-r--r--src/i830_render.c3
-rw-r--r--src/i915_render.c3
-rw-r--r--src/i915_video.c9
-rw-r--r--src/i965_render.c3
-rw-r--r--src/i965_video.c16
9 files changed, 36 insertions, 61 deletions
diff --git a/src/i830.h b/src/i830.h
index e4d50706..8947524f 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -307,7 +307,6 @@ typedef struct _I830Rec {
Rotation rotation;
void (*PointerMoved)(int, int, int);
CreateScreenResourcesProcPtr CreateScreenResources;
- int *used3D;
i830_memory *logical_context;
@@ -527,7 +526,7 @@ typedef struct _I830Rec {
CARD32 saveSWF[17];
CARD32 saveBLC_PWM_CTL;
- enum last_3d last_3d;
+ enum last_3d *last_3d;
/** Enables logging of debug output related to mode switching. */
Bool debug_modes;
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 4746be0c..6ec56cf9 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1196,7 +1196,7 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("i830DRISwapContext (in)\n");
- pI830->last_3d = LAST_3D_OTHER;
+ *pI830->last_3d = LAST_3D_OTHER;
if (!pScrn->vtSema)
return;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3133d775..7f1fe2cc 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2045,22 +2045,25 @@ I830InitFBManager(
return ret;
}
-/* Initialize the first context */
+/**
+ * Intialiazes the hardware for the 3D pipeline use in the 2D driver.
+ *
+ * Some state caching is performed to avoid redundant state emits. This
+ * function is also responsible for marking the state as clobbered for DRI
+ * clients.
+ */
void
IntelEmitInvarientState(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
CARD32 ctx_addr;
-#ifdef XF86DRI
- drmI830Sarea *sarea;
-#endif
- if (pI830->noAccel || !I830IsPrimary(pScrn))
+ if (pI830->noAccel)
return;
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
- sarea = DRIGetSAREAPrivate(pScrn->pScreen);
+ drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn->pScreen);
/* Mark that the X Server was the last holder of the context */
if (sarea)
@@ -2068,6 +2071,12 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
}
#endif
+ /* If we've emitted our state since the last clobber by another client,
+ * skip it.
+ */
+ if (*pI830->last_3d != LAST_3D_OTHER)
+ return;
+
ctx_addr = pI830->logical_context->offset;
assert((pI830->logical_context->offset & 2047) == 0);
{
@@ -2304,13 +2313,14 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->LpRing = xcalloc(1, sizeof(I830RingBuffer));
if (!pI830->overlayOn)
pI830->overlayOn = xalloc(sizeof(Bool));
- if (!pI830->used3D)
- pI830->used3D = xalloc(sizeof(int));
- if (!pI830->LpRing || !pI830->overlayOn || !pI830->used3D) {
+ if (!pI830->last_3d)
+ pI830->last_3d = xalloc(sizeof(enum last_3d));
+ if (!pI830->LpRing || !pI830->overlayOn || !pI830->last_3d) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not allocate primary data structures.\n");
return FALSE;
}
+ *pI830->last_3d = LAST_3D_OTHER;
*pI830->overlayOn = FALSE;
if (pI830->entityPrivate)
pI830->entityPrivate->XvInUse = -1;
@@ -2320,7 +2330,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->LpRing = pI8301->LpRing;
pI830->overlay_regs = pI8301->overlay_regs;
pI830->overlayOn = pI8301->overlayOn;
- pI830->used3D = pI8301->used3D;
+ pI830->last_3d = pI8301->last_3d;
}
/* Need MMIO mapped to do GTT lookups during memory allocation. */
@@ -3012,15 +3022,11 @@ I830EnterVT(int scrnIndex, int flags)
*/
i830SetHotkeyControl(pScrn, HOTKEY_DRIVER_NOTIFY);
- /* Needed for rotation */
- IntelEmitInvarientState(pScrn);
-
if (pI830->checkDevices)
pI830->devicesTimer = TimerSet(NULL, 0, 1000, I830CheckDevicesTimer, pScrn);
- /* Force invarient 3D state to be emitted */
- *pI830->used3D = 1<<31;
- pI830->last_3d = LAST_3D_OTHER;
+ /* Mark 3D state as being clobbered */
+ *pI830->last_3d = LAST_3D_OTHER;
return TRUE;
}
@@ -3111,8 +3117,8 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
pI830->LpRing = NULL;
xfree(pI830->overlayOn);
pI830->overlayOn = NULL;
- xfree(pI830->used3D);
- pI830->used3D = NULL;
+ xfree(pI830->last_3d);
+ pI830->last_3d = NULL;
}
pScrn->PointerMoved = pI830->PointerMoved;
diff --git a/src/i830_exa.c b/src/i830_exa.c
index bb60c0ac..22618dcd 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -270,22 +270,6 @@ I830EXADoneCopy(PixmapPtr pDstPixmap)
#endif
}
-void
-i830_enter_render(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-#ifdef XF86DRI
- if (pI830->directRenderingEnabled) {
- drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
- pSAREAPriv->ctxOwner = DRIGetContext(pScrn->pScreen);
- }
-#endif
- if (pI830->last_3d != LAST_3D_RENDER) {
- i830WaitSync(pScrn);
- pI830->last_3d = LAST_3D_RENDER;
- }
-}
-
#define xFixedToFloat(val) \
((float)xFixedToInt(val) + ((float)xFixedFrac(val) / 65536.0))
diff --git a/src/i830_render.c b/src/i830_render.c
index 957953e7..90b884fa 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -400,7 +400,8 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
I830Ptr pI830 = I830PTR(pScrn);
CARD32 dst_format, dst_offset, dst_pitch;
- i830_enter_render(pScrn);
+ IntelEmitInvarientState(pScrn);
+ *pI830->last_3d = LAST_3D_RENDER;
i830_get_dest_format(pDstPicture, &dst_format);
dst_offset = intel_get_pixmap_offset(pDst);
diff --git a/src/i915_render.c b/src/i915_render.c
index d5a8579a..b2dacfe7 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -315,7 +315,8 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
CARD32 dst_format, dst_offset, dst_pitch;
CARD32 blendctl;
- i830_enter_render(pScrn);
+ IntelEmitInvarientState(pScrn);
+ *pI830->last_3d = LAST_3D_RENDER;
i915_get_dest_format(pDstPicture, &dst_format);
dst_offset = intel_get_pixmap_offset(pDst);
diff --git a/src/i915_video.c b/src/i915_video.c
index e4e0f1a4..d02f770a 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -75,13 +75,8 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
break;
}
- /* Tell the rotation code that we have stomped its invariant state by
- * setting a high bit. We don't use any invariant 3D state for video, so we
- * don't have to worry about it ourselves.
- */
- *pI830->used3D |= 1 << 30;
-
- pI830->last_3d = LAST_3D_VIDEO;
+ IntelEmitInvarientState(pScrn);
+ *pI830->last_3d = LAST_3D_VIDEO;
BEGIN_LP_RING(20);
diff --git a/src/i965_render.c b/src/i965_render.c
index 956baf36..e69a9399 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -404,7 +404,8 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
CARD32 dst_format, dst_offset, dst_pitch;
Bool rotation_program = FALSE;
- i830_enter_render(pScrn);
+ IntelEmitInvarientState(pScrn);
+ *pI830->last_3d = LAST_3D_RENDER;
src_offset = intel_get_pixmap_offset(pSrc);
src_pitch = intel_get_pixmap_pitch(pSrc);
diff --git a/src/i965_video.c b/src/i965_video.c
index 17d20061..30842336 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -200,20 +200,8 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
assert((id == FOURCC_UYVY) || (id == FOURCC_YUY2));
- /* Tell the rotation code that we have stomped its invariant state by
- * setting a high bit. We don't use any invariant 3D state for video, so
- * we don't have to worry about it ourselves.
- */
- *pI830->used3D |= 1 << 30;
-
-#ifdef XF86DRI
- /* Tell the DRI that we're smashing its state. */
- if (pI830->directRenderingEnabled) {
- drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
-
- pSAREAPriv->ctxOwner = DRIGetContext(pScrn->pScreen);
- }
-#endif /* XF86DRI */
+ IntelEmitInvarientState(pScrn);
+ *pI830->last_3d = LAST_3D_VIDEO;
next_offset = 0;