summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_draw.c
diff options
context:
space:
mode:
authorTopi Pohjolainen <topi.pohjolainen@intel.com>2016-04-19 09:01:10 +0300
committerTopi Pohjolainen <topi.pohjolainen@intel.com>2016-05-12 19:49:26 +0300
commit84066ebd6330b50e7628bdb0a40763e10e5f12d7 (patch)
treeb27ef3dff0cb021dd29e42987ae29aeefd3635bc /src/mesa/drivers/dri/i965/brw_draw.c
parent1ca02b6ebb424489d7c16be26a9f96359bbce25a (diff)
downloadexternal_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.zip
external_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.tar.gz
external_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.tar.bz2
i965: Deferred allocation of mcs for lossless compressed
Until now mcs was associated to single sampled buffers only for fast clear purposes and it was therefore the responsibility of the clear logic to allocate the aux buffer when needed. Now that normal 3D render or blorp blit may render with mcs enabled also, they need to prepare the mcs just as well. v2: Do not enable for scanout buffers v3 (Ben): - Fix typo in commit message. - Check for gen < 9 and return early in brw_predraw_set_aux_buffers() - Check for gen < 9 and return early in intel_miptree_prepare_mcs() v4: Check for msaa_layput and number of samples to determine if lossless compression is to used. Otherwise one cannot distuingish between fast clear with and without compression. Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_draw.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 9d034cf..dcbb681 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -391,6 +391,25 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
}
}
+static void
+brw_predraw_set_aux_buffers(struct brw_context *brw)
+{
+ if (brw->gen < 9)
+ return;
+
+ struct gl_context *ctx = &brw->ctx;
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ struct intel_renderbuffer *irb =
+ intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+ if (irb) {
+ intel_miptree_prepare_mcs(brw, irb->mt);
+ }
+ }
+}
+
/* May fail if out of video memory for texture or vbo upload, or on
* fallback conditions.
*/
@@ -438,6 +457,7 @@ brw_try_draw_prims(struct gl_context *ctx,
_mesa_fls(ctx->VertexProgram._Current->Base.SamplersUsed);
intel_prepare_render(brw);
+ brw_predraw_set_aux_buffers(brw);
/* This workaround has to happen outside of brw_upload_render_state()
* because it may flush the batchbuffer for a blit, affecting the state