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 <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Eric Anholt 2012-12-28 11:44:08 -08:00
parent bbdc83bca9
commit 313f2bc32b

View file

@ -151,17 +151,28 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
}; };
static void 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 = cPriv->driverPrivate;
struct brw_context *brw = brw_context(ctx);
if (brw == NULL) if (!brw)
return; return;
intel_resolve_for_dri2_flush(brw, drawable); struct gl_context *ctx = &brw->ctx;
brw->need_throttle = true;
FLUSH_VERTICES(ctx, 0);
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;
}
if (brw->batch.used)
intel_batchbuffer_flush(brw); intel_batchbuffer_flush(brw);
if (INTEL_DEBUG & DEBUG_AUB) { if (INTEL_DEBUG & DEBUG_AUB) {
@ -169,11 +180,26 @@ intelDRI2Flush(__DRIdrawable *drawable)
} }
} }
static const struct __DRI2flushExtensionRec intelFlushExtension = { /**
.base = { __DRI2_FLUSH, 3 }, * 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);
}
.flush = intelDRI2Flush, static const struct __DRI2flushExtensionRec intelFlushExtension = {
.base = { __DRI2_FLUSH, 4 },
.flush = intel_dri2_flush,
.invalidate = dri2InvalidateDrawable, .invalidate = dri2InvalidateDrawable,
.flush_with_flags = intel_dri2_flush_with_flags,
}; };
static struct intel_image_format intel_image_formats[] = { static struct intel_image_format intel_image_formats[] = {