i965: Remove the forced lack of caching for renderbuffer surface state.
authorEric Anholt <eric@anholt.net>
Wed, 6 May 2009 17:51:58 +0000 (10:51 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 6 May 2009 17:54:32 +0000 (10:54 -0700)
This snuck in with the multi-draw-buffers commit, and is a major penalty
to performance.  It doesn't appear to be required, as the only dependency
the surface BO has is on the state key (and if there's some other dependency,
it should just be in the key).

This brings openarena performance up to almost 2% faster than Mesa 7.4.

src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index f2d9541e518beb25e80c65998625b6490e2e8f8e..c49a5f6b4ec502b385d69dded35e8dd9c16f7e78 100644 (file)
@@ -505,7 +505,7 @@ const struct brw_tracked_state brw_wm_constant_surface = {
 static void
 brw_update_renderbuffer_surface(struct brw_context *brw,
                                struct gl_renderbuffer *rb,
-                               unsigned int unit, GLboolean cached)
+                               unsigned int unit)
 {
    GLcontext *ctx = &brw->intel.ctx;
    dri_bo *region_bo = NULL;
@@ -565,13 +565,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
                      ctx->Color.BlendEnabled);
 
    dri_bo_unreference(brw->wm.surf_bo[unit]);
-   brw->wm.surf_bo[unit] = NULL;
-   if (cached) 
-       brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
-                                                BRW_SS_SURFACE,
-                                                &key, sizeof(key),
-                                                &region_bo, 1,
-                                                NULL);
+   brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
+                                           BRW_SS_SURFACE,
+                                           &key, sizeof(key),
+                                           &region_bo, 1,
+                                           NULL);
 
    if (brw->wm.surf_bo[unit] == NULL) {
       struct brw_surface_state surf;
@@ -682,11 +680,10 @@ static void prepare_wm_surfaces(struct brw_context *brw )
       for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
          brw_update_renderbuffer_surface(brw,
                                         ctx->DrawBuffer->_ColorDrawBuffers[i],
-                                        i,
-                                        GL_FALSE);
+                                        i);
       }
    } else {
-      brw_update_renderbuffer_surface(brw, NULL, 0, GL_TRUE);
+      brw_update_renderbuffer_surface(brw, NULL, 0);
    }
 
    old_nr_surfaces = brw->wm.nr_surfaces;