summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-07-16 21:19:48 +0200
committerMarek Olšák <[email protected]>2016-07-23 13:33:42 +0200
commit1ffe77e7bb2486ea74cda077ed2a9622b758395c (patch)
tree4a04818614fc8c4e086e9dcd32dbadecbac4b6fb /src/gallium/drivers
parent0ba7288376dc66f932336862c8a6abb629b47686 (diff)
gallium: split transfer_inline_write into buffer and texture callbacks
to reduce the call indirections with u_resource_vtbl. The worst call tree you could get was: - u_transfer_inline_write_vtbl - u_default_transfer_inline_write - u_transfer_map_vtbl - driver_transfer_map - u_transfer_unmap_vtbl - driver_transfer_unmap That's 6 indirect calls. Some drivers only had 5. The goal is to have 1 indirect call for drivers that care. The resource type can be determined statically at most call sites. The new interface is: pipe_context::buffer_subdata(ctx, resource, usage, offset, size, data) pipe_context::texture_subdata(ctx, resource, level, usage, box, data, stride, layer_stride) v2: fix whitespace, correct ilo's behavior Reviewed-by: Nicolai Hähnle <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/ddebug/dd_context.c30
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c4
-rw-r--r--src/gallium/drivers/i915/i915_resource.c3
-rw-r--r--src/gallium/drivers/i915/i915_resource.h6
-rw-r--r--src/gallium/drivers/i915/i915_resource_buffer.c19
-rw-r--r--src/gallium/drivers/i915/i915_resource_texture.c3
-rw-r--r--src/gallium/drivers/ilo/ilo_transfer.c36
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c3
-rw-r--r--src/gallium/drivers/noop/noop_pipe.c26
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c1
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_miptree.c1
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_resource.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_miptree.c1
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_resource.c3
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c1
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_resource.c3
-rw-r--r--src/gallium/drivers/r300/r300_resource.c3
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c1
-rw-r--r--src/gallium/drivers/r300/r300_texture.c1
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c13
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c1
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c5
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c1
-rw-r--r--src/gallium/drivers/rbug/rbug_context.c52
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c3
-rw-r--r--src/gallium/drivers/svga/svga_resource.c3
-rw-r--r--src/gallium/drivers/svga/svga_resource_buffer.c1
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.c1
-rw-r--r--src/gallium/drivers/swr/swr_context.cpp3
-rw-r--r--src/gallium/drivers/trace/tr_context.c67
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.c4
-rw-r--r--src/gallium/drivers/virgl/virgl_buffer.c1
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c14
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c1
34 files changed, 186 insertions, 132 deletions
diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c
index 98475b9fe99..c0b2b3ddd7e 100644
--- a/src/gallium/drivers/ddebug/dd_context.c
+++ b/src/gallium/drivers/ddebug/dd_context.c
@@ -599,17 +599,28 @@ dd_context_transfer_unmap(struct pipe_context *_pipe,
}
static void
-dd_context_transfer_inline_write(struct pipe_context *_pipe,
- struct pipe_resource *resource,
- unsigned level, unsigned usage,
- const struct pipe_box *box,
- const void *data, unsigned stride,
- unsigned layer_stride)
+dd_context_buffer_subdata(struct pipe_context *_pipe,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+ struct pipe_context *pipe = dd_context(_pipe)->pipe;
+
+ pipe->buffer_subdata(pipe, resource, usage, offset, size, data);
+}
+
+static void
+dd_context_texture_subdata(struct pipe_context *_pipe,
+ struct pipe_resource *resource,
+ unsigned level, unsigned usage,
+ const struct pipe_box *box,
+ const void *data, unsigned stride,
+ unsigned layer_stride)
{
struct pipe_context *pipe = dd_context(_pipe)->pipe;
- pipe->transfer_inline_write(pipe, resource, level, usage, box, data,
- stride, layer_stride);
+ pipe->texture_subdata(pipe, resource, level, usage, box, data,
+ stride, layer_stride);
}
@@ -767,7 +778,8 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe)
CTX_INIT(transfer_map);
CTX_INIT(transfer_flush_region);
CTX_INIT(transfer_unmap);
- CTX_INIT(transfer_inline_write);
+ CTX_INIT(buffer_subdata);
+ CTX_INIT(texture_subdata);
CTX_INIT(texture_barrier);
CTX_INIT(memory_barrier);
/* create_video_codec */
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index ded81474331..96d1d88eeed 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -476,7 +476,6 @@ static const struct u_resource_vtbl fd_resource_vtbl = {
.transfer_map = fd_resource_transfer_map,
.transfer_flush_region = fd_resource_transfer_flush_region,
.transfer_unmap = fd_resource_transfer_unmap,
- .transfer_inline_write = u_default_transfer_inline_write,
};
static uint32_t
@@ -864,7 +863,8 @@ fd_resource_context_init(struct pipe_context *pctx)
pctx->transfer_map = u_transfer_map_vtbl;
pctx->transfer_flush_region = u_transfer_flush_region_vtbl;
pctx->transfer_unmap = u_transfer_unmap_vtbl;
- pctx->transfer_inline_write = u_transfer_inline_write_vtbl;
+ pctx->buffer_subdata = u_default_buffer_subdata;
+ pctx->texture_subdata = u_default_texture_subdata;
pctx->create_surface = fd_create_surface;
pctx->surface_destroy = fd_surface_destroy;
pctx->resource_copy_region = fd_resource_copy_region;
diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c
index 3ffb0b7a5d2..8e5572b4cd4 100644
--- a/src/gallium/drivers/i915/i915_resource.c
+++ b/src/gallium/drivers/i915/i915_resource.c
@@ -39,7 +39,8 @@ i915_init_resource_functions(struct i915_context *i915 )
i915->base.transfer_map = u_transfer_map_vtbl;
i915->base.transfer_flush_region = u_transfer_flush_region_vtbl;
i915->base.transfer_unmap = u_transfer_unmap_vtbl;
- i915->base.transfer_inline_write = u_transfer_inline_write_vtbl;
+ i915->base.buffer_subdata = i915_buffer_subdata;
+ i915->base.texture_subdata = u_default_texture_subdata;
}
void
diff --git a/src/gallium/drivers/i915/i915_resource.h b/src/gallium/drivers/i915/i915_resource.h
index 77fe8b70f79..0afd09501c6 100644
--- a/src/gallium/drivers/i915/i915_resource.h
+++ b/src/gallium/drivers/i915/i915_resource.h
@@ -129,4 +129,10 @@ struct pipe_resource *
i915_buffer_create(struct pipe_screen *screen,
const struct pipe_resource *template);
+void
+i915_buffer_subdata(struct pipe_context *rm_ctx,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data);
+
#endif /* I915_RESOURCE_H */
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index fb2e53b014f..24c954cae34 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -92,21 +92,15 @@ i915_buffer_transfer_unmap(struct pipe_context *pipe,
util_slab_free(&i915->transfer_pool, transfer);
}
-static void
-i915_buffer_transfer_inline_write( struct pipe_context *rm_ctx,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
+void
+i915_buffer_subdata(struct pipe_context *rm_ctx,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
{
struct i915_buffer *buffer = i915_buffer(resource);
- memcpy(buffer->data + box->x,
- data,
- box->width);
+ memcpy(buffer->data + offset, data, size);
}
@@ -117,7 +111,6 @@ struct u_resource_vtbl i915_buffer_vtbl =
i915_buffer_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
i915_buffer_transfer_unmap, /* transfer_unmap */
- i915_buffer_transfer_inline_write /* transfer_inline_write */
};
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index af9d97a8acc..f77bbfde181 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -818,7 +818,7 @@ i915_texture_transfer_unmap(struct pipe_context *pipe,
}
#if 0
-static void i915_transfer_inline_write( struct pipe_context *pipe,
+static void i915_texture_subdata(struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level,
unsigned usage,
@@ -913,7 +913,6 @@ struct u_resource_vtbl i915_texture_vtbl =
i915_texture_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
i915_texture_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c
index 5abd3bebf68..d243e38fbe2 100644
--- a/src/gallium/drivers/ilo/ilo_transfer.c
+++ b/src/gallium/drivers/ilo/ilo_transfer.c
@@ -1236,32 +1236,15 @@ ilo_transfer_map(struct pipe_context *pipe,
return ptr;
}
-static void
-ilo_transfer_inline_write(struct pipe_context *pipe,
- struct pipe_resource *res,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
+static void ilo_buffer_subdata(struct pipe_context *pipe,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
{
- if (likely(res->target == PIPE_BUFFER) &&
- !(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
- /* they should specify just an offset and a size */
- assert(level == 0);
- assert(box->y == 0);
- assert(box->z == 0);
- assert(box->height == 1);
- assert(box->depth == 1);
-
- buf_pwrite(ilo_context(pipe), res,
- usage, box->x, box->width, data);
- }
- else {
- u_default_transfer_inline_write(pipe, res,
- level, usage, box, data, stride, layer_stride);
- }
+ if (usage & PIPE_TRANSFER_UNSYNCHRONIZED)
+ u_default_buffer_subdata(pipe, resource, usage, offset, size, data);
+ else
+ buf_pwrite(ilo_context(pipe), resource, usage, offset, size, data);
}
/**
@@ -1273,5 +1256,6 @@ ilo_init_transfer_functions(struct ilo_context *ilo)
ilo->base.transfer_map = ilo_transfer_map;
ilo->base.transfer_flush_region = ilo_transfer_flush_region;
ilo->base.transfer_unmap = ilo_transfer_unmap;
- ilo->base.transfer_inline_write = ilo_transfer_inline_write;
+ ilo->base.buffer_subdata = ilo_buffer_subdata;
+ ilo->base.texture_subdata = u_default_texture_subdata;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 36f1c6b1a20..0d4c4efe0b9 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -816,5 +816,6 @@ llvmpipe_init_context_resource_funcs(struct pipe_context *pipe)
pipe->transfer_unmap = llvmpipe_transfer_unmap;
pipe->transfer_flush_region = u_default_transfer_flush_region;
- pipe->transfer_inline_write = u_default_transfer_inline_write;
+ pipe->buffer_subdata = u_default_buffer_subdata;
+ pipe->texture_subdata = u_default_texture_subdata;
}
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index 99e5f1ae1a9..097ff21c38b 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -192,14 +192,21 @@ static void noop_transfer_unmap(struct pipe_context *pipe,
FREE(transfer);
}
-static void noop_transfer_inline_write(struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
+static void noop_buffer_subdata(struct pipe_context *pipe,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+}
+
+static void noop_texture_subdata(struct pipe_context *pipe,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride)
{
}
@@ -294,7 +301,8 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen,
ctx->transfer_map = noop_transfer_map;
ctx->transfer_flush_region = noop_transfer_flush_region;
ctx->transfer_unmap = noop_transfer_unmap;
- ctx->transfer_inline_write = noop_transfer_inline_write;
+ ctx->buffer_subdata = noop_buffer_subdata;
+ ctx->texture_subdata = noop_texture_subdata;
noop_init_state_functions(ctx);
return ctx;
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 7c1421b5815..17052b26e9c 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -634,7 +634,6 @@ const struct u_resource_vtbl nouveau_buffer_vtbl =
nouveau_buffer_transfer_map, /* transfer_map */
nouveau_buffer_transfer_flush_region, /* transfer_flush_region */
nouveau_buffer_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
index c6f69650068..165b8f29b4b 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
@@ -358,7 +358,6 @@ const struct u_resource_vtbl nv30_miptree_vtbl = {
nv30_miptree_transfer_map,
u_default_transfer_flush_region,
nv30_miptree_transfer_unmap,
- u_default_transfer_inline_write
};
struct pipe_resource *
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c
index 4d215d2e616..6238a2384cb 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c
@@ -90,7 +90,8 @@ nv30_resource_init(struct pipe_context *pipe)
pipe->transfer_map = u_transfer_map_vtbl;
pipe->transfer_flush_region = u_transfer_flush_region_vtbl;
pipe->transfer_unmap = u_transfer_unmap_vtbl;
- pipe->transfer_inline_write = u_transfer_inline_write_vtbl;
+ pipe->buffer_subdata = u_default_buffer_subdata;
+ pipe->texture_subdata = u_default_texture_subdata;
pipe->create_surface = nv30_miptree_surface_new;
pipe->surface_destroy = nv30_miptree_surface_del;
pipe->resource_copy_region = nv30_resource_copy_region;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 745011977b3..f2e304fde62 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -204,7 +204,6 @@ const struct u_resource_vtbl nv50_miptree_vtbl =
nv50_miptree_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
nv50_miptree_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
static inline bool
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/src/gallium/drivers/nouveau/nv50/nv50_resource.c
index b090a30aed6..aed8c6241d4 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_resource.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.c
@@ -97,7 +97,8 @@ nv50_init_resource_functions(struct pipe_context *pcontext)
pcontext->transfer_map = u_transfer_map_vtbl;
pcontext->transfer_flush_region = u_transfer_flush_region_vtbl;
pcontext->transfer_unmap = u_transfer_unmap_vtbl;
- pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
+ pcontext->buffer_subdata = u_default_buffer_subdata;
+ pcontext->texture_subdata = u_default_texture_subdata;
pcontext->create_surface = nv50_surface_create;
pcontext->surface_destroy = nv50_surface_destroy;
pcontext->invalidate_resource = nv50_invalidate_resource;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index ed1ac48315b..27674f72a7c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -240,7 +240,6 @@ const struct u_resource_vtbl nvc0_miptree_vtbl =
nvc0_miptree_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
nvc0_miptree_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
index 0aee5890fd8..9bafe3d835d 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
@@ -49,7 +49,8 @@ nvc0_init_resource_functions(struct pipe_context *pcontext)
pcontext->transfer_map = u_transfer_map_vtbl;
pcontext->transfer_flush_region = u_transfer_flush_region_vtbl;
pcontext->transfer_unmap = u_transfer_unmap_vtbl;
- pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
+ pcontext->buffer_subdata = u_default_buffer_subdata;
+ pcontext->texture_subdata = u_default_texture_subdata;
pcontext->create_surface = nvc0_surface_create;
pcontext->surface_destroy = nv50_surface_destroy;
pcontext->invalidate_resource = nv50_invalidate_resource;
diff --git a/src/gallium/drivers/r300/r300_resource.c b/src/gallium/drivers/r300/r300_resource.c
index 701fd249d30..3da5fefef6d 100644
--- a/src/gallium/drivers/r300/r300_resource.c
+++ b/src/gallium/drivers/r300/r300_resource.c
@@ -43,7 +43,8 @@ void r300_init_resource_functions(struct r300_context *r300)
r300->context.transfer_map = u_transfer_map_vtbl;
r300->context.transfer_flush_region = u_default_transfer_flush_region;
r300->context.transfer_unmap = u_transfer_unmap_vtbl;
- r300->context.transfer_inline_write = u_default_transfer_inline_write;
+ r300->context.buffer_subdata = u_default_buffer_subdata;
+ r300->context.texture_subdata = u_default_texture_subdata;
r300->context.create_surface = r300_create_surface;
r300->context.surface_destroy = r300_surface_destroy;
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 5b69b24f59b..069e9fdc6b0 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -152,7 +152,6 @@ static const struct u_resource_vtbl r300_buffer_vtbl =
r300_buffer_transfer_map, /* transfer_map */
NULL, /* transfer_flush_region */
r300_buffer_transfer_unmap, /* transfer_unmap */
- NULL /* transfer_inline_write */
};
struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 14372da62e4..2fc93c2dfd6 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -1058,7 +1058,6 @@ static const struct u_resource_vtbl r300_texture_vtbl =
r300_texture_transfer_map, /* transfer_map */
NULL, /* transfer_flush_region */
r300_texture_transfer_unmap, /* transfer_unmap */
- NULL /* transfer_inline_write */
};
/* The common texture constructor. */
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index b711786da29..292b5e32afd 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -977,18 +977,6 @@ static void r600_compute_global_transfer_flush_region(struct pipe_context *ctx,
assert(0 && "TODO");
}
-static void r600_compute_global_transfer_inline_write(struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
-{
- assert(0 && "TODO");
-}
-
static void r600_compute_global_buffer_destroy(struct pipe_screen *screen,
struct pipe_resource *res)
{
@@ -1014,7 +1002,6 @@ static const struct u_resource_vtbl r600_global_buffer_vtbl =
r600_compute_global_transfer_map, /* transfer_map */
r600_compute_global_transfer_flush_region,/* transfer_flush_region */
r600_compute_global_transfer_unmap, /* transfer_unmap */
- r600_compute_global_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *r600_compute_global_buffer_create(struct pipe_screen *screen,
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index 9583d70489e..b5c8697ac52 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -456,7 +456,6 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
r600_buffer_transfer_map, /* transfer_map */
r600_buffer_flush_region, /* transfer_flush_region */
r600_buffer_transfer_unmap, /* transfer_unmap */
- NULL /* transfer_inline_write */
};
static struct r600_resource *
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 647832b5f6e..4ef58cae282 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -422,8 +422,9 @@ bool r600_common_context_init(struct r600_common_context *rctx,
rctx->b.transfer_map = u_transfer_map_vtbl;
rctx->b.transfer_flush_region = u_transfer_flush_region_vtbl;
rctx->b.transfer_unmap = u_transfer_unmap_vtbl;
- rctx->b.transfer_inline_write = u_default_transfer_inline_write;
- rctx->b.memory_barrier = r600_memory_barrier;
+ rctx->b.buffer_subdata = u_default_buffer_subdata;
+ rctx->b.texture_subdata = u_default_texture_subdata;
+ rctx->b.memory_barrier = r600_memory_barrier;
rctx->b.flush = r600_flush_from_st;
rctx->b.set_debug_callback = r600_set_debug_callback;
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 7763f812141..f7c2f80ec3c 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1628,7 +1628,6 @@ static const struct u_resource_vtbl r600_texture_vtbl =
r600_texture_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
r600_texture_transfer_unmap, /* transfer_unmap */
- NULL /* transfer_inline_write */
};
struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
index 77f09b001a8..83914d3615b 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -1141,14 +1141,31 @@ rbug_context_transfer_unmap(struct pipe_context *_context,
static void
-rbug_context_transfer_inline_write(struct pipe_context *_context,
- struct pipe_resource *_resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
+rbug_context_buffer_subdata(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+ struct rbug_context *rb_pipe = rbug_context(_context);
+ struct rbug_resource *rb_resource = rbug_resource(_resource);
+ struct pipe_context *context = rb_pipe->pipe;
+ struct pipe_resource *resource = rb_resource->resource;
+
+ pipe_mutex_lock(rb_pipe->call_mutex);
+ context->buffer_subdata(context, resource, usage, offset, size, data);
+ pipe_mutex_unlock(rb_pipe->call_mutex);
+}
+
+
+static void
+rbug_context_texture_subdata(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride)
{
struct rbug_context *rb_pipe = rbug_context(_context);
struct rbug_resource *rb_resource = rbug_resource(_resource);
@@ -1156,14 +1173,14 @@ rbug_context_transfer_inline_write(struct pipe_context *_context,
struct pipe_resource *resource = rb_resource->resource;
pipe_mutex_lock(rb_pipe->call_mutex);
- context->transfer_inline_write(context,
- resource,
- level,
- usage,
- box,
- data,
- stride,
- layer_stride);
+ context->texture_subdata(context,
+ resource,
+ level,
+ usage,
+ box,
+ data,
+ stride,
+ layer_stride);
pipe_mutex_unlock(rb_pipe->call_mutex);
}
@@ -1252,7 +1269,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
rb_pipe->base.transfer_map = rbug_context_transfer_map;
rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap;
rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region;
- rb_pipe->base.transfer_inline_write = rbug_context_transfer_inline_write;
+ rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata;
+ rb_pipe->base.texture_subdata = rbug_context_texture_subdata;
rb_pipe->pipe = pipe;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 64666fee03f..9c64397d0b9 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -514,7 +514,8 @@ softpipe_init_texture_funcs(struct pipe_context *pipe)
pipe->transfer_unmap = softpipe_transfer_unmap;
pipe->transfer_flush_region = u_default_transfer_flush_region;
- pipe->transfer_inline_write = u_default_transfer_inline_write;
+ pipe->buffer_subdata = u_default_buffer_subdata;
+ pipe->texture_subdata = u_default_texture_subdata;
pipe->create_surface = softpipe_create_surface;
pipe->surface_destroy = softpipe_surface_destroy;
diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c
index 264ac335405..6a297a2ae02 100644
--- a/src/gallium/drivers/svga/svga_resource.c
+++ b/src/gallium/drivers/svga/svga_resource.c
@@ -107,7 +107,8 @@ svga_init_resource_functions(struct svga_context *svga)
svga->pipe.transfer_map = u_transfer_map_vtbl;
svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl;
svga->pipe.transfer_unmap = u_transfer_unmap_vtbl;
- svga->pipe.transfer_inline_write = u_transfer_inline_write_vtbl;
+ svga->pipe.buffer_subdata = u_default_buffer_subdata;
+ svga->pipe.texture_subdata = u_default_texture_subdata;
if (svga_have_vgpu10(svga)) {
svga->pipe.generate_mipmap = svga_texture_generate_mipmap;
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index a92a5c11904..68ce103f750 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -369,7 +369,6 @@ struct u_resource_vtbl svga_buffer_vtbl =
svga_buffer_transfer_map, /* transfer_map */
svga_buffer_transfer_flush_region, /* transfer_flush_region */
svga_buffer_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index 9e1aaabd18c..230221a3867 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -779,7 +779,6 @@ struct u_resource_vtbl svga_texture_vtbl =
svga_texture_transfer_map, /* transfer_map */
u_default_transfer_flush_region, /* transfer_flush_region */
svga_texture_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index 1f3a14cb9c8..1083c9de194 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -376,7 +376,8 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
ctx->pipe.transfer_unmap = swr_transfer_unmap;
ctx->pipe.transfer_flush_region = u_default_transfer_flush_region;
- ctx->pipe.transfer_inline_write = u_default_transfer_inline_write;
+ ctx->pipe.buffer_subdata = u_default_buffer_subdata;
+ ctx->pipe.texture_subdata = u_default_texture_subdata;
ctx->pipe.resource_copy_region = swr_resource_copy;
ctx->pipe.render_condition = swr_render_condition;
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c1ad991eede..65d7f4eca79 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1470,7 +1470,7 @@ trace_context_transfer_map(struct pipe_context *_context,
/*
* Map and transfers can't be serialized so we convert all write transfers
- * to transfer_inline_write and ignore read transfers.
+ * to texture/buffer_subdata and ignore read transfers.
*/
map = context->transfer_map(context, texture, level, usage, box, &result);
@@ -1512,7 +1512,7 @@ trace_context_transfer_unmap(struct pipe_context *_context,
if (tr_trans->map) {
/*
- * Fake a transfer_inline_write
+ * Fake a texture/buffer_subdata
*/
struct pipe_resource *resource = transfer->resource;
@@ -1522,7 +1522,10 @@ trace_context_transfer_unmap(struct pipe_context *_context,
unsigned stride = transfer->stride;
unsigned layer_stride = transfer->layer_stride;
- trace_dump_call_begin("pipe_context", "transfer_inline_write");
+ if (resource->target == PIPE_BUFFER)
+ trace_dump_call_begin("pipe_context", "buffer_subdata");
+ else
+ trace_dump_call_begin("pipe_context", "texture_subdata");
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, resource);
@@ -1552,14 +1555,47 @@ trace_context_transfer_unmap(struct pipe_context *_context,
static void
-trace_context_transfer_inline_write(struct pipe_context *_context,
- struct pipe_resource *_resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned layer_stride)
+trace_context_buffer_subdata(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_resource *tr_res = trace_resource(_resource);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_resource *resource = tr_res->resource;
+ struct pipe_box box;
+
+ assert(resource->screen == context->screen);
+
+ trace_dump_call_begin("pipe_context", "buffer_subdata");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, resource);
+ trace_dump_arg(uint, usage);
+ trace_dump_arg(uint, offset);
+ trace_dump_arg(uint, size);
+
+ trace_dump_arg_begin("data");
+ u_box_1d(offset, size, &box);
+ trace_dump_box_bytes(data, resource, &box, 0, 0);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ context->buffer_subdata(context, resource, usage, offset, size, data);
+}
+
+
+static void
+trace_context_texture_subdata(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride)
{
struct trace_context *tr_context = trace_context(_context);
struct trace_resource *tr_res = trace_resource(_resource);
@@ -1568,7 +1604,7 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
assert(resource->screen == context->screen);
- trace_dump_call_begin("pipe_context", "transfer_inline_write");
+ trace_dump_call_begin("pipe_context", "texture_subdata");
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, resource);
@@ -1589,8 +1625,8 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
trace_dump_call_end();
- context->transfer_inline_write(context, resource, level, usage, box,
- data, stride, layer_stride);
+ context->texture_subdata(context, resource, level, usage, box,
+ data, stride, layer_stride);
}
@@ -1873,7 +1909,8 @@ trace_context_create(struct trace_screen *tr_scr,
TR_CTX_INIT(transfer_map);
TR_CTX_INIT(transfer_unmap);
TR_CTX_INIT(transfer_flush_region);
- TR_CTX_INIT(transfer_inline_write);
+ TR_CTX_INIT(buffer_subdata);
+ TR_CTX_INIT(texture_subdata);
#undef TR_CTX_INIT
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 08d7d207f79..398aa8181df 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -353,7 +353,6 @@ static const struct u_resource_vtbl vc4_resource_vtbl = {
.transfer_map = vc4_resource_transfer_map,
.transfer_flush_region = u_default_transfer_flush_region,
.transfer_unmap = vc4_resource_transfer_unmap,
- .transfer_inline_write = u_default_transfer_inline_write,
};
static void
@@ -985,7 +984,8 @@ vc4_resource_context_init(struct pipe_context *pctx)
pctx->transfer_map = u_transfer_map_vtbl;
pctx->transfer_flush_region = u_transfer_flush_region_vtbl;
pctx->transfer_unmap = u_transfer_unmap_vtbl;
- pctx->transfer_inline_write = u_transfer_inline_write_vtbl;
+ pctx->buffer_subdata = u_default_buffer_subdata;
+ pctx->texture_subdata = u_default_texture_subdata;
pctx->create_surface = vc4_create_surface;
pctx->surface_destroy = vc4_surface_destroy;
pctx->resource_copy_region = util_resource_copy_region;
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
index 94034072439..153df8dd0c9 100644
--- a/src/gallium/drivers/virgl/virgl_buffer.c
+++ b/src/gallium/drivers/virgl/virgl_buffer.c
@@ -145,7 +145,6 @@ static const struct u_resource_vtbl virgl_buffer_vtbl =
virgl_buffer_transfer_map, /* transfer_map */
virgl_buffer_transfer_flush_region, /* transfer_flush_region */
virgl_buffer_transfer_unmap, /* transfer_unmap */
- virgl_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *virgl_buffer_create(struct virgl_screen *vs,
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 2b3794765e2..441b0c11703 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -82,10 +82,22 @@ void virgl_init_screen_resource_functions(struct pipe_screen *screen)
screen->resource_destroy = u_resource_destroy_vtbl;
}
+static void virgl_buffer_subdata(struct pipe_context *pipe,
+ struct pipe_resource *resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+ struct pipe_box box;
+
+ u_box_1d(offset, size, &box);
+ virgl_transfer_inline_write(pipe, resource, 0, usage, &box, data, 0, 0);
+}
+
void virgl_init_context_resource_functions(struct pipe_context *ctx)
{
ctx->transfer_map = u_transfer_map_vtbl;
ctx->transfer_flush_region = u_transfer_flush_region_vtbl;
ctx->transfer_unmap = u_transfer_unmap_vtbl;
- ctx->transfer_inline_write = u_transfer_inline_write_vtbl;
+ ctx->buffer_subdata = virgl_buffer_subdata;
+ ctx->texture_subdata = u_default_texture_subdata;
}
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index 34db0560fe9..64b6744462d 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -304,7 +304,6 @@ static const struct u_resource_vtbl virgl_texture_vtbl =
virgl_texture_transfer_map, /* transfer_map */
NULL, /* transfer_flush_region */
virgl_texture_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *