gallium: Have pipe_buffer_* receive a pipe_screen instead of a pipe_context.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 3 Sep 2008 02:48:05 +0000 (11:48 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 3 Sep 2008 02:53:39 +0000 (11:53 +0900)
We want to use the pipe_buffer_* inlines everywhere, but a pipe context
is not always available nor is it needed.

27 files changed:
src/gallium/auxiliary/util/u_draw_quad.c
src/gallium/drivers/cell/ppu/cell_state_shader.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/i915simple/i915_prim_vbuf.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_state_pool.c
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_state_fs.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/include/pipe/p_inlines.h
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_softpipe_winsys.c
src/gallium/winsys/drm/intel/dri/intel_screen.c
src/gallium/winsys/egl_xlib/sw_winsys.c
src/gallium/winsys/gdi/wmesa.c
src/gallium/winsys/xlib/xm_winsys.c
src/gallium/winsys/xlib/xm_winsys_aub.c
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_bufferobjects.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_gen_mipmap.c

index bf143815d8b762442df0dc3948ee964c124f69a7..d643ee9ab75fdcb1383c70c11a99803ec2c2bb09 100644 (file)
@@ -127,6 +127,6 @@ util_draw_texquad(struct pipe_context *pipe,
          util_draw_vertex_buffer(pipe, vbuf, PIPE_PRIM_TRIANGLE_FAN, 4, 2);
       }
 
-      pipe_buffer_reference(pipe->winsys, &vbuf, NULL);
+      pipe_buffer_reference(pipe->screen, &vbuf, NULL);
    }
 }
index 86bcad05e9ed773b64f9d57bc47be5609ad4a701..3d1b887da942e425fc2c8dc63a62ec504aaa2a0e 100644 (file)
@@ -166,7 +166,7 @@ cell_set_constant_buffer(struct pipe_context *pipe,
    assert(index == 0);
 
    /* note: reference counting */
-   pipe_buffer_reference(ws,
+   winsys_buffer_reference(ws,
                         &cell->constants[shader].buffer,
                         buf->buffer);
    cell->constants[shader].size = buf->size;
index 5a0942bbd6e76b24657b8c7401d963ad42f70b1b..5c01aa21b85cf6e663a424bd60fc5f14f83c731b 100644 (file)
@@ -130,7 +130,7 @@ cell_texture_release_screen(struct pipe_screen *screen,
       DBG("%s deleting %p\n", __FUNCTION__, (void *) spt);
       */
 
-      pipe_buffer_reference(screen->winsys, &spt->buffer, NULL);
+      pipe_buffer_reference(screen, &spt->buffer, NULL);
 
       FREE(spt);
    }
@@ -161,7 +161,7 @@ cell_get_tex_surface_screen(struct pipe_screen *screen,
    if (ps) {
       assert(ps->refcount);
       assert(ps->winsys);
-      pipe_buffer_reference(ws, &ps->buffer, spt->buffer);
+      winsys_buffer_reference(ws, &ps->buffer, spt->buffer);
       ps->format = pt->format;
       ps->block = pt->block;
       ps->width = pt->width[level];
index e4ece550985b1803fa499b00ac2d03d98548e46d..9397a2ca1a855e87112e80ca137c578ca119706c 100644 (file)
@@ -124,7 +124,7 @@ 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;
-      pipe_buffer_reference(winsys, &i915_render->vbo, NULL);
+      winsys_buffer_reference(winsys, &i915_render->vbo, NULL);
    }
 
    if (!i915_render->vbo) {
index a853a5a3f687c7c8a159aaa1c5428f35dd55ca9d..bd87217063c4a6e1b2232341a7375bdd3f790b90 100644 (file)
@@ -645,7 +645,7 @@ i915_texture_release(struct pipe_screen *screen,
       DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
       */
 
-      pipe_buffer_reference(screen->winsys, &tex->buffer, NULL);
+      pipe_buffer_reference(screen, &tex->buffer, NULL);
 
       for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
          if (tex->image_offset[i])
@@ -684,7 +684,7 @@ i915_get_tex_surface(struct pipe_screen *screen,
       ps->refcount = 1;
       ps->winsys = ws;
       pipe_texture_reference(&ps->texture, pt);
-      pipe_buffer_reference(ws, &ps->buffer, tex->buffer);
+      pipe_buffer_reference(screen, &ps->buffer, tex->buffer);
       ps->format = pt->format;
       ps->width = pt->width[level];
       ps->height = pt->height[level];
@@ -728,7 +728,7 @@ i915_texture_blanket(struct pipe_screen * screen,
    i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
    i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
 
-   pipe_buffer_reference(screen->winsys, &tex->buffer, buffer);
+   pipe_buffer_reference(screen, &tex->buffer, buffer);
 
    return &tex->base;
 }
@@ -756,7 +756,7 @@ i915_tex_surface_release(struct pipe_screen *screen,
       }
 
       pipe_texture_reference(&surf->texture, NULL);
-      pipe_buffer_reference(screen->winsys, &surf->buffer, NULL);
+      pipe_buffer_reference(screen, &surf->buffer, NULL);
       FREE(surf);
    }
 
index 78d4c0e411b69254b7cd31a3eef3c1dfa3b0d16e..d0dc1ef74d667e3f0875fa8a558696428beb553b 100644 (file)
@@ -103,7 +103,7 @@ static void brw_destroy_pool( struct brw_context *brw,
 {
    struct brw_mem_pool *pool = &brw->pool[pool_id];
 
-   pipe_buffer_reference( pool->brw->pipe.winsys,
+   winsys_buffer_reference( pool->brw->pipe.winsys,
                          &pool->buffer,
                          NULL );
 }
index 05eda9d1f2625ca8b42c474293d60e34dfaf6235..cc0c665e021099a1d6ca9c04cabf750cb4dd99a2 100644 (file)
@@ -330,7 +330,7 @@ brw_texture_release_screen(struct pipe_screen *screen,
       DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
       */
 
-      pipe_buffer_reference(ws, &tex->buffer, NULL);
+      winsys_buffer_reference(ws, &tex->buffer, NULL);
 
       for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
          if (tex->image_offset[i])
@@ -369,7 +369,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
    if (ps) {
       assert(ps->format);
       assert(ps->refcount);
-      pipe_buffer_reference(ws, &ps->buffer, tex->buffer);
+      winsys_buffer_reference(ws, &ps->buffer, tex->buffer);
       ps->format = pt->format;
       ps->width = pt->width[level];
       ps->height = pt->height[level];
index dda90f760a37b14d3cc70c1498f5d0f7fed9a744..6f12390cf798631bbb40dcd3e00b4107a09e0e6a 100644 (file)
@@ -113,7 +113,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
 
    for (i = 0; i < Elements(softpipe->constants); i++) {
       if (softpipe->constants[i].buffer) {
-         pipe_buffer_reference(ws, &softpipe->constants[i].buffer, NULL);
+         winsys_buffer_reference(ws, &softpipe->constants[i].buffer, NULL);
       }
    }
 
index 1be461b3a468b32d0a353d859f10856f1bea7b97..e5b609cf6c98b83231207e31b353ec36beab12a1 100644 (file)
@@ -152,7 +152,7 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
    assert(index == 0);
 
    /* note: reference counting */
-   pipe_buffer_reference(ws,
+   winsys_buffer_reference(ws,
                         &softpipe->constants[shader].buffer,
                         buf ? buf->buffer : NULL);
    softpipe->constants[shader].size = buf ? buf->size : 0;
index 3a737d6f7224de89b1cbfdae426e35a92a36ab74..c283e3e41085eda82ba806f2c8d2f7824f38dca4 100644 (file)
@@ -192,7 +192,7 @@ softpipe_texture_blanket(struct pipe_screen * screen,
    spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);  
    spt->stride[0] = stride[0];
 
-   pipe_buffer_reference(screen->winsys, &spt->buffer, buffer);
+   pipe_buffer_reference(screen, &spt->buffer, buffer);
 
    return &spt->base;
 }
@@ -208,7 +208,7 @@ softpipe_texture_release(struct pipe_screen *screen,
    if (--(*pt)->refcount <= 0) {
       struct softpipe_texture *spt = softpipe_texture(*pt);
 
-      pipe_buffer_reference(screen->winsys, &spt->buffer, NULL);
+      pipe_buffer_reference(screen, &spt->buffer, NULL);
       FREE(spt);
    }
    *pt = NULL;
@@ -231,7 +231,7 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
    if (ps) {
       assert(ps->refcount);
       assert(ps->winsys);
-      pipe_buffer_reference(ws, &ps->buffer, spt->buffer);
+      pipe_buffer_reference(screen, &ps->buffer, spt->buffer);
       ps->format = pt->format;
       ps->block = pt->block;
       ps->width = pt->width[level];
index 1e4b98edb4883eca0c05794968ae00e87e5807e7..d70de8e3011b0f4466239171d28a7c6fc2956d50 100644 (file)
@@ -109,7 +109,7 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
 /* XXX: thread safety issues!
  */
 static INLINE void
-pipe_buffer_reference(struct pipe_winsys *winsys,
+winsys_buffer_reference(struct pipe_winsys *winsys,
                      struct pipe_buffer **ptr,
                      struct pipe_buffer *buf)
 {
@@ -164,48 +164,48 @@ pipe_texture_release(struct pipe_texture **ptr)
  */
 
 static INLINE struct pipe_buffer *
-pipe_buffer_create( struct pipe_context *pipe,
+pipe_buffer_create( struct pipe_screen *screen,
                     unsigned alignment, unsigned usage, unsigned size )
 {
-   return pipe->winsys->buffer_create(pipe->winsys, alignment, usage, size);
+   return screen->winsys->buffer_create(screen->winsys, alignment, usage, size);
 }
 
 static INLINE struct pipe_buffer *
-pipe_user_buffer_create( struct pipe_context *pipe, void *ptr, unsigned size )
+pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size )
 {
-   return pipe->winsys->user_buffer_create(pipe->winsys, ptr, size);
+   return screen->winsys->user_buffer_create(screen->winsys, ptr, size);
 }
 
 static INLINE void
-pipe_buffer_destroy( struct pipe_context *pipe, struct pipe_buffer *buf )
+pipe_buffer_destroy( struct pipe_screen *screen, struct pipe_buffer *buf )
 {
-   pipe->winsys->buffer_destroy(pipe->winsys, buf);
+   screen->winsys->buffer_destroy(screen->winsys, buf);
 }
 
 static INLINE void *
-pipe_buffer_map(struct pipe_context *pipe,
+pipe_buffer_map(struct pipe_screen *screen,
                 struct pipe_buffer *buf,
                 unsigned usage)
 {
-   return pipe->winsys->buffer_map(pipe->winsys, buf, usage);
+   return screen->winsys->buffer_map(screen->winsys, buf, usage);
 }
 
 static INLINE void
-pipe_buffer_unmap(struct pipe_context *pipe,
+pipe_buffer_unmap(struct pipe_screen *screen,
                   struct pipe_buffer *buf)
 {
-   pipe->winsys->buffer_unmap(pipe->winsys, buf);
+   screen->winsys->buffer_unmap(screen->winsys, buf);
 }
 
 /* XXX when we're using this everywhere, get rid of
- * pipe_buffer_reference() above.
+ * winsys_buffer_reference() above.
  */
 static INLINE void
-pipe_reference_buffer(struct pipe_context *pipe,
+pipe_buffer_reference(struct pipe_screen *screen,
                      struct pipe_buffer **ptr,
                      struct pipe_buffer *buf)
 {
-   pipe_buffer_reference(pipe->winsys, ptr, buf);
+   winsys_buffer_reference(screen->winsys, ptr, buf);
 }
 
 
index 0b2621f7c31f138dbdef3628ebbac7055aaf6411..231e07cd637cd04004fc38ec189414ea7345e80b 100644 (file)
@@ -248,7 +248,7 @@ struct st_context {
       util_draw_vertex_buffer(pipe, vbuf, prim, num_verts, num_attribs);
       
 error2:
-      pipe_buffer_reference(pipe->winsys, &vbuf, NULL);
+      pipe_buffer_reference(pipe->screen, &vbuf, NULL);
 error1:
       ;
    }
index f71d85dd9b413c86857a9d5a2130fa939f8d5cc5..bd71755f0b18a159f1d2a08532c06e1fde40f692 100644 (file)
@@ -293,7 +293,7 @@ st_buffer_destroy(struct st_buffer *st_buf)
 {
    if(st_buf) {
       struct pipe_winsys *winsys = st_buf->st_dev->screen->winsys;
-      pipe_buffer_reference(winsys, &st_buf->buffer, NULL);
+      pipe_buffer_reference(pipe->screen, &st_buf->buffer, NULL);
       FREE(st_buf);
    }
 }
index 2d4f5434b359b8a1a03bcce64d11b5850801763e..f62113a4691bb8b4a2a01a8f1a57361a788b3f9e 100644 (file)
@@ -221,7 +221,7 @@ st_softpipe_surface_release(struct pipe_winsys *winsys,
    surf->refcount--;
    if (surf->refcount == 0) {
       if (surf->buffer)
-       pipe_buffer_reference(winsys, &surf->buffer, NULL);
+       winsys_buffer_reference(winsys, &surf->buffer, NULL);
       free(surf);
    }
    *s = NULL;
index 46d4861e77c0e7608fa8d2dc72789fe38048c4c7..3a486481f56d2ef4f55f1ab33d0196f4ffd8df33 100644 (file)
@@ -83,7 +83,7 @@ intelCreateSurface(struct intel_screen *intelScreen, struct pipe_winsys *winsys,
                                      buffer);
 
    /* Unref the buffer we don't need it anyways */
-   pipe_buffer_reference(screen->winsys, &buffer, NULL);
+   pipe_buffer_reference(screen, &buffer, NULL);
 
    surface = screen->get_tex_surface(screen,
                                      texture,
index ae81d7f801b9e3d8fbb43da5fd91078d2d357a61..2fd190da52e9210a247377c2ee11d746ab8f0cfb 100644 (file)
@@ -216,7 +216,7 @@ surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
    surf->refcount--;
    if (surf->refcount == 0) {
       if (surf->buffer)
-         pipe_buffer_reference(winsys, &surf->buffer, NULL);
+         winsys_buffer_reference(winsys, &surf->buffer, NULL);
       free(surf);
    }
    *s = NULL;
index 730fb1b5417920a18510406cd70906acfeecb217..ed3dd2b92775914704f354b0ae9533a7344149ee 100644 (file)
@@ -463,7 +463,7 @@ wm_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
    surf->refcount--;
    if (surf->refcount == 0) {
       if (surf->buffer)
-       pipe_buffer_reference(winsys, &surf->buffer, NULL);
+       winsys_buffer_reference(winsys, &surf->buffer, NULL);
       free(surf);
    }
    *s = NULL;
index 68ead7f528e64f00e3bc892096bd19c4ea075904..70f01e0ef8310bf6b7e83414a91ce2bf8ce3819b 100644 (file)
@@ -543,7 +543,7 @@ xm_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
    surf->refcount--;
    if (surf->refcount == 0) {
       if (surf->buffer)
-       pipe_buffer_reference(winsys, &surf->buffer, NULL);
+       winsys_buffer_reference(winsys, &surf->buffer, NULL);
       free(surf);
    }
    *s = NULL;
index 35c4ebc4ba3e86845dfd25ac9c250ae3483b8499..b7c10b6bcae6eb8f88df00611454fc43c2cac263 100644 (file)
@@ -308,7 +308,7 @@ aub_i915_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
    surf->refcount--;
    if (surf->refcount == 0) {
       if (surf->buffer)
-         pipe_buffer_reference(winsys, &surf->buffer, NULL);
+         winsys_buffer_reference(winsys, &surf->buffer, NULL);
       free(surf);
    }
    *s = NULL;
index d3aadf5074db25d696078b536444f128ac0ca7ef..d02e51cb9a51935269efefef40cf581a9f980c80 100644 (file)
@@ -73,8 +73,8 @@ void st_upload_constants( struct st_context *st,
       /* We always need to get a new buffer, to keep the drivers simple and
        * avoid gratuitous rendering synchronization.
        */
-      pipe_reference_buffer(pipe, &cbuf->buffer, NULL );
-      cbuf->buffer = pipe_buffer_create(pipe, 16, PIPE_BUFFER_USAGE_CONSTANT,
+      pipe_buffer_reference(pipe->screen, &cbuf->buffer, NULL );
+      cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
                                        paramBytes );
 
       if (0)
@@ -86,10 +86,10 @@ void st_upload_constants( struct st_context *st,
 
       /* load Mesa constants into the constant buffer */
       if (cbuf->buffer) {
-         void *map = pipe_buffer_map(pipe, cbuf->buffer,
+         void *map = pipe_buffer_map(pipe->screen, cbuf->buffer,
                                      PIPE_BUFFER_USAGE_CPU_WRITE);
          memcpy(map, params->ParameterValues, paramBytes);
-         pipe_buffer_unmap(pipe, cbuf->buffer);
+         pipe_buffer_unmap(pipe->screen, cbuf->buffer);
       }
 
       cbuf->size = paramBytes;
index a0c305d66fff89348713019fbdd9ba3c980786b1..694104f9cfb10734406b030c8d8a1a1cd07ae02c 100644 (file)
@@ -378,7 +378,7 @@ setup_bitmap_vertex_data(struct st_context *st,
    void *buf;
 
    if (!st->bitmap.vbuf) {
-      st->bitmap.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+      st->bitmap.vbuf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
                                            sizeof(st->bitmap.vertices));
    }
 
@@ -418,9 +418,9 @@ setup_bitmap_vertex_data(struct st_context *st,
    }
 
    /* put vertex data into vbuf */
-   buf = pipe_buffer_map(pipe, st->bitmap.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
+   buf = pipe_buffer_map(pipe->screen, st->bitmap.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
    memcpy(buf, st->bitmap.vertices, sizeof(st->bitmap.vertices));
-   pipe_buffer_unmap(pipe, st->bitmap.vbuf);
+   pipe_buffer_unmap(pipe->screen, st->bitmap.vbuf);
 }
 
 
@@ -779,7 +779,7 @@ st_destroy_bitmap(struct st_context *st)
    }
 
    if (st->bitmap.vbuf) {
-      pipe_buffer_destroy(pipe, st->bitmap.vbuf);
+      pipe_buffer_destroy(pipe->screen, st->bitmap.vbuf);
       st->bitmap.vbuf = NULL;
    }
 
index af79aefa96870bce5d7f80825d6f874b351c26d2..07fa2afce055e86f0fb84578fe028366e9857332 100644 (file)
@@ -78,7 +78,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
    struct st_buffer_object *st_obj = st_buffer_object(obj);
 
    if (st_obj->buffer) 
-      pipe_reference_buffer(pipe, &st_obj->buffer, NULL);
+      pipe_buffer_reference(pipe->screen, &st_obj->buffer, NULL);
 
    free(st_obj);
 }
@@ -105,9 +105,9 @@ st_bufferobj_subdata(GLcontext *ctx,
    if (offset >= st_obj->size || size > (st_obj->size - offset))
       return;
 
-   map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
+   map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
    memcpy(map + offset, data, size);
-   pipe_buffer_unmap(pipe, st_obj->buffer);
+   pipe_buffer_unmap(pipe->screen, st_obj->buffer);
 }
 
 
@@ -128,9 +128,9 @@ st_bufferobj_get_subdata(GLcontext *ctx,
    if (offset >= st_obj->size || size > (st_obj->size - offset))
       return;
 
-   map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
+   map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
    memcpy(data, map + offset, size);
-   pipe_buffer_unmap(pipe, st_obj->buffer);
+   pipe_buffer_unmap(pipe->screen, st_obj->buffer);
 }
 
 
@@ -171,9 +171,9 @@ st_bufferobj_data(GLcontext *ctx,
       buffer_usage = 0;
    }
 
-   pipe_reference_buffer( pipe, &st_obj->buffer, NULL );
+   pipe_buffer_reference( pipe->screen, &st_obj->buffer, NULL );
 
-   st_obj->buffer = pipe_buffer_create( pipe, 32, buffer_usage, size );
+   st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size );
 
    st_obj->size = size;
 
@@ -207,7 +207,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
       break;      
    }
 
-   obj->Pointer = pipe_buffer_map(pipe, st_obj->buffer, flags);
+   obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags);
    return obj->Pointer;
 }
 
@@ -221,7 +221,7 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
    struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_buffer_object *st_obj = st_buffer_object(obj);
 
-   pipe_buffer_unmap(pipe, st_obj->buffer);
+   pipe_buffer_unmap(pipe->screen, st_obj->buffer);
    obj->Pointer = NULL;
    return GL_TRUE;
 }
index e475f022d34b7bc42cd55646903fde4458ccaa38..013b9a9c9cceefeacc881cd8787a73abc95ddead 100644 (file)
@@ -116,7 +116,7 @@ st_destroy_clear(struct st_context *st)
       st->clear.vs = NULL;
    }
    if (st->clear.vbuf) {
-      pipe_buffer_destroy(pipe, st->clear.vbuf);
+      pipe_buffer_destroy(pipe->screen, st->clear.vbuf);
       st->clear.vbuf = NULL;
    }
 }
@@ -152,7 +152,7 @@ draw_quad(GLcontext *ctx,
    void *buf;
 
    if (!st->clear.vbuf) {
-      st->clear.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+      st->clear.vbuf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
                                           sizeof(st->clear.vertices));
    }
 
@@ -180,9 +180,9 @@ draw_quad(GLcontext *ctx,
    }
 
    /* put vertex data into vbuf */
-   buf = pipe_buffer_map(pipe, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
+   buf = pipe_buffer_map(pipe->screen, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
    memcpy(buf, st->clear.vertices, sizeof(st->clear.vertices));
-   pipe_buffer_unmap(pipe, st->clear.vbuf);
+   pipe_buffer_unmap(pipe->screen, st->clear.vbuf);
 
    /* draw */
    util_draw_vertex_buffer(pipe, st->clear.vbuf,
index 4ec7c752dfe23aad0227f2b5f5549f747d46a525..00bbcae32ae8e401e1742e0a0c8645fe2aa07317 100644 (file)
@@ -487,17 +487,17 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
       ubyte *map;
 
       /* allocate/load buffer object with vertex data */
-      buf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+      buf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
                                sizeof(verts));
-      map = pipe_buffer_map(pipe, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
+      map = pipe_buffer_map(pipe->screen, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
       memcpy(map, verts, sizeof(verts));
-      pipe_buffer_unmap(pipe, buf);
+      pipe_buffer_unmap(pipe->screen, buf);
 
       util_draw_vertex_buffer(pipe, buf,
                               PIPE_PRIM_QUADS,
                               4,  /* verts */
                               3); /* attribs/vert */
-      pipe_buffer_reference(pipe->winsys, &buf, NULL);
+      pipe_buffer_reference(pipe->screen, &buf, NULL);
    }
 }
 
index 83b0be06daa8360ba05611449507e5e7f4decefb..08d4db7f7f42791db1f48f29816d84c1cfa77e62 100644 (file)
@@ -196,7 +196,7 @@ static void st_destroy_context_priv( struct st_context *st )
 
    for (i = 0; i < Elements(st->state.constants); i++) {
       if (st->state.constants[i].buffer) {
-         pipe_reference_buffer(st->pipe, &st->state.constants[i].buffer, NULL);
+         pipe_buffer_reference(st->pipe->screen, &st->state.constants[i].buffer, NULL);
       }
    }
 
index 2c8070118644b15ea98d92e3300451b9f4bdbfa3..bdf8648ef7ca92694bb0c934d4f6a3d96521841f 100644 (file)
@@ -229,7 +229,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
       if (!vec)
          return NULL;
 
-      map = pipe_buffer_map(pipe, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
+      map = pipe_buffer_map(pipe->screen, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
       map = ADD_POINTERS(map, array->Ptr);
 
       for (i = 0; i < count; i++) {
@@ -239,7 +239,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
          map += array->StrideB;
       }
 
-      pipe_buffer_unmap(pipe, stobj->buffer);
+      pipe_buffer_unmap(pipe->screen, stobj->buffer);
 
       pipe->set_edgeflags(pipe, vec);
 
@@ -373,13 +373,13 @@ setup_interleaved_attribs(GLcontext *ctx,
             get_user_arrays_bounds(vp, arrays, max_index, &low, &high);
             /*printf("user buffer range: %p %p  %d\n", low, high, high-low);*/
             vbuffer->buffer =
-               pipe_user_buffer_create(pipe, (void *) low, high - low);
+               pipe_user_buffer_create(pipe->screen, (void *) low, high - low);
             vbuffer->buffer_offset = 0;
             offset0 = low;
          }
          else {
             vbuffer->buffer = NULL;
-            pipe_reference_buffer(pipe, &vbuffer->buffer, stobj->buffer);
+            pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
             vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
             offset0 = arrays[mesaAttr]->Ptr;
          }
@@ -432,7 +432,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
          /*printf("stobj %u = %p\n", attr, (void*) stobj);*/
 
          vbuffer[attr].buffer = NULL;
-         pipe_reference_buffer(pipe, &vbuffer[attr].buffer, stobj->buffer);
+         pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, stobj->buffer);
          vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
          velements[attr].src_offset = 0;
       }
@@ -451,13 +451,13 @@ setup_non_interleaved_attribs(GLcontext *ctx,
                bytes = arrays[mesaAttr]->Size
                   * _mesa_sizeof_type(arrays[mesaAttr]->Type);
             }
-            vbuffer[attr].buffer = pipe_user_buffer_create(pipe,
+            vbuffer[attr].buffer = pipe_user_buffer_create(pipe->screen,
                            (void *) arrays[mesaAttr]->Ptr, bytes);
          }
          else {
             /* no array, use ctx->Current.Attrib[] value */
             bytes = sizeof(ctx->Current.Attrib[0]);
-            vbuffer[attr].buffer = pipe_user_buffer_create(pipe,
+            vbuffer[attr].buffer = pipe_user_buffer_create(pipe->screen,
                            (void *) ctx->Current.Attrib[mesaAttr], bytes);
             stride = 0;
          }
@@ -581,12 +581,12 @@ st_draw_vbo(GLcontext *ctx,
       if (bufobj && bufobj->Name) {
          /* elements/indexes are in a real VBO */
          struct st_buffer_object *stobj = st_buffer_object(bufobj);
-         pipe_reference_buffer(pipe, &indexBuf, stobj->buffer);
+         pipe_buffer_reference(pipe->screen, &indexBuf, stobj->buffer);
          indexOffset = (unsigned) ib->ptr / indexSize;
       }
       else {
          /* element/indicies are in user space memory */
-         indexBuf = pipe_user_buffer_create(pipe, (void *) ib->ptr,
+         indexBuf = pipe_user_buffer_create(pipe->screen, (void *) ib->ptr,
                                             ib->count * indexSize);
          indexOffset = 0;
       }
@@ -621,7 +621,7 @@ st_draw_vbo(GLcontext *ctx,
          }
       }
 
-      pipe_reference_buffer(pipe, &indexBuf, NULL);
+      pipe_buffer_reference(pipe->screen, &indexBuf, NULL);
    }
    else {
       /* non-indexed */
@@ -637,7 +637,7 @@ st_draw_vbo(GLcontext *ctx,
 
    /* unreference buffers (frees wrapped user-space buffer objects) */
    for (attr = 0; attr < num_vbuffers; attr++) {
-      pipe_reference_buffer(pipe, &vbuffer[attr].buffer, NULL);
+      pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
       assert(!vbuffer[attr].buffer);
    }
    pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
@@ -750,7 +750,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
          assert(stobj->buffer);
 
          vbuffers[attr].buffer = NULL;
-         pipe_reference_buffer(pipe, &vbuffers[attr].buffer, stobj->buffer);
+         pipe_buffer_reference(pipe->screen, &vbuffers[attr].buffer, stobj->buffer);
          vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
          velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
       }
@@ -762,7 +762,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
 
          /* wrap user data */
          vbuffers[attr].buffer
-            = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
+            = pipe_user_buffer_create(pipe->screen, (void *) arrays[mesaAttr]->Ptr,
                                       bytes);
          vbuffers[attr].buffer_offset = 0;
          velements[attr].src_offset = 0;
@@ -784,7 +784,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
 #endif
 
       /* map the attrib buffer */
-      map = pipe_buffer_map(pipe, vbuffers[attr].buffer,
+      map = pipe_buffer_map(pipe->screen, vbuffers[attr].buffer,
                             PIPE_BUFFER_USAGE_CPU_READ);
       draw_set_mapped_vertex_buffer(draw, attr, map);
    }
@@ -812,7 +812,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
         return;
       }
 
-      map = pipe_buffer_map(pipe, index_buffer_handle,
+      map = pipe_buffer_map(pipe->screen, index_buffer_handle,
                             PIPE_BUFFER_USAGE_CPU_READ);
       draw_set_mapped_element_buffer(draw, indexSize, map);
    }
@@ -823,7 +823,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
 
 
    /* map constant buffers */
-   mapped_constants = pipe_buffer_map(pipe,
+   mapped_constants = pipe_buffer_map(pipe->screen,
                                       st->state.constants[PIPE_SHADER_VERTEX].buffer,
                                       PIPE_BUFFER_USAGE_CPU_READ);
    draw_set_mapped_constant_buffer(st->draw, mapped_constants,
@@ -837,20 +837,20 @@ st_feedback_draw_vbo(GLcontext *ctx,
 
 
    /* unmap constant buffers */
-   pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX].buffer);
+   pipe_buffer_unmap(pipe->screen, st->state.constants[PIPE_SHADER_VERTEX].buffer);
 
    /*
     * unmap vertex/index buffers
     */
    for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
       if (draw->pt.vertex_buffer[i].buffer) {
-         pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer);
-         pipe_reference_buffer(pipe, &draw->pt.vertex_buffer[i].buffer, NULL);
+         pipe_buffer_unmap(pipe->screen, draw->pt.vertex_buffer[i].buffer);
+         pipe_buffer_reference(pipe->screen, &draw->pt.vertex_buffer[i].buffer, NULL);
          draw_set_mapped_vertex_buffer(draw, i, NULL);
       }
    }
    if (ib) {
-      pipe_buffer_unmap(pipe, index_buffer_handle);
+      pipe_buffer_unmap(pipe->screen, index_buffer_handle);
       draw_set_mapped_element_buffer(draw, 0, NULL);
    }
 }
index 6db9bc0dd58299fed59dfbd22151bf3e362f088f..b9d114b1c97c982b9847628b69fac53a3cadf0f0 100644 (file)
@@ -128,10 +128,10 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
       dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
                                         PIPE_BUFFER_USAGE_CPU_WRITE);
 
-      srcData = (ubyte *) pipe_buffer_map(pipe, srcSurf->buffer,
+      srcData = (ubyte *) pipe_buffer_map(pipe->screen, srcSurf->buffer,
                                           PIPE_BUFFER_USAGE_CPU_READ)
               + srcSurf->offset;
-      dstData = (ubyte *) pipe_buffer_map(pipe, dstSurf->buffer,
+      dstData = (ubyte *) pipe_buffer_map(pipe->screen, dstSurf->buffer,
                                           PIPE_BUFFER_USAGE_CPU_WRITE)
               + dstSurf->offset;
 
@@ -144,8 +144,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
                    dstSurf->stride, /* stride in bytes */
                    dstData);
 
-      pipe_buffer_unmap(pipe, srcSurf->buffer);
-      pipe_buffer_unmap(pipe, dstSurf->buffer);
+      pipe_buffer_unmap(pipe->screen, srcSurf->buffer);
+      pipe_buffer_unmap(pipe->screen, dstSurf->buffer);
 
       pipe_surface_reference(&srcSurf, NULL);
       pipe_surface_reference(&dstSurf, NULL);