aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-12-28 11:44:08 -0800
committerEric Anholt <[email protected]>2013-08-30 11:30:44 -0700
commit313f2bc32b86047928b1bae4d4d824e787638008 (patch)
tree8835b0bd8367a92cc35c63b3aeba82003ee3877e /src/mesa/drivers/dri/i965
parentbbdc83bca9cd0a72f4729dd15f0054b3b9b902cf (diff)
intel: Add support for the new flush_with_flags extension.
This gives us more information about why we're flushing that we can use for handling our throttling. v2 (Kenneth Graunke): Rebase on latest master, add missing FLUSH_VERTICES and FLUSH_CURRENT, which fixes a regression in Glean's polygonOffset test. v3 (anholt): Drop FLUSH_CURRENT -- FLUSH_VERTICES is what we need, which is "get any queued prims out of VBO and into the driver", not "update ctx->Current so we can read it with the CPU." Also drop batch->used check, which intel_batchbuffer_flush() does anyway. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 9b3c31a5e71..0580d6f4e78 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -151,29 +151,55 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
};
static void
-intelDRI2Flush(__DRIdrawable *drawable)
+intel_dri2_flush_with_flags(__DRIcontext *cPriv,
+ __DRIdrawable *dPriv,
+ unsigned flags,
+ enum __DRI2throttleReason reason)
{
- GET_CURRENT_CONTEXT(ctx);
- struct brw_context *brw = brw_context(ctx);
- if (brw == NULL)
+ struct brw_context *brw = cPriv->driverPrivate;
+
+ if (!brw)
return;
- intel_resolve_for_dri2_flush(brw, drawable);
- brw->need_throttle = true;
+ struct gl_context *ctx = &brw->ctx;
+
+ FLUSH_VERTICES(ctx, 0);
- if (brw->batch.used)
- intel_batchbuffer_flush(brw);
+ if (flags & __DRI2_FLUSH_DRAWABLE)
+ intel_resolve_for_dri2_flush(brw, dPriv);
+
+ if (reason == __DRI2_THROTTLE_SWAPBUFFER ||
+ reason == __DRI2_THROTTLE_FLUSHFRONT) {
+ brw->need_throttle = true;
+ }
+
+ intel_batchbuffer_flush(brw);
if (INTEL_DEBUG & DEBUG_AUB) {
aub_dump_bmp(ctx);
}
}
+/**
+ * Provides compatibility with loaders that only support the older (version
+ * 1-3) flush interface.
+ *
+ * That includes libGL up to Mesa 9.0, and the X Server at least up to 1.13.
+ */
+static void
+intel_dri2_flush(__DRIdrawable *drawable)
+{
+ intel_dri2_flush_with_flags(drawable->driContextPriv, drawable,
+ __DRI2_FLUSH_DRAWABLE,
+ __DRI2_THROTTLE_SWAPBUFFER);
+}
+
static const struct __DRI2flushExtensionRec intelFlushExtension = {
- .base = { __DRI2_FLUSH, 3 },
+ .base = { __DRI2_FLUSH, 4 },
- .flush = intelDRI2Flush,
+ .flush = intel_dri2_flush,
.invalidate = dri2InvalidateDrawable,
+ .flush_with_flags = intel_dri2_flush_with_flags,
};
static struct intel_image_format intel_image_formats[] = {