summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-04-20 15:46:11 -0700
committerEric Anholt <eric@anholt.net>2009-04-21 15:28:55 -0700
commit928a37041defcca6f57f9452ba62e67524cb4510 (patch)
tree10d8fcc888b59e198aae69499416580c113a2c4e /src
parent1fc93ee184ceefaea9528bb46ae82884c44d9b36 (diff)
Replace a bunch of #ifdef debug flushing/syncing with a single function.
This removes it from a callsite where it would have just resulted in a fatalerror.
Diffstat (limited to 'src')
-rw-r--r--src/i830.h13
-rw-r--r--src/i830_accel.c11
-rw-r--r--src/i830_exa.c30
-rw-r--r--src/i830_render.c10
-rw-r--r--src/i965_render.c10
5 files changed, 30 insertions, 44 deletions
diff --git a/src/i830.h b/src/i830.h
index f3bf2507..49e08ce4 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -124,6 +124,9 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
#endif
#endif
+#define ALWAYS_SYNC 0
+#define ALWAYS_FLUSH 0
+
typedef struct _I830Rec *I830Ptr;
typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr,
@@ -1062,4 +1065,14 @@ enum {
INTEL_CREATE_PIXMAP_TILING_Y,
};
+#if (ALWAYS_FLUSH | ALWAYS_SYNC)
+void
+i830_debug_sync(ScrnInfoPtr scrn);
+#else
+static inline void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+}
+#endif
+
#endif /* _I830_H_ */
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 9f5bcb55..67f264c2 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -271,6 +271,17 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
return TRUE;
}
+#if (ALWAYS_SYNC || ALWAYS_FLUSH)
+void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+ if (ALWAYS_SYNC)
+ I830Sync(scrn);
+ else
+ intel_batch_flush(scrn, FALSE);
+}
+#endif
+
/* The following function sets up the supported acceleration. Call it
* from the FbInit() function in the SVGA driver, or before ScreenInit
* in a monolithic server.
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 50775409..5199cefc 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -39,9 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string.h>
#include <sys/mman.h>
-#define ALWAYS_SYNC 0
-#define ALWAYS_FLUSH 0
-
const int I830CopyROP[16] =
{
ROP_0, /* GXclear */
@@ -289,16 +286,9 @@ i830_uxa_solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
static void
i830_uxa_done_solid(PixmapPtr pPixmap)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
/**
@@ -401,16 +391,9 @@ i830_uxa_copy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
static void
i830_uxa_done_copy(PixmapPtr pDstPixmap)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
@@ -422,16 +405,9 @@ i830_uxa_done_copy(PixmapPtr pDstPixmap)
void
i830_done_composite(PixmapPtr pDst)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
#define xFixedToFloat(val) \
diff --git a/src/i830_render.c b/src/i830_render.c
index 5696fa3d..4ca4e338 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -345,10 +345,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
ADVANCE_BATCH();
}
-#ifdef I830DEBUG
- ErrorF("try to sync to show any errors...");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
return TRUE;
}
@@ -569,10 +566,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
ADVANCE_BATCH();
}
-#ifdef I830DEBUG
- Error("try to sync to show any errors...");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
return TRUE;
}
diff --git a/src/i965_render.c b/src/i965_render.c
index 5160d95f..c3df9d21 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1216,11 +1216,6 @@ i965_emit_composite_state(ScrnInfoPtr pScrn)
ADVANCE_BATCH();
}
-
-#ifdef I830DEBUG
- ErrorF("try to sync to show any errors...\n");
- I830Sync(pScrn);
-#endif
}
/**
@@ -1605,10 +1600,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
intel_batch_end_atomic(pScrn);
-#ifdef I830DEBUG
- ErrorF("sync after 3dprimitive\n");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
}
void