[Mesa-dev] [PATCH 6/6] gallium: remove pipe_surface::usage

Marek Olšák maraeo at gmail.com
Sat Dec 8 06:40:22 PST 2012


Not really used by anybody.
---
 src/gallium/auxiliary/postprocess/pp_init.c               |    4 ++--
 src/gallium/auxiliary/postprocess/pp_program.c            |    1 -
 src/gallium/auxiliary/postprocess/pp_run.c                |    1 -
 src/gallium/auxiliary/util/u_blitter.c                    |    7 -------
 src/gallium/auxiliary/util/u_debug.c                      |    3 +--
 src/gallium/auxiliary/util/u_dump_state.c                 |    2 --
 src/gallium/auxiliary/util/u_gen_mipmap.c                 |    5 +----
 src/gallium/auxiliary/util/u_inlines.h                    |    9 +++------
 src/gallium/auxiliary/util/u_surface.c                    |    7 ++-----
 src/gallium/auxiliary/util/u_surface.h                    |    3 +--
 src/gallium/auxiliary/util/u_surfaces.c                   |    4 ++--
 src/gallium/auxiliary/util/u_surfaces.h                   |    6 +++---
 src/gallium/auxiliary/vl/vl_idct.c                        |    2 --
 src/gallium/auxiliary/vl/vl_video_buffer.c                |    1 -
 src/gallium/drivers/i915/i915_surface.c                   |    1 -
 src/gallium/drivers/llvmpipe/lp_texture.c                 |    1 -
 src/gallium/drivers/noop/noop_state.c                     |    1 -
 src/gallium/drivers/nouveau/nouveau_video.c               |    1 -
 src/gallium/drivers/nv30/nv30_miptree.c                   |    1 -
 src/gallium/drivers/nv50/nv50_miptree.c                   |    1 -
 src/gallium/drivers/nv50/nv50_resource.c                  |    1 -
 src/gallium/drivers/nv50/nv50_surface.c                   |    1 -
 src/gallium/drivers/nvc0/nvc0_surface.c                   |    1 -
 src/gallium/drivers/r300/r300_texture.c                   |    1 -
 src/gallium/drivers/r600/evergreen_compute_internal.c     |    1 -
 src/gallium/drivers/r600/r600_blit.c                      |    4 ----
 src/gallium/drivers/r600/r600_texture.c                   |    1 -
 src/gallium/drivers/radeonsi/r600_blit.c                  |    2 --
 src/gallium/drivers/radeonsi/r600_texture.c               |    1 -
 src/gallium/drivers/softpipe/sp_texture.c                 |    1 -
 src/gallium/drivers/svga/svga_surface.c                   |    1 -
 src/gallium/drivers/trace/tr_dump_state.c                 |    2 --
 src/gallium/include/pipe/p_state.h                        |    1 -
 src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp |    1 -
 src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h    |    2 --
 src/gallium/state_trackers/vdpau/output.c                 |    1 -
 src/gallium/state_trackers/vdpau/presentation.c           |    1 -
 src/gallium/state_trackers/vega/image.c                   |   10 +++-------
 src/gallium/state_trackers/vega/mask.c                    |    6 ++----
 src/gallium/state_trackers/vega/renderer.c                |    3 +--
 src/gallium/state_trackers/vega/vg_context.c              |    8 ++------
 src/gallium/state_trackers/vega/vg_manager.c              |    4 +---
 src/gallium/state_trackers/xa/xa_context.c                |    3 +--
 src/gallium/state_trackers/xorg/xorg_exa.c                |    4 +---
 src/gallium/state_trackers/xvmc/surface.c                 |    1 -
 src/gallium/tests/graw/clear.c                            |    1 -
 src/gallium/tests/graw/fs-test.c                          |    1 -
 src/gallium/tests/graw/graw_util.h                        |    2 --
 src/gallium/tests/graw/gs-test.c                          |    1 -
 src/gallium/tests/graw/quad-sample.c                      |    1 -
 src/gallium/tests/graw/shader-leak.c                      |    1 -
 src/gallium/tests/graw/tri-gs.c                           |    1 -
 src/gallium/tests/graw/tri-instanced.c                    |    1 -
 src/gallium/tests/graw/vs-test.c                          |    1 -
 src/gallium/tests/trivial/quad-tex.c                      |    1 -
 src/gallium/tests/trivial/tri.c                           |    1 -
 src/mesa/state_tracker/st_atom_framebuffer.c              |    1 -
 src/mesa/state_tracker/st_cb_eglimage.c                   |    8 ++------
 src/mesa/state_tracker/st_cb_fbo.c                        |    3 +--
 src/mesa/state_tracker/st_cb_texture.c                    |    1 -
 src/mesa/state_tracker/st_manager.c                       |    8 +++-----
 src/mesa/state_tracker/st_manager.h                       |    3 +--
 62 files changed, 33 insertions(+), 126 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c
index e059be6..d955273 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -213,7 +213,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
    tmp_res.depth0 = 1;
    tmp_res.array_size = 1;
    tmp_res.last_level = 0;
-   tmp_res.bind = p->surf.usage = PIPE_BIND_RENDER_TARGET;
+   tmp_res.bind = PIPE_BIND_RENDER_TARGET;
 
    if (!p->screen->is_format_supported(p->screen, tmp_res.format,
                                        tmp_res.target, 1, tmp_res.bind))
@@ -237,7 +237,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
          goto error;
    }
 
-   tmp_res.bind = p->surf.usage = PIPE_BIND_DEPTH_STENCIL;
+   tmp_res.bind = PIPE_BIND_DEPTH_STENCIL;
 
    tmp_res.format = p->surf.format = PIPE_FORMAT_S8_UINT_Z24_UNORM;
 
diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
index c25078d..7044e34 100644
--- a/src/gallium/auxiliary/postprocess/pp_program.c
+++ b/src/gallium/auxiliary/postprocess/pp_program.c
@@ -133,7 +133,6 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
 
    p->framebuffer.nr_cbufs = 1;
 
-   p->surf.usage = PIPE_BIND_RENDER_TARGET;
    p->surf.format = PIPE_FORMAT_B8G8R8A8_UNORM;
 
    return p;
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c
index 112458f..0bed547 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -166,7 +166,6 @@ void
 pp_filter_setup_out(struct program *p, struct pipe_resource *out)
 {
    p->surf.format = out->format;
-   p->surf.usage = PIPE_BIND_RENDER_TARGET;
 
    p->framebuffer.cbufs[0] = p->pipe->create_surface(p->pipe, out, &p->surf);
 }
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index e7baf3a..49f01de 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1083,12 +1083,6 @@ void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
                                       const struct pipe_box *srcbox)
 {
     memset(dst_templ, 0, sizeof(*dst_templ));
-    dst_templ->format = dst->format;
-    if (util_format_is_depth_or_stencil(dst->format)) {
-	dst_templ->usage = PIPE_BIND_DEPTH_STENCIL;
-    } else {
-	dst_templ->usage = PIPE_BIND_RENDER_TARGET;
-    }
     dst_templ->format = util_format_linear(dst->format);
     dst_templ->u.tex.level = dstlevel;
     dst_templ->u.tex.first_layer = dstz;
@@ -1743,7 +1737,6 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
    surf_tmpl.u.tex.level = dst_level;
    surf_tmpl.u.tex.first_layer = dst_layer;
    surf_tmpl.u.tex.last_layer = dst_layer;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 
    dstsurf = pipe->create_surface(pipe, dst, &surf_tmpl);
 
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index ee97b7a..ce472b0 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -537,8 +537,7 @@ void debug_dump_texture(struct pipe_context *pipe,
       return;
 
    /* XXX for now, just dump image for layer=0, level=0 */
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, texture, 0 /* no bind flag - not a surface */);
+   u_surface_default_template(&surf_tmpl, texture);
    surface = pipe->create_surface(pipe, texture, &surf_tmpl);
    if (surface) {
       debug_dump_surface(pipe, prefix, surface);
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index f5d8b43..09faffe 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -661,8 +661,6 @@ util_dump_surface(FILE *stream, const struct pipe_surface *state)
    util_dump_member(stream, uint, state, width);
    util_dump_member(stream, uint, state, height);
 
-   util_dump_member(stream, uint, state, usage);
-
    util_dump_member(stream, ptr, state, texture);
    util_dump_member(stream, uint, state, u.tex.level);
    util_dump_member(stream, uint, state, u.tex.first_layer);
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 90588a0..e1f18f3 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1617,10 +1617,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 	 } else
             layer = face;
 
-         memset(&surf_templ, 0, sizeof(surf_templ));
-         u_surface_default_template(&surf_templ, pt,
-                                    is_depth ? PIPE_BIND_DEPTH_STENCIL :
-                                               PIPE_BIND_RENDER_TARGET);
+         u_surface_default_template(&surf_templ, pt);
          surf_templ.u.tex.level = dstLevel;
          surf_templ.u.tex.first_layer = layer;
          surf_templ.u.tex.last_layer = layer;
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index cb06ee2..eeb94b5 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -188,14 +188,12 @@ pipe_so_target_reference(struct pipe_stream_output_target **ptr,
 
 static INLINE void
 pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps,
-                   struct pipe_resource *pt, unsigned level, unsigned layer,
-                   unsigned flags)
+                   struct pipe_resource *pt, unsigned level, unsigned layer)
 {
    pipe_resource_reference(&ps->texture, pt);
    ps->format = pt->format;
    ps->width = u_minify(pt->width0, level);
    ps->height = u_minify(pt->height0, level);
-   ps->usage = flags;
    ps->u.tex.level = level;
    ps->u.tex.first_layer = ps->u.tex.last_layer = layer;
    ps->context = ctx;
@@ -203,12 +201,11 @@ pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps,
 
 static INLINE void
 pipe_surface_init(struct pipe_context *ctx, struct pipe_surface* ps,
-                  struct pipe_resource *pt, unsigned level, unsigned layer,
-                  unsigned flags)
+                  struct pipe_resource *pt, unsigned level, unsigned layer)
 {
    ps->texture = 0;
    pipe_reference_init(&ps->reference, 1);
-   pipe_surface_reset(ctx, ps, pt, level, layer, flags);
+   pipe_surface_reset(ctx, ps, pt, level, layer);
 }
 
 /* Return true if the surfaces are equal. */
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index bef0029..5e771c9 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -49,14 +49,11 @@
  */
 void
 u_surface_default_template(struct pipe_surface *surf,
-                           const struct pipe_resource *texture,
-                           unsigned bind)
+                           const struct pipe_resource *texture)
 {
    memset(surf, 0, sizeof(*surf));
 
    surf->format = texture->format;
-   /* XXX should filter out all non-rt/ds bind flags ? */
-   surf->usage = bind;
 }
 
 /**
@@ -110,7 +107,7 @@ util_create_rgba_texture(struct pipe_context *pipe,
       return FALSE;
 
    /* create surface */
-   u_surface_default_template(&surf_templ, *textureOut, bind);
+   u_surface_default_template(&surf_templ, *textureOut);
    return TRUE;
 }
 
diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h
index a39f677..fe950c8 100644
--- a/src/gallium/auxiliary/util/u_surface.h
+++ b/src/gallium/auxiliary/util/u_surface.h
@@ -42,8 +42,7 @@ extern "C" {
 
 extern void
 u_surface_default_template(struct pipe_surface *view,
-                           const struct pipe_resource *texture,
-                           unsigned bind);
+                           const struct pipe_resource *texture);
 
 extern boolean
 util_create_rgba_texture(struct pipe_context *ctx,
diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c
index b0cfec2..c2f2b74 100644
--- a/src/gallium/auxiliary/util/u_surfaces.c
+++ b/src/gallium/auxiliary/util/u_surfaces.c
@@ -32,7 +32,7 @@
 boolean
 util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size,
                      struct pipe_context *ctx, struct pipe_resource *pt,
-                     unsigned level, unsigned layer, unsigned flags,
+                     unsigned level, unsigned layer,
                      struct pipe_surface **res)
 {
    struct pipe_surface *ps;
@@ -65,7 +65,7 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size,
       return FALSE;
    }
 
-   pipe_surface_init(ctx, ps, pt, level, layer, flags);
+   pipe_surface_init(ctx, ps, pt, level, layer);
 
    if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
       cso_hash_insert(us->u.hash, (layer << 8) | level, ps);
diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h
index 9581fed..1605215 100644
--- a/src/gallium/auxiliary/util/u_surfaces.h
+++ b/src/gallium/auxiliary/util/u_surfaces.h
@@ -46,14 +46,14 @@ struct util_surfaces
 boolean
 util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size,
                      struct pipe_context *ctx, struct pipe_resource *pt,
-                     unsigned level, unsigned layer, unsigned flags,
+                     unsigned level, unsigned layer,
                      struct pipe_surface **res);
 
 /* fast inline path for the very common case */
 static INLINE boolean
 util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size,
                   struct pipe_context *ctx, struct pipe_resource *pt,
-                  unsigned level, unsigned layer, unsigned flags,
+                  unsigned level, unsigned layer,
                   struct pipe_surface **res)
 {
    if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array))
@@ -67,7 +67,7 @@ util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size,
       }
    }
 
-   return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, flags, res);
+   return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, res);
 }
 
 static INLINE struct pipe_surface *
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index 5adc72f..a0c243f 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -603,7 +603,6 @@ init_source(struct vl_idct *idct, struct vl_idct_buffer *buffer)
    surf_templ.format = tex->format;
    surf_templ.u.tex.first_layer = 0;
    surf_templ.u.tex.last_layer = 0;
-   surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
    buffer->fb_state_mismatch.cbufs[0] = idct->pipe->create_surface(idct->pipe, tex, &surf_templ);
 
    buffer->viewport_mismatch.scale[0] = tex->width0;
@@ -643,7 +642,6 @@ init_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer)
       surf_templ.format = tex->format;
       surf_templ.u.tex.first_layer = i;
       surf_templ.u.tex.last_layer = i;
-      surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
       buffer->fb_state.cbufs[i] = idct->pipe->create_surface(
          idct->pipe, tex, &surf_templ);
 
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 82d7386..511485f 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -368,7 +368,6 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer)
          if (!buf->surfaces[surf]) {
             memset(&surf_templ, 0, sizeof(surf_templ));
             surf_templ.format = vl_video_buffer_surface_format(buf->resources[j]->format);
-            surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
             surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = i;
             buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[j], &surf_templ);
             if (!buf->surfaces[surf])
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c
index 08a6f34..b8eef89 100644
--- a/src/gallium/drivers/i915/i915_surface.c
+++ b/src/gallium/drivers/i915/i915_surface.c
@@ -332,7 +332,6 @@ i915_create_surface(struct pipe_context *ctx,
       ps->u.tex.level = surf_tmpl->u.tex.level;
       ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
       ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
-      ps->usage = surf_tmpl->usage;
       ps->context = ctx;
    }
    return ps;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index f4d2cb6..4099beb 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -602,7 +602,6 @@ llvmpipe_create_surface(struct pipe_context *pipe,
       ps->format = surf_tmpl->format;
       ps->width = u_minify(pt->width0, surf_tmpl->u.tex.level);
       ps->height = u_minify(pt->height0, surf_tmpl->u.tex.level);
-      ps->usage = surf_tmpl->usage;
 
       ps->u.tex.level = surf_tmpl->u.tex.level;
       ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
index 16ce9b4..f56ff59 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -116,7 +116,6 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
 	surface->format = surf_tmpl->format;
 	surface->width = texture->width0;
 	surface->height = texture->height0;
-	surface->usage = surf_tmpl->usage;
 	surface->texture = texture;
 	surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
 	surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index bd8f096..eeaabab 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -744,7 +744,6 @@ nouveau_video_buffer_surfaces(struct pipe_video_buffer *buffer)
       if (!buf->surfaces[i]) {
          memset(&surf_templ, 0, sizeof(surf_templ));
          surf_templ.format = buf->resources[i]->format;
-         surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
          buf->surfaces[i] = pipe->create_surface(pipe, buf->resources[i], &surf_templ);
          if (!buf->surfaces[i])
             goto error;
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 5d941ab..d4dcacb 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -460,7 +460,6 @@ nv30_miptree_surface_new(struct pipe_context *pipe,
    pipe_resource_reference(&ps->texture, pt);
    ps->context = pipe;
    ps->format = tmpl->format;
-   ps->usage = tmpl->usage;
    ps->u.tex.level = tmpl->u.tex.level;
    ps->u.tex.first_layer = tmpl->u.tex.first_layer;
    ps->u.tex.last_layer = tmpl->u.tex.last_layer;
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 568526c..fc9d7f3 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -378,7 +378,6 @@ nv50_surface_from_miptree(struct nv50_miptree *mt,
    pipe_resource_reference(&ps->texture, &mt->base.base);
 
    ps->format = templ->format;
-   ps->usage = templ->usage;
    ps->u.tex.level = templ->u.tex.level;
    ps->u.tex.first_layer = templ->u.tex.first_layer;
    ps->u.tex.last_layer = templ->u.tex.last_layer;
diff --git a/src/gallium/drivers/nv50/nv50_resource.c b/src/gallium/drivers/nv50/nv50_resource.c
index 42fefa6..d5c330d 100644
--- a/src/gallium/drivers/nv50/nv50_resource.c
+++ b/src/gallium/drivers/nv50/nv50_resource.c
@@ -43,7 +43,6 @@ nv50_surface_from_buffer(struct pipe_context *pipe,
    pipe_resource_reference(&sf->base.texture, pbuf);
 
    sf->base.format = templ->format;
-   sf->base.usage = templ->usage;
    sf->base.u.buf.first_element = templ->u.buf.first_element;
    sf->base.u.buf.last_element = templ->u.buf.last_element;
 
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index d9722a8..b02550f 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -697,7 +697,6 @@ nv50_blit_set_dst(struct nv50_blitctx *ctx,
    else
       templ.format = format;
 
-   templ.usage = PIPE_USAGE_STREAM;
    templ.u.tex.level = level;
    templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
 
diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c
index dbd4fa3..2f81cf5 100644
--- a/src/gallium/drivers/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nvc0/nvc0_surface.c
@@ -573,7 +573,6 @@ nvc0_blit_set_dst(struct nvc0_blitctx *ctx,
    else
       templ.format = format;
 
-   templ.usage = PIPE_USAGE_STREAM;
    templ.u.tex.level = level;
    templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
 
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index c16bb03..6197cf7 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -1109,7 +1109,6 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
         surface->base.format = surf_tmpl->format;
         surface->base.width = u_minify(width0_override, level);
         surface->base.height = u_minify(height0_override, level);
-        surface->base.usage = surf_tmpl->usage;
         surface->base.u.tex.level = level;
         surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
         surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c
index 7bc7fb4..cbf6622 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.c
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.c
@@ -272,7 +272,6 @@ void evergreen_set_rat(
 
 	/* Create the RAT surface */
 	memset(&rat_templ, 0, sizeof(rat_templ));
-	rat_templ.usage = RADEON_USAGE_READWRITE;
 	rat_templ.format = PIPE_FORMAT_R32_UINT;
 	rat_templ.u.tex.level = 0;
 	rat_templ.u.tex.first_layer = 0;
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index e39f4bd..f702f7b 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -182,7 +182,6 @@ void r600_blit_decompress_depth(struct pipe_context *ctx,
 				surf_tmpl.u.tex.level = level;
 				surf_tmpl.u.tex.first_layer = layer;
 				surf_tmpl.u.tex.last_layer = layer;
-				surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
 
 				zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl);
 
@@ -190,7 +189,6 @@ void r600_blit_decompress_depth(struct pipe_context *ctx,
 				surf_tmpl.u.tex.level = level;
 				surf_tmpl.u.tex.first_layer = layer;
 				surf_tmpl.u.tex.last_layer = layer;
-				surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 				cbsurf = ctx->create_surface(ctx,
 						&flushed_depth_texture->resource.b.b, &surf_tmpl);
 
@@ -231,7 +229,6 @@ static void r600_blit_decompress_depth_in_place(struct r600_context *rctx,
 	rctx->db_misc_state.atom.dirty = true;
 
 	surf_tmpl.format = texture->resource.b.b.format;
-	surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
 
 	for (level = first_level; level <= last_level; level++) {
 		if (!(texture->dirty_level_mask & (1 << level)))
@@ -348,7 +345,6 @@ static void r600_blit_decompress_color(struct pipe_context *ctx,
 			surf_tmpl.u.tex.level = level;
 			surf_tmpl.u.tex.first_layer = layer;
 			surf_tmpl.u.tex.last_layer = layer;
-			surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 			cbsurf = ctx->create_surface(ctx, &rtex->resource.b.b, &surf_tmpl);
 
 			r600_blitter_begin(ctx, R600_DECOMPRESS);
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index d6d1b3d..efff2c3 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -567,7 +567,6 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
 	surface->base.format = templ->format;
 	surface->base.width = width;
 	surface->base.height = height;
-	surface->base.usage = templ->usage;
 	surface->base.u = templ->u;
 	return &surface->base;
 }
diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c
index 30736fc..40967d6 100644
--- a/src/gallium/drivers/radeonsi/r600_blit.c
+++ b/src/gallium/drivers/radeonsi/r600_blit.c
@@ -133,12 +133,10 @@ void si_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_tex
 			surf_tmpl.u.tex.level = level;
 			surf_tmpl.u.tex.first_layer = layer;
 			surf_tmpl.u.tex.last_layer = layer;
-			surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
 
 			zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl);
 
 			surf_tmpl.format = texture->flushed_depth_texture->real_format;
-			surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 			cbsurf = ctx->create_surface(ctx,
 					(struct pipe_resource*)texture->flushed_depth_texture, &surf_tmpl);
 
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c
index 676f4a9..fdfc8f3 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -562,7 +562,6 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
 	surface->base.format = surf_tmpl->format;
 	surface->base.width = rtex->surface.level[level].npix_x;
 	surface->base.height = rtex->surface.level[level].npix_y;
-	surface->base.usage = surf_tmpl->usage;
 	surface->base.texture = texture;
 	surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
 	surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 9c31daa..0d1481a 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -296,7 +296,6 @@ softpipe_create_surface(struct pipe_context *pipe,
       ps->format = surf_tmpl->format;
       ps->width = u_minify(pt->width0, level);
       ps->height = u_minify(pt->height0, level);
-      ps->usage = surf_tmpl->usage;
 
       ps->u.tex.level = level;
       ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index d3c228b..f561956 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -216,7 +216,6 @@ svga_create_surface(struct pipe_context *pipe,
    s->base.format = surf_tmpl->format;
    s->base.width = u_minify(pt->width0, surf_tmpl->u.tex.level);
    s->base.height = u_minify(pt->height0, surf_tmpl->u.tex.level);
-   s->base.usage = surf_tmpl->usage;
    s->base.u.tex.level = surf_tmpl->u.tex.level;
    s->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
    s->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 4cc25d2..006082b 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -544,8 +544,6 @@ void trace_dump_surface_template(const struct pipe_surface *state,
    trace_dump_member(uint, state, width);
    trace_dump_member(uint, state, height);
 
-   trace_dump_member(uint, state, usage);
-
    trace_dump_member_begin("u");
    trace_dump_struct_begin(""); /* anonymous */
    if (target == PIPE_BUFFER) {
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index f84bfd7..ab49cab 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -335,7 +335,6 @@ struct pipe_surface
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
 
-   unsigned usage;               /**< bitmask of PIPE_BIND_x */
    unsigned writable:1;          /**< writable shader resource */
 
    union {
diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index 5444781..dc63fb9 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1167,7 +1167,6 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
 
 			if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h) {
 				struct pipe_surface templat;
-				templat.usage = PIPE_BIND_RENDER_TARGET;
 				templat.format = dst->format;
 				templat.u.tex.level = 0;
 				templat.u.tex.first_layer = 0;
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 31e59bf..2c06185 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -1226,7 +1226,6 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 		templat.format = (desc->Format == DXGI_FORMAT_UNKNOWN) ? resource->format : dxgi_to_pipe_format[desc->Format];
 		if(!templat.format)
 			return E_NOTIMPL;
-		templat.usage = PIPE_BIND_RENDER_TARGET;
 		templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
 
 		switch(desc->ViewDimension)
@@ -1316,7 +1315,6 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 		templat.format = (desc->Format == DXGI_FORMAT_UNKNOWN) ? resource->format : dxgi_to_pipe_format[desc->Format];
 		if(!templat.format)
 			return E_NOTIMPL;
-		templat.usage = PIPE_BIND_DEPTH_STENCIL;
 		templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
 
 		switch(desc->ViewDimension)
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index dd3c1a8..a835126 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -100,7 +100,6 @@ vlVdpOutputSurfaceCreate(VdpDevice device,
 
    memset(&surf_templ, 0, sizeof(surf_templ));
    surf_templ.format = res->format;
-   surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
    vlsurface->surface = pipe->create_surface(pipe, res, &surf_templ);
    if (!vlsurface->surface) {
       pipe_resource_reference(&res, NULL);
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index 51a702e..349654d 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -236,7 +236,6 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
 
    memset(&surf_templ, 0, sizeof(surf_templ));
    surf_templ.format = tex->format;
-   surf_templ.usage = PIPE_BIND_RENDER_TARGET;
    surf_draw = pipe->create_surface(pipe, tex, &surf_templ);
 
    surf->timestamp = (vlVdpTime)earliest_presentation_time;
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 74a84e0..4434550 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -139,7 +139,7 @@ static void vg_copy_texture(struct vg_context *ctx,
       struct pipe_surface *surf, surf_tmpl;
 
       /* get the destination surface */
-      u_surface_default_template(&surf_tmpl, dst, PIPE_BIND_RENDER_TARGET);
+      u_surface_default_template(&surf_tmpl, dst);
       surf = ctx->pipe->create_surface(ctx->pipe, dst, &surf_tmpl);
       if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) {
          renderer_copy(ctx->renderer,
@@ -570,9 +570,7 @@ void image_set_pixels(VGint dx, VGint dy,
    struct pipe_surface *surf, surf_tmpl;
    struct st_renderbuffer *strb = ctx->draw_buffer->strb;
 
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, image_texture(src),
-                              0 /* no bind flag - not a surface*/);
+   u_surface_default_template(&surf_tmpl, image_texture(src));
    surf = pipe->create_surface(pipe, image_texture(src), &surf_tmpl);
 
    vg_copy_surface(ctx, strb->surface, dx, dy,
@@ -593,9 +591,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
    /* flip the y coordinates */
    /*dy = dst->height - dy - height;*/
 
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, image_texture(dst),
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, image_texture(dst));
    surf = pipe->create_surface(pipe, image_texture(dst), &surf_tmpl);
 
    vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c
index 89bff6e..e46bbdd 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -398,8 +398,7 @@ void mask_copy(struct vg_mask_layer *layer,
    struct pipe_surface *surf, surf_tmpl;
 
    /* get the destination surface */
-   u_surface_default_template(&surf_tmpl, layer->sampler_view->texture,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, layer->sampler_view->texture);
    surf = ctx->pipe->create_surface(ctx->pipe, layer->sampler_view->texture,
                                     &surf_tmpl);
    if (surf && renderer_copy_begin(ctx->renderer, surf, VG_FALSE, src)) {
@@ -425,8 +424,7 @@ static void mask_layer_render_to(struct vg_mask_layer *layer,
    struct pipe_sampler_view *view = vg_get_surface_mask(ctx);
    struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
    struct pipe_surface *surf, surf_tmpl;
-   u_surface_default_template(&surf_tmpl, view->texture,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, view->texture);
    surf = pipe->create_surface(pipe, view->texture, &surf_tmpl);
 
    renderer_validate_for_mask_rendering(ctx->renderer, surf, mat);
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 9faf54f..11d3b5a 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -870,8 +870,7 @@ VGboolean renderer_filter_begin(struct renderer *renderer,
    if (!renderer_can_support(renderer, dst, PIPE_BIND_RENDER_TARGET))
       return VG_FALSE;
 
-   u_surface_default_template(&surf_tmpl, dst,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, dst);
    surf = renderer->pipe->create_surface(renderer->pipe, dst, &surf_tmpl);
    if (!surf)
       return VG_FALSE;
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index ca4ec7f..c636188 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -377,9 +377,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
    if (!dsrb->texture)
       return TRUE;
 
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, dsrb->texture,
-                              PIPE_BIND_DEPTH_STENCIL);
+   u_surface_default_template(&surf_tmpl, dsrb->texture);
    dsrb->surface = pipe->create_surface(pipe,
                                         dsrb->texture,
                                         &surf_tmpl);
@@ -450,9 +448,7 @@ static void vg_prepare_blend_texture(struct vg_context *ctx,
 
    vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
 
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture);
    surf = ctx->pipe->create_surface(ctx->pipe,
                                     stfb->blend_texture_view->texture,
                                     &surf_tmpl);
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index e9c4a83..c8531f8 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -61,9 +61,7 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
 
    strb->texture = pt;
 
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, strb->texture,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, strb->texture);
    strb->surface = pipe->create_surface(pipe, strb->texture, &surf_tmpl);
 
    if (!strb->surface) {
diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
index 93dae13..7b7a903 100644
--- a/src/gallium/state_trackers/xa/xa_context.c
+++ b/src/gallium/state_trackers/xa/xa_context.c
@@ -182,8 +182,7 @@ xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst)
 				     PIPE_BIND_RENDER_TARGET))
 	return -XA_ERR_INVAL;
 
-    u_surface_default_template(&srf_templ, dst->tex,
-			       PIPE_BIND_RENDER_TARGET);
+    u_surface_default_template(&srf_templ, dst->tex);
     ctx->srf = ctx->pipe->create_surface(ctx->pipe, dst->tex, &srf_templ);
     if (!ctx->srf)
 	return -XA_ERR_NORES;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index c8f20ac..d78ab74 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -1062,9 +1062,7 @@ struct pipe_surface *
 xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv)
 {
    struct pipe_surface surf_tmpl;
-   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
-   u_surface_default_template(&surf_tmpl, priv->tex,
-                              PIPE_BIND_RENDER_TARGET);
+   u_surface_default_template(&surf_tmpl, priv->tex);
 
    return pipe->create_surface(pipe, priv->tex, &surf_tmpl);
 
diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
index bec23a4..fd3f26c 100644
--- a/src/gallium/state_trackers/xvmc/surface.c
+++ b/src/gallium/state_trackers/xvmc/surface.c
@@ -386,7 +386,6 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    memset(&surf_templ, 0, sizeof(surf_templ));
    surf_templ.format = tex->format;
-   surf_templ.usage = PIPE_BIND_RENDER_TARGET;
    surf = pipe->create_surface(pipe, tex, &surf_templ);
 
    if (!surf)
diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c
index c6c645e..0b78be8 100644
--- a/src/gallium/tests/graw/clear.c
+++ b/src/gallium/tests/graw/clear.c
@@ -82,7 +82,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index 9cde75c..2c02f4f 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -421,7 +421,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
index 86bb18d..1ff7a3f 100644
--- a/src/gallium/tests/graw/graw_util.h
+++ b/src/gallium/tests/graw/graw_util.h
@@ -87,7 +87,6 @@ graw_util_create_window(struct graw_info *info,
 
       /* create color surface */
       surface_temp.format = resource_temp.format;
-      surface_temp.usage = PIPE_BIND_RENDER_TARGET;
       surface_temp.u.tex.level = 0;
       surface_temp.u.tex.first_layer = 0;
       surface_temp.u.tex.last_layer = 0;
@@ -118,7 +117,6 @@ graw_util_create_window(struct graw_info *info,
 
    /* create z surface */
    surface_temp.format = resource_temp.format;
-   surface_temp.usage = PIPE_BIND_DEPTH_STENCIL;
    surface_temp.u.tex.level = 0;
    surface_temp.u.tex.first_layer = 0;
    surface_temp.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index c43f545..0bd5e29 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -528,7 +528,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
index ab5f299..c9e7646 100644
--- a/src/gallium/tests/graw/quad-sample.c
+++ b/src/gallium/tests/graw/quad-sample.c
@@ -336,7 +336,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
index be93771..b685fb9 100644
--- a/src/gallium/tests/graw/shader-leak.c
+++ b/src/gallium/tests/graw/shader-leak.c
@@ -211,7 +211,6 @@ static void init( void )
    }
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
index 573bc8a..8fdc28d 100644
--- a/src/gallium/tests/graw/tri-gs.c
+++ b/src/gallium/tests/graw/tri-gs.c
@@ -218,7 +218,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
index 4e3a80b..651518a 100644
--- a/src/gallium/tests/graw/tri-instanced.c
+++ b/src/gallium/tests/graw/tri-instanced.c
@@ -269,7 +269,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
index 0677f04..e0358e6 100644
--- a/src/gallium/tests/graw/vs-test.c
+++ b/src/gallium/tests/graw/vs-test.c
@@ -415,7 +415,6 @@ static void init( void )
       exit(4);
 
    surf_tmpl.format = templat.format;
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = 0;
    surf_tmpl.u.tex.first_layer = 0;
    surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index feff902..db99789 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -211,7 +211,6 @@ static void init_prog(struct program *p)
 	p->sampler.normalized_coords = 1;
 
 	surf_tmpl.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
-	surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 	surf_tmpl.u.tex.level = 0;
 	surf_tmpl.u.tex.first_layer = 0;
 	surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index f9b4696..2c11f72 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -156,7 +156,6 @@ static void init_prog(struct program *p)
 	p->rasterizer.depth_clip = 1;
 
 	surf_tmpl.format = PIPE_FORMAT_B8G8R8A8_UNORM;
-	surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
 	surf_tmpl.u.tex.level = 0;
 	surf_tmpl.u.tex.first_layer = 0;
 	surf_tmpl.u.tex.last_layer = 0;
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index a10dbfb..3df8691 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -71,7 +71,6 @@ update_renderbuffer_surface(struct st_context *st,
             struct pipe_surface surf_tmpl;
             memset(&surf_tmpl, 0, sizeof(surf_tmpl));
             surf_tmpl.format = format;
-            surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
             surf_tmpl.u.tex.level = level;
             surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
             surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 0679e7d..8c78e5e 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -76,10 +76,8 @@ st_egl_image_target_renderbuffer_storage(struct gl_context *ctx,
    struct st_context *st = st_context(ctx);
    struct st_renderbuffer *strb = st_renderbuffer(rb);
    struct pipe_surface *ps;
-   unsigned usage;
 
-   usage = PIPE_BIND_RENDER_TARGET;
-   ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+   ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
    if (ps) {
       strb->Base.Width = ps->width;
       strb->Base.Height = ps->height;
@@ -146,10 +144,8 @@ st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
 {
    struct st_context *st = st_context(ctx);
    struct pipe_surface *ps;
-   unsigned usage;
 
-   usage = PIPE_BIND_SAMPLER_VIEW;
-   ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+   ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
    if (ps) {
       st_bind_surface(ctx, target, texObj, texImage, ps);
       pipe_surface_reference(&ps, NULL);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index ae280bf..bf206b0 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -206,7 +206,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
    if (!strb->texture)
       return FALSE;
 
-   u_surface_default_template(&surf_tmpl, strb->texture, templ.bind);
+   u_surface_default_template(&surf_tmpl, strb->texture);
    strb->surface = pipe->create_surface(pipe,
                                         strb->texture,
                                         &surf_tmpl);
@@ -444,7 +444,6 @@ st_render_texture(struct gl_context *ctx,
    memset(&surf_tmpl, 0, sizeof(surf_tmpl));
    surf_tmpl.format = ctx->Color.sRGBEnabled
       ? strb->texture->format : util_format_linear(strb->texture->format);
-   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
    surf_tmpl.u.tex.level = strb->rtt_level;
    surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
    surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 131ecf2..bf13526 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1090,7 +1090,6 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
 
    memset(&surf_tmpl, 0, sizeof(surf_tmpl));
    surf_tmpl.format = util_format_linear(stImage->pt->format);
-   surf_tmpl.usage = dst_usage;
    surf_tmpl.u.tex.level = stImage->base.Level;
    surf_tmpl.u.tex.first_layer = stImage->base.Face + destZ;
    surf_tmpl.u.tex.last_layer = stImage->base.Face + destZ;
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index e97b3f3..e80f238 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -224,8 +224,7 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
          continue;
       }
 
-      u_surface_default_template(&surf_tmpl, textures[i],
-                                 PIPE_BIND_RENDER_TARGET);
+      u_surface_default_template(&surf_tmpl, textures[i]);
       ps = st->pipe->create_surface(st->pipe, textures[i], &surf_tmpl);
       if (ps) {
          pipe_surface_reference(&strb->surface, ps);
@@ -792,8 +791,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
  * FIXME: I think this should operate on resources, not surfaces
  */
 struct pipe_surface *
-st_manager_get_egl_image_surface(struct st_context *st,
-                                 void *eglimg, unsigned usage)
+st_manager_get_egl_image_surface(struct st_context *st, void *eglimg)
 {
    struct st_manager *smapi =
       (struct st_manager *) st->iface.st_context_private;
@@ -807,7 +805,7 @@ st_manager_get_egl_image_surface(struct st_context *st,
    if (!smapi->get_egl_image(smapi, eglimg, &stimg))
       return NULL;
 
-   u_surface_default_template(&surf_tmpl, stimg.texture, usage);
+   u_surface_default_template(&surf_tmpl, stimg.texture);
    surf_tmpl.u.tex.level = stimg.level;
    surf_tmpl.u.tex.first_layer = stimg.layer;
    surf_tmpl.u.tex.last_layer = stimg.layer;
diff --git a/src/mesa/state_tracker/st_manager.h b/src/mesa/state_tracker/st_manager.h
index 6a94978..f729cff 100644
--- a/src/mesa/state_tracker/st_manager.h
+++ b/src/mesa/state_tracker/st_manager.h
@@ -36,8 +36,7 @@
 struct st_context;
 
 struct pipe_surface *
-st_manager_get_egl_image_surface(struct st_context *st,
-                                 void *eglimg, unsigned usage);
+st_manager_get_egl_image_surface(struct st_context *st, void *eglimg);
 
 void
 st_manager_flush_frontbuffer(struct st_context *st);
-- 
1.7.10.4



More information about the mesa-dev mailing list