summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-04-08 13:38:48 +0100
committerOwain G. Ainsworth <oga@openbsd.org>2011-05-30 00:25:21 +0100
commitc546e88540290d9fcea5b49f2f5f4c1ab897b13f (patch)
treeff0907cccaa300b26ad9f3ace493537343976141
parentd5e0fa072c5848549297137aada2bf86e4d7cde7 (diff)
intel: Restore manual flush for old kernels
Daniel Vetter pointed out that the automagic flush by the kernel for the busy-ioctl was only introduced upstream in 2.6.37. So we still need to manually emit a flush on old kernels. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (cherry picked from commit 97e9557619e58ef769eb7cbf1a03fbd52be7f2ed) Conflicts: src/intel_driver.c
-rw-r--r--src/intel.h2
-rw-r--r--src/intel_batchbuffer.c9
-rw-r--r--src/intel_batchbuffer.h2
-rw-r--r--src/intel_driver.c21
-rw-r--r--src/intel_uxa.c13
5 files changed, 46 insertions, 1 deletions
diff --git a/src/intel.h b/src/intel.h
index a127460a..de4809ab 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -682,6 +682,8 @@ typedef struct intel_screen_private {
Bool force_fallback;
Bool can_blt;
+ Bool has_kernel_flush;
+ Bool needs_flush;
Bool use_shadow;
/* Broken-out options. */
diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index 53d3dccc..e0129489 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -175,6 +175,13 @@ void intel_batch_emit_flush(ScrnInfoPtr scrn)
intel_batch_do_flush(scrn);
}
+static Bool intel_batch_needs_flush(intel_screen_private *intel)
+{
+ ScreenPtr screen = intel->scrn->pScreen;
+ PixmapPtr pixmap = screen->GetScreenPixmap(screen);
+ return intel_get_pixmap_private(pixmap)->batch_write;
+}
+
void intel_batch_submit(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -235,6 +242,8 @@ void intel_batch_submit(ScrnInfoPtr scrn)
}
}
+ intel->needs_flush |= intel_batch_needs_flush(intel);
+
while (!list_is_empty(&intel->batch_pixmaps)) {
struct intel_pixmap *entry;
diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index 3022f254..6cba76dc 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -137,6 +137,8 @@ intel_batch_mark_pixmap_domains(intel_screen_private *intel,
priv->batch_write |= write_domain != 0;
priv->busy = 1;
+
+ intel->needs_flush |= write_domain != 0;
}
static inline void
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 6218441f..f52f94de 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -1291,6 +1291,23 @@ static void I830XvInit(ScrnInfoPtr scrn)
intel->colorKey);
}
+static Bool has_kernel_flush(struct intel_screen_private *intel)
+{
+ drm_i915_getparam_t gp;
+ int value;
+
+ /* The BLT ring was introduced at the same time as the
+ * automatic flush for the busy-ioctl.
+ */
+
+ gp.value = &value;
+ gp.param = I915_PARAM_HAS_BLT;
+ if (drmIoctl(intel->drmSubFD, DRM_IOCTL_I915_GETPARAM, &gp))
+ return FALSE;
+
+ return value;
+}
+
static Bool can_accelerate_blt(struct intel_screen_private *intel)
{
if (0 && (IS_I830(intel) || IS_845G(intel))) {
@@ -2245,6 +2262,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
intel->force_fallback = FALSE;
intel->can_blt = can_accelerate_blt(intel);
+#if 0 /* XXX oga */
+ intel->has_kernel_flush = has_kernel_flush(intel);
+#endif
+ intel->has_kernel_flush = TRUE;
intel->use_shadow = !intel->can_blt;
/* Enable tiling by default */
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 1ae1f303..29b19619 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -936,7 +936,18 @@ static Bool intel_uxa_get_image(PixmapPtr pixmap,
static void intel_flush_rendering(intel_screen_private *intel)
{
- drm_intel_bo_busy(intel->front_buffer);
+ if (intel->needs_flush == 0)
+ return;
+
+ if (intel->has_kernel_flush) {
+ intel_batch_submit(intel->scrn);
+ drm_intel_bo_busy(intel->front_buffer);
+ } else {
+ intel_batch_emit_flush(intel->scrn);
+ intel_batch_submit(intel->scrn);
+ }
+
+ intel->needs_flush = 0;
}
void intel_uxa_block_handler(intel_screen_private *intel)