From: Chad Versace Date: Thu, 26 Jul 2012 23:47:35 +0000 (-0700) Subject: i965: Mark needed downsamples for msaa winsys buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b56140b4bafcef8bea5ca67cb31023a533c3bd4;p=mesa.git i965: Mark needed downsamples for msaa winsys buffers 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 Reviewed-by: Paul Berry Signed-off-by: Chad Versace --- diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 700b0cfcf8a..53b72f6ef4d 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -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)); } diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 1069a6335fe..ccfc306cac6 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -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 diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index e6e64080bf2..3a610c244b1 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -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) { diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 72ed04d1212..6574f0faf22 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -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);