i965: Add a new state flag BRW_NEW_NR_SURFACES instead of CACHE_NEW_SURFACE
authorEric Anholt <eric@anholt.net>
Fri, 28 Nov 2008 20:43:10 +0000 (12:43 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 29 Nov 2008 01:09:46 +0000 (17:09 -0800)
The CACHE_NEW_SURFACE bit always gets spammed since we get many different
surface BOs per state emit, but the only consumer of it wanted to just know
how many surfaces were enabled.

src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 31999276716559cb6f4de300b1d16ad861342a12..252c070471687c37f64e8e9bd0fff6ba2eb03cb0 100644 (file)
@@ -142,6 +142,7 @@ struct brw_context;
 #define BRW_NEW_BATCH                  0x10000
 /** brw->depth_region updated */
 #define BRW_NEW_DEPTH_BUFFER           0x20000
+#define BRW_NEW_NR_SURFACES            0x40000
 
 struct brw_state_flags {
    /** State update flags signalled by mesa internals */
index a640da5b45c0af22a0ec81a07598d2e32064a3da..5302405eda1bdaefd367f8d7fbd0bf0ec4c58db3 100644 (file)
@@ -88,7 +88,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
    /* BRW_NEW_CURBE_OFFSETS */
    key->curbe_offset = brw->curbe.wm_start;
 
-   /* CACHE_NEW_SURFACE */
+   /* BRW_NEW_NR_SURFACEs */
    key->nr_surfaces = brw->wm.nr_surfaces;
 
    /* CACHE_NEW_SAMPLER */
@@ -280,10 +280,10 @@ const struct brw_tracked_state brw_wm_unit = {
               _NEW_COLOR),
 
       .brw = (BRW_NEW_FRAGMENT_PROGRAM | 
-             BRW_NEW_CURBE_OFFSETS),
+             BRW_NEW_CURBE_OFFSETS |
+             BRW_NEW_NR_SURFACES),
 
-      .cache = (CACHE_NEW_SURFACE | 
-               CACHE_NEW_WM_PROG | 
+      .cache = (CACHE_NEW_WM_PROG |
                CACHE_NEW_SAMPLER)
    },
    .prepare = upload_wm_unit,
index 3790b50c976111e73d60ab66c55711c7a8d5d31f..63e14cc39000ccf2b4367165a1a483c46dff92d7 100644 (file)
@@ -438,6 +438,7 @@ static void prepare_wm_surfaces(struct brw_context *brw )
    GLcontext *ctx = &brw->intel.ctx;
    struct intel_context *intel = &brw->intel;
    GLuint i;
+   int old_nr_surfaces;
 
    if (brw->state.nr_draw_regions  > 1) {
       for (i = 0; i < brw->state.nr_draw_regions; i++) {
@@ -448,6 +449,7 @@ static void prepare_wm_surfaces(struct brw_context *brw )
       brw_update_region_surface(brw, brw->state.draw_regions[0], 0, GL_TRUE);
    }
 
+   old_nr_surfaces = brw->wm.nr_surfaces;
    brw->wm.nr_surfaces = MAX_DRAW_BUFFERS;
 
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
@@ -473,6 +475,9 @@ static void prepare_wm_surfaces(struct brw_context *brw )
 
    dri_bo_unreference(brw->wm.bind_bo);
    brw->wm.bind_bo = brw_wm_get_binding_table(brw);
+
+   if (brw->wm.nr_surfaces != old_nr_surfaces)
+      brw->state.dirty.brw |= BRW_NEW_NR_SURFACES;
 }