}
+static struct pipe_transfer *
+trace_screen_get_tex_transfer(struct pipe_screen *_screen,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct pipe_screen *screen = tr_scr->screen;
+ struct trace_texture *tr_tex;
+ struct pipe_transfer *result;
+
+ assert(texture);
+ tr_tex = trace_texture(tr_scr, texture);
+ texture = tr_tex->texture;
+ assert(texture->screen == screen);
+
+ trace_dump_call_begin("pipe_screen", "get_tex_transfer");
+
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(ptr, texture);
+ trace_dump_arg(uint, face);
+ trace_dump_arg(uint, level);
+ trace_dump_arg(uint, zslice);
+ trace_dump_arg(uint, usage);
+
+ result = screen->get_tex_transfer(screen, texture, face, level, zslice, usage,
+ x, y, w, h);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ result = trace_transfer_create(tr_tex, result);
+
+ return result;
+}
+
+
+static void
+trace_screen_tex_transfer_release(struct pipe_screen *_screen,
+ struct pipe_transfer **ptransfer)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct pipe_screen *screen = tr_scr->screen;
+ struct trace_texture *tr_tex;
+ struct trace_transfer *tr_trans;
+ struct pipe_transfer *transfer;
+
+ assert(ptransfer);
+ if(*ptransfer) {
+ tr_tex = trace_texture(tr_scr, (*ptransfer)->texture);
+ tr_trans = trace_transfer(tr_tex, *ptransfer);
+ transfer = tr_trans->transfer;
+ }
+ else
+ transfer = NULL;
+
+ if (*ptransfer) {
+ if (!--(*ptransfer)->refcount) {
+ trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
+
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(ptr, transfer);
+
+ trace_transfer_destroy(tr_tex, *ptransfer);
+
+ trace_dump_call_end();
+ }
+
+ *ptransfer = NULL;
+ }
+}
+
+
static void *
-trace_screen_surface_map(struct pipe_screen *_screen,
- struct pipe_surface *surface,
- unsigned flags)
+trace_screen_transfer_map(struct pipe_screen *_screen,
+ struct pipe_transfer *transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen;
struct trace_texture *tr_tex;
- struct trace_surface *tr_surf;
+ struct trace_transfer *tr_trans;
void *map;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
- surface = tr_surf->surface;
+ tr_tex = trace_texture(tr_scr, transfer->texture);
+ tr_trans = trace_transfer(tr_tex, transfer);
+ transfer = tr_trans->transfer;
- map = screen->surface_map(screen, surface, flags);
+ map = screen->transfer_map(screen, transfer);
if(map) {
- if(flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
- assert(!tr_surf->map);
- tr_surf->map = map;
+ if(transfer->usage != PIPE_TRANSFER_READ) {
+ assert(!tr_trans->map);
+ tr_trans->map = map;
}
}
static void
-trace_screen_surface_unmap(struct pipe_screen *_screen,
- struct pipe_surface *surface)
+trace_screen_transfer_unmap(struct pipe_screen *_screen,
+ struct pipe_transfer *transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen;
struct trace_texture *tr_tex;
- struct trace_surface *tr_surf;
+ struct trace_transfer *tr_trans;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
- surface = tr_surf->surface;
+ tr_tex = trace_texture(tr_scr, transfer->texture);
+ tr_trans = trace_transfer(tr_tex, transfer);
+ transfer = tr_trans->transfer;
- if(tr_surf->map) {
- size_t size = surface->nblocksy * surface->stride;
+ if(tr_trans->map) {
+ size_t size = transfer->nblocksy * transfer->stride;
- trace_dump_call_begin("pipe_winsys", "surface_write");
+ trace_dump_call_begin("pipe_winsys", "transfer_write");
trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, surface);
+ trace_dump_arg(ptr, transfer);
trace_dump_arg_begin("data");
- trace_dump_bytes(tr_surf->map, size);
+ trace_dump_bytes(tr_trans->map, size);
trace_dump_arg_end();
trace_dump_arg_begin("stride");
- trace_dump_uint(surface->stride);
+ trace_dump_uint(transfer->stride);
trace_dump_arg_end();
trace_dump_arg_begin("size");
trace_dump_call_end();
- tr_surf->map = NULL;
+ tr_trans->map = NULL;
}
- screen->surface_unmap(screen, surface);
+ screen->transfer_unmap(screen, transfer);
}
tr_scr->base.texture_release = trace_screen_texture_release;
tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
tr_scr->base.tex_surface_release = trace_screen_tex_surface_release;
- tr_scr->base.surface_map = trace_screen_surface_map;
- tr_scr->base.surface_unmap = trace_screen_surface_unmap;
+ tr_scr->base.get_tex_transfer = trace_screen_get_tex_transfer;
+ tr_scr->base.tex_transfer_release = trace_screen_tex_transfer_release;
+ tr_scr->base.transfer_map = trace_screen_transfer_map;
+ tr_scr->base.transfer_unmap = trace_screen_transfer_unmap;
tr_scr->screen = screen;
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
+ trace_dump_member(uint, state, layout);
+ trace_dump_member(uint, state, offset);
+ trace_dump_member(uint, state, refcount);
+ trace_dump_member(uint, state, usage);
+
+ trace_dump_member(ptr, state, texture);
+ trace_dump_member(uint, state, face);
+ trace_dump_member(uint, state, level);
+ trace_dump_member(uint, state, zslice);
+
+ trace_dump_struct_end();
+}
+
+
+void trace_dump_transfer(const struct pipe_transfer *state)
+{
+ if(!state) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_transfer");
+
+ trace_dump_member(format, state, format);
+ trace_dump_member(uint, state, width);
+ trace_dump_member(uint, state, height);
+
trace_dump_member_begin("block");
trace_dump_block(&state->block);
trace_dump_member_end();
trace_dump_member(uint, state, nblocksx);
trace_dump_member(uint, state, nblocksy);
trace_dump_member(uint, state, stride);
- trace_dump_member(uint, state, layout);
- trace_dump_member(uint, state, offset);
trace_dump_member(uint, state, refcount);
trace_dump_member(uint, state, usage);