From b496136af84e396e7890082817b563dc53ac36fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 12 May 2012 13:08:02 +0200 Subject: [PATCH] gallium: remove user_buffer_create from the interface Nothing uses it now. --- src/gallium/auxiliary/util/u_inlines.h | 8 ---- src/gallium/auxiliary/util/u_slab.h | 2 +- src/gallium/drivers/galahad/glhd_screen.c | 23 ---------- src/gallium/drivers/i915/i915_resource.c | 1 - src/gallium/drivers/identity/id_screen.c | 23 ---------- src/gallium/drivers/llvmpipe/lp_texture.c | 2 - src/gallium/drivers/noop/noop_pipe.c | 18 -------- src/gallium/drivers/nv30/nv30_resource.c | 1 - src/gallium/drivers/nv50/nv50_resource.c | 1 - src/gallium/drivers/nvc0/nvc0_resource.c | 1 - src/gallium/drivers/r600/r600_buffer.c | 25 ----------- src/gallium/drivers/r600/r600_pipe.h | 3 -- src/gallium/drivers/r600/r600_resource.c | 1 - src/gallium/drivers/radeonsi/r600_buffer.c | 25 ----------- src/gallium/drivers/radeonsi/r600_resource.c | 1 - src/gallium/drivers/radeonsi/radeonsi_pipe.h | 3 -- src/gallium/drivers/rbug/rbug_screen.c | 23 ---------- src/gallium/drivers/softpipe/sp_texture.c | 2 - src/gallium/drivers/svga/svga_resource.c | 1 - src/gallium/drivers/trace/tr_screen.c | 44 -------------------- src/gallium/include/pipe/p_screen.h | 26 ------------ 21 files changed, 1 insertion(+), 233 deletions(-) diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 2ec1ccfe9d3..2ec153c5823 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -233,14 +233,6 @@ pipe_buffer_create( struct pipe_screen *screen, return screen->resource_create(screen, &buffer); } - -static INLINE struct pipe_resource * -pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size, - unsigned usage ) -{ - return screen->user_buffer_create(screen, ptr, size, usage); -} - static INLINE void * pipe_buffer_map_range(struct pipe_context *pipe, struct pipe_resource *buffer, diff --git a/src/gallium/auxiliary/util/u_slab.h b/src/gallium/auxiliary/util/u_slab.h index 6b9718d08a7..3ed8b12d357 100644 --- a/src/gallium/auxiliary/util/u_slab.h +++ b/src/gallium/auxiliary/util/u_slab.h @@ -28,7 +28,7 @@ * Good for allocations which have very low lifetime and are allocated * and freed very often. Use a profiler first to know if it's worth using it! * - * Candidates: get_transfer, user_buffer_create + * Candidates: get_transfer * * @author Marek Olšák */ diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index 49702b6e424..7d03763a663 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -222,28 +222,6 @@ galahad_screen_resource_destroy(struct pipe_screen *screen, } -static struct pipe_resource * -galahad_screen_user_buffer_create(struct pipe_screen *_screen, - void *ptr, - unsigned bytes, - unsigned usage) -{ - struct galahad_screen *glhd_screen = galahad_screen(_screen); - struct pipe_screen *screen = glhd_screen->screen; - struct pipe_resource *result; - - result = screen->user_buffer_create(screen, - ptr, - bytes, - usage); - - if (result) - return galahad_resource_create(glhd_screen, result); - return NULL; -} - - - static void galahad_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, @@ -323,7 +301,6 @@ galahad_screen_create(struct pipe_screen *screen) glhd_screen->base.resource_from_handle = galahad_screen_resource_from_handle; glhd_screen->base.resource_get_handle = galahad_screen_resource_get_handle; glhd_screen->base.resource_destroy = galahad_screen_resource_destroy; - glhd_screen->base.user_buffer_create = galahad_screen_user_buffer_create; glhd_screen->base.flush_frontbuffer = galahad_screen_flush_frontbuffer; glhd_screen->base.fence_reference = galahad_screen_fence_reference; glhd_screen->base.fence_signalled = galahad_screen_fence_signalled; diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index b4719af1fb6..253c7d06233 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -46,5 +46,4 @@ i915_init_screen_resource_functions(struct i915_screen *is) is->base.resource_from_handle = i915_resource_from_handle; is->base.resource_get_handle = u_resource_get_handle_vtbl; is->base.resource_destroy = u_resource_destroy_vtbl; - is->base.user_buffer_create = i915_user_buffer_create; } diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index a173235b563..ab82e29cec3 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -188,28 +188,6 @@ identity_screen_resource_destroy(struct pipe_screen *screen, } -static struct pipe_resource * -identity_screen_user_buffer_create(struct pipe_screen *_screen, - void *ptr, - unsigned bytes, - unsigned usage) -{ - struct identity_screen *id_screen = identity_screen(_screen); - struct pipe_screen *screen = id_screen->screen; - struct pipe_resource *result; - - result = screen->user_buffer_create(screen, - ptr, - bytes, - usage); - - if (result) - return identity_resource_create(id_screen, result); - return NULL; -} - - - static void identity_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, @@ -286,7 +264,6 @@ identity_screen_create(struct pipe_screen *screen) id_screen->base.resource_from_handle = identity_screen_resource_from_handle; id_screen->base.resource_get_handle = identity_screen_resource_get_handle; id_screen->base.resource_destroy = identity_screen_resource_destroy; - id_screen->base.user_buffer_create = identity_screen_user_buffer_create; id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer; id_screen->base.fence_reference = identity_screen_fence_reference; id_screen->base.fence_signalled = identity_screen_fence_signalled; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 198874b4fce..4495e8de6cd 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -1432,8 +1432,6 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen) screen->resource_destroy = llvmpipe_resource_destroy; screen->resource_from_handle = llvmpipe_resource_from_handle; screen->resource_get_handle = llvmpipe_resource_get_handle; - screen->user_buffer_create = llvmpipe_user_buffer_create; - } diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index e47f944b59b..4c233d1ec41 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -142,23 +142,6 @@ static void noop_resource_destroy(struct pipe_screen *screen, FREE(resource); } -static struct pipe_resource *noop_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind) -{ - struct pipe_resource templ; - - templ.target = PIPE_BUFFER; - templ.format = PIPE_FORMAT_R8_UNORM; - templ.usage = PIPE_USAGE_IMMUTABLE; - templ.bind = bind; - templ.width0 = bytes; - templ.height0 = 1; - templ.depth0 = 1; - templ.flags = 0; - return noop_resource_create(screen, &templ); -} - /* * transfer @@ -392,7 +375,6 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) screen->resource_from_handle = noop_resource_from_handle; screen->resource_get_handle = noop_resource_get_handle; screen->resource_destroy = noop_resource_destroy; - screen->user_buffer_create = noop_user_buffer_create; screen->flush_frontbuffer = noop_flush_frontbuffer; return screen; diff --git a/src/gallium/drivers/nv30/nv30_resource.c b/src/gallium/drivers/nv30/nv30_resource.c index 6bcee4d0294..3d8e7d74b31 100644 --- a/src/gallium/drivers/nv30/nv30_resource.c +++ b/src/gallium/drivers/nv30/nv30_resource.c @@ -61,7 +61,6 @@ nv30_resource_screen_init(struct pipe_screen *pscreen) pscreen->resource_from_handle = nv30_resource_from_handle; pscreen->resource_get_handle = u_resource_get_handle_vtbl; pscreen->resource_destroy = u_resource_destroy_vtbl; - pscreen->user_buffer_create = nouveau_user_buffer_create; } void diff --git a/src/gallium/drivers/nv50/nv50_resource.c b/src/gallium/drivers/nv50/nv50_resource.c index a66a6a02675..9fe18a6d09d 100644 --- a/src/gallium/drivers/nv50/nv50_resource.c +++ b/src/gallium/drivers/nv50/nv50_resource.c @@ -103,5 +103,4 @@ nv50_screen_init_resource_functions(struct pipe_screen *pscreen) pscreen->resource_from_handle = nv50_resource_from_handle; pscreen->resource_get_handle = u_resource_get_handle_vtbl; pscreen->resource_destroy = u_resource_destroy_vtbl; - pscreen->user_buffer_create = nouveau_user_buffer_create; } diff --git a/src/gallium/drivers/nvc0/nvc0_resource.c b/src/gallium/drivers/nvc0/nvc0_resource.c index e8d83ca5d93..daf5c907a05 100644 --- a/src/gallium/drivers/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nvc0/nvc0_resource.c @@ -61,5 +61,4 @@ nvc0_screen_init_resource_functions(struct pipe_screen *pscreen) pscreen->resource_from_handle = nvc0_resource_from_handle; pscreen->resource_get_handle = u_resource_get_handle_vtbl; pscreen->resource_destroy = u_resource_destroy_vtbl; - pscreen->user_buffer_create = nouveau_user_buffer_create; } diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 857d860aaea..2f7eb513d4e 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -220,28 +220,3 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, } return &rbuffer->b.b; } - -struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind) -{ - struct r600_screen *rscreen = (struct r600_screen*)screen; - struct r600_resource *rbuffer; - - rbuffer = util_slab_alloc(&rscreen->pool_buffers); - - pipe_reference_init(&rbuffer->b.b.reference, 1); - rbuffer->b.vtbl = &r600_buffer_vtbl; - rbuffer->b.b.screen = screen; - rbuffer->b.b.target = PIPE_BUFFER; - rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM; - rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE; - rbuffer->b.b.bind = bind; - rbuffer->b.b.width0 = bytes; - rbuffer->b.b.height0 = 1; - rbuffer->b.b.depth0 = 1; - rbuffer->b.b.array_size = 1; - rbuffer->b.b.flags = 0; - rbuffer->buf = NULL; - return &rbuffer->b.b; -} diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index a3ec9e5f7fa..d6a97077641 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -400,9 +400,6 @@ bool r600_init_resource(struct r600_screen *rscreen, unsigned bind, unsigned usage); struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ); -struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind); /* r600_pipe.c */ void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index de339e03512..ef0b4ceffd0 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -50,7 +50,6 @@ void r600_init_screen_resource_functions(struct pipe_screen *screen) screen->resource_from_handle = r600_resource_from_handle; screen->resource_get_handle = u_resource_get_handle_vtbl; screen->resource_destroy = u_resource_destroy_vtbl; - screen->user_buffer_create = r600_user_buffer_create; } void r600_init_context_resource_functions(struct r600_context *r600) diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c index c6b707187a8..8fd7e277431 100644 --- a/src/gallium/drivers/radeonsi/r600_buffer.c +++ b/src/gallium/drivers/radeonsi/r600_buffer.c @@ -178,31 +178,6 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, return &rbuffer->b.b; } -struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind) -{ - struct r600_screen *rscreen = (struct r600_screen*)screen; - struct r600_resource *rbuffer; - - rbuffer = util_slab_alloc(&rscreen->pool_buffers); - - pipe_reference_init(&rbuffer->b.b.reference, 1); - rbuffer->b.vtbl = &r600_buffer_vtbl; - rbuffer->b.b.screen = screen; - rbuffer->b.b.target = PIPE_BUFFER; - rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM; - rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE; - rbuffer->b.b.bind = bind; - rbuffer->b.b.width0 = bytes; - rbuffer->b.b.height0 = 1; - rbuffer->b.b.depth0 = 1; - rbuffer->b.b.array_size = 1; - rbuffer->b.b.flags = 0; - rbuffer->buf = NULL; - return &rbuffer->b.b; -} - void r600_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count) { diff --git a/src/gallium/drivers/radeonsi/r600_resource.c b/src/gallium/drivers/radeonsi/r600_resource.c index 0e861c12be3..d9be706b6b8 100644 --- a/src/gallium/drivers/radeonsi/r600_resource.c +++ b/src/gallium/drivers/radeonsi/r600_resource.c @@ -50,7 +50,6 @@ void r600_init_screen_resource_functions(struct pipe_screen *screen) screen->resource_from_handle = r600_resource_from_handle; screen->resource_get_handle = u_resource_get_handle_vtbl; screen->resource_destroy = u_resource_destroy_vtbl; - screen->user_buffer_create = r600_user_buffer_create; } void r600_init_context_resource_functions(struct r600_context *r600) diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h index bba4cf23691..b16ec1069c9 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h @@ -384,9 +384,6 @@ bool r600_init_resource(struct r600_screen *rscreen, unsigned bind, unsigned usage); struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ); -struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind); void r600_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count); diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index 1b7ca7cb6fe..2471fdb4661 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -186,28 +186,6 @@ rbug_screen_resource_destroy(struct pipe_screen *screen, rbug_resource_destroy(rbug_resource(_resource)); } -static struct pipe_resource * -rbug_screen_user_buffer_create(struct pipe_screen *_screen, - void *ptr, - unsigned bytes, - unsigned usage) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - struct pipe_resource *result; - - result = screen->user_buffer_create(screen, - ptr, - bytes, - usage); - - if (result) - return rbug_resource_create(rb_screen, result); - return NULL; -} - - - static void rbug_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, @@ -298,7 +276,6 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle; rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle; rb_screen->base.resource_destroy = rbug_screen_resource_destroy; - rb_screen->base.user_buffer_create = rbug_screen_user_buffer_create; rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer; rb_screen->base.fence_reference = rbug_screen_fence_reference; rb_screen->base.fence_signalled = rbug_screen_fence_signalled; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index ee8d4230dd9..978fbe1fe67 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -506,6 +506,4 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->resource_destroy = softpipe_resource_destroy; screen->resource_from_handle = softpipe_resource_from_handle; screen->resource_get_handle = softpipe_resource_get_handle; - screen->user_buffer_create = softpipe_user_buffer_create; - } diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index b86469af12d..890c953a3c2 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -73,5 +73,4 @@ svga_init_screen_resource_functions(struct svga_screen *is) is->screen.resource_from_handle = svga_resource_from_handle; is->screen.resource_get_handle = u_resource_get_handle_vtbl; is->screen.resource_destroy = u_resource_destroy_vtbl; - is->screen.user_buffer_create = svga_user_buffer_create; } diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index fd5acbefe51..4a1aa997a7b 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -319,49 +319,6 @@ trace_screen_resource_destroy(struct pipe_screen *_screen, } - -/******************************************************************** - * buffer - */ - - - -static struct pipe_resource * -trace_screen_user_buffer_create(struct pipe_screen *_screen, - void *data, - unsigned size, - unsigned usage) -{ - struct trace_screen *tr_scr = trace_screen(_screen); - struct pipe_screen *screen = tr_scr->screen; - struct pipe_resource *result; - - trace_dump_call_begin("pipe_screen", "user_buffer_create"); - - trace_dump_arg(ptr, screen); - trace_dump_arg_begin("data"); - trace_dump_bytes(data, size); - trace_dump_arg_end(); - trace_dump_arg(uint, size); - trace_dump_arg(uint, usage); - - result = screen->user_buffer_create(screen, data, size, usage); - - trace_dump_ret(ptr, result); - - trace_dump_call_end(); - - if(result) { - assert(!(result->flags & TRACE_FLAG_USER_BUFFER)); - result->flags |= TRACE_FLAG_USER_BUFFER; - } - - return trace_resource_create(tr_scr, result); -} - - - - /******************************************************************** * fence */ @@ -506,7 +463,6 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.resource_from_handle = trace_screen_resource_from_handle; tr_scr->base.resource_get_handle = trace_screen_resource_get_handle; tr_scr->base.resource_destroy = trace_screen_resource_destroy; - tr_scr->base.user_buffer_create = trace_screen_user_buffer_create; tr_scr->base.fence_reference = trace_screen_fence_reference; tr_scr->base.fence_signalled = trace_screen_fence_signalled; tr_scr->base.fence_finish = trace_screen_fence_finish; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 7ae7c9a04e1..b4a7f01af66 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -161,32 +161,6 @@ struct pipe_screen { struct pipe_resource *pt); - /** - * Create a buffer that wraps user-space data. - * - * Effectively this schedules a delayed call to buffer_create - * followed by an upload of the data at *some point in the future*, - * or perhaps never. Basically the allocate/upload is delayed - * until the buffer is actually passed to hardware. - * - * The intention is to provide a quick way to turn regular data - * into a buffer, and secondly to avoid a copy operation if that - * data subsequently turns out to be only accessed by the CPU. - * - * Common example is OpenGL vertex buffers that are subsequently - * processed either by software TNL in the driver or by passing to - * hardware. - * - * XXX: What happens if the delayed call to buffer_create() fails? - * - * Note that ptr may be accessed at any time upto the time when the - * buffer is destroyed, so the data must not be freed before then. - */ - struct pipe_resource *(*user_buffer_create)(struct pipe_screen *screen, - void *ptr, - unsigned bytes, - unsigned bind_flags); - /** * Do any special operations to ensure frontbuffer contents are * displayed, eg copy fake frontbuffer. -- 2.30.2