Mesa (master): intel: Downsample on DRI2 flush

Chad Versace chadversary at kemper.freedesktop.org
Tue Aug 7 16:31:17 UTC 2012


Module: Mesa
Branch: master
Commit: 61fd6847827048ce9b01b1d164111472ad8bf593
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=61fd6847827048ce9b01b1d164111472ad8bf593

Author: Chad Versace <chad.versace at linux.intel.com>
Date:   Thu Jul 12 13:01:26 2012 -0700

intel: Downsample on DRI2 flush

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>

---

 src/mesa/drivers/dri/intel/intel_screen.c |   31 +++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 9aca463..a3c0140 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -150,6 +150,36 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
 };
 
 static void
+intel_downsample_for_dri2_flush(struct intel_context *intel,
+                                __DRIdrawable *drawable)
+{
+   if (intel->gen < 6) {
+      /* MSAA is not supported, so don't waste time checking for
+       * a multisample buffer.
+       */
+      return;
+   }
+
+   struct gl_framebuffer *fb = drawable->driverPrivate;
+   struct intel_renderbuffer *rb;
+
+   /* Usually, only the back buffer will need to be downsampled. However,
+    * the front buffer will also need it if the user has rendered into it.
+    */
+   static const gl_buffer_index buffers[2] = {
+         BUFFER_BACK_LEFT,
+         BUFFER_FRONT_LEFT,
+   };
+
+   for (int i = 0; i < 2; ++i) {
+      rb = intel_get_renderbuffer(fb, buffers[i]);
+      if (rb == NULL || rb->mt == NULL)
+         continue;
+      intel_miptree_downsample(intel, rb->mt);
+   }
+}
+
+static void
 intelDRI2Flush(__DRIdrawable *drawable)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -160,6 +190,7 @@ intelDRI2Flush(__DRIdrawable *drawable)
    if (intel->gen < 4)
       INTEL_FIREVERTICES(intel);
 
+   intel_downsample_for_dri2_flush(intel, drawable);
    intel->need_throttle = true;
 
    if (intel->batch.used)




More information about the mesa-commit mailing list