summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/trace/tr_screen.c')
-rw-r--r--src/gallium/drivers/trace/tr_screen.c131
1 files changed, 104 insertions, 27 deletions
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 8789f86b1a8..164c6bbc4d6 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -315,26 +315,101 @@ trace_screen_tex_surface_release(struct pipe_screen *_screen,
}
+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;
}
}
@@ -343,33 +418,33 @@ trace_screen_surface_map(struct pipe_screen *_screen,
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");
@@ -378,10 +453,10 @@ trace_screen_surface_unmap(struct pipe_screen *_screen,
trace_dump_call_end();
- tr_surf->map = NULL;
+ tr_trans->map = NULL;
}
- screen->surface_unmap(screen, surface);
+ screen->transfer_unmap(screen, transfer);
}
@@ -437,8 +512,10 @@ trace_screen_create(struct pipe_screen *screen)
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;