[Mesa-dev] [PATCH 1/2] gallium: remove PIPE_USAGE_IMMUTABLE, use STATIC instead

Marek Olšák maraeo at gmail.com
Mon Aug 13 06:51:19 PDT 2012


---
 src/gallium/auxiliary/vl/vl_idct.c                 |    2 +-
 src/gallium/auxiliary/vl/vl_zscan.c                |    4 ++--
 src/gallium/docs/source/screen.rst                 |    3 +--
 src/gallium/drivers/i915/i915_resource_buffer.c    |    2 +-
 src/gallium/drivers/llvmpipe/lp_texture.c          |    2 +-
 src/gallium/drivers/nouveau/nouveau_buffer.c       |    3 +--
 src/gallium/drivers/r300/r300_context.c            |    4 ++--
 src/gallium/drivers/r600/compute_memory_pool.c     |    2 +-
 .../drivers/r600/evergreen_compute_internal.c      |    2 +-
 src/gallium/drivers/r600/r600_asm.c                |    2 +-
 src/gallium/drivers/r600/r600_buffer.c             |    1 -
 src/gallium/drivers/r600/r600_shader.c             |    2 +-
 src/gallium/drivers/softpipe/sp_texture.c          |    2 +-
 src/gallium/drivers/svga/svga_resource_buffer.c    |    2 +-
 src/gallium/include/pipe/p_defines.h               |    7 +++----
 .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp      |    2 +-
 16 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index f848a78..358f78f 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -705,7 +705,7 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale)
    tex_templ.height0 = 8;
    tex_templ.depth0 = 1;
    tex_templ.array_size = 1;
-   tex_templ.usage = PIPE_USAGE_IMMUTABLE;
+   tex_templ.usage = PIPE_USAGE_STATIC;
    tex_templ.bind = PIPE_BIND_SAMPLER_VIEW;
    tex_templ.flags = 0;
 
diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
index 1f0939b..a50e335 100644
--- a/src/gallium/auxiliary/vl/vl_zscan.c
+++ b/src/gallium/auxiliary/vl/vl_zscan.c
@@ -374,7 +374,7 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks
    res_tmpl.height0 = VL_BLOCK_HEIGHT;
    res_tmpl.depth0 = 1;
    res_tmpl.array_size = 1;
-   res_tmpl.usage = PIPE_USAGE_IMMUTABLE;
+   res_tmpl.usage = PIPE_USAGE_STATIC;
    res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
 
    res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
@@ -498,7 +498,7 @@ vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
    res_tmpl.height0 = VL_BLOCK_HEIGHT;
    res_tmpl.depth0 = 2;
    res_tmpl.array_size = 1;
-   res_tmpl.usage = PIPE_USAGE_IMMUTABLE;
+   res_tmpl.usage = PIPE_USAGE_STATIC;
    res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
 
    res = zscan->pipe->screen->resource_create(zscan->pipe->screen, &res_tmpl);
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 4eb5b32..3c95c96 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -293,8 +293,7 @@ The PIPE_USAGE enums are hints about the expected usage pattern of a resource.
 
 * ``PIPE_USAGE_DEFAULT``: Expect many uploads to the resource, intermixed with draws.
 * ``PIPE_USAGE_DYNAMIC``: Expect many uploads to the resource, intermixed with draws.
-* ``PIPE_USAGE_STATIC``: Same as immutable (?)
-* ``PIPE_USAGE_IMMUTABLE``: Resource will not be changed after first upload.
+* ``PIPE_USAGE_STATIC``: Resource will not be changed after first upload.
 * ``PIPE_USAGE_STREAM``: Upload will be followed by draw, followed by upload, ...
 
 
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index 77c0345..2b5eea8 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -176,7 +176,7 @@ i915_user_buffer_create(struct pipe_screen *screen,
    buf->b.vtbl = &i915_buffer_vtbl;
    buf->b.b.screen = screen;
    buf->b.b.format = PIPE_FORMAT_R8_UNORM; /* ?? */
-   buf->b.b.usage = PIPE_USAGE_IMMUTABLE;
+   buf->b.b.usage = PIPE_USAGE_STATIC;
    buf->b.b.bind = bind;
    buf->b.b.flags = 0;
    buf->b.b.width0 = bytes;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 4495e8d..0c6a7d9 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -764,7 +764,7 @@ llvmpipe_user_buffer_create(struct pipe_screen *screen,
    buffer->base.screen = screen;
    buffer->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */
    buffer->base.bind = bind_flags;
-   buffer->base.usage = PIPE_USAGE_IMMUTABLE;
+   buffer->base.usage = PIPE_USAGE_STATIC;
    buffer->base.flags = 0;
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index e83aae0..eae2748 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -370,7 +370,6 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
        (screen->vidmem_bindings & screen->sysmem_bindings)) {
       switch (buffer->base.usage) {
       case PIPE_USAGE_DEFAULT:
-      case PIPE_USAGE_IMMUTABLE:
       case PIPE_USAGE_STATIC:
          buffer->domain = NOUVEAU_BO_VRAM;
          break;
@@ -417,7 +416,7 @@ nouveau_user_buffer_create(struct pipe_screen *pscreen, void *ptr,
    buffer->vtbl = &nouveau_buffer_vtbl;
    buffer->base.screen = pscreen;
    buffer->base.format = PIPE_FORMAT_R8_UNORM;
-   buffer->base.usage = PIPE_USAGE_IMMUTABLE;
+   buffer->base.usage = PIPE_USAGE_STATIC;
    buffer->base.bind = bind;
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 8cbe246..8944c7e 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -426,7 +426,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         rtempl.target = PIPE_TEXTURE_2D;
         rtempl.format = PIPE_FORMAT_I8_UNORM;
         rtempl.bind = PIPE_BIND_SAMPLER_VIEW;
-        rtempl.usage = PIPE_USAGE_IMMUTABLE;
+        rtempl.usage = PIPE_USAGE_STATIC;
         rtempl.width0 = 1;
         rtempl.height0 = 1;
         rtempl.depth0 = 1;
@@ -446,7 +446,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         vb.target = PIPE_BUFFER;
         vb.format = PIPE_FORMAT_R8_UNORM;
         vb.bind = PIPE_BIND_VERTEX_BUFFER;
-        vb.usage = PIPE_USAGE_IMMUTABLE;
+        vb.usage = PIPE_USAGE_STATIC;
         vb.width0 = sizeof(float) * 16;
         vb.height0 = 1;
         vb.depth0 = 1;
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index cf48bad..187dc84 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -55,7 +55,7 @@ static struct r600_resource_texture * create_pool_texture(struct r600_screen * s
 	templ.target = PIPE_TEXTURE_1D;
 	templ.format = PIPE_FORMAT_R32_UINT;
 	templ.bind = PIPE_BIND_CUSTOM;
-	templ.usage = PIPE_USAGE_IMMUTABLE;
+	templ.usage = PIPE_USAGE_STATIC;
 	templ.flags = 0;
 	templ.width0 = size_in_dw;
 	templ.height0 = 1;
diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c
index c95bb3c..11a4905 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.c
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.c
@@ -631,7 +631,7 @@ struct r600_resource* r600_compute_buffer_alloc_vram(
 	struct pipe_resource * buffer = pipe_buffer_create(
 			(struct pipe_screen*) screen,
 			PIPE_BIND_CUSTOM,
-			PIPE_USAGE_IMMUTABLE,
+			PIPE_USAGE_STATIC,
 			size);
 
 	return (struct r600_resource *)buffer;
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 2341bec..da9efb2 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2822,7 +2822,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_context *rctx, struct r6
 	ve->fetch_shader = (struct r600_resource*)
 			pipe_buffer_create(rctx->context.screen,
 					   PIPE_BIND_CUSTOM,
-					   PIPE_USAGE_IMMUTABLE, ve->fs_size);
+					   PIPE_USAGE_STATIC, ve->fs_size);
 	if (ve->fetch_shader == NULL) {
 		r600_bytecode_clear(&bc);
 		return -ENOMEM;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 27dddcc..20d6bed 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -217,7 +217,6 @@ bool r600_init_resource(struct r600_screen *rscreen,
 			break;
 		case PIPE_USAGE_DEFAULT:
 		case PIPE_USAGE_STATIC:
-		case PIPE_USAGE_IMMUTABLE:
 		default:
 			initial_domain = RADEON_DOMAIN_VRAM;
 			break;
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index cec167c..6f79475 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -67,7 +67,7 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s
 	/* copy new shader */
 	if (shader->bo == NULL) {
 		shader->bo = (struct r600_resource*)
-			pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, rshader->bc.ndw * 4);
+			pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_STATIC, rshader->bc.ndw * 4);
 		if (shader->bo == NULL) {
 			return -ENOMEM;
 		}
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 978fbe1..81b31b8 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -470,7 +470,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
    spr->base.screen = screen;
    spr->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */
    spr->base.bind = bind_flags;
-   spr->base.usage = PIPE_USAGE_IMMUTABLE;
+   spr->base.usage = PIPE_USAGE_STATIC;
    spr->base.flags = 0;
    spr->base.width0 = bytes;
    spr->base.height0 = 1;
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index fa713ee..ab69c79 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -388,7 +388,7 @@ svga_user_buffer_create(struct pipe_screen *screen,
    sbuf->b.vtbl = &svga_buffer_vtbl;
    sbuf->b.b.screen = screen;
    sbuf->b.b.format = PIPE_FORMAT_R8_UNORM; /* ?? */
-   sbuf->b.b.usage = PIPE_USAGE_IMMUTABLE;
+   sbuf->b.b.usage = PIPE_USAGE_STATIC;
    sbuf->b.b.bind = bind;
    sbuf->b.b.width0 = bytes;
    sbuf->b.b.height0 = 1;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 59c6382..6b5bc0e 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -338,10 +338,9 @@ enum pipe_transfer_usage {
  */
 #define PIPE_USAGE_DEFAULT        0 /* many uploads, draws intermixed */
 #define PIPE_USAGE_DYNAMIC        1 /* many uploads, draws intermixed */
-#define PIPE_USAGE_STATIC         2 /* same as immutable?? */
-#define PIPE_USAGE_IMMUTABLE      3 /* no change after first upload */
-#define PIPE_USAGE_STREAM         4 /* upload, draw, upload, draw */
-#define PIPE_USAGE_STAGING        5 /* supports data transfers from the GPU to the CPU */
+#define PIPE_USAGE_STATIC         2 /* no change after first upload */
+#define PIPE_USAGE_STREAM         3 /* upload, draw, upload, draw */
+#define PIPE_USAGE_STAGING        4 /* supports data transfers from the GPU to the CPU */
 
 
 /**
diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
index e531b0e..8b9ad91 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
@@ -53,7 +53,7 @@ unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT] =
 unsigned d3d11_to_pipe_usage[D3D11_USAGE_COUNT] =
 {
 	PIPE_USAGE_DEFAULT,
-	PIPE_USAGE_IMMUTABLE,
+	PIPE_USAGE_STATIC,
 	PIPE_USAGE_DYNAMIC,
 	PIPE_USAGE_STAGING
 };
-- 
1.7.9.5



More information about the mesa-dev mailing list