Nothing uses it now.
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,
* 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
*/
}
-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,
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;
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;
}
}
-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,
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;
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;
-
}
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
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;
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
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;
}
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;
}
}
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;
-}
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,
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)
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)
{
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)
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);
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,
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;
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;
-
}
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;
}
}
-
-/********************************************************************
- * 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
*/
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;
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.