add fence interfaces and buffer create flags to pipe_winsys
authorkeithw <keithw@keithw-laptop.(none)>
Mon, 19 Nov 2007 20:05:38 +0000 (20:05 +0000)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Sun, 9 Dec 2007 14:03:33 +0000 (14:03 +0000)
src/mesa/pipe/i915simple/i915_prim_vbuf.c
src/mesa/pipe/p_defines.h
src/mesa/pipe/p_winsys.h
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_cb_bufferobjects.c
src/mesa/state_tracker/st_draw.c

index 08ac5b672c3438681417a630ce07cf8302495d6c..571ad40595a3c6bd3534ee5cb335df11922a3e4d 100644 (file)
@@ -99,7 +99,7 @@ i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
 
    /* FIXME: handle failure */
    assert(!i915->vbo);
-   i915->vbo = winsys->buffer_create(winsys, 64);
+   i915->vbo = winsys->buffer_create(winsys, 64, 0, 0);
    winsys->buffer_data( winsys, i915->vbo, 
                         size, NULL, 
                         I915_BUFFER_USAGE_LIT_VERTEX );
index a85360548619ee68995d37bbb2cd9a6c0e6eb2e7..8dce3aba904244c085be9cccb4149b5de99329e4 100644 (file)
 /**
  * Buffer access flags
  */
-#define PIPE_BUFFER_FLAG_READ    0x1
-#define PIPE_BUFFER_FLAG_WRITE   0x2
+#define PIPE_BUFFER_FLAG_READ         0x1
+#define PIPE_BUFFER_FLAG_WRITE        0x2
+#define PIPE_BUFFER_FLAG_MEM_LOCAL    0x4
+#define PIPE_BUFFER_FLAG_CACHED       0x8
+#define PIPE_BUFFER_FLAG_CUSTOM       (1<<16)
+
 
 
 /**
index 438e8bdb63b84e2882bf2ccfcddc19a54515bfb4..f46807995d8541902f09134e3b4b7ccb87f90b7b 100644 (file)
@@ -59,6 +59,7 @@ struct pipe_surface;
 
 /** Opaque type */
 struct pipe_buffer_handle;
+struct pipe_fence_handle;
 
 struct pipe_winsys
 {
@@ -104,8 +105,10 @@ struct pipe_winsys
     * systems must then implement that interface (rather than the
     * other way around...).
     */
-   struct pipe_buffer_handle *(*buffer_create)(struct pipe_winsys *sws, 
-                                              unsigned alignment );
+   struct pipe_buffer_handle *(*buffer_create)( struct pipe_winsys *sws, 
+                                               unsigned alignment,
+                                                unsigned flags,
+                                                unsigned hint );
 
    /** Create a buffer that wraps user-space data */
    struct pipe_buffer_handle *(*user_buffer_create)(struct pipe_winsys *sws, 
@@ -136,24 +139,39 @@ struct pipe_winsys
     * usage argument is only an optimization hint, not a guarantee, therefore 
     * proper behavior must be observed in all circumstances.
     */
-   void (*buffer_data)(struct pipe_winsys *sws, 
+   int (*buffer_data)(struct pipe_winsys *sws, 
                       struct pipe_buffer_handle *buf,
                       unsigned size, const void *data,
                       unsigned usage);
 
    /** Modify some or all of the data contained in a buffer's data store */
-   void (*buffer_subdata)(struct pipe_winsys *sws, 
-                         struct pipe_buffer_handle *buf,
-                         unsigned long offset, 
-                         unsigned long size, 
-                         const void *data);
+   int (*buffer_subdata)(struct pipe_winsys *sws, 
+                         struct pipe_buffer_handle *buf,
+                         unsigned long offset, 
+                         unsigned long size, 
+                         const void *data);
 
    /** Query some or all of the data contained in a buffer's data store */
-   void (*buffer_get_subdata)(struct pipe_winsys *sws, 
-                             struct pipe_buffer_handle *buf,
-                             unsigned long offset, 
-                             unsigned long size, 
-                             void *data);
+   int (*buffer_get_subdata)(struct pipe_winsys *sws, 
+                             struct pipe_buffer_handle *buf,
+                             unsigned long offset, 
+                             unsigned long size, 
+                             void *data);
+
+
+   void (*fence_reference)( struct pipe_winsys *sws,
+                            struct pipe_fence_handle **ptr,
+                            struct pipe_fence_handle *fence );
+
+   int (*fence_signalled)( struct pipe_winsys *sws,
+                           struct pipe_fence_handle *fence,
+                           unsigned flag );
+
+
+   int (*fence_finish)( struct pipe_winsys *sws,
+                        struct pipe_fence_handle *fence,
+                        unsigned flag );
+
 
 };
 
index 446250c226c237698a7f8135c50b3c8fb1c82fb5..57f5ec68d209ea541b96978f9d0dfc0061e46704 100644 (file)
@@ -70,7 +70,7 @@ void st_upload_constants( struct st_context *st,
       _mesa_load_state_parameters(st->ctx, params);
 
       if (!cbuf->buffer)   
-        cbuf->buffer = ws->buffer_create(ws, 1);
+        cbuf->buffer = ws->buffer_create(ws, 1, 0, 0);
 
       if (0)
       {
index 99e1eb3c7a64515ed0e810b6e0985d528ea87454..872248cdb5b5b11074ea9a73afaf58c4a4ad4eb2 100644 (file)
@@ -63,7 +63,7 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
 
    _mesa_initialize_buffer_object(&st_obj->Base, name, target);
 
-   st_obj->buffer = st->pipe->winsys->buffer_create( st->pipe->winsys, 32 );
+   st_obj->buffer = st->pipe->winsys->buffer_create( st->pipe->winsys, 32, 0, 0 );
 
    return &st_obj->Base;
 }
index 32dcd73c46c8b74d1f837b8251c992a527a32f66..0a5725ae6a99cfaf334df7e7e57b4d9b3a738db0 100644 (file)
@@ -95,7 +95,7 @@ static void
 create_default_attribs_buffer(struct st_context *st)
 {
    struct pipe_context *pipe = st->pipe;
-   st->default_attrib_buffer = pipe->winsys->buffer_create( pipe->winsys, 32 );
+   st->default_attrib_buffer = pipe->winsys->buffer_create( pipe->winsys, 32, 0, 0 );
 }
 
 
@@ -288,7 +288,7 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
    }
 
    /* XXX create one-time */
-   vbuf = pipe->winsys->buffer_create(pipe->winsys, 32);
+   vbuf = pipe->winsys->buffer_create(pipe->winsys, 32, 0, 0);
    pipe->winsys->buffer_data(pipe->winsys, vbuf, 
                              vertex_bytes, verts,
                              PIPE_BUFFER_USAGE_VERTEX);