From db83dc619c96c35a039f2d8a32e1a179c0f00d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Tue, 26 Jul 2016 22:50:50 +0300 Subject: [PATCH] i915: Implement __DRI2_FLUSH version 4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DRI3 needs version 4 of __DRI2_FLUSH. Straight up port of i965 commit 313f2bc32b86 ("intel: Add support for the new flush_with_flags extension."). Signed-off-by: Ville Syrjälä Reviewed-by: Adam Jackson Reviewed-by: Emil Velikov Part-of: --- src/mesa/drivers/dri/i915/intel_screen.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 7d86a660001..6135357c2a0 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -153,16 +153,21 @@ static const __DRItexBufferExtension intelTexBufferExtension = { }; static void -intelDRI2Flush(__DRIdrawable *drawable) +intelDRI2FlushWithFlags(__DRIcontext *context, + __DRIdrawable *drawable, + unsigned flags, + enum __DRI2throttleReason reason) { - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); + struct intel_context *intel = context->driverPrivate; if (intel == NULL) return; + struct gl_context *ctx = &intel->ctx; INTEL_FIREVERTICES(intel); - intel->need_throttle = true; + if (reason == __DRI2_THROTTLE_SWAPBUFFER || + reason == __DRI2_THROTTLE_FLUSHFRONT) + intel->need_throttle = true; if (intel->batch.used) intel_batchbuffer_flush(intel); @@ -172,11 +177,20 @@ intelDRI2Flush(__DRIdrawable *drawable) } } +static void +intelDRI2Flush(__DRIdrawable *drawable) +{ + intelDRI2FlushWithFlags(drawable->driContextPriv, drawable, + __DRI2_FLUSH_DRAWABLE, + __DRI2_THROTTLE_SWAPBUFFER); +} + static const struct __DRI2flushExtensionRec intelFlushExtension = { - .base = { __DRI2_FLUSH, 3 }, + .base = { __DRI2_FLUSH, 4 }, .flush = intelDRI2Flush, .invalidate = dri2InvalidateDrawable, + .flush_with_flags = intelDRI2FlushWithFlags, }; static struct intel_image_format intel_image_formats[] = {