Mesa (master): gallium: Add texture usage information to surface_buffer_create

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Tue Aug 11 17:47:59 UTC 2009


Module: Mesa
Branch: master
Commit: a41a253ce3b667fc8ad1bfbafce9e3e633667383
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a41a253ce3b667fc8ad1bfbafce9e3e633667383

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Tue Aug 11 18:33:58 2009 +0100

gallium: Add texture usage information to surface_buffer_create

	We need aditional meta data about the usage of the surface
	in softpipe because we need to be able tell the diffrence
	between PRIMARY and DISPLAY_TARGET surfaces.

---

 src/gallium/auxiliary/util/u_simple_screen.c       |    3 ++-
 src/gallium/auxiliary/util/u_timed_winsys.c        |    3 ++-
 src/gallium/drivers/identity/id_screen.c           |    2 ++
 src/gallium/drivers/softpipe/sp_texture.c          |    2 ++
 src/gallium/drivers/trace/tr_screen.c              |    3 +++
 .../include/pipe/internal/p_winsys_screen.h        |    1 +
 src/gallium/include/pipe/p_screen.h                |    1 +
 7 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_simple_screen.c b/src/gallium/auxiliary/util/u_simple_screen.c
index 8114b53..f01296b 100644
--- a/src/gallium/auxiliary/util/u_simple_screen.c
+++ b/src/gallium/auxiliary/util/u_simple_screen.c
@@ -65,12 +65,13 @@ pass_surface_buffer_create(struct pipe_screen *screen,
                            unsigned width, unsigned height,
                            enum pipe_format format,
                            unsigned usage,
+                           unsigned tex_usage,
                            unsigned *stride)
 {
    struct pipe_buffer *buffer =
       screen->winsys->surface_buffer_create(screen->winsys,
                                                 width, height,
-                                                format, usage, stride);
+                                                format, usage, tex_usage, stride);
 
    buffer->screen = screen;
 
diff --git a/src/gallium/auxiliary/util/u_timed_winsys.c b/src/gallium/auxiliary/util/u_timed_winsys.c
index 77b2a3a..178acdc 100644
--- a/src/gallium/auxiliary/util/u_timed_winsys.c
+++ b/src/gallium/auxiliary/util/u_timed_winsys.c
@@ -212,13 +212,14 @@ timed_surface_buffer_create(struct pipe_winsys *winsys,
                               unsigned width, unsigned height,
                               enum pipe_format format, 
                               unsigned usage,
+                              unsigned tex_usage,
                               unsigned *stride)
 {
    struct pipe_winsys *backend = timed_winsys(winsys)->backend;
    uint64_t start = time_start();
 
    struct pipe_buffer *ret = backend->surface_buffer_create( backend, width, height, 
-                                                             format, usage, stride );
+                                                             format, usage, tex_usage, stride );
 
    time_finish(winsys, start, 7, __FUNCTION__);
    
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 259f1be..2643963 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -289,6 +289,7 @@ identity_screen_surface_buffer_create(struct pipe_screen *_screen,
                                       unsigned height,
                                       enum pipe_format format,
                                       unsigned usage,
+                                      unsigned tex_usage,
                                       unsigned *stride)
 {
    struct identity_screen *id_screen = identity_screen(_screen);
@@ -300,6 +301,7 @@ identity_screen_surface_buffer_create(struct pipe_screen *_screen,
                                           height,
                                           format,
                                           usage,
+                                          tex_usage,
                                           stride);
 
    if (result)
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index b7e52af..70f0932 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -95,6 +95,7 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
 {
    unsigned usage = (PIPE_BUFFER_USAGE_CPU_READ_WRITE |
                      PIPE_BUFFER_USAGE_GPU_READ_WRITE);
+   unsigned tex_usage = spt->base.tex_usage;
 
    spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);  
    spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);  
@@ -104,6 +105,7 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
                                                 spt->base.height[0],
                                                 spt->base.format,
                                                 usage,
+                                                tex_usage,
                                                 &spt->stride[0]);
 
    return spt->buffer != NULL;
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 5b1e26a..26f1c04 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -462,6 +462,7 @@ trace_screen_surface_buffer_create(struct pipe_screen *_screen,
                                    unsigned width, unsigned height,
                                    enum pipe_format format,
                                    unsigned usage,
+                                   unsigned tex_usage,
                                    unsigned *pstride)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
@@ -476,11 +477,13 @@ trace_screen_surface_buffer_create(struct pipe_screen *_screen,
    trace_dump_arg(uint, height);
    trace_dump_arg(format, format);
    trace_dump_arg(uint, usage);
+   trace_dump_arg(uint, tex_usage);
 
    result = screen->surface_buffer_create(screen,
                                           width, height,
                                           format,
                                           usage,
+                                          tex_usage,
                                           pstride);
 
    stride = *pstride;
diff --git a/src/gallium/include/pipe/internal/p_winsys_screen.h b/src/gallium/include/pipe/internal/p_winsys_screen.h
index f4a29e6..a1542da 100644
--- a/src/gallium/include/pipe/internal/p_winsys_screen.h
+++ b/src/gallium/include/pipe/internal/p_winsys_screen.h
@@ -140,6 +140,7 @@ struct pipe_winsys
 						unsigned width, unsigned height,
 						enum pipe_format format,
 						unsigned usage,
+						unsigned tex_usage,
 						unsigned *stride);
 
 
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 6cbdd75..3f30c52 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -194,6 +194,7 @@ struct pipe_screen {
 						unsigned width, unsigned height,
 						enum pipe_format format,
 						unsigned usage,
+						unsigned tex_usage,
 						unsigned *stride);
 
 




More information about the mesa-commit mailing list