[Mesa-dev] [PATCH 2/2] gallium: remove questionable PIPE_USAGE_DEFAULT, use STATIC instead
Marek Olšák
maraeo at gmail.com
Mon Aug 13 06:51:20 PDT 2012
Despite the comment and documentation, drivers interpreted it as STATIC.
---
src/gallium/auxiliary/vl/vl_winsys_xsp.c | 2 +-
src/gallium/docs/source/screen.rst | 5 ++---
src/gallium/drivers/nouveau/nouveau_buffer.c | 1 -
src/gallium/drivers/r600/r600_buffer.c | 1 -
src/gallium/include/pipe/p_defines.h | 7 +++----
.../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp | 2 +-
src/mesa/state_tracker/st_cb_bufferobjects.c | 2 +-
src/mesa/state_tracker/st_texture.c | 2 +-
8 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/gallium/auxiliary/vl/vl_winsys_xsp.c b/src/gallium/auxiliary/vl/vl_winsys_xsp.c
index ce3a37f..59f9b6c 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_xsp.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_xsp.c
@@ -86,7 +86,7 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
templat.width0 = width;
templat.height0 = height;
templat.depth0 = 1;
- templat.usage = PIPE_USAGE_DEFAULT;
+ templat.usage = PIPE_USAGE_STATIC;
templat.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET;
templat.flags = 0;
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 3c95c96..ce3e2ae 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -291,11 +291,10 @@ PIPE_USAGE_*
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``: Resource will not be changed after first upload.
+* ``PIPE_USAGE_DYNAMIC``: Expect many uploads to the resource, intermixed with draws.
* ``PIPE_USAGE_STREAM``: Upload will be followed by draw, followed by upload, ...
-
+* ``PIPE_USAGE_STAGING``: Support data transfers from the GPU to the CPU.
Methods
-------
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index eae2748..41567cd 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -369,7 +369,6 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
if (buffer->base.bind &
(screen->vidmem_bindings & screen->sysmem_bindings)) {
switch (buffer->base.usage) {
- case PIPE_USAGE_DEFAULT:
case PIPE_USAGE_STATIC:
buffer->domain = NOUVEAU_BO_VRAM;
break;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 20d6bed..570d0d7 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -215,7 +215,6 @@ bool r600_init_resource(struct r600_screen *rscreen,
case PIPE_USAGE_STAGING:
initial_domain = RADEON_DOMAIN_GTT;
break;
- case PIPE_USAGE_DEFAULT:
case PIPE_USAGE_STATIC:
default:
initial_domain = RADEON_DOMAIN_VRAM;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 6b5bc0e..5c17bf7 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -336,11 +336,10 @@ enum pipe_transfer_usage {
/* Hint about the expected lifecycle of a resource.
*/
-#define PIPE_USAGE_DEFAULT 0 /* many uploads, draws intermixed */
+#define PIPE_USAGE_STATIC 0 /* no change after first upload */
#define PIPE_USAGE_DYNAMIC 1 /* many uploads, draws intermixed */
-#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 */
+#define PIPE_USAGE_STREAM 2 /* upload, draw, upload, draw */
+#define PIPE_USAGE_STAGING 3 /* 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 8b9ad91..eaebe17 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
@@ -52,7 +52,7 @@ unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT] =
unsigned d3d11_to_pipe_usage[D3D11_USAGE_COUNT] =
{
- PIPE_USAGE_DEFAULT,
+ PIPE_USAGE_STATIC,
PIPE_USAGE_STATIC,
PIPE_USAGE_DYNAMIC,
PIPE_USAGE_STAGING
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index b47a2d8..e97a748 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -219,7 +219,7 @@ st_bufferobj_data(struct gl_context *ctx,
pipe_usage = PIPE_USAGE_STREAM;
break;
default:
- pipe_usage = PIPE_USAGE_DEFAULT;
+ pipe_usage = PIPE_USAGE_STATIC;
}
pipe_resource_reference( &st_obj->buffer, NULL );
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 9627a61..fff8fe2 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -87,7 +87,7 @@ st_texture_create(struct st_context *st,
pt.height0 = height0;
pt.depth0 = depth0;
pt.array_size = (target == PIPE_TEXTURE_CUBE ? 6 : layers);
- pt.usage = PIPE_USAGE_DEFAULT;
+ pt.usage = PIPE_USAGE_STATIC;
pt.bind = bind;
pt.flags = 0;
--
1.7.9.5
More information about the mesa-dev
mailing list