diff options
33 files changed, 53 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index b7a2856880..3baa00f518 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -329,7 +329,7 @@ pipe_buffer_map_range(struct pipe_context *pipe, u_box_1d(offset, length, &box); - map = pipe->transfer_map(pipe, buffer, 0, access, &box, transfer); + map = pipe->transfer_map(pipe, buffer, 0, access, &box, 0, transfer); if (!map) { return NULL; } @@ -466,7 +466,7 @@ pipe_transfer_map_box(struct pipe_context *context, const struct pipe_box *box, struct pipe_transfer **out_transfer) { - return context->transfer_map(context, resource, level, usage, box, + return context->transfer_map(context, resource, level, usage, box, 0, out_transfer); } @@ -490,7 +490,7 @@ pipe_transfer_map(struct pipe_context *context, resource, level, access, - &box, transfer); + &box, 0, transfer); } @@ -513,7 +513,7 @@ pipe_transfer_map_3d(struct pipe_context *context, resource, level, access, - &box, transfer); + &box, 0, transfer); } static inline void diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 1c647a3efd..0c41f5582a 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1436,6 +1436,7 @@ static void * tc_transfer_map(struct pipe_context *_pipe, struct pipe_resource *resource, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct threaded_context *tc = threaded_context(_pipe); @@ -1480,7 +1481,7 @@ tc_transfer_map(struct pipe_context *_pipe, usage & PIPE_TRANSFER_READ ? " read" : " ??"); return pipe->transfer_map(pipe, tres->latest ? tres->latest : resource, - level, usage, box, transfer); + level, usage, box, user_stride, transfer); } struct tc_transfer_flush_region { @@ -1641,7 +1642,7 @@ tc_buffer_subdata(struct pipe_context *_pipe, u_box_1d(offset, size, &box); - map = tc_transfer_map(_pipe, resource, 0, usage, &box, &transfer); + map = tc_transfer_map(_pipe, resource, 0, usage, &box, 0, &transfer); if (map) { memcpy(map, data, size); tc_transfer_unmap(_pipe, transfer); diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index 0e0c4cc91c..5f07ea067f 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -132,11 +132,12 @@ void *u_transfer_map_vtbl(struct pipe_context *context, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct u_resource *ur = u_resource(resource); return ur->vtbl->transfer_map(context, resource, level, usage, box, - transfer); + user_stride, transfer); } void u_transfer_flush_region_vtbl( struct pipe_context *pipe, diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 14084983da..9f1fcb626f 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -58,6 +58,7 @@ struct u_resource_vtbl { unsigned level, unsigned usage, const struct pipe_box *, + unsigned user_stride, struct pipe_transfer **); @@ -90,6 +91,7 @@ void *u_transfer_map_vtbl(struct pipe_context *context, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer); void u_transfer_flush_region_vtbl( struct pipe_context *pipe, diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c index f69015af51..b5ad30c522 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.c +++ b/src/gallium/auxiliary/util/u_transfer_helper.c @@ -224,6 +224,7 @@ u_transfer_helper_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **pptrans) { struct u_transfer_helper *helper = pctx->screen->transfer_helper; diff --git a/src/gallium/auxiliary/util/u_transfer_helper.h b/src/gallium/auxiliary/util/u_transfer_helper.h index b13a1ec06c..351efa894d 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.h +++ b/src/gallium/auxiliary/util/u_transfer_helper.h @@ -109,6 +109,7 @@ void *u_transfer_helper_transfer_map(struct pipe_context *pctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **pptrans); diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c index c404ea0607..aa98f357b9 100644 --- a/src/gallium/drivers/ddebug/dd_draw.c +++ b/src/gallium/drivers/ddebug/dd_draw.c @@ -1480,6 +1480,7 @@ static void * dd_context_transfer_map(struct pipe_context *_pipe, struct pipe_resource *resource, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct dd_context *dctx = dd_context(_pipe); @@ -1492,7 +1493,7 @@ dd_context_transfer_map(struct pipe_context *_pipe, dd_before_draw(dctx, record); } - void *ptr = pipe->transfer_map(pipe, resource, level, usage, box, transfer); + void *ptr = pipe->transfer_map(pipe, resource, level, usage, box, user_stride, transfer); if (record) { record->call.info.transfer_map.transfer_ptr = *transfer; record->call.info.transfer_map.ptr = ptr; diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c index 30ae3bfc39..8d079ad4e2 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c @@ -138,6 +138,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **out_transfer) { struct etna_context *ctx = etna_context(pctx); diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 2572fc40b2..88a3181ee6 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -66,6 +66,7 @@ i915_buffer_transfer_map(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct i915_context *i915 = i915_context(pipe); diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 4ade04f223..fbf8362427 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -717,6 +717,7 @@ i915_texture_transfer_map(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct i915_context *i915 = i915_context(pipe); diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 162c74ad7d..5424781d8e 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -510,6 +510,7 @@ llvmpipe_transfer_map( struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer ) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index d1e795dab1..cc74fcbd5d 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -174,6 +174,7 @@ static void *noop_transfer_map(struct pipe_context *pipe, unsigned level, enum pipe_transfer_usage usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct pipe_transfer *transfer; diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 2c604419ce..c5be45cadb 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -377,6 +377,7 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, struct pipe_resource *resource, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct nouveau_context *nv = nouveau_context(pipe); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c index 165b8f29b4..b2a3f5626a 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c @@ -261,6 +261,7 @@ static void * nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_resource *pt, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct nv30_context *nv30 = nv30_context(pipe); diff --git a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c index 8209f1f1e8..debc01e8fb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c @@ -247,6 +247,7 @@ nv50_miptree_transfer_map(struct pipe_context *pctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct nv50_screen *screen = nv50_screen(pctx->screen); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c index 225b894717..69a031a46f 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c @@ -372,6 +372,7 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct nvc0_context *nvc0 = nvc0_context(pctx); diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 4af1c46856..5b761fdd5b 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -69,6 +69,7 @@ r300_buffer_transfer_map( struct pipe_context *context, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer ) { struct r300_context *r300 = r300_context(context); diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 9d00f4d937..35361b5b7b 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -105,6 +105,7 @@ r300_texture_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct r300_context *r300 = r300_context(ctx); diff --git a/src/gallium/drivers/r300/r300_transfer.h b/src/gallium/drivers/r300/r300_transfer.h index 45477ae6d0..54cc5aa704 100644 --- a/src/gallium/drivers/r300/r300_transfer.h +++ b/src/gallium/drivers/r300/r300_transfer.h @@ -34,6 +34,7 @@ r300_texture_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer); void diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 866837dfa6..0338f25b88 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -1196,6 +1196,7 @@ static void *r600_compute_global_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct r600_context *rctx = (struct r600_context*)ctx; diff --git a/src/gallium/drivers/r600/r600_buffer_common.c b/src/gallium/drivers/r600/r600_buffer_common.c index 501b96fa0b..b09e0fa797 100644 --- a/src/gallium/drivers/r600/r600_buffer_common.c +++ b/src/gallium/drivers/r600/r600_buffer_common.c @@ -352,6 +352,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct r600_common_context *rctx = (struct r600_common_context*)ctx; @@ -558,7 +559,7 @@ void r600_buffer_subdata(struct pipe_context *ctx, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage, - &box, &transfer); + &box, 0, &transfer); if (!map) return; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index fbcc878a24..765c8e41d6 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -1279,6 +1279,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct r600_common_context *rctx = (struct r600_common_context*)ctx; diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 2b4b7bb7f4..c99d716f46 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -355,6 +355,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct r600_common_context *rctx = (struct r600_common_context*)ctx; @@ -575,7 +576,7 @@ static void si_buffer_subdata(struct pipe_context *ctx, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage, - &box, &transfer); + &box, 0, &transfer); if (!map) return; diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index e0d452f5a2..02bbd0bf0d 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1648,6 +1648,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct r600_common_context *rctx = (struct r600_common_context*)ctx; diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index e1f3c4f284..a03f4a79b4 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -1072,6 +1072,7 @@ rbug_context_transfer_map(struct pipe_context *_context, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct rbug_context *rb_pipe = rbug_context(_context); @@ -1086,7 +1087,9 @@ rbug_context_transfer_map(struct pipe_context *_context, resource, level, usage, - box, &result); + box, + user_stride, + &result); mtx_unlock(&rb_pipe->call_mutex); *transfer = rbug_transfer_create(rb_pipe, rb_resource, result); diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index ea5e2c64b8..d099576ca9 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -357,6 +357,7 @@ softpipe_transfer_map(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys; diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index e9d31de616..dc706cccce 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -70,6 +70,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct svga_context *svga = svga_context(pipe); diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 71b8ebe7d4..5a0141316b 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -540,6 +540,7 @@ svga_texture_transfer_map(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **ptransfer) { struct svga_context *svga = svga_context(pipe); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 6d918d42a3..ff8b556b59 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1375,6 +1375,7 @@ trace_context_transfer_map(struct pipe_context *_context, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct trace_context *tr_context = trace_context(_context); @@ -1387,7 +1388,7 @@ trace_context_transfer_map(struct pipe_context *_context, * to texture/buffer_subdata and ignore read transfers. */ - map = context->transfer_map(context, resource, level, usage, box, &result); + map = context->transfer_map(context, resource, level, usage, box, user_stride, &result); if (!map) return NULL; diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index a86bd814d2..12f0c43397 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -147,6 +147,7 @@ vc4_resource_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **pptrans) { struct vc4_context *vc4 = vc4_context(pctx); diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 2e63aebc72..d6af398b10 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -43,6 +43,7 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct virgl_context *vctx = virgl_context(ctx); diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c index 150a5ebd8c..903418f97a 100644 --- a/src/gallium/drivers/virgl/virgl_texture.c +++ b/src/gallium/drivers/virgl/virgl_texture.c @@ -124,6 +124,7 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx, unsigned level, unsigned usage, const struct pipe_box *box, + unsigned user_stride, struct pipe_transfer **transfer) { struct virgl_context *vctx = virgl_context(ctx); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index c3dc5edf57..6d99479e4b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -573,12 +573,19 @@ struct pipe_context { * out_transfer will contain the transfer object that must be passed * to all the other transfer functions. It also contains useful * information (like texture strides). + * + * If \p user_stride is non-zero, the driver should attempt to provide + * a transfer with stride == user_stride. However, the resulting stride + * may be different, e.g. if user_stride is not sufficiently aligned. + * The map may also fail if user_stride is insufficiently aligned or too + * large, and the behavior is undefined if user_stride is too small. */ void *(*transfer_map)(struct pipe_context *, struct pipe_resource *resource, unsigned level, unsigned usage, /* a combination of PIPE_TRANSFER_x */ const struct pipe_box *, + unsigned user_stride, struct pipe_transfer **out_transfer); /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the |