Mesa (main): i915: Implement __DRI2_FLUSH version 4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 5 00:32:44 UTC 2021


Module: Mesa
Branch: main
Commit: db83dc619c96c35a039f2d8a32e1a179c0f00d64
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=db83dc619c96c35a039f2d8a32e1a179c0f00d64

Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Tue Jul 26 22:50:50 2016 +0300

i915: Implement __DRI2_FLUSH version 4

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ä <ville.syrjala at linux.intel.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9734>

---

 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[] = {



More information about the mesa-commit mailing list