i965: Mark needed downsamples for msaa winsys buffers
authorChad Versace <chad.versace@linux.intel.com>
Thu, 26 Jul 2012 23:47:35 +0000 (16:47 -0700)
committerChad Versace <chad.versace@linux.intel.com>
Tue, 7 Aug 2012 16:30:33 +0000 (09:30 -0700)
Add function intel_renderbuffer_set_needs_downsample. It is a no-op
except on multisample winsys buffers shared with DRI2.

Mark the needed downsamples with the new function at two locations:
    - Immediately after drawing is complete.
    - After blitting.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_fbo.h

index 700b0cfcf8a5c0d8104bd5e94b43af67c2a66d80..53b72f6ef4d2eed202f6b89fccd0237dfbf8b8c6 100644 (file)
@@ -163,8 +163,8 @@ do_blorp_blit(struct intel_context *intel, GLbitfield buffer_bit,
                            srcX0, srcY0, dstX0, dstY0, dstX1, dstY1,
                            mirror_x, mirror_y);
 
-   /* Mark the dst buffer as needing a HiZ resolve if necessary. */
    intel_renderbuffer_set_needs_hiz_resolve(intel_renderbuffer(dst_rb));
+   intel_renderbuffer_set_needs_downsample(intel_renderbuffer(dst_rb));
 }
 
 
index 1069a6335fe6fb9a93bdd7f089ac239c84389e38..ccfc306cac622d09d33ff170be36d152284b54f3 100644 (file)
@@ -326,18 +326,28 @@ brw_predraw_resolve_buffers(struct brw_context *brw)
  * If the depth buffer was written to and if it has an accompanying HiZ
  * buffer, then mark that it needs a depth resolve.
  *
- * (In the future, this will also mark needed MSAA resolves).
+ * If the color buffer is a multisample window system buffer, then
+ * mark that it needs a downsample.
  */
 static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
 {
+   struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &brw->intel.ctx;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct intel_renderbuffer *depth_irb =
-        intel_get_renderbuffer(fb, BUFFER_DEPTH);
 
-   if (depth_irb && ctx->Depth.Mask) {
+   struct intel_renderbuffer *front_irb = NULL;
+   struct intel_renderbuffer *back_irb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
+   struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
+
+   if (intel->is_front_buffer_rendering)
+      front_irb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
+
+   if (front_irb)
+      intel_renderbuffer_set_needs_downsample(front_irb);
+   if (back_irb)
+      intel_renderbuffer_set_needs_downsample(back_irb);
+   if (depth_irb && ctx->Depth.Mask)
       intel_renderbuffer_set_needs_depth_resolve(depth_irb);
-   }
 }
 
 static int
index e6e64080bf216e59e2a1aeac3b87e898ea9f083f..3a610c244b1704723cd983c9c5f590a8dc005e6c 100644 (file)
@@ -881,6 +881,16 @@ intel_blit_framebuffer(struct gl_context *ctx,
                               mask, filter);
 }
 
+/**
+ * This is a no-op except on multisample buffers shared with DRI2.
+ */
+void
+intel_renderbuffer_set_needs_downsample(struct intel_renderbuffer *irb)
+{
+   if (irb->mt && irb->mt->singlesample_mt)
+      irb->mt->need_downsample = true;
+}
+
 void
 intel_renderbuffer_set_needs_hiz_resolve(struct intel_renderbuffer *irb)
 {
index 72ed04d1212520c326a3702508a5d62da47a5a5c..6574f0faf22628c73c6f9301c7624e75deb31030 100644 (file)
@@ -169,6 +169,9 @@ intel_renderbuffer_tile_offsets(struct intel_renderbuffer *irb,
 struct intel_region*
 intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex);
 
+void
+intel_renderbuffer_set_needs_downsample(struct intel_renderbuffer *irb);
+
 void
 intel_renderbuffer_set_needs_hiz_resolve(struct intel_renderbuffer *irb);