gallium: Remove some little-used fields from struct pipe_surface.
authorMichel Dänzer <daenzer@vmware.com>
Thu, 26 Mar 2009 09:53:47 +0000 (10:53 +0100)
committerMichel Dänzer <daenzer@vmware.com>
Thu, 26 Mar 2009 09:53:47 +0000 (10:53 +0100)
28 files changed:
src/gallium/drivers/cell/ppu/cell_clear.c
src/gallium/drivers/i915simple/i915_clear.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/drivers/nv04/nv04_miptree.c
src/gallium/drivers/nv10/nv10_miptree.c
src/gallium/drivers/nv20/nv20_clear.c
src/gallium/drivers/nv20/nv20_miptree.c
src/gallium/drivers/nv30/nv30_clear.c
src/gallium/drivers/nv30/nv30_miptree.c
src/gallium/drivers/nv30/nv30_state_emit.c
src/gallium/drivers/nv40/nv40_clear.c
src/gallium/drivers/nv40/nv40_miptree.c
src/gallium/drivers/nv40/nv40_state_emit.c
src/gallium/drivers/nv50/nv50_clear.c
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/r300/r300_clear.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/softpipe/sp_clear.c
src/gallium/drivers/softpipe/sp_setup.c
src/gallium/drivers/trace/tr_state.c
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_state.h
src/gallium/state_trackers/egl/egl_surface.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_framebuffer.c
src/mesa/state_tracker/st_public.h

index edc0674..34be5f3 100644 (file)
@@ -101,17 +101,4 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
       clr->surface = surfIndex;
       clr->value = clearValue;
    }
-
-   /* Technically, the surface's contents are now known and cleared,
-    * so we could set the status to PIPE_SURFACE_STATUS_CLEAR.  But
-    * it turns out it's quite painful to recognize when any particular
-    * surface goes from PIPE_SURFACE_STATUS_CLEAR to 
-    * PIPE_SURFACE_STATUS_DEFINED (i.e. with known contents), because
-    * the drawing commands could be operating on numerous draw buffers,
-    * which we'd have to iterate through to set all their stati...
-    * For now, we cheat a bit and set the surface's status to DEFINED
-    * right here.  Later we should revisit this and set the status to
-    * CLEAR here, and find a better place to set the status to DEFINED.
-    */
-   ps->status = PIPE_SURFACE_STATUS_DEFINED;
 }
index 8a2d3ca..cde69da 100644 (file)
@@ -44,5 +44,4 @@ i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
           unsigned clearValue)
 {
    pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-   ps->status = PIPE_SURFACE_STATUS_DEFINED;
 }
index 39aca9f..ca8e87a 100644 (file)
@@ -677,7 +677,6 @@ i915_get_tex_surface(struct pipe_screen *screen,
       ps->height = pt->height[level];
       ps->offset = offset;
       ps->usage = flags;
-      ps->status = PIPE_SURFACE_STATUS_DEFINED;
    }
    return ps;
 }
@@ -725,14 +724,6 @@ i915_init_texture_functions(struct i915_context *i915)
 static void
 i915_tex_surface_destroy(struct pipe_surface *surf)
 {
-   /* This really should not be possible, but it's actually
-    * happening quite a bit...  Will fix.
-    */
-   if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
-      debug_printf("XXX destroying a surface with pending clears...\n");
-      assert(0);
-   }
-
    pipe_texture_reference(&surf->texture, NULL);
    FREE(surf);
 }
index c921c0d..f44bd17 100644 (file)
@@ -363,7 +363,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
       ps->nblocksy = pt->nblocksy[level];
       ps->stride = tex->stride;
       ps->offset = offset;
-      ps->status = PIPE_SURFACE_STATUS_DEFINED;
    }
    return ps;
 }
index 85dc017..4da833c 100644 (file)
@@ -122,7 +122,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index bb3a1c0..34e3c2e 100644 (file)
@@ -136,7 +136,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index 29f4afd..81b6f3e 100644 (file)
@@ -9,5 +9,4 @@ nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
           unsigned clearValue)
 {
        pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
 }
index b2f29af..185fbf5 100644 (file)
@@ -170,7 +170,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index 8c3ca20..71f4135 100644 (file)
@@ -9,5 +9,4 @@ nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
           unsigned clearValue)
 {
        pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
 }
index d6dc621..7f8054d 100644 (file)
@@ -177,7 +177,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index f77b08f..c18be20 100644 (file)
@@ -21,14 +21,6 @@ static void
 nv30_state_do_validate(struct nv30_context *nv30,
                       struct nv30_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv30_state_entry *e = *states;
 
index 59efd62..2c4e8f0 100644 (file)
@@ -9,5 +9,4 @@ nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
           unsigned clearValue)
 {
        pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
 }
index abadca8..5a201cc 100644 (file)
@@ -176,7 +176,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index ce859de..10aae29 100644 (file)
@@ -38,14 +38,6 @@ static void
 nv40_state_do_validate(struct nv40_context *nv40,
                       struct nv40_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv40_state_entry *e = *states;
 
index f9bc3b5..db44a9d 100644 (file)
@@ -86,7 +86,5 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
        pipe->set_framebuffer_state(pipe, &s_fb);
        pipe->set_scissor_state(pipe, &s_sc);
        nv50->dirty |= dirty;
-
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
 }
 
index dc4688c..f79a7ca 100644 (file)
@@ -163,7 +163,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ps->width = pt->width[level];
        ps->height = pt->height[level];
        ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ps->reference, 1);
        ps->face = face;
        ps->level = level;
index 85098a7..fc6157d 100644 (file)
@@ -178,17 +178,10 @@ nv50_state_emit(struct nv50_context *nv50)
 boolean
 nv50_state_validate(struct nv50_context *nv50)
 {
-       const struct pipe_framebuffer_state *fb = &nv50->framebuffer;
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nouveau_stateobj *so;
        unsigned i;
 
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        if (nv50->dirty & NV50_NEW_FRAMEBUFFER)
                nv50_state_validate_fb(nv50);
 
index fd28437..8506ed2 100644 (file)
@@ -29,5 +29,4 @@ void r300_clear(struct pipe_context* pipe,
                 unsigned color)
 {
     pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
-    ps->status = PIPE_SURFACE_STATUS_DEFINED;
-}
\ No newline at end of file
+}
index 6cdea3d..fe91f4e 100644 (file)
@@ -147,7 +147,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
         surface->height = texture->height[level];
         surface->offset = offset;
         surface->usage = flags;
-        surface->status = PIPE_SURFACE_STATUS_DEFINED;
     }
 
     return surface;
index ad108ec..a60c6c4 100644 (file)
@@ -79,7 +79,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
 
    if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) {
       sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue);
-      softpipe->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_CLEAR;
 #if TILE_CLEAR_OPTIMIZATION
       return;
 #endif
@@ -96,7 +95,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
             cv = clearValue;
          }
          sp_tile_cache_clear(softpipe->cbuf_cache[i], cv);
-         softpipe->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_CLEAR;
       }
    }
 
index 96cb09b..711343a 100644 (file)
@@ -1489,16 +1489,6 @@ void setup_prepare( struct setup_context *setup )
       softpipe_update_derived(sp);
    }
 
-   /* Mark surfaces as defined now */
-   for (i = 0; i < sp->framebuffer.nr_cbufs; i++){
-      if (sp->framebuffer.cbufs[i]) {
-         sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-      }
-   }
-   if (sp->framebuffer.zsbuf) {
-      sp->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-   }
-
    /* Note: nr_attrs is only used for debugging (vertex printing) */
    setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw);
 
index f9fbe9a..a9570c1 100644 (file)
@@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state)
    trace_dump_reference(&state->reference);
 
    trace_dump_member(format, state, format);
-   trace_dump_member(uint, state, status);
-   trace_dump_member(uint, state, clear_value);
    trace_dump_member(uint, state, width);
    trace_dump_member(uint, state, height);
 
index 52d4439..8e4f253 100644 (file)
@@ -186,14 +186,6 @@ enum pipe_texture_target {
 
 
 /**
- * Surface status
- */
-#define PIPE_SURFACE_STATUS_UNDEFINED  0
-#define PIPE_SURFACE_STATUS_DEFINED    1
-#define PIPE_SURFACE_STATUS_CLEAR      2
-
-
-/**
  * Transfer object usage flags
  */
 enum pipe_transfer_usage {
index 9c7baa3..705ae68 100644 (file)
@@ -281,8 +281,6 @@ struct pipe_surface
 {
    struct pipe_reference reference;
    enum pipe_format format;      /**< PIPE_FORMAT_x */
-   unsigned status;              /**< PIPE_SURFACE_STATUS_x */
-   unsigned clear_value;         /**< XXX may be temporary */
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
    unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
index ca545b1..489aa8d 100644 (file)
@@ -406,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
                        surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
                        /* TODO stuff here */
                }
-
-               st_notify_swapbuffers_complete(surf->stfb);
        }
 
        return EGL_TRUE;
index dd9ba28..020684b 100644 (file)
@@ -291,11 +291,6 @@ clear_with_quad(GLcontext *ctx,
 static INLINE GLboolean
 check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 {
-   const struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
@@ -312,14 +307,10 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 static INLINE GLboolean
 check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 {
-   const struct st_renderbuffer *strb = st_renderbuffer(rb);
    const GLuint stencilMax = (1 << rb->StencilBits) - 1;
    GLboolean maskStencil
       = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
@@ -339,14 +330,10 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
    const struct st_renderbuffer *strb = st_renderbuffer(rb);
    const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
    if (isDS && 
-       strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
        ctx->DrawBuffer->Visual.stencilBits > 0)
       return TRUE;
 
@@ -366,9 +353,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
    const GLboolean maskStencil
       = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (maskStencil) 
       return TRUE;
 
@@ -381,7 +365,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
     * current state.
     */
    if (isDS && 
-       strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
        ctx->DrawBuffer->Visual.depthBits > 0)
       return TRUE;
 
index 06fec20..daaad65 100644 (file)
@@ -293,32 +293,6 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
 }
 
 
-/** 
- * Quick hack - allows the winsys to inform the driver that surface
- * states are now undefined after a glXSwapBuffers or similar.
- */
-void
-st_notify_swapbuffers_complete(struct st_framebuffer *stfb)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (ctx && ctx->DrawBuffer == &stfb->Base) {
-      struct st_renderbuffer *strb;
-
-      /* Mark back color buffers as undefined */
-      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].
-                             Renderbuffer);
-      if (strb && strb->surface)
-         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
-
-      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_RIGHT].
-                             Renderbuffer);
-      if (strb && strb->surface)
-         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
-   }
-}
-
-
 void *st_framebuffer_private( struct st_framebuffer *stfb )
 {
    return stfb->Private;
index 414218b..0303143 100644 (file)
@@ -100,7 +100,6 @@ void st_flush( struct st_context *st, uint pipeFlushFlags,
 void st_finish( struct st_context *st );
 
 void st_notify_swapbuffers(struct st_framebuffer *stfb);
-void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
 
 int st_set_teximage(struct pipe_texture *pt, int target);