From e8ab3b1ce76dddca7b591b9ce21836ab36995653 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 10 Apr 2012 04:33:23 +0200 Subject: [PATCH] gallium: add user_ptr in pipe_resource I need to access the pointer in st/mesa when I only have pipe_resource. --- src/gallium/drivers/i915/i915_resource_buffer.c | 1 + src/gallium/drivers/llvmpipe/lp_texture.c | 1 + src/gallium/drivers/noop/noop_pipe.c | 1 + src/gallium/drivers/nouveau/nouveau_buffer.c | 1 + src/gallium/drivers/r300/r300_screen_buffer.c | 2 ++ src/gallium/drivers/r600/r600_buffer.c | 2 ++ src/gallium/drivers/radeonsi/r600_buffer.c | 1 + src/gallium/drivers/softpipe/sp_texture.c | 1 + src/gallium/drivers/svga/svga_resource_buffer.c | 1 + src/gallium/include/pipe/p_state.h | 3 +++ 10 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 77c03450b3a..6718948fe5c 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -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; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 28e5aa9a806..f6a1ec26bc5 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -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; diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index e47f944b59b..e63263a0e0c 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -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); } diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index ff199debd74..369492de317 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -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; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 37f6e8d53d8..fba17a27720 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -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; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 4708d0154ca..440af5622fa 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -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; diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c index bb885df8dcd..fa31afadaea 100644 --- a/src/gallium/drivers/radeonsi/r600_buffer.c +++ b/src/gallium/drivers/radeonsi/r600_buffer.c @@ -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; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 95374c34ec3..f5c6f565f21 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -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; diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index fa713ee88ad..ff53b827855 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -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; diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 72ec04a10cd..a459a56a760 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -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 */ }; -- 2.30.2