gallium: add user_ptr in pipe_resource
authorMarek Olšák <maraeo@gmail.com>
Tue, 10 Apr 2012 02:33:23 +0000 (04:33 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 23 Apr 2012 23:39:21 +0000 (01:39 +0200)
I need to access the pointer in st/mesa when I only have pipe_resource.

src/gallium/drivers/i915/i915_resource_buffer.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/noop/noop_pipe.c
src/gallium/drivers/nouveau/nouveau_buffer.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/radeonsi/r600_buffer.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/svga/svga_resource_buffer.c
src/gallium/include/pipe/p_state.h

index 77c03450b3a24b81449838c82d2cca95a8e1bdcf..6718948fe5c8d924c12cd42d70548516194cf6e1 100644 (file)
@@ -183,6 +183,7 @@ i915_user_buffer_create(struct pipe_screen *screen,
    buf->b.b.height0 = 1;
    buf->b.b.depth0 = 1;
    buf->b.b.array_size = 1;
+   buf->b.b.user_ptr = ptr;
 
    buf->data = ptr;
    buf->free_on_destroy = FALSE;
index 28e5aa9a806b8f3c5df6ba53cc16ccca96f39163..f6a1ec26bc5ec47196698e9c92e152334824db86 100644 (file)
@@ -770,6 +770,7 @@ llvmpipe_user_buffer_create(struct pipe_screen *screen,
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
    buffer->base.array_size = 1;
+   buffer->base.user_ptr = ptr;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
 
index e47f944b59b5b24e308d08e079aab8fd4e3f3d8b..e63263a0e0cc763747a15f942b5c598310c316cd 100644 (file)
@@ -156,6 +156,7 @@ static struct pipe_resource *noop_user_buffer_create(struct pipe_screen *screen,
        templ.height0 = 1;
        templ.depth0 = 1;
        templ.flags = 0;
+       templ.user_ptr = ptr;
        return noop_resource_create(screen, &templ);
 }
 
index ff199debd7445238efb8ae863acf3b884ba2f8b8..369492de3170840b1f8fbf2660798b3c3c1544e8 100644 (file)
@@ -398,6 +398,7 @@ nouveau_user_buffer_create(struct pipe_screen *pscreen, void *ptr,
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
+   buffer->base.user_ptr = ptr;
 
    buffer->data = ptr;
    buffer->status = NOUVEAU_BUFFER_STATUS_USER_MEMORY;
index 37f6e8d53d8873b99b11e20596ebc0a13c6540e6..fba17a277202072bed149f343ed596d06b5ed889 100644 (file)
@@ -193,6 +193,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     rbuf->b.b.vtbl = &r300_buffer_vtbl;
     pipe_reference_init(&rbuf->b.b.b.reference, 1);
     rbuf->b.b.b.screen = screen;
+    rbuf->b.b.b.user_ptr = NULL;
     rbuf->b.user_ptr = NULL;
     rbuf->domain = RADEON_DOMAIN_GTT;
     rbuf->buf = NULL;
@@ -239,6 +240,7 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
     rbuf->b.b.b.depth0 = 1;
     rbuf->b.b.b.array_size = 1;
     rbuf->b.b.b.flags = 0;
+    rbuf->b.b.b.user_ptr = ptr;
     rbuf->b.b.vtbl = &r300_buffer_vtbl;
     rbuf->b.user_ptr = ptr;
     rbuf->domain = RADEON_DOMAIN_GTT;
index 4708d0154ca4e5fcae423035e7cc793c226c26d7..440af5622faaeacc4fcfed55fb3b269e91fc7173 100644 (file)
@@ -222,6 +222,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
        rbuffer->b.b.b = *templ;
        pipe_reference_init(&rbuffer->b.b.b.reference, 1);
        rbuffer->b.b.b.screen = screen;
+       rbuffer->b.b.b.user_ptr = NULL;
        rbuffer->b.b.vtbl = &r600_buffer_vtbl;
        rbuffer->b.user_ptr = NULL;
 
@@ -253,6 +254,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
        rbuffer->b.b.b.depth0 = 1;
        rbuffer->b.b.b.array_size = 1;
        rbuffer->b.b.b.flags = 0;
+       rbuffer->b.b.b.user_ptr = ptr;
        rbuffer->b.user_ptr = ptr;
        rbuffer->buf = NULL;
        return &rbuffer->b.b.b;
index bb885df8dcda1ca5ecf9c2effa8a8bb632f0552e..fa31afadaea8f46eb1fe679a2bdc8c6762faa64e 100644 (file)
@@ -232,6 +232,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
        rbuffer->b.b.b.depth0 = 1;
        rbuffer->b.b.b.array_size = 1;
        rbuffer->b.b.b.flags = 0;
+       rbuffer->b.b.b.user_ptr = ptr;
        rbuffer->b.user_ptr = ptr;
        rbuffer->buf = NULL;
        return &rbuffer->b.b.b;
index 95374c34ec3fd335f73ef71dbd48b6729bba87fc..f5c6f565f217127ebfe706fc124e39358b6726cb 100644 (file)
@@ -476,6 +476,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
    spr->base.height0 = 1;
    spr->base.depth0 = 1;
    spr->base.array_size = 1;
+   spr->base.user_ptr = ptr;
    spr->userBuffer = TRUE;
    spr->data = ptr;
 
index fa713ee88adda16c864983942dcfee6276e6faf1..ff53b82785518c57dfba6f2556fedf6e57cfcc71 100644 (file)
@@ -394,6 +394,7 @@ svga_user_buffer_create(struct pipe_screen *screen,
    sbuf->b.b.height0 = 1;
    sbuf->b.b.depth0 = 1;
    sbuf->b.b.array_size = 1;
+   sbuf->b.b.user_ptr = ptr;
 
    sbuf->swbuf = ptr;
    sbuf->user = TRUE;
index 72ec04a10cd3c79bcc213d95efd655a098e7b9be..a459a56a760e40b1973111ca50a26b0dcc03fc45 100644 (file)
@@ -415,6 +415,9 @@ struct pipe_resource
 
    unsigned bind;            /**< bitmask of PIPE_BIND_x */
    unsigned flags;           /**< bitmask of PIPE_RESOURCE_FLAG_x */
+
+   /* XXX this is only temporary and will be removed once it's not needed */
+   uint8_t *user_ptr;        /**< user buffer pointer */
 };