Module: Mesa
Branch: gallium-resources
Commit: ce418533be752dbeb164e7ff82a99483048e482b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce418533be752dbeb164e7ff82a99483048e482b

Author: Keith Whitwell <[email protected]>
Date:   Sun Mar 14 11:26:07 2010 +0000

gallium: softpipe runs gears with pipe_resources

---

 configs/default                           |    2 +-
 src/gallium/auxiliary/util/u_inlines.h    |    2 +-
 src/gallium/auxiliary/util/u_tile.c       |   14 +++---
 src/gallium/drivers/softpipe/sp_texture.c |    5 +-
 src/gallium/drivers/trace/Makefile        |    1 -
 src/gallium/drivers/trace/SConscript      |    1 -
 src/gallium/drivers/trace/tr_buffer.c     |   76 -----------------------------
 src/gallium/drivers/trace/tr_buffer.h     |   70 --------------------------
 src/gallium/include/pipe/p_screen.h       |    3 +-
 9 files changed, 14 insertions(+), 160 deletions(-)

diff --git a/configs/default b/configs/default
index 8fbf8dd..245198d 100644
--- a/configs/default
+++ b/configs/default
@@ -98,7 +98,7 @@ EGL_DRIVERS_DIRS = glx
 # Gallium directories and 
 GALLIUM_DIRS = auxiliary drivers state_trackers
 GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
-GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
+GALLIUM_DRIVERS_DIRS = softpipe # trace identity svga i915 i965 r300
 GALLIUM_DRIVERS = $(foreach 
DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 GALLIUM_WINSYS_DIRS = null xlib drm
 GALLIUM_TARGET_DIRS = libgl-xlib
diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index d068faf..67a5d45 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -146,7 +146,7 @@ static INLINE struct pipe_resource *
 pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size,
                         unsigned usage )
 {
-   return screen->user_buffer_create(screen, ptr, size);
+   return screen->user_buffer_create(screen, ptr, size, usage);
 }
 
 static INLINE void *
diff --git a/src/gallium/auxiliary/util/u_tile.c 
b/src/gallium/auxiliary/util/u_tile.c
index 5eabe5a..26bb477 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -55,7 +55,7 @@ pipe_get_tile_raw(struct pipe_context *pipe,
    if (dst_stride == 0)
       dst_stride = util_format_get_stride(pt->resource->format, w);
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    src = pipe->transfer_map(pipe, pt);
@@ -84,7 +84,7 @@ pipe_put_tile_raw(struct pipe_context *pipe,
    if (src_stride == 0)
       src_stride = util_format_get_stride(format, w);
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    dst = pipe->transfer_map(pipe, pt);
@@ -1255,7 +1255,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
    void *packed;
    enum pipe_format format = pt->resource->format;
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    packed = MALLOC(util_format_get_nblocks(format, w, h) * 
util_format_get_blocksize(format));
@@ -1293,7 +1293,7 @@ pipe_get_tile_swizzle(struct pipe_context *pipe,
    uint i;
    float rgba01[6];
 
-   if (pipe_clip_tile(x, y, &w, &h, pt)) {
+   if (u_clip_tile(x, y, &w, &h, &pt->box)) {
       return;
    }
 
@@ -1347,7 +1347,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
    void *packed;
    enum pipe_format format = pt->resource->format;
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    packed = MALLOC(util_format_get_nblocks(format, w, h) * 
util_format_get_blocksize(format));
@@ -1449,7 +1449,7 @@ pipe_get_tile_z(struct pipe_context *pipe,
    uint i, j;
    enum pipe_format format = pt->resource->format;
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    map = (ubyte *)pipe->transfer_map(pipe, pt);
@@ -1534,7 +1534,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
    uint i, j;
    enum pipe_format format = pt->resource->format;
 
-   if (pipe_clip_tile(x, y, &w, &h, pt))
+   if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
    map = (ubyte *)pipe->transfer_map(pipe, pt);
diff --git a/src/gallium/drivers/softpipe/sp_texture.c 
b/src/gallium/drivers/softpipe/sp_texture.c
index 0d7f7cb..f7f2589 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -383,7 +383,8 @@ softpipe_transfer_unmap(struct pipe_context *pipe,
 static struct pipe_resource *
 softpipe_user_buffer_create(struct pipe_screen *screen,
                             void *ptr,
-                            unsigned bytes)
+                            unsigned bytes,
+                           unsigned usage)
 {
    struct softpipe_resource *buffer;
 
@@ -393,7 +394,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
 
    pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.screen = screen;
-   buffer->base.usage = PIPE_BUFFER_USAGE_CPU_READ;
+   buffer->base.usage = PIPE_BUFFER_USAGE_CPU_READ | usage;
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
diff --git a/src/gallium/drivers/trace/Makefile 
b/src/gallium/drivers/trace/Makefile
index dd6831c..78f6347 100644
--- a/src/gallium/drivers/trace/Makefile
+++ b/src/gallium/drivers/trace/Makefile
@@ -4,7 +4,6 @@ include $(TOP)/configs/current
 LIBNAME = trace
 
 C_SOURCES = \
-       tr_buffer.c \
        tr_context.c \
        tr_dump.c \
        tr_dump_state.c \
diff --git a/src/gallium/drivers/trace/SConscript 
b/src/gallium/drivers/trace/SConscript
index c1675d1..5f1fb17 100644
--- a/src/gallium/drivers/trace/SConscript
+++ b/src/gallium/drivers/trace/SConscript
@@ -5,7 +5,6 @@ env = env.Clone()
 trace = env.ConvenienceLibrary(
     target = 'trace',
     source = [
-        'tr_buffer.c',
         'tr_context.c',
         'tr_drm.c',
         'tr_dump.c',
diff --git a/src/gallium/drivers/trace/tr_buffer.c 
b/src/gallium/drivers/trace/tr_buffer.c
deleted file mode 100644
index fa2ac06..0000000
--- a/src/gallium/drivers/trace/tr_buffer.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "util/u_inlines.h"
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-
-#include "tr_buffer.h"
-
-struct pipe_buffer *
-trace_buffer_create(struct trace_screen *tr_scr,
-                    struct pipe_buffer *buffer)
-{
-   struct trace_buffer *tr_buf;
-
-   if(!buffer)
-      goto error;
-
-   assert(buffer->screen == tr_scr->screen);
-
-   tr_buf = CALLOC_STRUCT(trace_buffer);
-   if(!tr_buf)
-      goto error;
-
-   memcpy(&tr_buf->base, buffer, sizeof(struct pipe_buffer));
-
-   pipe_reference_init(&tr_buf->base.reference, 1);
-   tr_buf->base.screen = &tr_scr->base;
-   tr_buf->buffer = buffer;
-
-   trace_screen_add_to_list(tr_scr, buffers, tr_buf);
-
-   return &tr_buf->base;
-
-error:
-   pipe_buffer_reference(&buffer, NULL);
-   return NULL;
-}
-
-
-void
-trace_buffer_destroy(struct trace_screen *tr_scr,
-                     struct pipe_buffer *buffer)
-{
-   struct trace_buffer *tr_buf = trace_buffer(buffer);
-
-   trace_screen_remove_from_list(tr_scr, buffers, tr_buf);
-
-   pipe_buffer_reference(&tr_buf->buffer, NULL);
-   FREE(tr_buf);
-}
diff --git a/src/gallium/drivers/trace/tr_buffer.h 
b/src/gallium/drivers/trace/tr_buffer.h
deleted file mode 100644
index 1a2d0b9..0000000
--- a/src/gallium/drivers/trace/tr_buffer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef TR_BUFFER_H_
-#define TR_BUFFER_H_
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_state.h"
-
-#include "tr_screen.h"
-
-
-struct trace_buffer
-{
-   struct pipe_buffer base;
-
-   struct pipe_buffer *buffer;
-
-   struct tr_list list;
-
-   void *map;
-   boolean range_flushed;
-};
-
-
-static INLINE struct trace_buffer *
-trace_buffer(struct pipe_buffer *buffer)
-{
-   if(!buffer)
-      return NULL;
-   (void)trace_screen(buffer->screen);
-   return (struct trace_buffer *)buffer;
-}
-
-
-struct pipe_buffer *
-trace_buffer_create(struct trace_screen *tr_scr,
-                    struct pipe_buffer *buffer);
-
-void
-trace_buffer_destroy(struct trace_screen *tr_scr,
-                     struct pipe_buffer *buffer);
-
-
-#endif
diff --git a/src/gallium/include/pipe/p_screen.h 
b/src/gallium/include/pipe/p_screen.h
index a2cc0a8..cc9cebc 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -167,7 +167,8 @@ struct pipe_screen {
     */
    struct pipe_resource *(*user_buffer_create)(struct pipe_screen *screen,
                                               void *ptr,
-                                              unsigned bytes);
+                                              unsigned bytes,
+                                              unsigned usage);
 
    /**
     * Create a video surface suitable for use as a decoding target by the

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to