i915: Use pipe_buffer_* inlines as much as possible.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 4 Sep 2008 00:34:04 +0000 (09:34 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 4 Sep 2008 00:38:23 +0000 (09:38 +0900)
src/gallium/drivers/i915simple/i915_context.c
src/gallium/drivers/i915simple/i915_prim_vbuf.c
src/gallium/drivers/i915simple/i915_screen.c

index c6776716a2fa7933d8e355a376055947e570fe1d..4d9f2f030d727fc7d7c62ddb5952a73e79df5c26 100644 (file)
@@ -72,7 +72,7 @@ i915_draw_range_elements(struct pipe_context *pipe,
     */
    for (i = 0; i < i915->num_vertex_buffers; i++) {
       void *buf
-         = pipe->winsys->buffer_map(pipe->winsys,
+         = pipe_buffer_map(pipe->screen,
                                     i915->vertex_buffer[i].buffer,
                                     PIPE_BUFFER_USAGE_CPU_READ);
       draw_set_mapped_vertex_buffer(draw, i, buf);
@@ -80,7 +80,7 @@ i915_draw_range_elements(struct pipe_context *pipe,
    /* Map index buffer, if present */
    if (indexBuffer) {
       void *mapped_indexes
-         = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
+         = pipe_buffer_map(pipe->screen, indexBuffer,
                                     PIPE_BUFFER_USAGE_CPU_READ);
       draw_set_mapped_element_buffer_range(draw, indexSize,
                                           min_index,
@@ -105,11 +105,11 @@ i915_draw_range_elements(struct pipe_context *pipe,
     * unmap vertex/index buffers
     */
    for (i = 0; i < i915->num_vertex_buffers; i++) {
-      pipe->winsys->buffer_unmap(pipe->winsys, i915->vertex_buffer[i].buffer);
+      pipe_buffer_unmap(pipe->screen, i915->vertex_buffer[i].buffer);
       draw_set_mapped_vertex_buffer(draw, i, NULL);
    }
    if (indexBuffer) {
-      pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
+      pipe_buffer_unmap(pipe->screen, indexBuffer);
       draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL);
    }
 
index 9397a2ca1a855e87112e80ca137c578ca119706c..4fda1ab64f54606fae4ea3db547d1c210dcb324c 100644 (file)
@@ -115,7 +115,7 @@ i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
 {
    struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
    struct i915_context *i915 = i915_render->i915;
-   struct pipe_winsys *winsys = i915->pipe.winsys;
+   struct pipe_screen *screen = i915->pipe.screen;
    size_t size = (size_t)vertex_size * (size_t)nr_vertices;
 
    /* FIXME: handle failure */
@@ -124,20 +124,20 @@ i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
    if (i915_render->vbo_size > size + i915_render->vbo_offset && !i915->vbo_flushed) {
    } else {
       i915->vbo_flushed = 0;
-      winsys_buffer_reference(winsys, &i915_render->vbo, NULL);
+      pipe_buffer_reference(screen, &i915_render->vbo, NULL);
    }
 
    if (!i915_render->vbo) {
       i915_render->vbo_size = MAX2(size, i915_render->vbo_alloc_size);
       i915_render->vbo_offset = 0;
-      i915_render->vbo = winsys->buffer_create(winsys,
-                                              64,
-                                              I915_BUFFER_USAGE_LIT_VERTEX,
-                                              i915_render->vbo_size);
-      i915_render->vbo_ptr = winsys->buffer_map(winsys,
-                                               i915_render->vbo,
-                                               PIPE_BUFFER_USAGE_CPU_WRITE);
-      winsys->buffer_unmap(winsys, i915_render->vbo);
+      i915_render->vbo = pipe_buffer_create(screen,
+                                            64,
+                                            I915_BUFFER_USAGE_LIT_VERTEX,
+                                            i915_render->vbo_size);
+      i915_render->vbo_ptr = pipe_buffer_map(screen,
+                                             i915_render->vbo,
+                                             PIPE_BUFFER_USAGE_CPU_WRITE);
+      pipe_buffer_unmap(screen, i915_render->vbo);
    }
 
    i915->vbo = i915_render->vbo;
@@ -488,7 +488,7 @@ static struct vbuf_render *
 i915_vbuf_render_create( struct i915_context *i915 )
 {
    struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render);
-   struct pipe_winsys *winsys = i915->pipe.winsys;
+   struct pipe_screen *screen = i915->pipe.screen;
 
    i915_render->i915 = i915;
    
@@ -510,14 +510,14 @@ i915_vbuf_render_create( struct i915_context *i915 )
    i915_render->vbo_alloc_size = 128 * 4096;
    i915_render->vbo_size = i915_render->vbo_alloc_size;
    i915_render->vbo_offset = 0;
-   i915_render->vbo = winsys->buffer_create(winsys,
-                                           64,
-                                           I915_BUFFER_USAGE_LIT_VERTEX,
-                                           i915_render->vbo_size);
-   i915_render->vbo_ptr = winsys->buffer_map(winsys,
-                                            i915_render->vbo,
-                                            PIPE_BUFFER_USAGE_CPU_WRITE);
-   winsys->buffer_unmap(winsys, i915_render->vbo);
+   i915_render->vbo = pipe_buffer_create(screen,
+                                         64,
+                                         I915_BUFFER_USAGE_LIT_VERTEX,
+                                         i915_render->vbo_size);
+   i915_render->vbo_ptr = pipe_buffer_map(screen,
+                                          i915_render->vbo,
+                                          PIPE_BUFFER_USAGE_CPU_WRITE);
+   pipe_buffer_unmap(screen, i915_render->vbo);
 
    return &i915_render->base;
 }
index e9e40c3f0b2f313c7c877df32c2d2465efcad312..1c976082df7f38e32578d21793c88bd696f4ddd0 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "util/u_memory.h"
 #include "pipe/p_winsys.h"
+#include "pipe/p_inlines.h"
 #include "util/u_string.h"
 
 #include "i915_reg.h"
@@ -207,7 +208,7 @@ i915_surface_map( struct pipe_screen *screen,
                   struct pipe_surface *surface,
                   unsigned flags )
 {
-   char *map = screen->winsys->buffer_map( screen->winsys, surface->buffer, flags );
+   char *map = pipe_buffer_map( screen, surface->buffer, flags );
    if (map == NULL)
       return NULL;
 
@@ -226,7 +227,7 @@ static void
 i915_surface_unmap(struct pipe_screen *screen,
                    struct pipe_surface *surface)
 {
-   screen->winsys->buffer_unmap( screen->winsys, surface->buffer );
+   pipe_buffer_unmap( screen, surface->buffer );
 }