[Mesa-dev] [PATCH 3/3] gallium: remove PIPE_USAGE_STATIC

Fredrik Höglund fredrik at kde.org
Wed Feb 5 01:14:17 CET 2014


On Wednesday 05 February 2014, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> It's changed to DEFAULT except for glBufferStorage, which is changed
> to IMMUTABLE.
> ---
>  src/gallium/auxiliary/hud/font.c                | 2 +-
>  src/gallium/auxiliary/postprocess/pp_mlaa.c     | 4 ++--
>  src/gallium/auxiliary/postprocess/pp_program.c  | 2 +-
>  src/gallium/auxiliary/util/u_index_modify.c     | 6 +++---
>  src/gallium/auxiliary/vl/vl_compositor.c        | 2 +-
>  src/gallium/auxiliary/vl/vl_mpeg12_decoder.c    | 6 +++---
>  src/gallium/auxiliary/vl/vl_vertex_buffers.c    | 4 ++--
>  src/gallium/auxiliary/vl/vl_video_buffer.c      | 2 +-
>  src/gallium/auxiliary/vl/vl_winsys_dri.c        | 2 +-
>  src/gallium/docs/source/screen.rst              | 1 -
>  src/gallium/drivers/nouveau/nouveau_buffer.c    | 1 -
>  src/gallium/drivers/nouveau/nouveau_video.c     | 2 +-
>  src/gallium/drivers/r300/r300_blit.c            | 2 +-
>  src/gallium/drivers/r300/r300_context.c         | 2 +-
>  src/gallium/drivers/r600/r600_pipe.c            | 4 ++--
>  src/gallium/drivers/r600/r600_state.c           | 2 +-
>  src/gallium/drivers/r600/r600_uvd.c             | 6 +++---
>  src/gallium/drivers/radeon/r600_buffer_common.c | 1 -
>  src/gallium/drivers/radeon/r600_pipe_common.c   | 2 +-
>  src/gallium/drivers/radeon/r600_texture.c       | 8 ++++----
>  src/gallium/drivers/radeonsi/si_descriptors.c   | 2 +-
>  src/gallium/drivers/radeonsi/si_pipe.c          | 2 +-
>  src/gallium/drivers/radeonsi/si_state_draw.c    | 4 ++--
>  src/gallium/drivers/radeonsi/si_uvd.c           | 6 +++---
>  src/gallium/drivers/svga/svga_draw_arrays.c     | 2 +-
>  src/gallium/drivers/svga/svga_draw_elements.c   | 2 +-
>  src/gallium/include/pipe/p_defines.h            | 1 -
>  src/gallium/state_trackers/vdpau/bitmap.c       | 2 +-
>  src/gallium/state_trackers/vdpau/output.c       | 2 +-
>  src/gallium/state_trackers/vega/renderer.c      | 4 ++--
>  src/gallium/state_trackers/xa/xa_renderer.c     | 2 +-
>  src/gallium/state_trackers/xvmc/subpicture.c    | 2 +-
>  src/gallium/tests/graw/fs-fragcoord.c           | 2 +-
>  src/gallium/tests/graw/fs-frontface.c           | 2 +-
>  src/gallium/tests/graw/fs-test.c                | 2 +-
>  src/gallium/tests/graw/fs-write-z.c             | 2 +-
>  src/gallium/tests/graw/gs-test.c                | 4 ++--
>  src/gallium/tests/graw/occlusion-query.c        | 2 +-
>  src/gallium/tests/graw/quad-sample.c            | 2 +-
>  src/gallium/tests/graw/quad-tex.c               | 2 +-
>  src/gallium/tests/graw/shader-leak.c            | 2 +-
>  src/gallium/tests/graw/tex-srgb.c               | 2 +-
>  src/gallium/tests/graw/tex-swizzle.c            | 2 +-
>  src/gallium/tests/graw/tri-gs.c                 | 2 +-
>  src/gallium/tests/graw/tri-instanced.c          | 6 +++---
>  src/gallium/tests/graw/tri-large.c              | 2 +-
>  src/gallium/tests/graw/tri.c                    | 2 +-
>  src/gallium/tests/graw/vs-test.c                | 2 +-
>  src/gallium/tests/trivial/quad-tex.c            | 2 +-
>  src/gallium/tests/trivial/tri.c                 | 2 +-
>  src/mesa/state_tracker/st_cb_bufferobjects.c    | 7 +++----
>  51 files changed, 68 insertions(+), 73 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c
> index 6747874..03e35d9 100644
> --- a/src/gallium/auxiliary/hud/font.c
> +++ b/src/gallium/auxiliary/hud/font.c
> @@ -401,7 +401,7 @@ util_font_create_fixed_8x13(struct pipe_context *pipe,
>     tex_templ.height0 = 256;
>     tex_templ.depth0 = 1;
>     tex_templ.array_size = 1;
> -   tex_templ.usage = PIPE_USAGE_STATIC;
> +   tex_templ.usage = PIPE_USAGE_DEFAULT;
>     tex_templ.bind = PIPE_BIND_SAMPLER_VIEW;
>  
>     tex = screen->resource_create(screen, &tex_templ);
> diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> index 4f0c156..9827b8c 100644
> --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
> +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> @@ -240,7 +240,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
>  
>     ppq->constbuf = pipe_buffer_create(ppq->p->screen,
>                                        PIPE_BIND_CONSTANT_BUFFER,
> -                                      PIPE_USAGE_STATIC,
> +                                      PIPE_USAGE_DEFAULT,
>                                        sizeof(constants));
>     if (ppq->constbuf == NULL) {
>        pp_debug("Failed to allocate constant buffer\n");
> @@ -259,7 +259,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
>     res.format = PIPE_FORMAT_R8G8_UNORM;
>     res.width0 = res.height0 = 165;
>     res.bind = PIPE_BIND_SAMPLER_VIEW;
> -   res.usage = PIPE_USAGE_STATIC;
> +   res.usage = PIPE_USAGE_DEFAULT;
>     res.depth0 = res.array_size = res.nr_samples = 1;
>  
>     if (!ppq->p->screen->is_format_supported(ppq->p->screen, res.format,
> diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
> index 19275d7..91cc781 100644
> --- a/src/gallium/auxiliary/postprocess/pp_program.c
> +++ b/src/gallium/auxiliary/postprocess/pp_program.c
> @@ -78,7 +78,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
>        };
>  
>        p->vbuf = pipe_buffer_create(pipe->screen, PIPE_BIND_VERTEX_BUFFER,
> -                                   PIPE_USAGE_STATIC, sizeof(verts));
> +                                   PIPE_USAGE_DEFAULT, sizeof(verts));
>        pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(verts), verts);
>     }
>  
> diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c
> index 5e3fd46..e134894 100644
> --- a/src/gallium/auxiliary/util/u_index_modify.c
> +++ b/src/gallium/auxiliary/util/u_index_modify.c
> @@ -71,7 +71,7 @@ void util_shorten_ubyte_elts(struct pipe_context *context,
>  
>      new_elts = pipe_buffer_create(context->screen,
>                                    PIPE_BIND_INDEX_BUFFER,
> -                                  PIPE_USAGE_STATIC,
> +                                  PIPE_USAGE_DEFAULT,
>                                    2 * count);
>  
>      out_map = pipe_buffer_map(context, new_elts, PIPE_TRANSFER_WRITE,
> @@ -130,7 +130,7 @@ void util_rebuild_ushort_elts(struct pipe_context *context,
>  
>      new_elts = pipe_buffer_create(context->screen,
>                                    PIPE_BIND_INDEX_BUFFER,
> -                                  PIPE_USAGE_STATIC,
> +                                  PIPE_USAGE_DEFAULT,
>                                    2 * count);
>  
>      out_map = pipe_buffer_map(context, new_elts,
> @@ -189,7 +189,7 @@ void util_rebuild_uint_elts(struct pipe_context *context,
>  
>      new_elts = pipe_buffer_create(context->screen,
>                                    PIPE_BIND_INDEX_BUFFER,
> -                                  PIPE_USAGE_STATIC,
> +                                  PIPE_USAGE_DEFAULT,
>                                    2 * count);
>  
>      out_map = pipe_buffer_map(context, new_elts,
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
> index 33b2a11..3cea044 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -1064,7 +1064,7 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip
>     (
>        pipe->screen,
>        PIPE_BIND_CONSTANT_BUFFER,
> -      PIPE_USAGE_STATIC,
> +      PIPE_USAGE_DEFAULT,
>        sizeof(csc_matrix)
>     );
>  
> diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> index 40dc2d5..8579460 100644
> --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> @@ -967,7 +967,7 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf
>     dec->idct_source = vl_video_buffer_create_ex
>     (
>        dec->context, &templat,
> -      formats, 1, 1, PIPE_USAGE_STATIC
> +      formats, 1, 1, PIPE_USAGE_DEFAULT
>     );
>  
>     if (!dec->idct_source)
> @@ -981,7 +981,7 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf
>     dec->mc_source = vl_video_buffer_create_ex
>     (
>        dec->context, &templat,
> -      formats, nr_of_idct_render_targets, 1, PIPE_USAGE_STATIC
> +      formats, nr_of_idct_render_targets, 1, PIPE_USAGE_DEFAULT
>     );
>  
>     if (!dec->mc_source)
> @@ -1032,7 +1032,7 @@ init_mc_source_widthout_idct(struct vl_mpeg12_decoder *dec, const struct format_
>     dec->mc_source = vl_video_buffer_create_ex
>     (
>        dec->context, &templat,
> -      formats, 1, 1, PIPE_USAGE_STATIC
> +      formats, 1, 1, PIPE_USAGE_DEFAULT
>     );
>        
>     return dec->mc_source != NULL;
> diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
> index e3f0c497..13d3f8c 100644
> --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
> +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
> @@ -53,7 +53,7 @@ vl_vb_upload_quads(struct pipe_context *pipe)
>     (
>        pipe->screen,
>        PIPE_BIND_VERTEX_BUFFER,
> -      PIPE_USAGE_STATIC,
> +      PIPE_USAGE_DEFAULT,
>        sizeof(struct vertex2f) * 4
>     );
>     quad.user_buffer = NULL;
> @@ -98,7 +98,7 @@ vl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height)
>     (
>        pipe->screen,
>        PIPE_BIND_VERTEX_BUFFER,
> -      PIPE_USAGE_STATIC,
> +      PIPE_USAGE_DEFAULT,
>        sizeof(struct vertex2s) * width * height
>     );
>     pos.user_buffer = NULL;
> diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
> index 092a031..5e0ae0e 100644
> --- a/src/gallium/auxiliary/vl/vl_video_buffer.c
> +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
> @@ -427,7 +427,7 @@ vl_video_buffer_create(struct pipe_context *pipe,
>     result = vl_video_buffer_create_ex
>     (
>        pipe, &templat, resource_formats,
> -      1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_STATIC
> +      1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_DEFAULT
>     );
>  
>  
> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
> index 3e97c56..fb4aaad 100644
> --- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
> @@ -234,7 +234,7 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
>     template.height0 = reply->height;
>     template.depth0 = 1;
>     template.array_size = 1;
> -   template.usage = PIPE_USAGE_STATIC;
> +   template.usage = PIPE_USAGE_DEFAULT;
>     template.bind = PIPE_BIND_RENDER_TARGET;
>     template.flags = 0;
>  
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 5932e3b..290bbea 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -351,7 +351,6 @@ no matter which hint they got.
>    not expected to be mapped after the first upload.
>  * ``PIPE_USAGE_DYNAMIC``: Expect frequent write-only CPU access. What is
>    uploaded is expected to be used at least several times by the GPU.
> -* ``PIPE_USAGE_STATIC``: Same as PIPE_USAGE_DEFAULT.
>  * ``PIPE_USAGE_STREAM``: Expect frequent write-only CPU access. What is
>    uploaded is expected to be used only once by the GPU.
>  * ``PIPE_USAGE_STAGING``: Optimized for fast CPU access.
> diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
> index 0b21530..5b0b93b 100644
> --- a/src/gallium/drivers/nouveau/nouveau_buffer.c
> +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
> @@ -626,7 +626,6 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
>        switch (buffer->base.usage) {
>        case PIPE_USAGE_DEFAULT:
>        case PIPE_USAGE_IMMUTABLE:
> -      case PIPE_USAGE_STATIC:
>           buffer->domain = NOUVEAU_BO_VRAM;
>           break;
>        case PIPE_USAGE_DYNAMIC:
> diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
> index f72a096..8795c9d 100644
> --- a/src/gallium/drivers/nouveau/nouveau_video.c
> +++ b/src/gallium/drivers/nouveau/nouveau_video.c
> @@ -811,7 +811,7 @@ nouveau_video_buffer_create(struct pipe_context *pipe,
>     templ.depth0 = 1;
>     templ.array_size = 1;
>     templ.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
> -   templ.usage = PIPE_USAGE_STATIC;
> +   templ.usage = PIPE_USAGE_DEFAULT;
>     templ.flags = NOUVEAU_RESOURCE_FLAG_LINEAR;
>  
>     buffer->resources[0] = pipe->screen->resource_create(pipe->screen, &templ);
> diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
> index 696a61d..cc9ea8a 100644
> --- a/src/gallium/drivers/r300/r300_blit.c
> +++ b/src/gallium/drivers/r300/r300_blit.c
> @@ -772,7 +772,7 @@ static void r300_msaa_resolve(struct pipe_context *pipe,
>      templ.height0 = info->src.resource->height0;
>      templ.depth0 = 1;
>      templ.array_size = 1;
> -    templ.usage = PIPE_USAGE_STATIC;
> +    templ.usage = PIPE_USAGE_DEFAULT;
>      templ.flags = R300_RESOURCE_FORCE_MICROTILING;
>  
>      tmp = screen->resource_create(screen, &templ);
> diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
> index 5627aaf..e28dbfb 100644
> --- a/src/gallium/drivers/r300/r300_context.c
> +++ b/src/gallium/drivers/r300/r300_context.c
> @@ -451,7 +451,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
>          memset(&vb, 0, sizeof(vb));
>          vb.target = PIPE_BUFFER;
>          vb.format = PIPE_FORMAT_R8_UNORM;
> -        vb.usage = PIPE_USAGE_STATIC;
> +        vb.usage = PIPE_USAGE_DEFAULT;
>          vb.width0 = sizeof(float) * 16;
>          vb.height0 = 1;
>          vb.depth0 = 1;
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index d2686ed..6018861 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -277,7 +277,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
>  	}
>  
>  	rctx->allocator_fetch_shader = u_suballocator_create(&rctx->b.b, 64 * 1024, 256,
> -							     0, PIPE_USAGE_STATIC, FALSE);
> +							     0, PIPE_USAGE_DEFAULT, FALSE);
>  	if (!rctx->allocator_fetch_shader)
>  		goto fail;
>  
> @@ -636,7 +636,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
>  	templ.array_size = 1;
>  	templ.target = PIPE_TEXTURE_2D;
>  	templ.format = PIPE_FORMAT_R8G8B8A8_UNORM;
> -	templ.usage = PIPE_USAGE_STATIC;
> +	templ.usage = PIPE_USAGE_DEFAULT;
>  
>  	struct r600_resource *res = r600_resource(rscreen->screen.resource_create(&rscreen->screen, &templ));
>  	unsigned char *map = ws->buffer_map(res->cs_buf, NULL, PIPE_TRANSFER_WRITE);
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index a0d527b..3857898 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -1244,7 +1244,7 @@ static struct r600_resource *r600_buffer_create_helper(struct r600_screen *rscre
>  	buffer.target = PIPE_BUFFER;
>  	buffer.format = PIPE_FORMAT_R8_UNORM;
>  	buffer.bind = PIPE_BIND_CUSTOM;
> -	buffer.usage = PIPE_USAGE_STATIC;
> +	buffer.usage = PIPE_USAGE_DEFAULT;
>  	buffer.flags = 0;
>  	buffer.width0 = size;
>  	buffer.height0 = 1;
> diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c
> index 300bccb..8616404 100644
> --- a/src/gallium/drivers/r600/r600_uvd.c
> +++ b/src/gallium/drivers/r600/r600_uvd.c
> @@ -75,7 +75,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
>  	template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH);
>  	template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT);
>  
> -	vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_STATIC, 0);
> +	vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_DEFAULT, 0);
>  	if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced)
>  		templ.bind = PIPE_BIND_LINEAR;
>  	resources[0] = (struct r600_texture *)
> @@ -84,7 +84,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
>  		goto error;
>  
>  	if (resource_formats[1] != PIPE_FORMAT_NONE) {
> -		vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_STATIC, 1);
> +		vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_DEFAULT, 1);
>  		if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced)
>  			templ.bind = PIPE_BIND_LINEAR;
>  		resources[1] = (struct r600_texture *)
> @@ -94,7 +94,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
>  	}
>  
>  	if (resource_formats[2] != PIPE_FORMAT_NONE) {
> -		vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_STATIC, 2);
> +		vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_DEFAULT, 2);
>  		if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced)
>  			templ.bind = PIPE_BIND_LINEAR;
>  		resources[2] = (struct r600_texture *)
> diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
> index 98ecbae..aee8a51 100644
> --- a/src/gallium/drivers/radeon/r600_buffer_common.c
> +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
> @@ -115,7 +115,6 @@ bool r600_init_resource(struct r600_common_screen *rscreen,
>  		res->domains = RADEON_DOMAIN_GTT;
>  		break;
>  	case PIPE_USAGE_DEFAULT:
> -	case PIPE_USAGE_STATIC:
>  	case PIPE_USAGE_IMMUTABLE:
>  	default:
>  		/* Not listing GTT here improves performance in some apps. */
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 307bb47..8ff077a 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -66,7 +66,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
>  	r600_query_init(rctx);
>  
>  	rctx->allocator_so_filled_size = u_suballocator_create(&rctx->b, 4096, 4,
> -							       0, PIPE_USAGE_STATIC, TRUE);
> +							       0, PIPE_USAGE_DEFAULT, TRUE);
>  	if (!rctx->allocator_so_filled_size)
>  		return false;
>  
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index a168e85..17895f5 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -453,7 +453,7 @@ void r600_texture_init_cmask(struct r600_common_screen *rscreen,
>  
>  	rtex->cmask_buffer = (struct r600_resource *)
>  		pipe_buffer_create(&rscreen->b, PIPE_BIND_CUSTOM,
> -				   PIPE_USAGE_STATIC, rtex->cmask.size);
> +				   PIPE_USAGE_DEFAULT, rtex->cmask.size);
>  	if (rtex->cmask_buffer == NULL) {
>  		rtex->cmask.size = 0;
>  	}
> @@ -587,7 +587,7 @@ static void r600_texture_allocate_htile(struct r600_common_screen *rscreen,
>  	/* XXX don't allocate it separately */
>  	rtex->htile_buffer = (struct r600_resource*)
>  			     pipe_buffer_create(&rscreen->b, PIPE_BIND_CUSTOM,
> -						PIPE_USAGE_STATIC, htile_size);
> +						PIPE_USAGE_DEFAULT, htile_size);
>  	if (rtex->htile_buffer == NULL) {
>  		/* this is not a fatal error as we can still keep rendering
>  		 * without htile buffer */
> @@ -868,7 +868,7 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
>  	resource.array_size = texture->array_size;
>  	resource.last_level = texture->last_level;
>  	resource.nr_samples = texture->nr_samples;
> -	resource.usage = staging ? PIPE_USAGE_STAGING : PIPE_USAGE_STATIC;
> +	resource.usage = staging ? PIPE_USAGE_STAGING : PIPE_USAGE_DEFAULT;
>  	resource.bind = texture->bind & ~PIPE_BIND_DEPTH_STENCIL;
>  	resource.flags = texture->flags | R600_RESOURCE_FLAG_FLUSHED_DEPTH;
>  
> @@ -902,7 +902,7 @@ static void r600_init_temp_resource_from_box(struct pipe_resource *res,
>  	res->height0 = box->height;
>  	res->depth0 = 1;
>  	res->array_size = 1;
> -	res->usage = flags & R600_RESOURCE_FLAG_TRANSFER ? PIPE_USAGE_STAGING : PIPE_USAGE_STATIC;
> +	res->usage = flags & R600_RESOURCE_FLAG_TRANSFER ? PIPE_USAGE_STAGING : PIPE_USAGE_DEFAULT;
>  	res->flags = flags;
>  
>  	/* We must set the correct texture target and dimensions for a 3D box. */
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index f717371..d45bc80 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -126,7 +126,7 @@ static void si_init_descriptors(struct si_context *sctx,
>  
>  	desc->buffer = (struct r600_resource*)
>  		pipe_buffer_create(sctx->b.b.screen, PIPE_BIND_CUSTOM,
> -				   PIPE_USAGE_STATIC,
> +				   PIPE_USAGE_DEFAULT,
>  				   SI_NUM_CONTEXTS * desc->context_size);
>  
>  	r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx, desc->buffer, RADEON_USAGE_READWRITE);
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index d1a5ba9..e8428d3 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -183,7 +183,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void *
>  	 * with a NULL buffer). We need to use a dummy buffer instead. */
>  	if (sctx->b.chip_class == CIK) {
>  		sctx->null_const_buf.buffer = pipe_buffer_create(screen, PIPE_BIND_CONSTANT_BUFFER,
> -								 PIPE_USAGE_STATIC, 16);
> +								 PIPE_USAGE_DEFAULT, 16);
>  		sctx->null_const_buf.buffer_size = sctx->null_const_buf.buffer->width0;
>  
>  		for (shader = 0; shader < SI_NUM_SHADERS; shader++) {
> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
> index 7c8fe76..480e3f8 100644
> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
> @@ -548,13 +548,13 @@ static void si_init_gs_rings(struct si_context *sctx)
>  
>  	sctx->esgs_ring.buffer =
>  		pipe_buffer_create(sctx->b.b.screen, PIPE_BIND_CUSTOM,
> -				   PIPE_USAGE_STATIC, size);
> +				   PIPE_USAGE_DEFAULT, size);
>  	sctx->esgs_ring.buffer_size = size;
>  
>  	size = 64 * 1024 * 1024;
>  	sctx->gsvs_ring.buffer =
>  		pipe_buffer_create(sctx->b.b.screen, PIPE_BIND_CUSTOM,
> -				   PIPE_USAGE_STATIC, size);
> +				   PIPE_USAGE_DEFAULT, size);
>  	sctx->gsvs_ring.buffer_size = size;
>  
>  	if (sctx->b.chip_class >= CIK) {
> diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c
> index f0d1427..9c5907a 100644
> --- a/src/gallium/drivers/radeonsi/si_uvd.c
> +++ b/src/gallium/drivers/radeonsi/si_uvd.c
> @@ -61,7 +61,7 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
>  	template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH);
>  	template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT);
>  
> -	vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_STATIC, 0);
> +	vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_DEFAULT, 0);
>  	/* TODO: get tiling working */
>  	templ.bind = PIPE_BIND_LINEAR;
>  	resources[0] = (struct r600_texture *)
> @@ -70,7 +70,7 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
>  		goto error;
>  
>  	if (resource_formats[1] != PIPE_FORMAT_NONE) {
> -		vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_STATIC, 1);
> +		vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_DEFAULT, 1);
>  		templ.bind = PIPE_BIND_LINEAR;
>  		resources[1] = (struct r600_texture *)
>  			pipe->screen->resource_create(pipe->screen, &templ);
> @@ -79,7 +79,7 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
>  	}
>  
>  	if (resource_formats[2] != PIPE_FORMAT_NONE) {
> -		vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_STATIC, 2);
> +		vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_DEFAULT, 2);
>  		templ.bind = PIPE_BIND_LINEAR;
>  		resources[2] = (struct r600_texture *)
>  			pipe->screen->resource_create(pipe->screen, &templ);
> diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c
> index 89a5dc1..d4d7720 100644
> --- a/src/gallium/drivers/svga/svga_draw_arrays.c
> +++ b/src/gallium/drivers/svga/svga_draw_arrays.c
> @@ -50,7 +50,7 @@ generate_indices(struct svga_hwtnl *hwtnl,
>     void *dst_map = NULL;
>  
>     dst = pipe_buffer_create(pipe->screen,
> -                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STATIC, size);
> +                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
>     if (dst == NULL)
>        goto fail;
>  
> diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c
> index 411b8d9..3384095 100644
> --- a/src/gallium/drivers/svga/svga_draw_elements.c
> +++ b/src/gallium/drivers/svga/svga_draw_elements.c
> @@ -58,7 +58,7 @@ translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src,
>     size = index_size * nr;
>  
>     dst = pipe_buffer_create(pipe->screen,
> -                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STATIC, size);
> +                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
>     if (dst == NULL)
>        goto fail;
>  
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 1c550f8..ebd00ce 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -389,7 +389,6 @@ enum pipe_flush_flags {
>  #define PIPE_USAGE_DYNAMIC        2 /* uploaded data is used multiple times */
>  #define PIPE_USAGE_STREAM         3 /* uploaded data is used once */
>  #define PIPE_USAGE_STAGING        4 /* fast CPU access */
> -#define PIPE_USAGE_STATIC         5 /* same as DEFAULT, will be removed */
>  
>  
>  /**
> diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c
> index 335c224..a068921 100644
> --- a/src/gallium/state_trackers/vdpau/bitmap.c
> +++ b/src/gallium/state_trackers/vdpau/bitmap.c
> @@ -77,7 +77,7 @@ vlVdpBitmapSurfaceCreate(VdpDevice device,
>     res_tmpl.depth0 = 1;
>     res_tmpl.array_size = 1;
>     res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
> -   res_tmpl.usage = frequently_accessed ? PIPE_USAGE_DYNAMIC : PIPE_USAGE_STATIC;
> +   res_tmpl.usage = frequently_accessed ? PIPE_USAGE_DYNAMIC : PIPE_USAGE_DEFAULT;
>  
>     pipe_mutex_lock(dev->mutex);
>  
> diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
> index aa7e997..5882bb2 100644
> --- a/src/gallium/state_trackers/vdpau/output.c
> +++ b/src/gallium/state_trackers/vdpau/output.c
> @@ -80,7 +80,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device,
>     res_tmpl.depth0 = 1;
>     res_tmpl.array_size = 1;
>     res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
> -   res_tmpl.usage = PIPE_USAGE_STATIC;
> +   res_tmpl.usage = PIPE_USAGE_DEFAULT;
>  
>     pipe_mutex_lock(dev->mutex);
>  
> diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
> index 35795fc..931924c 100644
> --- a/src/gallium/state_trackers/vega/renderer.c
> +++ b/src/gallium/state_trackers/vega/renderer.c
> @@ -173,7 +173,7 @@ static void renderer_set_mvp(struct renderer *renderer,
>     pipe_resource_reference(&cbuf, NULL);
>     cbuf = pipe_buffer_create(renderer->pipe->screen,
>                               PIPE_BIND_CONSTANT_BUFFER,
> -                             PIPE_USAGE_STATIC,
> +                             PIPE_USAGE_DEFAULT,
>                               sizeof(consts));
>     if (cbuf) {
>        pipe_buffer_write(renderer->pipe, cbuf,
> @@ -476,7 +476,7 @@ static void renderer_set_custom_fs(struct renderer *renderer,
>           pipe_resource_reference(&cbuf, NULL);
>  
>           cbuf = pipe_buffer_create(renderer->pipe->screen,
> -               PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STATIC,
> +               PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_DEFAULT,
>                 const_buffer_len);
>           pipe_buffer_write(renderer->pipe, cbuf, 0,
>                 const_buffer_len, const_buffer);
> diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c
> index b775509..9ba78be 100644
> --- a/src/gallium/state_trackers/xa/xa_renderer.c
> +++ b/src/gallium/state_trackers/xa/xa_renderer.c
> @@ -380,7 +380,7 @@ renderer_set_constants(struct xa_context *r,
>  
>      pipe_resource_reference(cbuf, NULL);
>      *cbuf = pipe_buffer_create(r->pipe->screen,
> -			       PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STATIC,
> +			       PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_DEFAULT,
>  			       param_bytes);
>  
>      if (*cbuf) {
> diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
> index 2a4bdbf..3497399 100644
> --- a/src/gallium/state_trackers/xvmc/subpicture.c
> +++ b/src/gallium/state_trackers/xvmc/subpicture.c
> @@ -270,7 +270,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
>        tex_templ.format = PIPE_FORMAT_R8G8B8X8_UNORM;
>        tex_templ.width0 = subpicture->num_palette_entries;
>        tex_templ.height0 = 1;
> -      tex_templ.usage = PIPE_USAGE_STATIC;
> +      tex_templ.usage = PIPE_USAGE_DEFAULT;
>  
>        tex = pipe->screen->resource_create(pipe->screen, &tex_templ);
>  
> diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c
> index 75225b6..9b85cf7 100644
> --- a/src/gallium/tests/graw/fs-fragcoord.c
> +++ b/src/gallium/tests/graw/fs-fragcoord.c
> @@ -70,7 +70,7 @@ set_vertices(void)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c
> index faa43f3..a0c8a2d 100644
> --- a/src/gallium/tests/graw/fs-frontface.c
> +++ b/src/gallium/tests/graw/fs-frontface.c
> @@ -92,7 +92,7 @@ set_vertices(void)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
> index 0560e31..e335bc6 100644
> --- a/src/gallium/tests/graw/fs-test.c
> +++ b/src/gallium/tests/graw/fs-test.c
> @@ -177,7 +177,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/fs-write-z.c b/src/gallium/tests/graw/fs-write-z.c
> index 74ab2f4..eabae64 100644
> --- a/src/gallium/tests/graw/fs-write-z.c
> +++ b/src/gallium/tests/graw/fs-write-z.c
> @@ -96,7 +96,7 @@ set_vertices(void)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
> index 879bf3e..c522a8f 100644
> --- a/src/gallium/tests/graw/gs-test.c
> +++ b/src/gallium/tests/graw/gs-test.c
> @@ -255,13 +255,13 @@ static void set_vertices( void )
>     if (draw_strip) {
>        vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                   PIPE_BIND_VERTEX_BUFFER,
> -                                                 PIPE_USAGE_STATIC,
> +                                                 PIPE_USAGE_DEFAULT,
>                                                   sizeof(vertices_strip),
>                                                   vertices_strip);
>     } else {
>        vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                   PIPE_BIND_VERTEX_BUFFER,
> -                                                 PIPE_USAGE_STATIC,
> +                                                 PIPE_USAGE_DEFAULT,
>                                                   sizeof(vertices),
>                                                   vertices);
>     }
> diff --git a/src/gallium/tests/graw/occlusion-query.c b/src/gallium/tests/graw/occlusion-query.c
> index 51d6326..f5227e3 100644
> --- a/src/gallium/tests/graw/occlusion-query.c
> +++ b/src/gallium/tests/graw/occlusion-query.c
> @@ -96,7 +96,7 @@ set_vertices(struct vertex *vertices, unsigned bytes)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                bytes,
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
> index 2e248a8..4d5a597 100644
> --- a/src/gallium/tests/graw/quad-sample.c
> +++ b/src/gallium/tests/graw/quad-sample.c
> @@ -103,7 +103,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c
> index 9e4407e..5f90166 100644
> --- a/src/gallium/tests/graw/quad-tex.c
> +++ b/src/gallium/tests/graw/quad-tex.c
> @@ -59,7 +59,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
> index 754ada6..fce3683 100644
> --- a/src/gallium/tests/graw/shader-leak.c
> +++ b/src/gallium/tests/graw/shader-leak.c
> @@ -93,7 +93,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c
> index dce9118..af989d7 100644
> --- a/src/gallium/tests/graw/tex-srgb.c
> +++ b/src/gallium/tests/graw/tex-srgb.c
> @@ -75,7 +75,7 @@ set_vertices(struct vertex *verts, unsigned num_verts)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                num_verts * sizeof(struct vertex),
>                                                verts);
>  
> diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c
> index 910a8ca..e45b848 100644
> --- a/src/gallium/tests/graw/tex-swizzle.c
> +++ b/src/gallium/tests/graw/tex-swizzle.c
> @@ -57,7 +57,7 @@ static void set_vertices(void)
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
> index 24de12b..ab92dd0 100644
> --- a/src/gallium/tests/graw/tri-gs.c
> +++ b/src/gallium/tests/graw/tri-gs.c
> @@ -94,7 +94,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
> index 55bc3a5..d7cad81 100644
> --- a/src/gallium/tests/graw/tri-instanced.c
> +++ b/src/gallium/tests/graw/tri-instanced.c
> @@ -137,7 +137,7 @@ static void set_vertices( void )
>     vbuf[0].buffer_offset = 0;
>     vbuf[0].buffer = pipe_buffer_create_with_data(ctx,
>                                                   PIPE_BIND_VERTEX_BUFFER,
> -                                                 PIPE_USAGE_STATIC,
> +                                                 PIPE_USAGE_DEFAULT,
>                                                   sizeof(vertices),
>                                                   vertices);
>  
> @@ -146,7 +146,7 @@ static void set_vertices( void )
>     vbuf[1].buffer_offset = 0;
>     vbuf[1].buffer = pipe_buffer_create_with_data(ctx,
>                                                   PIPE_BIND_VERTEX_BUFFER,
> -                                                 PIPE_USAGE_STATIC,
> +                                                 PIPE_USAGE_DEFAULT,
>                                                   sizeof(inst_data),
>                                                   inst_data);
>  
> @@ -155,7 +155,7 @@ static void set_vertices( void )
>     /* index data */
>     ibuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_INDEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(indices),
>                                                indices);
>     ibuf.offset = 0;
> diff --git a/src/gallium/tests/graw/tri-large.c b/src/gallium/tests/graw/tri-large.c
> index 67d49b0..4ccb7c5 100644
> --- a/src/gallium/tests/graw/tri-large.c
> +++ b/src/gallium/tests/graw/tri-large.c
> @@ -61,7 +61,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c
> index f1d8142..0968387 100644
> --- a/src/gallium/tests/graw/tri.c
> +++ b/src/gallium/tests/graw/tri.c
> @@ -58,7 +58,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
> index 0e9fc53..187759d 100644
> --- a/src/gallium/tests/graw/vs-test.c
> +++ b/src/gallium/tests/graw/vs-test.c
> @@ -176,7 +176,7 @@ static void set_vertices( void )
>     vbuf.buffer_offset = 0;
>     vbuf.buffer = pipe_buffer_create_with_data(ctx,
>                                                PIPE_BIND_VERTEX_BUFFER,
> -                                              PIPE_USAGE_STATIC,
> +                                              PIPE_USAGE_DEFAULT,
>                                                sizeof(vertices),
>                                                vertices);
>  
> diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
> index 5ed741b..1d52aff 100644
> --- a/src/gallium/tests/trivial/quad-tex.c
> +++ b/src/gallium/tests/trivial/quad-tex.c
> @@ -131,7 +131,7 @@ static void init_prog(struct program *p)
>  		};
>  
>  		p->vbuf = pipe_buffer_create(p->screen, PIPE_BIND_VERTEX_BUFFER,
> -					     PIPE_USAGE_STATIC, sizeof(vertices));
> +					     PIPE_USAGE_DEFAULT, sizeof(vertices));
>  		pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(vertices), vertices);
>  	}
>  
> diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
> index f93c3f7..062d45d 100644
> --- a/src/gallium/tests/trivial/tri.c
> +++ b/src/gallium/tests/trivial/tri.c
> @@ -122,7 +122,7 @@ static void init_prog(struct program *p)
>  		};
>  
>  		p->vbuf = pipe_buffer_create(p->screen, PIPE_BIND_VERTEX_BUFFER,
> -					     PIPE_USAGE_STATIC, sizeof(vertices));
> +					     PIPE_USAGE_DEFAULT, sizeof(vertices));
>  		pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(vertices), vertices);
>  	}
>  
> diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
> index 765c973..50fb071 100644
> --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
> +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
> @@ -235,7 +235,7 @@ st_bufferobj_data(struct gl_context *ctx,
>        if (storageFlags & GL_CLIENT_STORAGE_BIT)
>           pipe_usage = PIPE_USAGE_STAGING;
>        else
> -         pipe_usage = PIPE_USAGE_STATIC;
> +         pipe_usage = PIPE_USAGE_IMMUTABLE;

I don't think this is correct.  st_obj->Base.Immutable means that the
data store is immutable in the sense that it can't be re-allocated by
calling glBufferData or glBufferStorage.  But the content of the data store
is only immutable if the client didn't set the GL_DYNAMIC_STORAGE BIT.
Otherwise the buffer object may still be mapped or updated with calls
to glBufferSubData.

>     }
>     else {
>        /* BufferData */
> @@ -243,7 +243,8 @@ st_bufferobj_data(struct gl_context *ctx,
>        case GL_STATIC_DRAW:
>        case GL_STATIC_READ:
>        case GL_STATIC_COPY:
> -         pipe_usage = PIPE_USAGE_STATIC;
> +      default:
> +         pipe_usage = PIPE_USAGE_DEFAULT;
>           break;
>        case GL_DYNAMIC_DRAW:
>        case GL_DYNAMIC_READ:
> @@ -255,8 +256,6 @@ st_bufferobj_data(struct gl_context *ctx,
>        case GL_STREAM_COPY:
>           pipe_usage = PIPE_USAGE_STREAM;
>           break;
> -      default:
> -         pipe_usage = PIPE_USAGE_DEFAULT;
>        }
>     }
>  
> 



More information about the mesa-dev mailing list