i965/gen7: Add a prepare_depthbuffer function.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 23 May 2011 21:40:51 +0000 (14:40 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 8 Jun 2011 21:50:38 +0000 (14:50 -0700)
We need to call add_validated_bo to do proper aperture space accounting.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/gen7_misc_state.c

index 0364b61b75bc829dcf55689f0b52db1eb04048ba..024021185ac7ec5645ecc7ef8453cada512c0bff 100644 (file)
@@ -56,6 +56,20 @@ gen7_depth_format(struct brw_context *brw)
    return 0;
 }
 
+static void prepare_depthbuffer(struct brw_context *brw)
+{
+   struct intel_context *intel = &brw->intel;
+   struct gl_context *ctx = &intel->ctx;
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
+   struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
+
+   if (drb)
+      brw_add_validated_bo(brw, drb->region->buffer);
+   if (srb)
+      brw_add_validated_bo(brw, srb->region->buffer);
+}
+
 static void emit_depthbuffer(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
@@ -138,5 +152,6 @@ const struct brw_tracked_state gen7_depthbuffer = {
       .brw = BRW_NEW_BATCH,
       .cache = 0,
    },
+   .prepare = prepare_depthbuffer,
    .emit = emit_depthbuffer,
 };