gallium: split transfer_(un)map into buffer_(un)map and texture_(un)map

The u_resource_vtbl indirection is going to be removed.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10659>
This commit is contained in:
Marek Olšák
2021-05-05 15:27:46 -04:00
committed by Marge Bot
parent 9effc49569
commit eb74f97769
96 changed files with 709 additions and 447 deletions
+70 -9
View File
@@ -1599,10 +1599,10 @@ dd_context_clear_texture(struct pipe_context *_pipe,
*/ */
static void * static void *
dd_context_transfer_map(struct pipe_context *_pipe, dd_context_buffer_map(struct pipe_context *_pipe,
struct pipe_resource *resource, unsigned level, struct pipe_resource *resource, unsigned level,
unsigned usage, const struct pipe_box *box, unsigned usage, const struct pipe_box *box,
struct pipe_transfer **transfer) struct pipe_transfer **transfer)
{ {
struct dd_context *dctx = dd_context(_pipe); struct dd_context *dctx = dd_context(_pipe);
struct pipe_context *pipe = dctx->pipe; struct pipe_context *pipe = dctx->pipe;
@@ -1614,7 +1614,41 @@ dd_context_transfer_map(struct pipe_context *_pipe,
dd_before_draw(dctx, record); dd_before_draw(dctx, record);
} }
void *ptr = pipe->transfer_map(pipe, resource, level, usage, box, transfer); void *ptr = pipe->buffer_map(pipe, resource, level, usage, box, transfer);
if (record) {
record->call.info.transfer_map.transfer_ptr = *transfer;
record->call.info.transfer_map.ptr = ptr;
if (*transfer) {
record->call.info.transfer_map.transfer = **transfer;
record->call.info.transfer_map.transfer.resource = NULL;
pipe_resource_reference(&record->call.info.transfer_map.transfer.resource,
(*transfer)->resource);
} else {
memset(&record->call.info.transfer_map.transfer, 0, sizeof(struct pipe_transfer));
}
dd_after_draw(dctx, record);
}
return ptr;
}
static void *
dd_context_texture_map(struct pipe_context *_pipe,
struct pipe_resource *resource, unsigned level,
unsigned usage, const struct pipe_box *box,
struct pipe_transfer **transfer)
{
struct dd_context *dctx = dd_context(_pipe);
struct pipe_context *pipe = dctx->pipe;
struct dd_draw_record *record =
dd_screen(dctx->base.screen)->transfers ? dd_create_record(dctx) : NULL;
if (record) {
record->call.type = CALL_TRANSFER_MAP;
dd_before_draw(dctx, record);
}
void *ptr = pipe->texture_map(pipe, resource, level, usage, box, transfer);
if (record) { if (record) {
record->call.info.transfer_map.transfer_ptr = *transfer; record->call.info.transfer_map.transfer_ptr = *transfer;
record->call.info.transfer_map.ptr = ptr; record->call.info.transfer_map.ptr = ptr;
@@ -1660,7 +1694,7 @@ dd_context_transfer_flush_region(struct pipe_context *_pipe,
} }
static void static void
dd_context_transfer_unmap(struct pipe_context *_pipe, dd_context_buffer_unmap(struct pipe_context *_pipe,
struct pipe_transfer *transfer) struct pipe_transfer *transfer)
{ {
struct dd_context *dctx = dd_context(_pipe); struct dd_context *dctx = dd_context(_pipe);
@@ -1679,7 +1713,32 @@ dd_context_transfer_unmap(struct pipe_context *_pipe,
dd_before_draw(dctx, record); dd_before_draw(dctx, record);
} }
pipe->transfer_unmap(pipe, transfer); pipe->buffer_unmap(pipe, transfer);
if (record)
dd_after_draw(dctx, record);
}
static void
dd_context_texture_unmap(struct pipe_context *_pipe,
struct pipe_transfer *transfer)
{
struct dd_context *dctx = dd_context(_pipe);
struct pipe_context *pipe = dctx->pipe;
struct dd_draw_record *record =
dd_screen(dctx->base.screen)->transfers ? dd_create_record(dctx) : NULL;
if (record) {
record->call.type = CALL_TRANSFER_UNMAP;
record->call.info.transfer_unmap.transfer_ptr = transfer;
record->call.info.transfer_unmap.transfer = *transfer;
record->call.info.transfer_unmap.transfer.resource = NULL;
pipe_resource_reference(
&record->call.info.transfer_unmap.transfer.resource,
transfer->resource);
dd_before_draw(dctx, record);
}
pipe->texture_unmap(pipe, transfer);
if (record) if (record)
dd_after_draw(dctx, record); dd_after_draw(dctx, record);
} }
@@ -1759,9 +1818,11 @@ dd_init_draw_functions(struct dd_context *dctx)
CTX_INIT(flush_resource); CTX_INIT(flush_resource);
CTX_INIT(generate_mipmap); CTX_INIT(generate_mipmap);
CTX_INIT(get_query_result_resource); CTX_INIT(get_query_result_resource);
CTX_INIT(transfer_map); CTX_INIT(buffer_map);
CTX_INIT(texture_map);
CTX_INIT(transfer_flush_region); CTX_INIT(transfer_flush_region);
CTX_INIT(transfer_unmap); CTX_INIT(buffer_unmap);
CTX_INIT(texture_unmap);
CTX_INIT(buffer_subdata); CTX_INIT(buffer_subdata);
CTX_INIT(texture_subdata); CTX_INIT(texture_subdata);
} }
@@ -381,9 +381,11 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen,
ctx->end_query = noop_end_query; ctx->end_query = noop_end_query;
ctx->get_query_result = noop_get_query_result; ctx->get_query_result = noop_get_query_result;
ctx->set_active_query_state = noop_set_active_query_state; ctx->set_active_query_state = noop_set_active_query_state;
ctx->transfer_map = noop_transfer_map; ctx->buffer_map = noop_transfer_map;
ctx->texture_map = noop_transfer_map;
ctx->transfer_flush_region = noop_transfer_flush_region; ctx->transfer_flush_region = noop_transfer_flush_region;
ctx->transfer_unmap = noop_transfer_unmap; ctx->buffer_unmap = noop_transfer_unmap;
ctx->texture_unmap = noop_transfer_unmap;
ctx->buffer_subdata = noop_buffer_subdata; ctx->buffer_subdata = noop_buffer_subdata;
ctx->texture_subdata = noop_texture_subdata; ctx->texture_subdata = noop_texture_subdata;
ctx->invalidate_resource = noop_invalidate_resource; ctx->invalidate_resource = noop_invalidate_resource;
@@ -1107,7 +1107,7 @@ rbug_context_surface_destroy(struct pipe_context *_pipe,
static void * static void *
rbug_context_transfer_map(struct pipe_context *_context, rbug_context_buffer_map(struct pipe_context *_context,
struct pipe_resource *_resource, struct pipe_resource *_resource,
unsigned level, unsigned level,
unsigned usage, unsigned usage,
@@ -1122,7 +1122,34 @@ rbug_context_transfer_map(struct pipe_context *_context,
void *map; void *map;
mtx_lock(&rb_pipe->call_mutex); mtx_lock(&rb_pipe->call_mutex);
map = context->transfer_map(context, map = context->buffer_map(context,
resource,
level,
usage,
box, &result);
mtx_unlock(&rb_pipe->call_mutex);
*transfer = rbug_transfer_create(rb_pipe, rb_resource, result);
return *transfer ? map : NULL;
}
static void *
rbug_context_texture_map(struct pipe_context *_context,
struct pipe_resource *_resource,
unsigned level,
unsigned usage,
const struct pipe_box *box,
struct pipe_transfer **transfer)
{
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;
struct pipe_transfer *result;
void *map;
mtx_lock(&rb_pipe->call_mutex);
map = context->texture_map(context,
resource, resource,
level, level,
usage, usage,
@@ -1152,7 +1179,7 @@ rbug_context_transfer_flush_region(struct pipe_context *_context,
static void static void
rbug_context_transfer_unmap(struct pipe_context *_context, rbug_context_buffer_unmap(struct pipe_context *_context,
struct pipe_transfer *_transfer) struct pipe_transfer *_transfer)
{ {
struct rbug_context *rb_pipe = rbug_context(_context); struct rbug_context *rb_pipe = rbug_context(_context);
@@ -1161,7 +1188,24 @@ rbug_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *transfer = rb_transfer->transfer; struct pipe_transfer *transfer = rb_transfer->transfer;
mtx_lock(&rb_pipe->call_mutex); mtx_lock(&rb_pipe->call_mutex);
context->transfer_unmap(context, context->buffer_unmap(context,
transfer);
rbug_transfer_destroy(rb_pipe,
rb_transfer);
mtx_unlock(&rb_pipe->call_mutex);
}
static void
rbug_context_texture_unmap(struct pipe_context *_context,
struct pipe_transfer *_transfer)
{
struct rbug_context *rb_pipe = rbug_context(_context);
struct rbug_transfer *rb_transfer = rbug_transfer(_transfer);
struct pipe_context *context = rb_pipe->pipe;
struct pipe_transfer *transfer = rb_transfer->transfer;
mtx_lock(&rb_pipe->call_mutex);
context->texture_unmap(context,
transfer); transfer);
rbug_transfer_destroy(rb_pipe, rbug_transfer_destroy(rb_pipe,
rb_transfer); rb_transfer);
@@ -1308,8 +1352,10 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy;
rb_pipe->base.create_surface = rbug_context_create_surface; rb_pipe->base.create_surface = rbug_context_create_surface;
rb_pipe->base.surface_destroy = rbug_context_surface_destroy; rb_pipe->base.surface_destroy = rbug_context_surface_destroy;
rb_pipe->base.transfer_map = rbug_context_transfer_map; rb_pipe->base.buffer_map = rbug_context_buffer_map;
rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; rb_pipe->base.buffer_unmap = rbug_context_buffer_unmap;
rb_pipe->base.texture_map = rbug_context_texture_map;
rb_pipe->base.texture_unmap = rbug_context_texture_unmap;
rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region;
rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata; rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata;
rb_pipe->base.texture_subdata = rbug_context_texture_subdata; rb_pipe->base.texture_subdata = rbug_context_texture_subdata;
@@ -267,7 +267,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
} }
tex = tr_tex->resource; tex = tr_tex->resource;
map = pipe_transfer_map(context, tex, map = pipe_texture_map(context, tex,
gptr->level, gptr->face + gptr->zslice, gptr->level, gptr->face + gptr->zslice,
PIPE_MAP_READ, PIPE_MAP_READ,
gptr->x, gptr->y, gptr->w, gptr->h, &t); gptr->x, gptr->y, gptr->w, gptr->h, &t);
@@ -283,7 +283,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
t->stride, t->stride,
NULL); NULL);
context->transfer_unmap(context, t); context->texture_unmap(context, t);
mtx_unlock(&rb_screen->list_mutex); mtx_unlock(&rb_screen->list_mutex);
@@ -186,7 +186,10 @@ rbug_transfer_create(struct rbug_context *rb_context,
return &rb_transfer->base; return &rb_transfer->base;
error: error:
rb_context->pipe->transfer_unmap(rb_context->pipe, transfer); if (rb_resource->base.target == PIPE_BUFFER)
rb_context->pipe->buffer_unmap(rb_context->pipe, transfer);
else
rb_context->pipe->texture_unmap(rb_context->pipe, transfer);
return NULL; return NULL;
} }
@@ -1572,7 +1572,10 @@ trace_context_transfer_map(struct pipe_context *_context,
* to texture/buffer_subdata and ignore read transfers. * to texture/buffer_subdata and ignore read transfers.
*/ */
map = context->transfer_map(context, resource, level, usage, box, &result); if (resource->target == PIPE_BUFFER)
map = context->buffer_map(context, resource, level, usage, box, &result);
else
map = context->texture_map(context, resource, level, usage, box, &result);
if (!map) if (!map)
return NULL; return NULL;
@@ -1672,7 +1675,10 @@ trace_context_transfer_unmap(struct pipe_context *_context,
tr_trans->map = NULL; tr_trans->map = NULL;
} }
context->transfer_unmap(context, transfer); if (transfer->resource->target == PIPE_BUFFER)
context->buffer_unmap(context, transfer);
else
context->texture_unmap(context, transfer);
trace_transfer_destroy(tr_ctx, tr_trans); trace_transfer_destroy(tr_ctx, tr_trans);
} }
@@ -2160,8 +2166,8 @@ trace_context_create(struct trace_screen *tr_scr,
TR_CTX_INIT(delete_image_handle); TR_CTX_INIT(delete_image_handle);
TR_CTX_INIT(make_image_handle_resident); TR_CTX_INIT(make_image_handle_resident);
TR_CTX_INIT(transfer_map); tr_ctx->base.buffer_map = tr_ctx->base.texture_map = trace_context_transfer_map;
TR_CTX_INIT(transfer_unmap); tr_ctx->base.buffer_unmap = tr_ctx->base.texture_unmap = trace_context_transfer_unmap;
TR_CTX_INIT(transfer_flush_region); TR_CTX_INIT(transfer_flush_region);
TR_CTX_INIT(buffer_subdata); TR_CTX_INIT(buffer_subdata);
TR_CTX_INIT(texture_subdata); TR_CTX_INIT(texture_subdata);
@@ -101,7 +101,10 @@ trace_transfer_create(struct trace_context *tr_ctx,
return &tr_trans->base.b; return &tr_trans->base.b;
error: error:
tr_ctx->pipe->transfer_unmap(tr_ctx->pipe, transfer); if (res->target == PIPE_BUFFER)
tr_ctx->pipe->buffer_unmap(tr_ctx->pipe, transfer);
else
tr_ctx->pipe->texture_unmap(tr_ctx->pipe, transfer);
return NULL; return NULL;
} }
+3 -3
View File
@@ -417,8 +417,8 @@ util_font_create_fixed_8x13(struct pipe_context *pipe,
return FALSE; return FALSE;
} }
map = pipe_transfer_map(pipe, tex, 0, 0, PIPE_MAP_WRITE, 0, 0, map = pipe_texture_map(pipe, tex, 0, 0, PIPE_MAP_WRITE, 0, 0,
tex->width0, tex->height0, &transfer); tex->width0, tex->height0, &transfer);
if (!map) { if (!map) {
pipe_resource_reference(&tex, NULL); pipe_resource_reference(&tex, NULL);
return FALSE; return FALSE;
@@ -432,7 +432,7 @@ util_font_create_fixed_8x13(struct pipe_context *pipe,
transfer->stride, i); transfer->stride, i);
} }
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
pipe_resource_reference(&out_font->texture, NULL); pipe_resource_reference(&out_font->texture, NULL);
out_font->texture = tex; out_font->texture = tex;
+9 -9
View File
@@ -113,10 +113,10 @@ debug_dump_surface(struct pipe_context *pipe,
*/ */
texture = surface->texture; texture = surface->texture;
data = pipe_transfer_map(pipe, texture, surface->u.tex.level, data = pipe_texture_map(pipe, texture, surface->u.tex.level,
surface->u.tex.first_layer, surface->u.tex.first_layer,
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, surface->width, surface->height, &transfer); 0, 0, surface->width, surface->height, &transfer);
if (!data) if (!data)
return; return;
@@ -128,7 +128,7 @@ debug_dump_surface(struct pipe_context *pipe,
transfer->stride, transfer->stride,
data); data);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
@@ -192,13 +192,13 @@ debug_dump_surface_bmp(struct pipe_context *pipe,
struct pipe_resource *texture = surface->texture; struct pipe_resource *texture = surface->texture;
void *ptr; void *ptr;
ptr = pipe_transfer_map(pipe, texture, surface->u.tex.level, ptr = pipe_texture_map(pipe, texture, surface->u.tex.level,
surface->u.tex.first_layer, PIPE_MAP_READ, surface->u.tex.first_layer, PIPE_MAP_READ,
0, 0, surface->width, surface->height, &transfer); 0, 0, surface->width, surface->height, &transfer);
debug_dump_transfer_bmp(pipe, filename, transfer, ptr); debug_dump_transfer_bmp(pipe, filename, transfer, ptr);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
void void
+23 -29
View File
@@ -355,7 +355,7 @@ pipe_buffer_map_range(struct pipe_context *pipe,
u_box_1d(offset, length, &box); u_box_1d(offset, length, &box);
map = pipe->transfer_map(pipe, buffer, 0, access, &box, transfer); map = pipe->buffer_map(pipe, buffer, 0, access, &box, transfer);
if (!map) { if (!map) {
return NULL; return NULL;
} }
@@ -384,7 +384,7 @@ static inline void
pipe_buffer_unmap(struct pipe_context *pipe, pipe_buffer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer) struct pipe_transfer *transfer)
{ {
pipe->transfer_unmap(pipe, transfer); pipe->buffer_unmap(pipe, transfer);
} }
static inline void static inline void
@@ -504,21 +504,18 @@ pipe_buffer_read(struct pipe_context *pipe,
* \param access bitmask of PIPE_MAP_x flags * \param access bitmask of PIPE_MAP_x flags
*/ */
static inline void * static inline void *
pipe_transfer_map(struct pipe_context *context, pipe_texture_map(struct pipe_context *context,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
unsigned access, unsigned access,
unsigned x, unsigned y, unsigned x, unsigned y,
unsigned w, unsigned h, unsigned w, unsigned h,
struct pipe_transfer **transfer) struct pipe_transfer **transfer)
{ {
struct pipe_box box; struct pipe_box box;
u_box_2d_zslice(x, y, layer, w, h, &box); u_box_2d_zslice(x, y, layer, w, h, &box);
return context->transfer_map(context, return context->texture_map(context, resource, level, access,
resource, &box, transfer);
level,
access,
&box, transfer);
} }
@@ -527,28 +524,25 @@ pipe_transfer_map(struct pipe_context *context,
* \param access bitmask of PIPE_MAP_x flags * \param access bitmask of PIPE_MAP_x flags
*/ */
static inline void * static inline void *
pipe_transfer_map_3d(struct pipe_context *context, pipe_texture_map_3d(struct pipe_context *context,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned level,
unsigned access, unsigned access,
unsigned x, unsigned y, unsigned z, unsigned x, unsigned y, unsigned z,
unsigned w, unsigned h, unsigned d, unsigned w, unsigned h, unsigned d,
struct pipe_transfer **transfer) struct pipe_transfer **transfer)
{ {
struct pipe_box box; struct pipe_box box;
u_box_3d(x, y, z, w, h, d, &box); u_box_3d(x, y, z, w, h, d, &box);
return context->transfer_map(context, return context->texture_map(context, resource, level, access,
resource, &box, transfer);
level,
access,
&box, transfer);
} }
static inline void static inline void
pipe_transfer_unmap(struct pipe_context *context, pipe_texture_unmap(struct pipe_context *context,
struct pipe_transfer *transfer) struct pipe_transfer *transfer)
{ {
context->transfer_unmap(context, transfer); context->texture_unmap(context, transfer);
} }
static inline void static inline void
+2 -2
View File
@@ -69,7 +69,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe,
int i, j; int i, j;
/* map texture memory */ /* map texture memory */
data = pipe_transfer_map(pipe, tex, 0, 0, data = pipe_texture_map(pipe, tex, 0, 0,
PIPE_MAP_WRITE, 0, 0, 32, 32, &transfer); PIPE_MAP_WRITE, 0, 0, 32, 32, &transfer);
/* /*
@@ -92,7 +92,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe,
} }
/* unmap */ /* unmap */
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
+60 -33
View File
@@ -288,32 +288,59 @@ util_resource_copy_region(struct pipe_context *pipe,
assert((src_box.width / src_bw) * (src_box.height / src_bh) * src_bs == assert((src_box.width / src_bw) * (src_box.height / src_bh) * src_bs ==
(dst_box.width / dst_bw) * (dst_box.height / dst_bh) * dst_bs); (dst_box.width / dst_bw) * (dst_box.height / dst_bh) * dst_bs);
src_map = pipe->transfer_map(pipe,
src,
src_level,
PIPE_MAP_READ,
&src_box, &src_trans);
assert(src_map);
if (!src_map) {
goto no_src_map;
}
dst_map = pipe->transfer_map(pipe,
dst,
dst_level,
PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, &dst_box,
&dst_trans);
assert(dst_map);
if (!dst_map) {
goto no_dst_map;
}
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) { if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
src_map = pipe->buffer_map(pipe,
src,
src_level,
PIPE_MAP_READ,
&src_box, &src_trans);
assert(src_map);
if (!src_map) {
goto no_src_map_buf;
}
dst_map = pipe->buffer_map(pipe,
dst,
dst_level,
PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, &dst_box,
&dst_trans);
assert(dst_map);
if (!dst_map) {
goto no_dst_map_buf;
}
assert(src_box.height == 1); assert(src_box.height == 1);
assert(src_box.depth == 1); assert(src_box.depth == 1);
memcpy(dst_map, src_map, src_box.width); memcpy(dst_map, src_map, src_box.width);
pipe->buffer_unmap(pipe, dst_trans);
no_dst_map_buf:
pipe->buffer_unmap(pipe, src_trans);
no_src_map_buf:
;
} else { } else {
src_map = pipe->texture_map(pipe,
src,
src_level,
PIPE_MAP_READ,
&src_box, &src_trans);
assert(src_map);
if (!src_map) {
goto no_src_map;
}
dst_map = pipe->texture_map(pipe,
dst,
dst_level,
PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, &dst_box,
&dst_trans);
assert(dst_map);
if (!dst_map) {
goto no_dst_map;
}
util_copy_box(dst_map, util_copy_box(dst_map,
src_format, src_format,
dst_trans->stride, dst_trans->layer_stride, dst_trans->stride, dst_trans->layer_stride,
@@ -322,13 +349,13 @@ util_resource_copy_region(struct pipe_context *pipe,
src_map, src_map,
src_trans->stride, src_trans->layer_stride, src_trans->stride, src_trans->layer_stride,
0, 0, 0); 0, 0, 0);
}
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
no_dst_map: no_dst_map:
pipe->transfer_unmap(pipe, src_trans); pipe->texture_unmap(pipe, src_trans);
no_src_map: no_src_map:
; ;
}
} }
static void static void
@@ -361,7 +388,7 @@ util_clear_color_texture(struct pipe_context *pipe,
struct pipe_transfer *dst_trans; struct pipe_transfer *dst_trans;
ubyte *dst_map; ubyte *dst_map;
dst_map = pipe_transfer_map_3d(pipe, dst_map = pipe_texture_map_3d(pipe,
texture, texture,
level, level,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -375,7 +402,7 @@ util_clear_color_texture(struct pipe_context *pipe,
util_clear_color_texture_helper(dst_trans, dst_map, format, color, util_clear_color_texture_helper(dst_trans, dst_map, format, color,
width, height, depth); width, height, depth);
} }
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
} }
@@ -413,7 +440,7 @@ util_clear_render_target(struct pipe_context *pipe,
unsigned pixstride = util_format_get_blocksize(dst->format); unsigned pixstride = util_format_get_blocksize(dst->format);
dx = (dst->u.buf.first_element + dstx) * pixstride; dx = (dst->u.buf.first_element + dstx) * pixstride;
w = width * pixstride; w = width * pixstride;
dst_map = pipe_transfer_map(pipe, dst_map = pipe_texture_map(pipe,
dst->texture, dst->texture,
0, 0, 0, 0,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -422,7 +449,7 @@ util_clear_render_target(struct pipe_context *pipe,
if (dst_map) { if (dst_map) {
util_clear_color_texture_helper(dst_trans, dst_map, dst->format, util_clear_color_texture_helper(dst_trans, dst_map, dst->format,
color, width, height, 1); color, width, height, 1);
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
} }
} }
else { else {
@@ -562,7 +589,7 @@ util_clear_depth_stencil_texture(struct pipe_context *pipe,
util_format_is_depth_and_stencil(format)) util_format_is_depth_and_stencil(format))
need_rmw = TRUE; need_rmw = TRUE;
dst_map = pipe_transfer_map_3d(pipe, dst_map = pipe_texture_map_3d(pipe,
texture, texture,
level, level,
(need_rmw ? PIPE_MAP_READ_WRITE : (need_rmw ? PIPE_MAP_READ_WRITE :
@@ -580,7 +607,7 @@ util_clear_depth_stencil_texture(struct pipe_context *pipe,
dst_trans->layer_stride, width, height, dst_trans->layer_stride, width, height,
depth, zstencil); depth, zstencil);
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
} }
+2 -2
View File
@@ -231,10 +231,10 @@ util_probe_rect_rgba_multi(struct pipe_context *ctx, struct pipe_resource *tex,
unsigned x,y,e,c; unsigned x,y,e,c;
bool pass = true; bool pass = true;
map = pipe_transfer_map(ctx, tex, 0, 0, PIPE_MAP_READ, map = pipe_texture_map(ctx, tex, 0, 0, PIPE_MAP_READ,
offx, offy, w, h, &transfer); offx, offy, w, h, &transfer);
pipe_get_tile_rgba(transfer, map, 0, 0, w, h, tex->format, pixels); pipe_get_tile_rgba(transfer, map, 0, 0, w, h, tex->format, pixels);
pipe_transfer_unmap(ctx, transfer); pipe_texture_unmap(ctx, transfer);
for (e = 0; e < num_expected_colors; e++) { for (e = 0; e < num_expected_colors; e++) {
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
+141 -88
View File
@@ -1981,80 +1981,100 @@ tc_improve_map_buffer_flags(struct threaded_context *tc,
} }
static void * static void *
tc_transfer_map(struct pipe_context *_pipe, tc_buffer_map(struct pipe_context *_pipe,
struct pipe_resource *resource, unsigned level, struct pipe_resource *resource, unsigned level,
unsigned usage, const struct pipe_box *box, unsigned usage, const struct pipe_box *box,
struct pipe_transfer **transfer) struct pipe_transfer **transfer)
{ {
struct threaded_context *tc = threaded_context(_pipe); struct threaded_context *tc = threaded_context(_pipe);
struct threaded_resource *tres = threaded_resource(resource); struct threaded_resource *tres = threaded_resource(resource);
struct pipe_context *pipe = tc->pipe; struct pipe_context *pipe = tc->pipe;
if (resource->target == PIPE_BUFFER) { usage = tc_improve_map_buffer_flags(tc, tres, usage, box->x, box->width);
usage = tc_improve_map_buffer_flags(tc, tres, usage, box->x, box->width);
/* Do a staging transfer within the threaded context. The driver should /* Do a staging transfer within the threaded context. The driver should
* only get resource_copy_region. * only get resource_copy_region.
*/
if (usage & PIPE_MAP_DISCARD_RANGE) {
struct threaded_transfer *ttrans = slab_alloc(&tc->pool_transfers);
uint8_t *map;
ttrans->staging = NULL;
u_upload_alloc(tc->base.stream_uploader, 0,
box->width + (box->x % tc->map_buffer_alignment),
tc->map_buffer_alignment, &ttrans->b.offset,
&ttrans->staging, (void**)&map);
if (!map) {
slab_free(&tc->pool_transfers, ttrans);
return NULL;
}
ttrans->b.resource = resource;
ttrans->b.level = 0;
ttrans->b.usage = usage;
ttrans->b.box = *box;
ttrans->b.stride = 0;
ttrans->b.layer_stride = 0;
ttrans->valid_buffer_range = &tres->valid_buffer_range;
*transfer = &ttrans->b;
p_atomic_inc(&tres->pending_staging_uploads);
util_range_add(resource, &tres->pending_staging_uploads_range,
box->x, box->x + box->width);
return map + (box->x % tc->map_buffer_alignment);
}
if (usage & PIPE_MAP_UNSYNCHRONIZED &&
p_atomic_read(&tres->pending_staging_uploads) &&
util_ranges_intersect(&tres->pending_staging_uploads_range, box->x, box->x + box->width)) {
/* Write conflict detected between a staging transfer and the direct mapping we're
* going to do. Resolve the conflict by ignoring UNSYNCHRONIZED so the direct mapping
* will have to wait for the staging transfer completion.
* Note: The conflict detection is only based on the mapped range, not on the actual
* written range(s).
*/ */
if (usage & PIPE_MAP_DISCARD_RANGE) { usage &= ~PIPE_MAP_UNSYNCHRONIZED & ~TC_TRANSFER_MAP_THREADED_UNSYNC;
struct threaded_transfer *ttrans = slab_alloc(&tc->pool_transfers); tc->use_forced_staging_uploads = false;
uint8_t *map;
ttrans->staging = NULL;
u_upload_alloc(tc->base.stream_uploader, 0,
box->width + (box->x % tc->map_buffer_alignment),
tc->map_buffer_alignment, &ttrans->b.offset,
&ttrans->staging, (void**)&map);
if (!map) {
slab_free(&tc->pool_transfers, ttrans);
return NULL;
}
ttrans->b.resource = resource;
ttrans->b.level = 0;
ttrans->b.usage = usage;
ttrans->b.box = *box;
ttrans->b.stride = 0;
ttrans->b.layer_stride = 0;
ttrans->valid_buffer_range = &tres->valid_buffer_range;
*transfer = &ttrans->b;
p_atomic_inc(&tres->pending_staging_uploads);
util_range_add(resource, &tres->pending_staging_uploads_range,
box->x, box->x + box->width);
return map + (box->x % tc->map_buffer_alignment);
}
if (usage & PIPE_MAP_UNSYNCHRONIZED &&
p_atomic_read(&tres->pending_staging_uploads) &&
util_ranges_intersect(&tres->pending_staging_uploads_range, box->x, box->x + box->width)) {
/* Write conflict detected between a staging transfer and the direct mapping we're
* going to do. Resolve the conflict by ignoring UNSYNCHRONIZED so the direct mapping
* will have to wait for the staging transfer completion.
* Note: The conflict detection is only based on the mapped range, not on the actual
* written range(s).
*/
usage &= ~PIPE_MAP_UNSYNCHRONIZED & ~TC_TRANSFER_MAP_THREADED_UNSYNC;
tc->use_forced_staging_uploads = false;
}
} }
/* Unsychronized buffer mappings don't have to synchronize the thread. */ /* Unsychronized buffer mappings don't have to synchronize the thread. */
if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC)) { if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC)) {
tc_sync_msg(tc, resource->target != PIPE_BUFFER ? " texture" : tc_sync_msg(tc, usage & PIPE_MAP_DISCARD_RANGE ? " discard_range" :
usage & PIPE_MAP_DISCARD_RANGE ? " discard_range" :
usage & PIPE_MAP_READ ? " read" : " staging conflict"); usage & PIPE_MAP_READ ? " read" : " staging conflict");
tc_set_driver_thread(tc); tc_set_driver_thread(tc);
} }
tc->bytes_mapped_estimate += box->width; tc->bytes_mapped_estimate += box->width;
void *ret = pipe->transfer_map(pipe, tres->latest ? tres->latest : resource, void *ret = pipe->buffer_map(pipe, tres->latest ? tres->latest : resource,
level, usage, box, transfer); level, usage, box, transfer);
if (resource->target == PIPE_BUFFER) threaded_transfer(*transfer)->valid_buffer_range = &tres->valid_buffer_range;
threaded_transfer(*transfer)->valid_buffer_range = &tres->valid_buffer_range;
if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC))
tc_clear_driver_thread(tc);
return ret;
}
static void *
tc_texture_map(struct pipe_context *_pipe,
struct pipe_resource *resource, unsigned level,
unsigned usage, const struct pipe_box *box,
struct pipe_transfer **transfer)
{
struct threaded_context *tc = threaded_context(_pipe);
struct threaded_resource *tres = threaded_resource(resource);
struct pipe_context *pipe = tc->pipe;
tc_sync_msg(tc, "texture");
tc_set_driver_thread(tc);
tc->bytes_mapped_estimate += box->width;
void *ret = pipe->texture_map(pipe, tres->latest ? tres->latest : resource,
level, usage, box, transfer);
if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC)) if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC))
tc_clear_driver_thread(tc); tc_clear_driver_thread(tc);
@@ -2147,7 +2167,11 @@ tc_transfer_flush_region(struct pipe_context *_pipe,
p->box = *rel_box; p->box = *rel_box;
} }
struct tc_transfer_unmap { static void
tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence,
unsigned flags);
struct tc_buffer_unmap {
struct tc_call_base base; struct tc_call_base base;
bool was_staging_transfer; bool was_staging_transfer;
union { union {
@@ -2157,9 +2181,9 @@ struct tc_transfer_unmap {
}; };
static uint16_t static uint16_t
tc_call_transfer_unmap(struct pipe_context *pipe, void *call, uint64_t *last) tc_call_buffer_unmap(struct pipe_context *pipe, void *call, uint64_t *last)
{ {
struct tc_transfer_unmap *p = to_call(call, tc_transfer_unmap); struct tc_buffer_unmap *p = to_call(call, tc_buffer_unmap);
if (p->was_staging_transfer) { if (p->was_staging_transfer) {
struct threaded_resource *tres = threaded_resource(p->resource); struct threaded_resource *tres = threaded_resource(p->resource);
@@ -2168,18 +2192,14 @@ tc_call_transfer_unmap(struct pipe_context *pipe, void *call, uint64_t *last)
p_atomic_dec(&tres->pending_staging_uploads); p_atomic_dec(&tres->pending_staging_uploads);
tc_drop_resource_reference(p->resource); tc_drop_resource_reference(p->resource);
} else { } else {
pipe->transfer_unmap(pipe, p->transfer); pipe->buffer_unmap(pipe, p->transfer);
} }
return call_size(tc_transfer_unmap); return call_size(tc_buffer_unmap);
} }
static void static void
tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence, tc_buffer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
unsigned flags);
static void
tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
{ {
struct threaded_context *tc = threaded_context(_pipe); struct threaded_context *tc = threaded_context(_pipe);
struct threaded_transfer *ttrans = threaded_transfer(transfer); struct threaded_transfer *ttrans = threaded_transfer(transfer);
@@ -2194,30 +2214,28 @@ tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
PIPE_MAP_DISCARD_RANGE))); PIPE_MAP_DISCARD_RANGE)));
struct pipe_context *pipe = tc->pipe; struct pipe_context *pipe = tc->pipe;
if (tres->b.target == PIPE_BUFFER) { util_range_add(&tres->b, ttrans->valid_buffer_range,
util_range_add(&tres->b, ttrans->valid_buffer_range, transfer->box.x, transfer->box.x + transfer->box.width);
transfer->box.x, transfer->box.x + transfer->box.width);
} pipe->buffer_unmap(pipe, transfer);
pipe->transfer_unmap(pipe, transfer);
return; return;
} }
bool was_staging_transfer = false; bool was_staging_transfer = false;
if (tres->b.target == PIPE_BUFFER) { if (transfer->usage & PIPE_MAP_WRITE &&
if (transfer->usage & PIPE_MAP_WRITE && !(transfer->usage & PIPE_MAP_FLUSH_EXPLICIT))
!(transfer->usage & PIPE_MAP_FLUSH_EXPLICIT)) tc_buffer_do_flush_region(tc, ttrans, &transfer->box);
tc_buffer_do_flush_region(tc, ttrans, &transfer->box);
if (ttrans->staging) { if (ttrans->staging) {
was_staging_transfer = true; was_staging_transfer = true;
tc_drop_resource_reference(ttrans->staging); tc_drop_resource_reference(ttrans->staging);
slab_free(&tc->pool_transfers, ttrans); slab_free(&tc->pool_transfers, ttrans);
}
} }
struct tc_transfer_unmap *p = tc_add_call(tc, TC_CALL_transfer_unmap,
tc_transfer_unmap); struct tc_buffer_unmap *p = tc_add_call(tc, TC_CALL_buffer_unmap,
tc_buffer_unmap);
if (was_staging_transfer) { if (was_staging_transfer) {
tc_set_resource_reference(&p->resource, &tres->b); tc_set_resource_reference(&p->resource, &tres->b);
p->was_staging_transfer = true; p->was_staging_transfer = true;
@@ -2226,7 +2244,40 @@ tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
p->was_staging_transfer = false; p->was_staging_transfer = false;
} }
/* tc_transfer_map directly maps the buffers, but tc_transfer_unmap /* tc_buffer_map directly maps the buffers, but tc_buffer_unmap
* defers the unmap operation to the batch execution.
* bytes_mapped_estimate is an estimation of the map/unmap bytes delta
* and if it goes over an optional limit the current batch is flushed,
* to reclaim some RAM. */
if (!ttrans->staging && tc->bytes_mapped_limit &&
tc->bytes_mapped_estimate > tc->bytes_mapped_limit) {
tc_flush(_pipe, NULL, PIPE_FLUSH_ASYNC);
}
}
struct tc_texture_unmap {
struct tc_call_base base;
struct pipe_transfer *transfer;
};
static uint16_t
tc_call_texture_unmap(struct pipe_context *pipe, void *call, uint64_t *last)
{
struct tc_texture_unmap *p = (struct tc_texture_unmap *) call;
pipe->texture_unmap(pipe, p->transfer);
return call_size(tc_texture_unmap);
}
static void
tc_texture_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
{
struct threaded_context *tc = threaded_context(_pipe);
struct threaded_transfer *ttrans = threaded_transfer(transfer);
tc_add_call(tc, TC_CALL_texture_unmap, tc_texture_unmap)->transfer = transfer;
/* tc_texture_map directly maps the textures, but tc_texture_unmap
* defers the unmap operation to the batch execution. * defers the unmap operation to the batch execution.
* bytes_mapped_estimate is an estimation of the map/unmap bytes delta * bytes_mapped_estimate is an estimation of the map/unmap bytes delta
* and if it goes over an optional limit the current batch is flushed, * and if it goes over an optional limit the current batch is flushed,
@@ -2287,10 +2338,10 @@ tc_buffer_subdata(struct pipe_context *_pipe,
u_box_1d(offset, size, &box); u_box_1d(offset, size, &box);
map = tc_transfer_map(_pipe, resource, 0, usage, &box, &transfer); map = tc_buffer_map(_pipe, resource, 0, usage, &box, &transfer);
if (map) { if (map) {
memcpy(map, data, size); memcpy(map, data, size);
tc_transfer_unmap(_pipe, transfer); tc_buffer_unmap(_pipe, transfer);
} }
return; return;
} }
@@ -3945,9 +3996,11 @@ threaded_context_create(struct pipe_context *pipe,
CTX_INIT(sampler_view_destroy); CTX_INIT(sampler_view_destroy);
CTX_INIT(create_surface); CTX_INIT(create_surface);
CTX_INIT(surface_destroy); CTX_INIT(surface_destroy);
CTX_INIT(transfer_map); CTX_INIT(buffer_map);
CTX_INIT(texture_map);
CTX_INIT(transfer_flush_region); CTX_INIT(transfer_flush_region);
CTX_INIT(transfer_unmap); CTX_INIT(buffer_unmap);
CTX_INIT(texture_unmap);
CTX_INIT(buffer_subdata); CTX_INIT(buffer_subdata);
CTX_INIT(texture_subdata); CTX_INIT(texture_subdata);
CTX_INIT(texture_barrier); CTX_INIT(texture_barrier);
@@ -23,7 +23,8 @@ CALL(set_vertex_buffers)
CALL(set_stream_output_targets) CALL(set_stream_output_targets)
CALL(replace_buffer_storage) CALL(replace_buffer_storage)
CALL(transfer_flush_region) CALL(transfer_flush_region)
CALL(transfer_unmap) CALL(buffer_unmap)
CALL(texture_unmap)
CALL(buffer_subdata) CALL(buffer_subdata)
CALL(texture_subdata) CALL(texture_subdata)
CALL(emit_string_marker) CALL(emit_string_marker)
+4 -4
View File
@@ -31,12 +31,12 @@ void u_default_buffer_subdata(struct pipe_context *pipe,
u_box_1d(offset, size, &box); u_box_1d(offset, size, &box);
map = pipe->transfer_map(pipe, resource, 0, usage, &box, &transfer); map = pipe->buffer_map(pipe, resource, 0, usage, &box, &transfer);
if (!map) if (!map)
return; return;
memcpy(map, data, size); memcpy(map, data, size);
pipe_transfer_unmap(pipe, transfer); pipe_buffer_unmap(pipe, transfer);
} }
void u_default_texture_subdata(struct pipe_context *pipe, void u_default_texture_subdata(struct pipe_context *pipe,
@@ -60,7 +60,7 @@ void u_default_texture_subdata(struct pipe_context *pipe,
/* texture_subdata implicitly discards the rewritten buffer range */ /* texture_subdata implicitly discards the rewritten buffer range */
usage |= PIPE_MAP_DISCARD_RANGE; usage |= PIPE_MAP_DISCARD_RANGE;
map = pipe->transfer_map(pipe, map = pipe->texture_map(pipe,
resource, resource,
level, level,
usage, usage,
@@ -81,7 +81,7 @@ void u_default_texture_subdata(struct pipe_context *pipe,
layer_stride, /* bytes */ layer_stride, /* bytes */
0, 0, 0); 0, 0, 0);
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} }
void u_default_transfer_flush_region(UNUSED struct pipe_context *pipe, void u_default_transfer_flush_region(UNUSED struct pipe_context *pipe,
@@ -213,7 +213,7 @@ transfer_map_msaa(struct pipe_context *pctx,
map_box.x = 0; map_box.x = 0;
map_box.y = 0; map_box.y = 0;
void *ss_map = pctx->transfer_map(pctx, trans->ss, 0, usage, &map_box, void *ss_map = pctx->texture_map(pctx, trans->ss, 0, usage, &map_box,
&trans->trans); &trans->trans);
if (!ss_map) { if (!ss_map) {
free(trans); free(trans);
@@ -505,7 +505,7 @@ u_transfer_helper_transfer_unmap(struct pipe_context *pctx,
* so don't call helper->vtbl->transfer_unmap() directly * so don't call helper->vtbl->transfer_unmap() directly
*/ */
if (trans->ss) { if (trans->ss) {
pctx->transfer_unmap(pctx, trans->trans); pctx->texture_unmap(pctx, trans->trans);
pipe_resource_reference(&trans->ss, NULL); pipe_resource_reference(&trans->ss, NULL);
} else { } else {
helper->vtbl->transfer_unmap(pctx, trans->trans); helper->vtbl->transfer_unmap(pctx, trans->trans);
+1 -1
View File
@@ -134,7 +134,7 @@ upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
box->x, upload->offset - box->x); box->x, upload->offset - box->x);
} }
pipe_transfer_unmap(upload->pipe, upload->transfer); pipe_buffer_unmap(upload->pipe, upload->transfer);
upload->transfer = NULL; upload->transfer = NULL;
upload->map = NULL; upload->map = NULL;
} }
+2 -2
View File
@@ -718,7 +718,7 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale)
if (!matrix) if (!matrix)
goto error_matrix; goto error_matrix;
f = pipe->transfer_map(pipe, matrix, 0, f = pipe->texture_map(pipe, matrix, 0,
PIPE_MAP_WRITE | PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, PIPE_MAP_DISCARD_RANGE,
&rect, &buf_transfer); &rect, &buf_transfer);
@@ -732,7 +732,7 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale)
// transpose and scale // transpose and scale
f[i * pitch + j] = ((const float (*)[8])const_matrix)[j][i] * scale; f[i * pitch + j] = ((const float (*)[8])const_matrix)[j][i] * scale;
pipe->transfer_unmap(pipe, buf_transfer); pipe->texture_unmap(pipe, buf_transfer);
memset(&sv_templ, 0, sizeof(sv_templ)); memset(&sv_templ, 0, sizeof(sv_templ));
u_sampler_view_default_template(&sv_templ, matrix, matrix->format); u_sampler_view_default_template(&sv_templ, matrix, matrix->format);
+2 -2
View File
@@ -628,7 +628,7 @@ vl_mpeg12_begin_frame(struct pipe_video_codec *decoder,
rect.height = tex->height0; rect.height = tex->height0;
buf->texels = buf->texels =
dec->context->transfer_map(dec->context, tex, 0, dec->context->texture_map(dec->context, tex, 0,
PIPE_MAP_WRITE | PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, PIPE_MAP_DISCARD_RANGE,
&rect, &buf->tex_transfer); &rect, &buf->tex_transfer);
@@ -770,7 +770,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
vl_vb_unmap(&buf->vertex_stream, dec->context); vl_vb_unmap(&buf->vertex_stream, dec->context);
if (buf->tex_transfer) if (buf->tex_transfer)
dec->context->transfer_unmap(dec->context, buf->tex_transfer); dec->context->texture_unmap(dec->context, buf->tex_transfer);
vb[0] = dec->quads; vb[0] = dec->quads;
vb[1] = dec->pos; vb[1] = dec->pos;
+4 -4
View File
@@ -409,7 +409,7 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks
if (!res) if (!res)
goto error_resource; goto error_resource;
f = pipe->transfer_map(pipe, res, f = pipe->texture_map(pipe, res,
0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&rect, &buf_transfer); &rect, &buf_transfer);
if (!f) if (!f)
@@ -428,7 +428,7 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks
f[i * VL_BLOCK_WIDTH + y * pitch + x] = addr; f[i * VL_BLOCK_WIDTH + y * pitch + x] = addr;
} }
pipe->transfer_unmap(pipe, buf_transfer); pipe->texture_unmap(pipe, buf_transfer);
memset(&sv_tmpl, 0, sizeof(sv_tmpl)); memset(&sv_tmpl, 0, sizeof(sv_tmpl));
u_sampler_view_default_template(&sv_tmpl, res, res->format); u_sampler_view_default_template(&sv_tmpl, res, res->format);
@@ -579,7 +579,7 @@ vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
rect.width *= zscan->blocks_per_line; rect.width *= zscan->blocks_per_line;
data = pipe->transfer_map(pipe, buffer->quant->texture, data = pipe->texture_map(pipe, buffer->quant->texture,
0, PIPE_MAP_WRITE | 0, PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_RANGE, PIPE_MAP_DISCARD_RANGE,
&rect, &buf_transfer); &rect, &buf_transfer);
@@ -593,7 +593,7 @@ vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
for (x = 0; x < VL_BLOCK_WIDTH; ++x) for (x = 0; x < VL_BLOCK_WIDTH; ++x)
data[i * VL_BLOCK_WIDTH + y * pitch + x] = matrix[x + y * VL_BLOCK_WIDTH]; data[i * VL_BLOCK_WIDTH + y * pitch + x] = matrix[x + y * VL_BLOCK_WIDTH];
pipe->transfer_unmap(pipe, buf_transfer); pipe->texture_unmap(pipe, buf_transfer);
} }
void void
+4 -2
View File
@@ -522,9 +522,11 @@ agx_create_context(struct pipe_screen *screen,
pctx->end_query = agx_end_query; pctx->end_query = agx_end_query;
pctx->get_query_result = agx_get_query_result; pctx->get_query_result = agx_get_query_result;
pctx->set_active_query_state = agx_set_active_query_state; pctx->set_active_query_state = agx_set_active_query_state;
pctx->transfer_map = agx_transfer_map; pctx->buffer_map = agx_transfer_map;
pctx->texture_map = agx_transfer_map;
pctx->transfer_flush_region = agx_transfer_flush_region; pctx->transfer_flush_region = agx_transfer_flush_region;
pctx->transfer_unmap = agx_transfer_unmap; pctx->buffer_unmap = agx_transfer_unmap;
pctx->texture_unmap = agx_transfer_unmap;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
pctx->texture_subdata = u_default_texture_subdata; pctx->texture_subdata = u_default_texture_subdata;
pctx->invalidate_resource = agx_invalidate_resource; pctx->invalidate_resource = agx_invalidate_resource;
+4 -2
View File
@@ -1080,8 +1080,10 @@ d3d12_resource_make_writeable(struct pipe_context *pctx,
void void
d3d12_context_resource_init(struct pipe_context *pctx) d3d12_context_resource_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = d3d12_transfer_map; pctx->buffer_map = d3d12_transfer_map;
pctx->transfer_unmap = d3d12_transfer_unmap; pctx->buffer_unmap = d3d12_transfer_unmap;
pctx->texture_map = d3d12_transfer_map;
pctx->texture_unmap = d3d12_transfer_unmap;
pctx->transfer_flush_region = u_default_transfer_flush_region; pctx->transfer_flush_region = u_default_transfer_flush_region;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
+2 -2
View File
@@ -635,7 +635,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen,
if (map) { if (map) {
pipe_transfer *transfer = nullptr; pipe_transfer *transfer = nullptr;
void *res_map = pipe_transfer_map(pctx, pres, level, layer, PIPE_MAP_READ, 0, 0, void *res_map = pipe_texture_map(pctx, pres, level, layer, PIPE_MAP_READ, 0, 0,
u_minify(pres->width0, level), u_minify(pres->width0, level),
u_minify(pres->height0, level), u_minify(pres->height0, level),
&transfer); &transfer);
@@ -643,7 +643,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen,
util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0, util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0,
transfer->box.width, transfer->box.height, transfer->box.width, transfer->box.height,
(const ubyte*)res_map, transfer->stride, 0, 0); (const ubyte*)res_map, transfer->stride, 0, 0);
pipe_transfer_unmap(pctx, transfer); pipe_texture_unmap(pctx, transfer);
} }
winsys->displaytarget_unmap(winsys, res->dt); winsys->displaytarget_unmap(winsys, res->dt);
} }
@@ -508,9 +508,11 @@ etna_transfer_flush_region(struct pipe_context *pctx,
void void
etna_transfer_init(struct pipe_context *pctx) etna_transfer_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = etna_transfer_map; pctx->buffer_map = etna_transfer_map;
pctx->texture_map = etna_transfer_map;
pctx->transfer_flush_region = etna_transfer_flush_region; pctx->transfer_flush_region = etna_transfer_flush_region;
pctx->transfer_unmap = etna_transfer_unmap; pctx->buffer_unmap = etna_transfer_unmap;
pctx->texture_unmap = etna_transfer_unmap;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
pctx->texture_subdata = u_default_texture_subdata; pctx->texture_subdata = u_default_texture_subdata;
} }
@@ -1644,9 +1644,11 @@ fd_blit_pipe(struct pipe_context *pctx,
void void
fd_resource_context_init(struct pipe_context *pctx) fd_resource_context_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = u_transfer_helper_transfer_map; pctx->buffer_map = u_transfer_helper_transfer_map;
pctx->texture_map = u_transfer_helper_transfer_map;
pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region;
pctx->transfer_unmap = u_transfer_helper_transfer_unmap; pctx->buffer_unmap = u_transfer_helper_transfer_unmap;
pctx->texture_unmap = u_transfer_helper_transfer_unmap;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
pctx->texture_subdata = u_default_texture_subdata; pctx->texture_subdata = u_default_texture_subdata;
pctx->create_surface = fd_create_surface; pctx->create_surface = fd_create_surface;
+4 -2
View File
@@ -36,9 +36,11 @@ i915_resource_from_handle(struct pipe_screen * screen,
void void
i915_init_resource_functions(struct i915_context *i915 ) i915_init_resource_functions(struct i915_context *i915 )
{ {
i915->base.transfer_map = u_transfer_map_vtbl; i915->base.buffer_map = u_transfer_map_vtbl;
i915->base.texture_map = u_transfer_map_vtbl;
i915->base.transfer_flush_region = u_default_transfer_flush_region; i915->base.transfer_flush_region = u_default_transfer_flush_region;
i915->base.transfer_unmap = u_transfer_unmap_vtbl; i915->base.buffer_unmap = u_transfer_unmap_vtbl;
i915->base.texture_unmap = u_transfer_unmap_vtbl;
i915->base.buffer_subdata = i915_buffer_subdata; i915->base.buffer_subdata = i915_buffer_subdata;
i915->base.texture_subdata = u_default_texture_subdata; i915->base.texture_subdata = u_default_texture_subdata;
} }
+4 -2
View File
@@ -2396,9 +2396,11 @@ iris_init_resource_functions(struct pipe_context *ctx)
{ {
ctx->flush_resource = iris_flush_resource; ctx->flush_resource = iris_flush_resource;
ctx->invalidate_resource = iris_invalidate_resource; ctx->invalidate_resource = iris_invalidate_resource;
ctx->transfer_map = u_transfer_helper_transfer_map; ctx->buffer_map = u_transfer_helper_transfer_map;
ctx->texture_map = u_transfer_helper_transfer_map;
ctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; ctx->transfer_flush_region = u_transfer_helper_transfer_flush_region;
ctx->transfer_unmap = u_transfer_helper_transfer_unmap; ctx->buffer_unmap = u_transfer_helper_transfer_unmap;
ctx->texture_unmap = u_transfer_helper_transfer_unmap;
ctx->buffer_subdata = u_default_buffer_subdata; ctx->buffer_subdata = u_default_buffer_subdata;
ctx->texture_subdata = iris_texture_subdata; ctx->texture_subdata = iris_texture_subdata;
} }
+4 -2
View File
@@ -903,9 +903,11 @@ lima_resource_context_init(struct lima_context *ctx)
ctx->base.blit = lima_blit; ctx->base.blit = lima_blit;
ctx->base.transfer_map = lima_transfer_map; ctx->base.buffer_map = lima_transfer_map;
ctx->base.texture_map = lima_transfer_map;
ctx->base.transfer_flush_region = lima_transfer_flush_region; ctx->base.transfer_flush_region = lima_transfer_flush_region;
ctx->base.transfer_unmap = lima_transfer_unmap; ctx->base.buffer_unmap = lima_transfer_unmap;
ctx->base.texture_unmap = lima_transfer_unmap;
ctx->base.flush_resource = lima_flush_resource; ctx->base.flush_resource = lima_flush_resource;
} }
+7 -7
View File
@@ -65,7 +65,7 @@ lp_resource_copy_ms(struct pipe_context *pipe,
&dst_box, &dst_box,
&dst_trans); &dst_trans);
if (!dst_map) { if (!dst_map) {
pipe->transfer_unmap(pipe, src_trans); pipe->texture_unmap(pipe, src_trans);
return; return;
} }
@@ -77,8 +77,8 @@ lp_resource_copy_ms(struct pipe_context *pipe,
src_map, src_map,
src_trans->stride, src_trans->layer_stride, src_trans->stride, src_trans->layer_stride,
0, 0, 0); 0, 0, 0);
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
pipe->transfer_unmap(pipe, src_trans); pipe->texture_unmap(pipe, src_trans);
} }
} }
static void static void
@@ -295,7 +295,7 @@ lp_clear_color_texture_msaa(struct pipe_context *pipe,
lp_clear_color_texture_helper(dst_trans, dst_map, format, color, lp_clear_color_texture_helper(dst_trans, dst_map, format, color,
box->width, box->height, box->depth); box->width, box->height, box->depth);
} }
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
} }
static void static void
@@ -361,7 +361,7 @@ lp_clear_depth_stencil_texture_msaa(struct pipe_context *pipe,
dst_trans->stride, dst_trans->layer_stride, dst_trans->stride, dst_trans->layer_stride,
box->width, box->height, box->depth, zstencil); box->width, box->height, box->depth, zstencil);
pipe->transfer_unmap(pipe, dst_trans); pipe->texture_unmap(pipe, dst_trans);
} }
static void static void
@@ -456,7 +456,7 @@ llvmpipe_clear_buffer(struct pipe_context *pipe,
char *dst; char *dst;
u_box_1d(offset, size, &box); u_box_1d(offset, size, &box);
dst = pipe->transfer_map(pipe, dst = pipe->buffer_map(pipe,
res, res,
0, 0,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -475,7 +475,7 @@ llvmpipe_clear_buffer(struct pipe_context *pipe,
memcpy(&dst[i], clear_value, clear_value_size); memcpy(&dst[i], clear_value, clear_value_size);
break; break;
} }
pipe->transfer_unmap(pipe, dst_t); pipe->buffer_unmap(pipe, dst_t);
} }
void void
+4 -2
View File
@@ -964,8 +964,10 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
void void
llvmpipe_init_context_resource_funcs(struct pipe_context *pipe) llvmpipe_init_context_resource_funcs(struct pipe_context *pipe)
{ {
pipe->transfer_map = llvmpipe_transfer_map; pipe->buffer_map = llvmpipe_transfer_map;
pipe->transfer_unmap = llvmpipe_transfer_unmap; pipe->buffer_unmap = llvmpipe_transfer_unmap;
pipe->texture_map = llvmpipe_transfer_map;
pipe->texture_unmap = llvmpipe_transfer_unmap;
pipe->transfer_flush_region = u_default_transfer_flush_region; pipe->transfer_flush_region = u_default_transfer_flush_region;
pipe->buffer_subdata = u_default_buffer_subdata; pipe->buffer_subdata = u_default_buffer_subdata;
@@ -92,9 +92,11 @@ nv30_resource_screen_init(struct pipe_screen *pscreen)
void void
nv30_resource_init(struct pipe_context *pipe) nv30_resource_init(struct pipe_context *pipe)
{ {
pipe->transfer_map = u_transfer_map_vtbl; pipe->buffer_map = u_transfer_map_vtbl;
pipe->texture_map = u_transfer_map_vtbl;
pipe->transfer_flush_region = nouveau_buffer_transfer_flush_region; pipe->transfer_flush_region = nouveau_buffer_transfer_flush_region;
pipe->transfer_unmap = u_transfer_unmap_vtbl; pipe->buffer_unmap = u_transfer_unmap_vtbl;
pipe->texture_unmap = u_transfer_unmap_vtbl;
pipe->buffer_subdata = u_default_buffer_subdata; pipe->buffer_subdata = u_default_buffer_subdata;
pipe->texture_subdata = u_default_texture_subdata; pipe->texture_subdata = u_default_texture_subdata;
pipe->create_surface = nv30_miptree_surface_new; pipe->create_surface = nv30_miptree_surface_new;
@@ -103,9 +103,11 @@ nv50_invalidate_resource(struct pipe_context *pipe, struct pipe_resource *res)
void void
nv50_init_resource_functions(struct pipe_context *pcontext) nv50_init_resource_functions(struct pipe_context *pcontext)
{ {
pcontext->transfer_map = u_transfer_map_vtbl; pcontext->buffer_map = u_transfer_map_vtbl;
pcontext->texture_map = u_transfer_map_vtbl;
pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region; pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region;
pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->buffer_unmap = u_transfer_unmap_vtbl;
pcontext->texture_unmap = u_transfer_unmap_vtbl;
pcontext->buffer_subdata = u_default_buffer_subdata; pcontext->buffer_subdata = u_default_buffer_subdata;
pcontext->texture_subdata = u_default_texture_subdata; pcontext->texture_subdata = u_default_texture_subdata;
pcontext->create_surface = nv50_surface_create; pcontext->create_surface = nv50_surface_create;
@@ -154,9 +154,11 @@ nvc0_resource_from_user_memory(struct pipe_screen *pipe,
void void
nvc0_init_resource_functions(struct pipe_context *pcontext) nvc0_init_resource_functions(struct pipe_context *pcontext)
{ {
pcontext->transfer_map = u_transfer_map_vtbl; pcontext->buffer_map = u_transfer_map_vtbl;
pcontext->texture_map = u_transfer_map_vtbl;
pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region; pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region;
pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->buffer_unmap = u_transfer_unmap_vtbl;
pcontext->texture_unmap = u_transfer_unmap_vtbl;
pcontext->buffer_subdata = u_default_buffer_subdata; pcontext->buffer_subdata = u_default_buffer_subdata;
pcontext->texture_subdata = u_default_texture_subdata; pcontext->texture_subdata = u_default_texture_subdata;
pcontext->create_surface = nvc0_surface_create; pcontext->create_surface = nvc0_surface_create;
+4 -2
View File
@@ -1352,8 +1352,10 @@ panfrost_resource_screen_init(struct pipe_screen *pscreen)
void void
panfrost_resource_context_init(struct pipe_context *pctx) panfrost_resource_context_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = u_transfer_helper_transfer_map; pctx->buffer_map = u_transfer_helper_transfer_map;
pctx->transfer_unmap = u_transfer_helper_transfer_unmap; pctx->buffer_unmap = u_transfer_helper_transfer_unmap;
pctx->texture_map = u_transfer_helper_transfer_map;
pctx->texture_unmap = u_transfer_helper_transfer_unmap;
pctx->create_surface = panfrost_create_surface; pctx->create_surface = panfrost_create_surface;
pctx->surface_destroy = panfrost_surface_destroy; pctx->surface_destroy = panfrost_surface_destroy;
pctx->resource_copy_region = util_resource_copy_region; pctx->resource_copy_region = util_resource_copy_region;
+4 -2
View File
@@ -40,9 +40,11 @@ r300_resource_create(struct pipe_screen *screen,
void r300_init_resource_functions(struct r300_context *r300) void r300_init_resource_functions(struct r300_context *r300)
{ {
r300->context.transfer_map = u_transfer_map_vtbl; r300->context.buffer_map = u_transfer_map_vtbl;
r300->context.texture_map = u_transfer_map_vtbl;
r300->context.transfer_flush_region = u_default_transfer_flush_region; r300->context.transfer_flush_region = u_default_transfer_flush_region;
r300->context.transfer_unmap = u_transfer_unmap_vtbl; r300->context.buffer_unmap = u_transfer_unmap_vtbl;
r300->context.texture_unmap = u_transfer_unmap_vtbl;
r300->context.buffer_subdata = u_default_buffer_subdata; r300->context.buffer_subdata = u_default_buffer_subdata;
r300->context.texture_subdata = u_default_texture_subdata; r300->context.texture_subdata = u_default_texture_subdata;
r300->context.create_surface = r300_create_surface; r300->context.create_surface = r300_create_surface;
@@ -479,7 +479,7 @@ static void compute_memory_move_item(struct compute_memory_pool *pool,
u_box_1d(new_start_in_dw * 4, (offset + item->size_in_dw) * 4, &box); u_box_1d(new_start_in_dw * 4, (offset + item->size_in_dw) * 4, &box);
map = pipe->transfer_map(pipe, src, 0, PIPE_MAP_READ_WRITE, map = pipe->buffer_map(pipe, src, 0, PIPE_MAP_READ_WRITE,
&box, &trans); &box, &trans);
assert(map); assert(map);
@@ -487,7 +487,7 @@ static void compute_memory_move_item(struct compute_memory_pool *pool,
memmove(map, map + offset, item->size_in_dw * 4); memmove(map, map + offset, item->size_in_dw * 4);
pipe->transfer_unmap(pipe, trans); pipe->buffer_unmap(pipe, trans);
} }
} }
@@ -614,20 +614,20 @@ static void compute_memory_transfer(
offset_in_chunk, size); offset_in_chunk, size);
if (device_to_host) { if (device_to_host) {
map = pipe->transfer_map(pipe, gart, 0, PIPE_MAP_READ, map = pipe->buffer_map(pipe, gart, 0, PIPE_MAP_READ,
&(struct pipe_box) { .width = aligned_size * 4, &(struct pipe_box) { .width = aligned_size * 4,
.height = 1, .depth = 1 }, &xfer); .height = 1, .depth = 1 }, &xfer);
assert(xfer); assert(xfer);
assert(map); assert(map);
memcpy(data, map + internal_offset, size); memcpy(data, map + internal_offset, size);
pipe->transfer_unmap(pipe, xfer); pipe->buffer_unmap(pipe, xfer);
} else { } else {
map = pipe->transfer_map(pipe, gart, 0, PIPE_MAP_WRITE, map = pipe->buffer_map(pipe, gart, 0, PIPE_MAP_WRITE,
&(struct pipe_box) { .width = aligned_size * 4, &(struct pipe_box) { .width = aligned_size * 4,
.height = 1, .depth = 1 }, &xfer); .height = 1, .depth = 1 }, &xfer);
assert(xfer); assert(xfer);
assert(map); assert(map);
memcpy(map + internal_offset, data, size); memcpy(map + internal_offset, data, size);
pipe->transfer_unmap(pipe, xfer); pipe->buffer_unmap(pipe, xfer);
} }
} }
+2 -2
View File
@@ -555,7 +555,7 @@ static void evergreen_compute_upload_input(struct pipe_context *ctx,
} }
u_box_1d(0, input_size, &box); u_box_1d(0, input_size, &box);
num_work_groups_start = ctx->transfer_map(ctx, num_work_groups_start = ctx->buffer_map(ctx,
(struct pipe_resource*)shader->kernel_param, (struct pipe_resource*)shader->kernel_param,
0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&box, &transfer); &box, &transfer);
@@ -582,7 +582,7 @@ static void evergreen_compute_upload_input(struct pipe_context *ctx,
((unsigned*)num_work_groups_start)[i]); ((unsigned*)num_work_groups_start)[i]);
} }
ctx->transfer_unmap(ctx, transfer); ctx->buffer_unmap(ctx, transfer);
/* ID=0 and ID=3 are reserved for the parameters. /* ID=0 and ID=3 are reserved for the parameters.
* LLVM will preferably use ID=0, but it does not work for dynamic * LLVM will preferably use ID=0, but it does not work for dynamic
+4 -2
View File
@@ -590,9 +590,11 @@ bool r600_common_context_init(struct r600_common_context *rctx,
rctx->b.invalidate_resource = r600_invalidate_resource; rctx->b.invalidate_resource = r600_invalidate_resource;
rctx->b.resource_commit = r600_resource_commit; rctx->b.resource_commit = r600_resource_commit;
rctx->b.transfer_map = u_transfer_map_vtbl; rctx->b.buffer_map = u_transfer_map_vtbl;
rctx->b.texture_map = u_transfer_map_vtbl;
rctx->b.transfer_flush_region = r600_buffer_flush_region; rctx->b.transfer_flush_region = r600_buffer_flush_region;
rctx->b.transfer_unmap = u_transfer_unmap_vtbl; rctx->b.buffer_unmap = u_transfer_unmap_vtbl;
rctx->b.texture_unmap = u_transfer_unmap_vtbl;
rctx->b.texture_subdata = u_default_texture_subdata; rctx->b.texture_subdata = u_default_texture_subdata;
rctx->b.flush = r600_flush_from_st; rctx->b.flush = r600_flush_from_st;
rctx->b.set_debug_callback = r600_set_debug_callback; rctx->b.set_debug_callback = r600_set_debug_callback;
+4 -4
View File
@@ -59,7 +59,7 @@ static void set_random_pixels(struct pipe_context *ctx,
uint8_t *map; uint8_t *map;
unsigned x,y,z; unsigned x,y,z;
map = pipe_transfer_map_3d(ctx, tex, 0, PIPE_MAP_WRITE, map = pipe_texture_map_3d(ctx, tex, 0, PIPE_MAP_WRITE,
0, 0, 0, tex->width0, tex->height0, 0, 0, 0, tex->width0, tex->height0,
tex->array_size, &t); tex->array_size, &t);
assert(map); assert(map);
@@ -82,7 +82,7 @@ static void set_random_pixels(struct pipe_context *ctx,
} }
} }
pipe_transfer_unmap(ctx, t); pipe_texture_unmap(ctx, t);
} }
static bool compare_textures(struct pipe_context *ctx, static bool compare_textures(struct pipe_context *ctx,
@@ -94,7 +94,7 @@ static bool compare_textures(struct pipe_context *ctx,
int y,z; int y,z;
bool pass = true; bool pass = true;
map = pipe_transfer_map_3d(ctx, tex, 0, PIPE_MAP_READ, map = pipe_texture_map_3d(ctx, tex, 0, PIPE_MAP_READ,
0, 0, 0, tex->width0, tex->height0, 0, 0, 0, tex->width0, tex->height0,
tex->array_size, &t); tex->array_size, &t);
assert(map); assert(map);
@@ -112,7 +112,7 @@ static bool compare_textures(struct pipe_context *ctx,
} }
} }
done: done:
pipe_transfer_unmap(ctx, t); pipe_texture_unmap(ctx, t);
return pass; return pass;
} }
+4 -2
View File
@@ -745,9 +745,11 @@ void si_init_screen_buffer_functions(struct si_screen *sscreen)
void si_init_buffer_functions(struct si_context *sctx) void si_init_buffer_functions(struct si_context *sctx)
{ {
sctx->b.invalidate_resource = si_invalidate_resource; sctx->b.invalidate_resource = si_invalidate_resource;
sctx->b.transfer_map = u_transfer_map_vtbl; sctx->b.buffer_map = u_transfer_map_vtbl;
sctx->b.texture_map = u_transfer_map_vtbl;
sctx->b.transfer_flush_region = si_buffer_flush_region; sctx->b.transfer_flush_region = si_buffer_flush_region;
sctx->b.transfer_unmap = u_transfer_unmap_vtbl; sctx->b.buffer_unmap = u_transfer_unmap_vtbl;
sctx->b.texture_unmap = u_transfer_unmap_vtbl;
sctx->b.texture_subdata = u_default_texture_subdata; sctx->b.texture_subdata = u_default_texture_subdata;
sctx->b.buffer_subdata = si_buffer_subdata; sctx->b.buffer_subdata = si_buffer_subdata;
sctx->b.resource_commit = si_resource_commit; sctx->b.resource_commit = si_resource_commit;
+4 -4
View File
@@ -58,7 +58,7 @@ static void set_random_pixels(struct pipe_context *ctx, struct pipe_resource *te
uint8_t *map; uint8_t *map;
int x, y, z; int x, y, z;
map = pipe_transfer_map_3d(ctx, tex, 0, PIPE_MAP_WRITE, 0, 0, 0, tex->width0, tex->height0, map = pipe_texture_map_3d(ctx, tex, 0, PIPE_MAP_WRITE, 0, 0, 0, tex->width0, tex->height0,
tex->array_size, &t); tex->array_size, &t);
assert(map); assert(map);
@@ -77,7 +77,7 @@ static void set_random_pixels(struct pipe_context *ctx, struct pipe_resource *te
} }
} }
pipe_transfer_unmap(ctx, t); pipe_texture_unmap(ctx, t);
} }
static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex, static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex,
@@ -89,7 +89,7 @@ static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex
bool pass = true; bool pass = true;
unsigned stride = util_format_get_stride(tex->format, tex->width0); unsigned stride = util_format_get_stride(tex->format, tex->width0);
map = pipe_transfer_map_3d(ctx, tex, 0, PIPE_MAP_READ, 0, 0, 0, tex->width0, tex->height0, map = pipe_texture_map_3d(ctx, tex, 0, PIPE_MAP_READ, 0, 0, 0, tex->width0, tex->height0,
tex->array_size, &t); tex->array_size, &t);
assert(map); assert(map);
@@ -105,7 +105,7 @@ static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex
} }
} }
done: done:
pipe_transfer_unmap(ctx, t); pipe_texture_unmap(ctx, t);
return pass; return pass;
} }
@@ -74,10 +74,10 @@ sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc)
/*assert(tc->entries[pos].x < 0);*/ /*assert(tc->entries[pos].x < 0);*/
} }
if (tc->transfer) { if (tc->transfer) {
tc->pipe->transfer_unmap(tc->pipe, tc->transfer); tc->pipe->texture_unmap(tc->pipe, tc->transfer);
} }
if (tc->tex_trans) { if (tc->tex_trans) {
tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->pipe->texture_unmap(tc->pipe, tc->tex_trans);
} }
FREE( tc ); FREE( tc );
@@ -132,7 +132,7 @@ sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
pipe_resource_reference(&tc->texture, texture); pipe_resource_reference(&tc->texture, texture);
if (tc->tex_trans_map) { if (tc->tex_trans_map) {
tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->pipe->texture_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans = NULL; tc->tex_trans = NULL;
tc->tex_trans_map = NULL; tc->tex_trans_map = NULL;
} }
@@ -230,7 +230,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
unsigned width, height, layer; unsigned width, height, layer;
if (tc->tex_trans_map) { if (tc->tex_trans_map) {
tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); tc->pipe->texture_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans = NULL; tc->tex_trans = NULL;
tc->tex_trans_map = NULL; tc->tex_trans_map = NULL;
} }
@@ -246,7 +246,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
} }
tc->tex_trans_map = tc->tex_trans_map =
pipe_transfer_map(tc->pipe, tc->texture, pipe_texture_map(tc->pipe, tc->texture,
addr.bits.level, addr.bits.level,
layer, layer,
PIPE_MAP_READ | PIPE_MAP_UNSYNCHRONIZED, PIPE_MAP_READ | PIPE_MAP_UNSYNCHRONIZED,
+4 -2
View File
@@ -512,8 +512,10 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
void void
softpipe_init_texture_funcs(struct pipe_context *pipe) softpipe_init_texture_funcs(struct pipe_context *pipe)
{ {
pipe->transfer_map = softpipe_transfer_map; pipe->buffer_map = softpipe_transfer_map;
pipe->transfer_unmap = softpipe_transfer_unmap; pipe->buffer_unmap = softpipe_transfer_unmap;
pipe->texture_map = softpipe_transfer_map;
pipe->texture_unmap = softpipe_transfer_unmap;
pipe->transfer_flush_region = u_default_transfer_flush_region; pipe->transfer_flush_region = u_default_transfer_flush_region;
pipe->buffer_subdata = u_default_buffer_subdata; pipe->buffer_subdata = u_default_buffer_subdata;
+3 -3
View File
@@ -149,7 +149,7 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
int i; int i;
for (i = 0; i < tc->num_maps; i++) for (i = 0; i < tc->num_maps; i++)
if (tc->transfer[i]) { if (tc->transfer[i]) {
tc->pipe->transfer_unmap(tc->pipe, tc->transfer[i]); tc->pipe->texture_unmap(tc->pipe, tc->transfer[i]);
} }
FREE(tc->transfer); FREE(tc->transfer);
FREE(tc->transfer_map); FREE(tc->transfer_map);
@@ -176,7 +176,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
return; return;
for (i = 0; i < tc->num_maps; i++) { for (i = 0; i < tc->num_maps; i++) {
pipe->transfer_unmap(pipe, tc->transfer[i]); pipe->texture_unmap(pipe, tc->transfer[i]);
tc->transfer[i] = NULL; tc->transfer[i] = NULL;
tc->transfer_map[i] = NULL; tc->transfer_map[i] = NULL;
} }
@@ -200,7 +200,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
if (ps->texture->target != PIPE_BUFFER) { if (ps->texture->target != PIPE_BUFFER) {
for (i = 0; i < tc->num_maps; i++) { for (i = 0; i < tc->num_maps; i++) {
tc->transfer_map[i] = pipe_transfer_map(pipe, ps->texture, tc->transfer_map[i] = pipe_texture_map(pipe, ps->texture,
ps->u.tex.level, ps->u.tex.first_layer + i, ps->u.tex.level, ps->u.tex.first_layer + i,
PIPE_MAP_READ_WRITE | PIPE_MAP_READ_WRITE |
PIPE_MAP_UNSYNCHRONIZED, PIPE_MAP_UNSYNCHRONIZED,
+4 -2
View File
@@ -120,9 +120,11 @@ svga_can_create_resource(struct pipe_screen *screen,
void void
svga_init_resource_functions(struct svga_context *svga) svga_init_resource_functions(struct svga_context *svga)
{ {
svga->pipe.transfer_map = u_transfer_map_vtbl; svga->pipe.buffer_map = u_transfer_map_vtbl;
svga->pipe.texture_map = u_transfer_map_vtbl;
svga->pipe.transfer_flush_region = svga_buffer_transfer_flush_region; svga->pipe.transfer_flush_region = svga_buffer_transfer_flush_region;
svga->pipe.transfer_unmap = u_transfer_unmap_vtbl; svga->pipe.buffer_unmap = u_transfer_unmap_vtbl;
svga->pipe.texture_unmap = u_transfer_unmap_vtbl;
svga->pipe.buffer_subdata = u_default_buffer_subdata; svga->pipe.buffer_subdata = u_default_buffer_subdata;
svga->pipe.texture_subdata = u_default_texture_subdata; svga->pipe.texture_subdata = u_default_texture_subdata;
+4 -2
View File
@@ -555,8 +555,10 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
ctx->pipe.priv = priv; ctx->pipe.priv = priv;
ctx->pipe.create_surface = swr_create_surface; ctx->pipe.create_surface = swr_create_surface;
ctx->pipe.surface_destroy = swr_surface_destroy; ctx->pipe.surface_destroy = swr_surface_destroy;
ctx->pipe.transfer_map = swr_transfer_map; ctx->pipe.buffer_map = swr_transfer_map;
ctx->pipe.transfer_unmap = swr_transfer_unmap; ctx->pipe.buffer_unmap = swr_transfer_unmap;
ctx->pipe.texture_map = swr_transfer_map;
ctx->pipe.texture_unmap = swr_transfer_unmap;
ctx->pipe.transfer_flush_region = swr_transfer_flush_region; ctx->pipe.transfer_flush_region = swr_transfer_flush_region;
ctx->pipe.buffer_subdata = u_default_buffer_subdata; ctx->pipe.buffer_subdata = u_default_buffer_subdata;
+17 -6
View File
@@ -916,9 +916,15 @@ tegra_transfer_map(struct pipe_context *pcontext,
if (!transfer) if (!transfer)
return NULL; return NULL;
transfer->map = context->gpu->transfer_map(context->gpu, resource->gpu, if (presource->target == PIPE_BUFFER) {
level, usage, box, transfer->map = context->gpu->buffer_map(context->gpu, resource->gpu,
&transfer->gpu); level, usage, box,
&transfer->gpu);
} else {
transfer->map = context->gpu->texture_map(context->gpu, resource->gpu,
level, usage, box,
&transfer->gpu);
}
memcpy(&transfer->base, transfer->gpu, sizeof(*transfer->gpu)); memcpy(&transfer->base, transfer->gpu, sizeof(*transfer->gpu));
transfer->base.resource = NULL; transfer->base.resource = NULL;
pipe_resource_reference(&transfer->base.resource, presource); pipe_resource_reference(&transfer->base.resource, presource);
@@ -946,7 +952,10 @@ tegra_transfer_unmap(struct pipe_context *pcontext,
struct tegra_transfer *transfer = to_tegra_transfer(ptransfer); struct tegra_transfer *transfer = to_tegra_transfer(ptransfer);
struct tegra_context *context = to_tegra_context(pcontext); struct tegra_context *context = to_tegra_context(pcontext);
context->gpu->transfer_unmap(context->gpu, transfer->gpu); if (ptransfer->resource->target == PIPE_BUFFER)
context->gpu->buffer_unmap(context->gpu, transfer->gpu);
else
context->gpu->texture_unmap(context->gpu, transfer->gpu);
pipe_resource_reference(&transfer->base.resource, NULL); pipe_resource_reference(&transfer->base.resource, NULL);
free(transfer); free(transfer);
} }
@@ -1359,9 +1368,11 @@ tegra_screen_context_create(struct pipe_screen *pscreen, void *priv,
context->base.create_surface = tegra_create_surface; context->base.create_surface = tegra_create_surface;
context->base.surface_destroy = tegra_surface_destroy; context->base.surface_destroy = tegra_surface_destroy;
context->base.transfer_map = tegra_transfer_map; context->base.buffer_map = tegra_transfer_map;
context->base.texture_map = tegra_transfer_map;
context->base.transfer_flush_region = tegra_transfer_flush_region; context->base.transfer_flush_region = tegra_transfer_flush_region;
context->base.transfer_unmap = tegra_transfer_unmap; context->base.buffer_unmap = tegra_transfer_unmap;
context->base.texture_unmap = tegra_transfer_unmap;
context->base.buffer_subdata = tegra_buffer_subdata; context->base.buffer_subdata = tegra_buffer_subdata;
context->base.texture_subdata = tegra_texture_subdata; context->base.texture_subdata = tegra_texture_subdata;
+4 -2
View File
@@ -1161,9 +1161,11 @@ v3d_resource_screen_init(struct pipe_screen *pscreen)
void void
v3d_resource_context_init(struct pipe_context *pctx) v3d_resource_context_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = u_transfer_helper_transfer_map; pctx->buffer_map = u_transfer_helper_transfer_map;
pctx->texture_map = u_transfer_helper_transfer_map;
pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region;
pctx->transfer_unmap = u_transfer_helper_transfer_unmap; pctx->buffer_unmap = u_transfer_helper_transfer_unmap;
pctx->texture_unmap = u_transfer_helper_transfer_unmap;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
pctx->texture_subdata = v3d_texture_subdata; pctx->texture_subdata = v3d_texture_subdata;
pctx->create_surface = v3d_create_surface; pctx->create_surface = v3d_create_surface;
+5 -3
View File
@@ -1099,7 +1099,7 @@ vc4_get_shadow_index_buffer(struct pipe_context *pctx,
} }
if (src_transfer) if (src_transfer)
pctx->transfer_unmap(pctx, src_transfer); pctx->buffer_unmap(pctx, src_transfer);
return shadow_rsc; return shadow_rsc;
} }
@@ -1142,9 +1142,11 @@ vc4_resource_screen_init(struct pipe_screen *pscreen)
void void
vc4_resource_context_init(struct pipe_context *pctx) vc4_resource_context_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = u_transfer_helper_transfer_map; pctx->buffer_map = u_transfer_helper_transfer_map;
pctx->texture_map = u_transfer_helper_transfer_map;
pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region;
pctx->transfer_unmap = u_transfer_helper_transfer_unmap; pctx->buffer_unmap = u_transfer_helper_transfer_unmap;
pctx->texture_unmap = u_transfer_helper_transfer_unmap;
pctx->buffer_subdata = u_default_buffer_subdata; pctx->buffer_subdata = u_default_buffer_subdata;
pctx->texture_subdata = vc4_texture_subdata; pctx->texture_subdata = vc4_texture_subdata;
pctx->create_surface = vc4_create_surface; pctx->create_surface = vc4_create_surface;
+4 -2
View File
@@ -672,9 +672,11 @@ static void virgl_buffer_subdata(struct pipe_context *pipe,
void virgl_init_context_resource_functions(struct pipe_context *ctx) void virgl_init_context_resource_functions(struct pipe_context *ctx)
{ {
ctx->transfer_map = u_transfer_map_vtbl; ctx->buffer_map = u_transfer_map_vtbl;
ctx->texture_map = u_transfer_map_vtbl;
ctx->transfer_flush_region = virgl_buffer_transfer_flush_region; ctx->transfer_flush_region = virgl_buffer_transfer_flush_region;
ctx->transfer_unmap = u_transfer_unmap_vtbl; ctx->buffer_unmap = u_transfer_unmap_vtbl;
ctx->texture_unmap = u_transfer_unmap_vtbl;
ctx->buffer_subdata = virgl_buffer_subdata; ctx->buffer_subdata = virgl_buffer_subdata;
ctx->texture_subdata = u_default_texture_subdata; ctx->texture_subdata = u_default_texture_subdata;
} }
+4 -2
View File
@@ -1351,8 +1351,10 @@ zink_screen_resource_init(struct pipe_screen *pscreen)
void void
zink_context_resource_init(struct pipe_context *pctx) zink_context_resource_init(struct pipe_context *pctx)
{ {
pctx->transfer_map = u_transfer_helper_deinterleave_transfer_map; pctx->buffer_map = u_transfer_helper_deinterleave_transfer_map;
pctx->transfer_unmap = u_transfer_helper_deinterleave_transfer_unmap; pctx->buffer_unmap = u_transfer_helper_deinterleave_transfer_unmap;
pctx->texture_map = u_transfer_helper_deinterleave_transfer_map;
pctx->texture_unmap = u_transfer_helper_deinterleave_transfer_unmap;
pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region;
pctx->buffer_subdata = zink_buffer_subdata; pctx->buffer_subdata = zink_buffer_subdata;
+2 -2
View File
@@ -1077,7 +1077,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
if (map) { if (map) {
struct pipe_transfer *transfer = NULL; struct pipe_transfer *transfer = NULL;
void *res_map = pipe_transfer_map(pcontext, pres, level, layer, PIPE_MAP_READ, 0, 0, void *res_map = pipe_texture_map(pcontext, pres, level, layer, PIPE_MAP_READ, 0, 0,
u_minify(pres->width0, level), u_minify(pres->width0, level),
u_minify(pres->height0, level), u_minify(pres->height0, level),
&transfer); &transfer);
@@ -1085,7 +1085,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0, util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0,
transfer->box.width, transfer->box.height, transfer->box.width, transfer->box.height,
(const ubyte*)res_map, transfer->stride, 0, 0); (const ubyte*)res_map, transfer->stride, 0, 0);
pipe_transfer_unmap(pcontext, transfer); pipe_texture_unmap(pcontext, transfer);
} }
winsys->displaytarget_unmap(winsys, res->dt); winsys->displaytarget_unmap(winsys, res->dt);
} }
@@ -233,7 +233,7 @@ mapping::mapping(command_queue &q, resource &r,
PIPE_MAP_DISCARD_RANGE : 0) | PIPE_MAP_DISCARD_RANGE : 0) |
(!blocking ? PIPE_MAP_UNSYNCHRONIZED : 0)); (!blocking ? PIPE_MAP_UNSYNCHRONIZED : 0));
p = pctx->transfer_map(pctx, r.pipe, 0, usage, p = pctx->buffer_map(pctx, r.pipe, 0, usage,
box(origin + r.offset, region), &pxfer); box(origin + r.offset, region), &pxfer);
if (!p) { if (!p) {
pxfer = NULL; pxfer = NULL;
@@ -252,7 +252,7 @@ mapping::mapping(mapping &&m) :
mapping::~mapping() { mapping::~mapping() {
if (pxfer) { if (pxfer) {
pctx->transfer_unmap(pctx, pxfer); pctx->buffer_unmap(pctx, pxfer);
} }
pipe_resource_reference(&pres, NULL); pipe_resource_reference(&pres, NULL);
} }
+2 -2
View File
@@ -1697,7 +1697,7 @@ dri2_map_image(__DRIcontext *context, __DRIimage *image,
if (flags & __DRI_IMAGE_TRANSFER_WRITE) if (flags & __DRI_IMAGE_TRANSFER_WRITE)
pipe_access |= PIPE_MAP_WRITE; pipe_access |= PIPE_MAP_WRITE;
map = pipe_transfer_map(pipe, resource, 0, 0, pipe_access, x0, y0, map = pipe_texture_map(pipe, resource, 0, 0, pipe_access, x0, y0,
width, height, &trans); width, height, &trans);
if (map) { if (map) {
*data = trans; *data = trans;
@@ -1713,7 +1713,7 @@ dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data)
struct dri_context *ctx = dri_context(context); struct dri_context *ctx = dri_context(context);
struct pipe_context *pipe = ctx->st->pipe; struct pipe_context *pipe = ctx->st->pipe;
pipe_transfer_unmap(pipe, (struct pipe_transfer *)data); pipe_texture_unmap(pipe, (struct pipe_transfer *)data);
} }
static int static int
+2 -2
View File
@@ -421,7 +421,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
get_drawable_info(dPriv, &x, &y, &w, &h); get_drawable_info(dPriv, &x, &y, &w, &h);
map = pipe_transfer_map(pipe, res, map = pipe_texture_map(pipe, res,
0, 0, // level, layer, 0, 0, // level, layer,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
x, y, w, h, &transfer); x, y, w, h, &transfer);
@@ -439,7 +439,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
ximage_stride); ximage_stride);
} }
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} }
static __DRIimageExtension driSWImageExtension = { static __DRIimageExtension driSWImageExtension = {
+3 -3
View File
@@ -1495,7 +1495,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
internal_format = choose_pixel_format(drawable->xm_visual); internal_format = choose_pixel_format(drawable->xm_visual);
map = pipe_transfer_map(pipe, res, map = pipe_texture_map(pipe, res,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
x, y, x, y,
@@ -1512,7 +1512,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
ZPixmap); ZPixmap);
if (!img) { if (!img) {
pipe_transfer_unmap(pipe, tex_xfer); pipe_texture_unmap(pipe, tex_xfer);
return; return;
} }
@@ -1524,7 +1524,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
&img->data[line * img->bytes_per_line], &img->data[line * img->bytes_per_line],
byte_width); byte_width);
pipe_transfer_unmap(pipe, tex_xfer); pipe_texture_unmap(pipe, tex_xfer);
st->teximage(st, st->teximage(st,
ST_TEXTURE_2D, ST_TEXTURE_2D,
+12 -12
View File
@@ -1822,7 +1822,7 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd,
box.height = copycmd->regions[i].imageExtent.height; box.height = copycmd->regions[i].imageExtent.height;
box.depth = copycmd->src->type == VK_IMAGE_TYPE_3D ? copycmd->regions[i].imageExtent.depth : copycmd->regions[i].imageSubresource.layerCount; box.depth = copycmd->src->type == VK_IMAGE_TYPE_3D ? copycmd->regions[i].imageExtent.depth : copycmd->regions[i].imageSubresource.layerCount;
src_data = state->pctx->transfer_map(state->pctx, src_data = state->pctx->texture_map(state->pctx,
copycmd->src->bo, copycmd->src->bo,
copycmd->regions[i].imageSubresource.mipLevel, copycmd->regions[i].imageSubresource.mipLevel,
PIPE_MAP_READ, PIPE_MAP_READ,
@@ -1835,7 +1835,7 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd,
dbox.width = copycmd->dst->bo->width0; dbox.width = copycmd->dst->bo->width0;
dbox.height = 1; dbox.height = 1;
dbox.depth = 1; dbox.depth = 1;
dst_data = state->pctx->transfer_map(state->pctx, dst_data = state->pctx->buffer_map(state->pctx,
copycmd->dst->bo, copycmd->dst->bo,
0, 0,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -1877,8 +1877,8 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd,
box.depth, box.depth,
src_data, src_t->stride, src_t->layer_stride, 0, 0, 0); src_data, src_t->stride, src_t->layer_stride, 0, 0, 0);
} }
state->pctx->transfer_unmap(state->pctx, src_t); state->pctx->texture_unmap(state->pctx, src_t);
state->pctx->transfer_unmap(state->pctx, dst_t); state->pctx->buffer_unmap(state->pctx, dst_t);
} }
} }
@@ -1901,7 +1901,7 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
sbox.width = copycmd->src->bo->width0; sbox.width = copycmd->src->bo->width0;
sbox.height = 1; sbox.height = 1;
sbox.depth = 1; sbox.depth = 1;
src_data = state->pctx->transfer_map(state->pctx, src_data = state->pctx->buffer_map(state->pctx,
copycmd->src->bo, copycmd->src->bo,
0, 0,
PIPE_MAP_READ, PIPE_MAP_READ,
@@ -1916,7 +1916,7 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
box.height = copycmd->regions[i].imageExtent.height; box.height = copycmd->regions[i].imageExtent.height;
box.depth = copycmd->dst->type == VK_IMAGE_TYPE_3D ? copycmd->regions[i].imageExtent.depth : copycmd->regions[i].imageSubresource.layerCount; box.depth = copycmd->dst->type == VK_IMAGE_TYPE_3D ? copycmd->regions[i].imageExtent.depth : copycmd->regions[i].imageSubresource.layerCount;
dst_data = state->pctx->transfer_map(state->pctx, dst_data = state->pctx->texture_map(state->pctx,
copycmd->dst->bo, copycmd->dst->bo,
copycmd->regions[i].imageSubresource.mipLevel, copycmd->regions[i].imageSubresource.mipLevel,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -1960,8 +1960,8 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
src_data, src_data,
buffer_row_len, img_stride, 0, 0, 0); buffer_row_len, img_stride, 0, 0, 0);
} }
state->pctx->transfer_unmap(state->pctx, src_t); state->pctx->buffer_unmap(state->pctx, src_t);
state->pctx->transfer_unmap(state->pctx, dst_t); state->pctx->texture_unmap(state->pctx, dst_t);
} }
} }
@@ -2129,7 +2129,7 @@ static void handle_update_buffer(struct lvp_cmd_buffer_entry *cmd,
struct pipe_box box; struct pipe_box box;
u_box_1d(updcmd->offset, updcmd->data_size, &box); u_box_1d(updcmd->offset, updcmd->data_size, &box);
dst = state->pctx->transfer_map(state->pctx, dst = state->pctx->buffer_map(state->pctx,
updcmd->buffer->bo, updcmd->buffer->bo,
0, 0,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
@@ -2137,7 +2137,7 @@ static void handle_update_buffer(struct lvp_cmd_buffer_entry *cmd,
&dst_t); &dst_t);
memcpy(dst, updcmd->data, updcmd->data_size); memcpy(dst, updcmd->data, updcmd->data_size);
state->pctx->transfer_unmap(state->pctx, dst_t); state->pctx->buffer_unmap(state->pctx, dst_t);
} }
static void handle_draw_indexed(struct lvp_cmd_buffer_entry *cmd, static void handle_draw_indexed(struct lvp_cmd_buffer_entry *cmd,
@@ -2418,12 +2418,12 @@ static void handle_copy_query_pool_results(struct lvp_cmd_buffer_entry *cmd,
box.width = copycmd->stride; box.width = copycmd->stride;
box.height = 1; box.height = 1;
box.depth = 1; box.depth = 1;
map = state->pctx->transfer_map(state->pctx, map = state->pctx->buffer_map(state->pctx,
copycmd->dst->bo, 0, PIPE_MAP_READ, &box, copycmd->dst->bo, 0, PIPE_MAP_READ, &box,
&src_t); &src_t);
memset(map, 0, box.width); memset(map, 0, box.width);
state->pctx->transfer_unmap(state->pctx, src_t); state->pctx->buffer_unmap(state->pctx, src_t);
} }
} }
} }
+3 -3
View File
@@ -475,11 +475,11 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
else else
pipe = NineDevice9_GetPipe(device); pipe = NineDevice9_GetPipe(device);
data = pipe->transfer_map(pipe, This->base.resource, 0, data = pipe->buffer_map(pipe, This->base.resource, 0,
usage, &box, &This->maps[This->nmaps].transfer); usage, &box, &This->maps[This->nmaps].transfer);
if (!data) { if (!data) {
DBG("pipe::transfer_map failed\n" DBG("pipe::buffer_map failed\n"
" usage = %x\n" " usage = %x\n"
" box.x = %u\n" " box.x = %u\n"
" box.width = %u\n", " box.width = %u\n",
@@ -517,7 +517,7 @@ NineBuffer9_Unlock( struct NineBuffer9 *This )
pipe = This->maps[i].is_pipe_secondary ? pipe = This->maps[i].is_pipe_secondary ?
device->pipe_secondary : device->pipe_secondary :
nine_context_get_pipe_acquire(device); nine_context_get_pipe_acquire(device);
pipe->transfer_unmap(pipe, This->maps[i].transfer); pipe->buffer_unmap(pipe, This->maps[i].transfer);
/* We need to flush in case the driver does implicit copies */ /* We need to flush in case the driver does implicit copies */
if (This->maps[i].is_pipe_secondary) if (This->maps[i].is_pipe_secondary)
pipe->flush(pipe, NULL, 0); pipe->flush(pipe, NULL, 0);
+6 -6
View File
@@ -393,14 +393,14 @@ NineDevice9_ctor( struct NineDevice9 *This,
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
u_box_1d(0, 16, &box); u_box_1d(0, 16, &box);
data = This->context.pipe->transfer_map(This->context.pipe, This->dummy_vbo, 0, data = This->context.pipe->buffer_map(This->context.pipe, This->dummy_vbo, 0,
PIPE_MAP_WRITE | PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_WHOLE_RESOURCE, PIPE_MAP_DISCARD_WHOLE_RESOURCE,
&box, &transfer); &box, &transfer);
assert(data); assert(data);
assert(transfer); assert(transfer);
memset(data, 0, 16); memset(data, 0, 16);
This->context.pipe->transfer_unmap(This->context.pipe, transfer); This->context.pipe->buffer_unmap(This->context.pipe, transfer);
} }
This->cursor.software = FALSE; This->cursor.software = FALSE;
@@ -834,7 +834,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
u_box_origin_2d(This->cursor.w, This->cursor.h, &box); u_box_origin_2d(This->cursor.w, This->cursor.h, &box);
ptr = pipe->transfer_map(pipe, This->cursor.image, 0, ptr = pipe->texture_map(pipe, This->cursor.image, 0,
PIPE_MAP_WRITE | PIPE_MAP_WRITE |
PIPE_MAP_DISCARD_WHOLE_RESOURCE, PIPE_MAP_DISCARD_WHOLE_RESOURCE,
&box, &transfer); &box, &transfer);
@@ -876,7 +876,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
NineSurface9_UnlockRect(surf); NineSurface9_UnlockRect(surf);
} }
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
/* hide cursor if we emulate it */ /* hide cursor if we emulate it */
if (!hw_cursor) if (!hw_cursor)
@@ -3321,7 +3321,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
pipe_sw->stream_output_target_destroy(pipe_sw, target); pipe_sw->stream_output_target_destroy(pipe_sw, target);
u_box_1d(0, VertexCount * so.stride[0] * 4, &box); u_box_1d(0, VertexCount * so.stride[0] * 4, &box);
map = pipe_sw->transfer_map(pipe_sw, resource, 0, PIPE_MAP_READ, &box, map = pipe_sw->buffer_map(pipe_sw, resource, 0, PIPE_MAP_READ, &box,
&transfer); &transfer);
if (!map) { if (!map) {
hr = D3DERR_DRIVERINTERNALERROR; hr = D3DERR_DRIVERINTERNALERROR;
@@ -3332,7 +3332,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
dst, DestIndex, VertexCount, dst, DestIndex, VertexCount,
map, &so); map, &so);
if (transfer) if (transfer)
pipe_sw->transfer_unmap(pipe_sw, transfer); pipe_sw->buffer_unmap(pipe_sw, transfer);
out: out:
nine_state_after_draw_sw(This); nine_state_after_draw_sw(This);
@@ -122,7 +122,7 @@ nine_upload_destroy_buffer_group(struct nine_buffer_upload *upload,
assert(group->refcount == 0); assert(group->refcount == 0);
if (group->transfer) if (group->transfer)
pipe_transfer_unmap(upload->pipe, group->transfer); pipe_buffer_unmap(upload->pipe, group->transfer);
if (group->resource) if (group->resource)
pipe_resource_reference(&group->resource, NULL); pipe_resource_reference(&group->resource, NULL);
group->transfer = NULL; group->transfer = NULL;
@@ -276,7 +276,7 @@ nine_upload_release_buffer(struct nine_buffer_upload *upload,
} else { } else {
/* lonely buffer */ /* lonely buffer */
if (buf->transfer) if (buf->transfer)
pipe_transfer_unmap(upload->pipe, buf->transfer); pipe_buffer_unmap(upload->pipe, buf->transfer);
pipe_resource_reference(&buf->resource, NULL); pipe_resource_reference(&buf->resource, NULL);
} }
+4 -4
View File
@@ -2571,7 +2571,7 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_box_upload,
return; return;
} }
map = pipe->transfer_map(pipe, map = pipe->texture_map(pipe,
res, res,
level, level,
PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
@@ -2592,7 +2592,7 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_box_upload,
dst_box->width, dst_box->height, dst_box->width, dst_box->height,
dst_box->depth); dst_box->depth);
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} }
struct pipe_query * struct pipe_query *
@@ -3128,7 +3128,7 @@ update_vertex_buffers_sw(struct NineDevice9 *device, int start_vertice, int num_
u_box_1d(vtxbuf.buffer_offset + offset + start_vertice * vtxbuf.stride, u_box_1d(vtxbuf.buffer_offset + offset + start_vertice * vtxbuf.stride,
num_vertices * vtxbuf.stride, &box); num_vertices * vtxbuf.stride, &box);
userbuf = pipe->transfer_map(pipe, buf, 0, PIPE_MAP_READ, &box, userbuf = pipe->buffer_map(pipe, buf, 0, PIPE_MAP_READ, &box,
&(sw_internal->transfers_so[i])); &(sw_internal->transfers_so[i]));
vtxbuf.is_user_buffer = true; vtxbuf.is_user_buffer = true;
vtxbuf.buffer.user = userbuf; vtxbuf.buffer.user = userbuf;
@@ -3290,7 +3290,7 @@ nine_state_after_draw_sw(struct NineDevice9 *device)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
pipe_sw->set_vertex_buffers(pipe_sw, i, 0, 1, false, NULL); pipe_sw->set_vertex_buffers(pipe_sw, i, 0, 1, false, NULL);
if (sw_internal->transfers_so[i]) if (sw_internal->transfers_so[i])
pipe->transfer_unmap(pipe, sw_internal->transfers_so[i]); pipe->buffer_unmap(pipe, sw_internal->transfers_so[i]);
sw_internal->transfers_so[i] = NULL; sw_internal->transfers_so[i] = NULL;
} }
nine_context_get_pipe_release(device); nine_context_get_pipe_release(device);
+6 -6
View File
@@ -217,7 +217,7 @@ NineSurface9_dtor( struct NineSurface9 *This )
if (This->transfer) { if (This->transfer) {
struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.base.device); struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.base.device);
pipe->transfer_unmap(pipe, This->transfer); pipe->texture_unmap(pipe, This->transfer);
This->transfer = NULL; This->transfer = NULL;
} }
@@ -529,13 +529,13 @@ NineSurface9_LockRect( struct NineSurface9 *This,
pipe = nine_context_get_pipe_acquire(This->base.base.device); pipe = nine_context_get_pipe_acquire(This->base.base.device);
else else
pipe = NineDevice9_GetPipe(This->base.base.device); pipe = NineDevice9_GetPipe(This->base.base.device);
pLockedRect->pBits = pipe->transfer_map(pipe, resource, pLockedRect->pBits = pipe->texture_map(pipe, resource,
This->level, usage, &box, This->level, usage, &box,
&This->transfer); &This->transfer);
if (no_refs) if (no_refs)
nine_context_get_pipe_release(This->base.base.device); nine_context_get_pipe_release(This->base.base.device);
if (!This->transfer) { if (!This->transfer) {
DBG("transfer_map failed\n"); DBG("texture_map failed\n");
if (Flags & D3DLOCK_DONOTWAIT) if (Flags & D3DLOCK_DONOTWAIT)
return D3DERR_WASSTILLDRAWING; return D3DERR_WASSTILLDRAWING;
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
@@ -561,7 +561,7 @@ NineSurface9_UnlockRect( struct NineSurface9 *This )
user_assert(This->lock_count, D3DERR_INVALIDCALL); user_assert(This->lock_count, D3DERR_INVALIDCALL);
if (This->transfer) { if (This->transfer) {
pipe = nine_context_get_pipe_acquire(This->base.base.device); pipe = nine_context_get_pipe_acquire(This->base.base.device);
pipe->transfer_unmap(pipe, This->transfer); pipe->texture_unmap(pipe, This->transfer);
nine_context_get_pipe_release(This->base.base.device); nine_context_get_pipe_release(This->base.base.device);
This->transfer = NULL; This->transfer = NULL;
} }
@@ -749,7 +749,7 @@ NineSurface9_CopyDefaultToMem( struct NineSurface9 *This,
nine_csmt_process(This->base.base.device); nine_csmt_process(This->base.base.device);
pipe = NineDevice9_GetPipe(This->base.base.device); pipe = NineDevice9_GetPipe(This->base.base.device);
p_src = pipe->transfer_map(pipe, r_src, From->level, p_src = pipe->texture_map(pipe, r_src, From->level,
PIPE_MAP_READ, PIPE_MAP_READ,
&src_box, &transfer); &src_box, &transfer);
p_dst = nine_get_pointer(This->base.base.device->allocator, This->data); p_dst = nine_get_pointer(This->base.base.device->allocator, This->data);
@@ -762,7 +762,7 @@ NineSurface9_CopyDefaultToMem( struct NineSurface9 *This,
p_src, p_src,
transfer->stride, 0, 0); transfer->stride, 0, 0);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
nine_pointer_weakrelease(This->base.base.device->allocator, This->data); nine_pointer_weakrelease(This->base.base.device->allocator, This->data);
} }
+3 -3
View File
@@ -148,7 +148,7 @@ NineVolume9_dtor( struct NineVolume9 *This )
if (This->transfer) { if (This->transfer) {
struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.device); struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.device);
pipe->transfer_unmap(pipe, This->transfer); pipe->texture_unmap(pipe, This->transfer);
This->transfer = NULL; This->transfer = NULL;
} }
@@ -343,7 +343,7 @@ NineVolume9_LockBox( struct NineVolume9 *This,
else else
pipe = NineDevice9_GetPipe(This->base.device); pipe = NineDevice9_GetPipe(This->base.device);
pLockedVolume->pBits = pLockedVolume->pBits =
pipe->transfer_map(pipe, resource, This->level, usage, pipe->texture_map(pipe, resource, This->level, usage,
&box, &This->transfer); &box, &This->transfer);
if (no_refs) if (no_refs)
nine_context_get_pipe_release(This->base.device); nine_context_get_pipe_release(This->base.device);
@@ -374,7 +374,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This )
user_assert(This->lock_count, D3DERR_INVALIDCALL); user_assert(This->lock_count, D3DERR_INVALIDCALL);
if (This->transfer) { if (This->transfer) {
pipe = nine_context_get_pipe_acquire(This->base.device); pipe = nine_context_get_pipe_acquire(This->base.device);
pipe->transfer_unmap(pipe, This->transfer); pipe->texture_unmap(pipe, This->transfer);
This->transfer = NULL; This->transfer = NULL;
nine_context_get_pipe_release(This->base.device); nine_context_get_pipe_release(This->base.device);
} }
+4 -4
View File
@@ -311,7 +311,7 @@ static OMX_ERRORTYPE enc_AllocateBackTexture(omx_base_PortType *port,
box.width = (*resource)->width0; box.width = (*resource)->width0;
box.height = (*resource)->height0; box.height = (*resource)->height0;
box.depth = (*resource)->depth0; box.depth = (*resource)->depth0;
ptr = priv->s_pipe->transfer_map(priv->s_pipe, *resource, 0, PIPE_MAP_WRITE, &box, transfer); ptr = priv->s_pipe->texture_map(priv->s_pipe, *resource, 0, PIPE_MAP_WRITE, &box, transfer);
if (map) if (map)
*map = ptr; *map = ptr;
@@ -345,7 +345,7 @@ static OMX_ERRORTYPE vid_enc_SetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE i
enc_AllocateBackTexture(priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX], enc_AllocateBackTexture(priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX],
&resource, &transfer, NULL); &resource, &transfer, NULL);
port->sPortParam.format.video.nStride = transfer->stride; port->sPortParam.format.video.nStride = transfer->stride;
pipe_transfer_unmap(priv->s_pipe, transfer); pipe_texture_unmap(priv->s_pipe, transfer);
pipe_resource_reference(&resource, NULL); pipe_resource_reference(&resource, NULL);
framesize = port->sPortParam.format.video.nStride * framesize = port->sPortParam.format.video.nStride *
@@ -700,7 +700,7 @@ static OMX_ERRORTYPE vid_enc_FreeInBuffer(omx_base_PortType *port, OMX_U32 idx,
if (inp) { if (inp) {
enc_ReleaseTasks(&inp->tasks); enc_ReleaseTasks(&inp->tasks);
if (inp->transfer) if (inp->transfer)
pipe_transfer_unmap(priv->s_pipe, inp->transfer); pipe_texture_unmap(priv->s_pipe, inp->transfer);
pipe_resource_reference(&inp->resource, NULL); pipe_resource_reference(&inp->resource, NULL);
FREE(inp); FREE(inp);
} }
@@ -737,7 +737,7 @@ static OMX_ERRORTYPE vid_enc_FreeOutBuffer(omx_base_PortType *port, OMX_U32 idx,
if (buf->pOutputPortPrivate) { if (buf->pOutputPortPrivate) {
struct output_buf_private *outp = buf->pOutputPortPrivate; struct output_buf_private *outp = buf->pOutputPortPrivate;
if (outp->transfer) if (outp->transfer)
pipe_transfer_unmap(priv->t_pipe, outp->transfer); pipe_texture_unmap(priv->t_pipe, outp->transfer);
pipe_resource_reference(&outp->bitstream, NULL); pipe_resource_reference(&outp->bitstream, NULL);
FREE(outp); FREE(outp);
buf->pOutputPortPrivate = NULL; buf->pOutputPortPrivate = NULL;
@@ -69,7 +69,7 @@ static OMX_ERRORTYPE enc_AllocateBackTexture(OMX_HANDLETYPE ap_hdl,
box.width = (*resource)->width0; box.width = (*resource)->width0;
box.height = (*resource)->height0; box.height = (*resource)->height0;
box.depth = (*resource)->depth0; box.depth = (*resource)->depth0;
ptr = priv->s_pipe->transfer_map(priv->s_pipe, *resource, 0, PIPE_MAP_WRITE, &box, transfer); ptr = priv->s_pipe->texture_map(priv->s_pipe, *resource, 0, PIPE_MAP_WRITE, &box, transfer);
if (map) if (map)
*map = ptr; *map = ptr;
@@ -157,7 +157,7 @@ static OMX_ERRORTYPE h264e_inport_FreeBuffer(const void * ap_obj, OMX_HANDLETYPE
if (inp) { if (inp) {
enc_ReleaseTasks(&inp->tasks); enc_ReleaseTasks(&inp->tasks);
if (inp->transfer) if (inp->transfer)
pipe_transfer_unmap(priv->s_pipe, inp->transfer); pipe_texture_unmap(priv->s_pipe, inp->transfer);
pipe_resource_reference(&inp->resource, NULL); pipe_resource_reference(&inp->resource, NULL);
FREE(inp); FREE(inp);
} }
@@ -84,7 +84,7 @@ static OMX_ERRORTYPE h264e_outport_FreeBuffer(const void * ap_obj, OMX_HANDLETYP
if (outp) { if (outp) {
if (outp->transfer) if (outp->transfer)
pipe_transfer_unmap(priv->t_pipe, outp->transfer); pipe_texture_unmap(priv->t_pipe, outp->transfer);
pipe_resource_reference(&outp->bitstream, NULL); pipe_resource_reference(&outp->bitstream, NULL);
FREE(outp); FREE(outp);
buf->pOutputPortPrivate = NULL; buf->pOutputPortPrivate = NULL;
+2 -2
View File
@@ -138,7 +138,7 @@ void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buffer *buf
struct pipe_box box = {0, 0, j, width, height, 1}; struct pipe_box box = {0, 0, j, width, height, 1};
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
uint8_t *map, *dst; uint8_t *map, *dst;
map = priv->pipe->transfer_map(priv->pipe, views[i]->texture, 0, map = priv->pipe->texture_map(priv->pipe, views[i]->texture, 0,
PIPE_MAP_READ, &box, &transfer); PIPE_MAP_READ, &box, &transfer);
if (!map) if (!map)
return; return;
@@ -150,7 +150,7 @@ void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buffer *buf
def->nStride * views[i]->texture->array_size, 0, 0, def->nStride * views[i]->texture->array_size, 0, 0,
box.width, box.height, map, transfer->stride, 0, 0); box.width, box.height, map, transfer->stride, 0, 0);
pipe_transfer_unmap(priv->pipe, transfer); pipe_texture_unmap(priv->pipe, transfer);
} }
} }
} }
+4 -4
View File
@@ -147,7 +147,7 @@ void vid_enc_BufferEncoded_common(vid_enc_PrivateType * priv, OMX_BUFFERHEADERTY
/* ------------- map result buffer ----------------- */ /* ------------- map result buffer ----------------- */
if (outp->transfer) if (outp->transfer)
pipe_transfer_unmap(priv->t_pipe, outp->transfer); pipe_texture_unmap(priv->t_pipe, outp->transfer);
pipe_resource_reference(&outp->bitstream, task->bitstream); pipe_resource_reference(&outp->bitstream, task->bitstream);
pipe_resource_reference(&task->bitstream, NULL); pipe_resource_reference(&task->bitstream, NULL);
@@ -156,7 +156,7 @@ void vid_enc_BufferEncoded_common(vid_enc_PrivateType * priv, OMX_BUFFERHEADERTY
box.height = outp->bitstream->height0; box.height = outp->bitstream->height0;
box.depth = outp->bitstream->depth0; box.depth = outp->bitstream->depth0;
output->pBuffer = priv->t_pipe->transfer_map(priv->t_pipe, outp->bitstream, 0, output->pBuffer = priv->t_pipe->texture_map(priv->t_pipe, outp->bitstream, 0,
PIPE_MAP_READ_WRITE, PIPE_MAP_READ_WRITE,
&box, &outp->transfer); &box, &outp->transfer);
@@ -425,7 +425,7 @@ OMX_ERRORTYPE enc_LoadImage_common(vid_enc_PrivateType * priv, OMX_VIDEO_PORTDEF
} else { } else {
struct vl_video_buffer *dst_buf = (struct vl_video_buffer *)vbuf; struct vl_video_buffer *dst_buf = (struct vl_video_buffer *)vbuf;
pipe_transfer_unmap(pipe, inp->transfer); pipe_texture_unmap(pipe, inp->transfer);
/* inp->resource uses PIPE_FORMAT_I8 and the layout looks like this: /* inp->resource uses PIPE_FORMAT_I8 and the layout looks like this:
* *
@@ -545,7 +545,7 @@ OMX_ERRORTYPE enc_LoadImage_common(vid_enc_PrivateType * priv, OMX_VIDEO_PORTDEF
box.width = inp->resource->width0; box.width = inp->resource->width0;
box.height = inp->resource->height0; box.height = inp->resource->height0;
box.depth = inp->resource->depth0; box.depth = inp->resource->depth0;
buf->pBuffer = pipe->transfer_map(pipe, inp->resource, 0, buf->pBuffer = pipe->texture_map(pipe, inp->resource, 0,
PIPE_MAP_WRITE, &box, PIPE_MAP_WRITE, &box,
&inp->transfer); &inp->transfer);
} }
+2 -2
View File
@@ -200,7 +200,7 @@ osmesa_read_buffer(OSMesaContext osmesa, struct pipe_resource *res, void *dst,
u_box_2d(0, 0, res->width0, res->height0, &box); u_box_2d(0, 0, res->width0, res->height0, &box);
struct pipe_transfer *transfer = NULL; struct pipe_transfer *transfer = NULL;
ubyte *src = pipe->transfer_map(pipe, res, 0, PIPE_MAP_READ, &box, ubyte *src = pipe->texture_map(pipe, res, 0, PIPE_MAP_READ, &box,
&transfer); &transfer);
/* /*
@@ -221,7 +221,7 @@ osmesa_read_buffer(OSMesaContext osmesa, struct pipe_resource *res, void *dst,
src += transfer->stride; src += transfer->stride;
} }
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
+1 -1
View File
@@ -132,7 +132,7 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
box.width = resource->width0; box.width = resource->width0;
box.height = resource->height0; box.height = resource->height0;
box.depth = resource->depth0; box.depth = resource->depth0;
*pbuff = drv->pipe->transfer_map(drv->pipe, resource, 0, PIPE_MAP_WRITE, *pbuff = drv->pipe->texture_map(drv->pipe, resource, 0, PIPE_MAP_WRITE,
&box, &buf->derived_surface.transfer); &box, &buf->derived_surface.transfer);
mtx_unlock(&drv->mutex); mtx_unlock(&drv->mutex);
+4 -4
View File
@@ -540,7 +540,7 @@ vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y,
struct pipe_box box = {box_x, box_y, j, box_w, box_h, 1}; struct pipe_box box = {box_x, box_y, j, box_w, box_h, 1};
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
uint8_t *map; uint8_t *map;
map = drv->pipe->transfer_map(drv->pipe, views[i]->texture, 0, map = drv->pipe->texture_map(drv->pipe, views[i]->texture, 0,
PIPE_MAP_READ, &box, &transfer); PIPE_MAP_READ, &box, &transfer);
if (!map) { if (!map) {
mtx_unlock(&drv->mutex); mtx_unlock(&drv->mutex);
@@ -557,7 +557,7 @@ vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y,
pitches[i] * views[i]->texture->array_size, 0, 0, pitches[i] * views[i]->texture->array_size, 0, 0,
box.width, box.height, map, transfer->stride, 0, 0); box.width, box.height, map, transfer->stride, 0, 0);
} }
pipe_transfer_unmap(drv->pipe, transfer); pipe_texture_unmap(drv->pipe, transfer);
} }
} }
mtx_unlock(&drv->mutex); mtx_unlock(&drv->mutex);
@@ -675,7 +675,7 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image,
struct pipe_transfer *transfer = NULL; struct pipe_transfer *transfer = NULL;
uint8_t *map = NULL; uint8_t *map = NULL;
map = drv->pipe->transfer_map(drv->pipe, map = drv->pipe->texture_map(drv->pipe,
tex, tex,
0, 0,
PIPE_MAP_WRITE | PIPE_MAP_WRITE |
@@ -689,7 +689,7 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image,
u_copy_nv12_from_yv12((const void * const*) data, pitches, i, j, u_copy_nv12_from_yv12((const void * const*) data, pitches, i, j,
transfer->stride, tex->array_size, transfer->stride, tex->array_size,
map, dst_box.width, dst_box.height); map, dst_box.width, dst_box.height);
pipe_transfer_unmap(drv->pipe, transfer); pipe_texture_unmap(drv->pipe, transfer);
} else { } else {
drv->pipe->texture_subdata(drv->pipe, tex, 0, drv->pipe->texture_subdata(drv->pipe, tex, 0,
PIPE_MAP_WRITE, &dst_box, PIPE_MAP_WRITE, &dst_box,
+2 -2
View File
@@ -200,7 +200,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
void *map; void *map;
map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_MAP_WRITE, map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
dst_box, &transfer); dst_box, &transfer);
if (!map) if (!map)
return; return;
@@ -209,7 +209,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
dst_box->width, dst_box->height, dst_box->width, dst_box->height,
src, src_stride, src_x, src_y); src, src_stride, src_x, src_y);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
static VAStatus static VAStatus
+2 -2
View File
@@ -221,7 +221,7 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface,
res = vlsurface->sampler_view->texture; res = vlsurface->sampler_view->texture;
box = RectToPipeBox(source_rect, res); box = RectToPipeBox(source_rect, res);
map = pipe->transfer_map(pipe, res, 0, PIPE_MAP_READ, &box, &transfer); map = pipe->texture_map(pipe, res, 0, PIPE_MAP_READ, &box, &transfer);
if (!map) { if (!map) {
mtx_unlock(&vlsurface->device->mutex); mtx_unlock(&vlsurface->device->mutex);
return VDP_STATUS_RESOURCES; return VDP_STATUS_RESOURCES;
@@ -230,7 +230,7 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface,
util_copy_rect(*destination_data, res->format, *destination_pitches, 0, 0, util_copy_rect(*destination_data, res->format, *destination_pitches, 0, 0,
box.width, box.height, map, transfer->stride, 0, 0); box.width, box.height, map, transfer->stride, 0, 0);
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
mtx_unlock(&vlsurface->device->mutex); mtx_unlock(&vlsurface->device->mutex);
return VDP_STATUS_OK; return VDP_STATUS_OK;
+4 -4
View File
@@ -260,7 +260,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface,
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
uint8_t *map; uint8_t *map;
map = pipe->transfer_map(pipe, sv->texture, 0, map = pipe->texture_map(pipe, sv->texture, 0,
PIPE_MAP_READ, &box, &transfer); PIPE_MAP_READ, &box, &transfer);
if (!map) { if (!map) {
mtx_unlock(&vlsurface->device->mutex); mtx_unlock(&vlsurface->device->mutex);
@@ -285,7 +285,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface,
box.width, box.height, map, transfer->stride, 0, 0); box.width, box.height, map, transfer->stride, 0, 0);
} }
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} }
} }
mtx_unlock(&vlsurface->device->mutex); mtx_unlock(&vlsurface->device->mutex);
@@ -400,7 +400,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
uint8_t *map; uint8_t *map;
map = pipe->transfer_map(pipe, tex, 0, usage, map = pipe->texture_map(pipe, tex, 0, usage,
&dst_box, &transfer); &dst_box, &transfer);
if (!map) { if (!map) {
mtx_unlock(&p_surf->device->mutex); mtx_unlock(&p_surf->device->mutex);
@@ -411,7 +411,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
i, j, transfer->stride, tex->array_size, i, j, transfer->stride, tex->array_size,
map, dst_box.width, dst_box.height); map, dst_box.width, dst_box.height);
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} else { } else {
pipe->texture_subdata(pipe, tex, 0, pipe->texture_subdata(pipe, tex, 0,
PIPE_MAP_WRITE, &dst_box, PIPE_MAP_WRITE, &dst_box,
+4 -4
View File
@@ -114,7 +114,7 @@ xa_surface_dma(struct xa_context *ctx,
w = boxes->x2 - boxes->x1; w = boxes->x2 - boxes->x1;
h = boxes->y2 - boxes->y1; h = boxes->y2 - boxes->y1;
map = pipe_transfer_map(pipe, srf->tex, 0, 0, map = pipe_texture_map(pipe, srf->tex, 0, 0,
transfer_direction, boxes->x1, boxes->y1, transfer_direction, boxes->x1, boxes->y1,
w, h, &transfer); w, h, &transfer);
if (!map) if (!map)
@@ -128,7 +128,7 @@ xa_surface_dma(struct xa_context *ctx,
boxes->x1, boxes->y1, w, h, map, transfer->stride, 0, boxes->x1, boxes->y1, w, h, map, transfer->stride, 0,
0); 0);
} }
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
return XA_ERR_NONE; return XA_ERR_NONE;
} }
@@ -163,7 +163,7 @@ xa_surface_map(struct xa_context *ctx,
if (!(gallium_usage & (PIPE_MAP_READ_WRITE))) if (!(gallium_usage & (PIPE_MAP_READ_WRITE)))
return NULL; return NULL;
map = pipe_transfer_map(pipe, srf->tex, 0, 0, map = pipe_texture_map(pipe, srf->tex, 0, 0,
gallium_usage, 0, 0, gallium_usage, 0, 0,
srf->tex->width0, srf->tex->height0, srf->tex->width0, srf->tex->height0,
&srf->transfer); &srf->transfer);
@@ -180,7 +180,7 @@ xa_surface_unmap(struct xa_surface *srf)
if (srf->transfer) { if (srf->transfer) {
struct pipe_context *pipe = srf->mapping_pipe; struct pipe_context *pipe = srf->mapping_pipe;
pipe->transfer_unmap(pipe, srf->transfer); pipe->texture_unmap(pipe, srf->transfer);
srf->transfer = NULL; srf->transfer = NULL;
} }
} }
+6 -6
View File
@@ -210,7 +210,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
struct pipe_transfer *transfer; struct pipe_transfer *transfer;
void *map; void *map;
map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_MAP_WRITE, map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
dst_box, &transfer); dst_box, &transfer);
if (!map) if (!map)
return; return;
@@ -219,7 +219,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
dst_box->width, dst_box->height, dst_box->width, dst_box->height,
src, src_stride, src_x, src_y); src, src_stride, src_x, src_y);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
static void static void
@@ -231,7 +231,7 @@ upload_sampler_convert(struct pipe_context *pipe, struct pipe_sampler_view *dst,
int i, j; int i, j;
char *map, *src; char *map, *src;
map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_MAP_WRITE, map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
dst_box, &transfer); dst_box, &transfer);
if (!map) if (!map)
return; return;
@@ -254,7 +254,7 @@ upload_sampler_convert(struct pipe_context *pipe, struct pipe_sampler_view *dst,
map[j * 2 + 0] = map[j * 2 + 1] = (src[j] >> 4) | (src[j] << 4); map[j * 2 + 0] = map[j * 2 + 1] = (src[j] >> 4) | (src[j] << 4);
} }
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
} }
PUBLIC PUBLIC
@@ -393,7 +393,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh
dst = subpicture_priv->sampler; dst = subpicture_priv->sampler;
/* TODO: Assert clear rect is within bounds? Or clip? */ /* TODO: Assert clear rect is within bounds? Or clip? */
map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_MAP_WRITE, map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
&dst_box, &transfer); &dst_box, &transfer);
if (!map) if (!map)
return XvMCBadSubpicture; return XvMCBadSubpicture;
@@ -401,7 +401,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh
util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0, util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0,
dst_box.width, dst_box.height, &uc); dst_box.width, dst_box.height, &uc);
pipe->transfer_unmap(pipe, transfer); pipe->texture_unmap(pipe, transfer);
return Success; return Success;
} }
+19 -9
View File
@@ -762,14 +762,14 @@ struct pipe_context {
* *
* out_transfer will contain the transfer object that must be passed * out_transfer will contain the transfer object that must be passed
* to all the other transfer functions. It also contains useful * to all the other transfer functions. It also contains useful
* information (like texture strides). * information (like texture strides for texture_map).
*/ */
void *(*transfer_map)(struct pipe_context *, void *(*buffer_map)(struct pipe_context *,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned level,
unsigned usage, /* a combination of PIPE_MAP_x */ unsigned usage, /* a combination of PIPE_MAP_x */
const struct pipe_box *, const struct pipe_box *,
struct pipe_transfer **out_transfer); struct pipe_transfer **out_transfer);
/* If transfer was created with WRITE|FLUSH_EXPLICIT, only the /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
* regions specified with this call are guaranteed to be written to * regions specified with this call are guaranteed to be written to
@@ -779,8 +779,18 @@ struct pipe_context {
struct pipe_transfer *transfer, struct pipe_transfer *transfer,
const struct pipe_box *); const struct pipe_box *);
void (*transfer_unmap)(struct pipe_context *, void (*buffer_unmap)(struct pipe_context *,
struct pipe_transfer *transfer); struct pipe_transfer *transfer);
void *(*texture_map)(struct pipe_context *,
struct pipe_resource *resource,
unsigned level,
unsigned usage, /* a combination of PIPE_MAP_x */
const struct pipe_box *,
struct pipe_transfer **out_transfer);
void (*texture_unmap)(struct pipe_context *,
struct pipe_transfer *transfer);
/* One-shot transfer operation with data supplied in a user /* One-shot transfer operation with data supplied in a user
* pointer. * pointer.
+1 -1
View File
@@ -249,7 +249,7 @@ enum pipe_map_flags
PIPE_MAP_READ = 1 << 0, PIPE_MAP_READ = 1 << 0,
/** /**
* Resource contents will be written back at transfer_unmap * Resource contents will be written back at buffer/texture_unmap
* time (or modified as a result of being accessed directly). * time (or modified as a result of being accessed directly).
*/ */
PIPE_MAP_WRITE = 1 << 1, PIPE_MAP_WRITE = 1 << 1,
+2 -2
View File
@@ -331,7 +331,7 @@ static void init_tex( void )
{ {
struct pipe_transfer *t; struct pipe_transfer *t;
uint32_t *ptr; uint32_t *ptr;
ptr = pipe_transfer_map(ctx, samptex, ptr = pipe_texture_map(ctx, samptex,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, SIZE, SIZE, &t); /* x, y, width, height */ 0, 0, SIZE, SIZE, &t); /* x, y, width, height */
@@ -341,7 +341,7 @@ static void init_tex( void )
exit(9); exit(9);
} }
ctx->transfer_unmap(ctx, t); ctx->texture_unmap(ctx, t);
} }
memset(&sv_template, 0, sizeof sv_template); memset(&sv_template, 0, sizeof sv_template);
+3 -5
View File
@@ -261,21 +261,19 @@ graw_util_create_tex2d(const struct graw_info *info,
{ {
struct pipe_transfer *t; struct pipe_transfer *t;
uint32_t *ptr; uint32_t *ptr;
t = pipe_transfer_map(info->ctx, samptex, t = pipe_texture_map(info->ctx, samptex,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, SIZE, SIZE); /* x, y, width, height */ 0, 0, SIZE, SIZE); /* x, y, width, height */
ptr = info->ctx->transfer_map(info->ctx, t); ptr = info->ctx->texture_map(info->ctx, t);
if (memcmp(ptr, tex2d, sizeof tex2d) != 0) { if (memcmp(ptr, tex2d, sizeof tex2d) != 0) {
assert(0); assert(0);
exit(9); exit(9);
} }
info->ctx->transfer_unmap(info->ctx, t); info->ctx->texture_unmap(info->ctx, t);
info->ctx->transfer_destroy(info->ctx, t);
} }
#endif #endif
+2 -2
View File
@@ -421,7 +421,7 @@ static void init_tex( void )
{ {
struct pipe_transfer *t; struct pipe_transfer *t;
uint32_t *ptr; uint32_t *ptr;
ptr = pipe_transfer_map(ctx, samptex, ptr = pipe_texture_map(ctx, samptex,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, SIZE, SIZE, &t); /* x, y, width, height */ 0, 0, SIZE, SIZE, &t); /* x, y, width, height */
@@ -431,7 +431,7 @@ static void init_tex( void )
exit(9); exit(9);
} }
ctx->transfer_unmap(ctx, t); ctx->texture_unmap(ctx, t);
} }
memset(&sv_template, 0, sizeof sv_template); memset(&sv_template, 0, sizeof sv_template);
+2 -2
View File
@@ -246,7 +246,7 @@ static void init_tex( void )
{ {
struct pipe_transfer *t; struct pipe_transfer *t;
uint32_t *ptr; uint32_t *ptr;
ptr = pipe_transfer_map(ctx, samptex, ptr = pipe_texture_map(ctx, samptex,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, SIZE, SIZE, &t); /* x, y, width, height */ 0, 0, SIZE, SIZE, &t); /* x, y, width, height */
@@ -256,7 +256,7 @@ static void init_tex( void )
exit(9); exit(9);
} }
ctx->transfer_unmap(ctx, t); ctx->texture_unmap(ctx, t);
} }
memset(&sv_template, 0, sizeof sv_template); memset(&sv_template, 0, sizeof sv_template);
+2 -2
View File
@@ -319,7 +319,7 @@ static void init_tex( void )
{ {
struct pipe_transfer *t; struct pipe_transfer *t;
uint32_t *ptr; uint32_t *ptr;
ptr = pipe_transfer_map(ctx, samptex, ptr = pipe_texture_map(ctx, samptex,
0, 0, /* level, layer */ 0, 0, /* level, layer */
PIPE_MAP_READ, PIPE_MAP_READ,
0, 0, SIZE, SIZE, &t); /* x, y, width, height */ 0, 0, SIZE, SIZE, &t); /* x, y, width, height */
@@ -329,7 +329,7 @@ static void init_tex( void )
exit(9); exit(9);
} }
ctx->transfer_unmap(ctx, t); ctx->texture_unmap(ctx, t);
} }
memset(&sv_template, 0, sizeof sv_template); memset(&sv_template, 0, sizeof sv_template);
+4 -4
View File
@@ -204,7 +204,7 @@ static void init_tex(struct context *ctx, int slot,
*tex = ctx->screen->resource_create(ctx->screen, &ttex); *tex = ctx->screen->resource_create(ctx->screen, &ttex);
assert(*tex); assert(*tex);
map = pipe->transfer_map(pipe, *tex, 0, PIPE_MAP_WRITE, map = pipe->texture_map(pipe, *tex, 0, PIPE_MAP_WRITE,
&(struct pipe_box) { .width = w, &(struct pipe_box) { .width = w,
.height = h, .height = h,
.depth = 1 }, &xfer); .depth = 1 }, &xfer);
@@ -217,7 +217,7 @@ static void init_tex(struct context *ctx, int slot,
} }
} }
pipe->transfer_unmap(pipe, xfer); pipe->texture_unmap(pipe, xfer);
ctx->tex_rw[slot] = rw; ctx->tex_rw[slot] = rw;
} }
@@ -246,7 +246,7 @@ static void check_tex(struct context *ctx, int slot,
if (!check) if (!check)
check = default_check; check = default_check;
map = pipe->transfer_map(pipe, tex, 0, PIPE_MAP_READ, map = pipe->texture_map(pipe, tex, 0, PIPE_MAP_READ,
&(struct pipe_box) { .width = tex->width0, &(struct pipe_box) { .width = tex->width0,
.height = tex->height0, .height = tex->height0,
.depth = 1 }, &xfer); .depth = 1 }, &xfer);
@@ -282,7 +282,7 @@ static void check_tex(struct context *ctx, int slot,
} }
} }
pipe->transfer_unmap(pipe, xfer); pipe->texture_unmap(pipe, xfer);
if (err) if (err)
printf("(%d, %d): \x1b[31mFAIL\x1b[0m (%d)\n", x, y, err); printf("(%d, %d): \x1b[31mFAIL\x1b[0m (%d)\n", x, y, err);
+2 -2
View File
@@ -177,12 +177,12 @@ static void init_prog(struct program *p)
box.height = 2; box.height = 2;
box.depth = 1; box.depth = 1;
ptr = p->pipe->transfer_map(p->pipe, p->tex, 0, PIPE_MAP_WRITE, &box, &t); ptr = p->pipe->texture_map(p->pipe, p->tex, 0, PIPE_MAP_WRITE, &box, &t);
ptr[0] = 0xffff0000; ptr[0] = 0xffff0000;
ptr[1] = 0xff0000ff; ptr[1] = 0xff0000ff;
ptr[2] = 0xff00ff00; ptr[2] = 0xff00ff00;
ptr[3] = 0xffffff00; ptr[3] = 0xffffff00;
p->pipe->transfer_unmap(p->pipe, t); p->pipe->texture_unmap(p->pipe, t);
u_sampler_view_default_template(&v_tmplt, p->tex, p->tex->format); u_sampler_view_default_template(&v_tmplt, p->tex, p->tex->format);
@@ -105,7 +105,7 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride)
struct pipe_transfer *tr; struct pipe_transfer *tr;
void *map; void *map;
map = pipe_transfer_map(pipe, tex, 0, 0, map = pipe_texture_map(pipe, tex, 0, 0,
PIPE_MAP_READ_WRITE, PIPE_MAP_READ_WRITE,
0, 0, wdt->tex->width0, wdt->tex->height0, &tr); 0, 0, wdt->tex->width0, wdt->tex->height0, &tr);
if (!map) if (!map)
@@ -114,7 +114,7 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride)
*stride = tr->stride; *stride = tr->stride;
wdt->stride = tr->stride; wdt->stride = tr->stride;
pipe->transfer_unmap(pipe, tr); pipe->texture_unmap(pipe, tr);
return true; return true;
} }
@@ -221,7 +221,7 @@ wsw_dt_map(struct sw_winsys *ws,
assert(!wdt->transfer); assert(!wdt->transfer);
ptr = pipe_transfer_map(pipe, tex, 0, 0, ptr = pipe_texture_map(pipe, tex, 0, 0,
PIPE_MAP_READ_WRITE, PIPE_MAP_READ_WRITE,
0, 0, wdt->tex->width0, wdt->tex->height0, &tr); 0, 0, wdt->tex->width0, wdt->tex->height0, &tr);
if (!ptr) if (!ptr)
@@ -239,7 +239,7 @@ wsw_dt_map(struct sw_winsys *ws,
return wdt->ptr; return wdt->ptr;
err: err:
pipe->transfer_unmap(pipe, tr); pipe->texture_unmap(pipe, tr);
return NULL; return NULL;
} }
@@ -257,7 +257,7 @@ wsw_dt_unmap(struct sw_winsys *ws,
if (wdt->map_count) if (wdt->map_count)
return; return;
pipe->transfer_unmap(pipe, wdt->transfer); pipe->texture_unmap(pipe, wdt->transfer);
pipe->flush(pipe, NULL, 0); pipe->flush(pipe, NULL, 0);
wdt->transfer = NULL; wdt->transfer = NULL;
} }
@@ -54,7 +54,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
uint *dest; uint *dest;
uint i, j; uint i, j;
dest = (uint *) pipe_transfer_map(pipe, dest = (uint *) pipe_texture_map(pipe,
pt, 0, 0, PIPE_MAP_WRITE, pt, 0, 0, PIPE_MAP_WRITE,
0, 0, texSize, texSize, &transfer); 0, 0, texSize, texSize, &transfer);
@@ -78,7 +78,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
} }
} }
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
} }
/** /**
+5 -5
View File
@@ -143,7 +143,7 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
return NULL; return NULL;
} }
dest = pipe_transfer_map(st->pipe, pt, 0, 0, dest = pipe_texture_map(st->pipe, pt, 0, 0,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
0, 0, width, height, &transfer); 0, 0, width, height, &transfer);
@@ -155,7 +155,7 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
_mesa_unmap_pbo_source(ctx, unpack); _mesa_unmap_pbo_source(ctx, unpack);
/* Release transfer */ /* Release transfer */
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
return pt; return pt;
} }
@@ -406,7 +406,7 @@ create_cache_trans(struct st_context *st)
/* Map the texture transfer. /* Map the texture transfer.
* Subsequent glBitmap calls will write into the texture image. * Subsequent glBitmap calls will write into the texture image.
*/ */
cache->buffer = pipe_transfer_map(pipe, cache->texture, 0, 0, cache->buffer = pipe_texture_map(pipe, cache->texture, 0, 0,
PIPE_MAP_WRITE, 0, 0, PIPE_MAP_WRITE, 0, 0,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT, &cache->trans); BITMAP_CACHE_HEIGHT, &cache->trans);
@@ -442,7 +442,7 @@ st_flush_bitmap_cache(struct st_context *st)
if (cache->trans && cache->buffer) { if (cache->trans && cache->buffer) {
if (0) if (0)
print_cache(cache); print_cache(cache);
pipe_transfer_unmap(pipe, cache->trans); pipe_texture_unmap(pipe, cache->trans);
cache->buffer = NULL; cache->buffer = NULL;
cache->trans = NULL; cache->trans = NULL;
} }
@@ -810,7 +810,7 @@ st_destroy_bitmap(struct st_context *st)
struct st_bitmap_cache *cache = &st->bitmap.cache; struct st_bitmap_cache *cache = &st->bitmap.cache;
if (cache->trans && cache->buffer) { if (cache->trans && cache->buffer) {
pipe_transfer_unmap(pipe, cache->trans); pipe_texture_unmap(pipe, cache->trans);
} }
pipe_resource_reference(&st->bitmap.cache.texture, NULL); pipe_resource_reference(&st->bitmap.cache.texture, NULL);
} }
+4 -4
View File
@@ -584,7 +584,7 @@ fallback_copy_image(struct st_context *st,
dst_x, dst_y, dst_w, dst_h, dst_x, dst_y, dst_w, dst_h,
GL_MAP_WRITE_BIT, &dst, &dst_stride); GL_MAP_WRITE_BIT, &dst, &dst_stride);
} else { } else {
dst = pipe_transfer_map(st->pipe, dst_res, 0, dst_z, dst = pipe_texture_map(st->pipe, dst_res, 0, dst_z,
PIPE_MAP_WRITE, PIPE_MAP_WRITE,
dst_x, dst_y, dst_w, dst_h, dst_x, dst_y, dst_w, dst_h,
&dst_transfer); &dst_transfer);
@@ -597,7 +597,7 @@ fallback_copy_image(struct st_context *st,
src_x, src_y, src_w, src_h, src_x, src_y, src_w, src_h,
GL_MAP_READ_BIT, &src, &src_stride); GL_MAP_READ_BIT, &src, &src_stride);
} else { } else {
src = pipe_transfer_map(st->pipe, src_res, 0, src_z, src = pipe_texture_map(st->pipe, src_res, 0, src_z,
PIPE_MAP_READ, PIPE_MAP_READ,
src_x, src_y, src_w, src_h, src_x, src_y, src_w, src_h,
&src_transfer); &src_transfer);
@@ -613,13 +613,13 @@ fallback_copy_image(struct st_context *st,
if (dst_image) { if (dst_image) {
st->ctx->Driver.UnmapTextureImage(st->ctx, dst_image, dst_z); st->ctx->Driver.UnmapTextureImage(st->ctx, dst_image, dst_z);
} else { } else {
pipe_transfer_unmap(st->pipe, dst_transfer); pipe_texture_unmap(st->pipe, dst_transfer);
} }
if (src_image) { if (src_image) {
st->ctx->Driver.UnmapTextureImage(st->ctx, src_image, src_z); st->ctx->Driver.UnmapTextureImage(st->ctx, src_image, src_z);
} else { } else {
pipe_transfer_unmap(st->pipe, src_transfer); pipe_texture_unmap(st->pipe, src_transfer);
} }
} }
+6 -6
View File
@@ -669,7 +669,7 @@ make_texture(struct st_context *st,
ctx->_ImageTransferState = 0x0; ctx->_ImageTransferState = 0x0;
/* map texture transfer */ /* map texture transfer */
dest = pipe_transfer_map(pipe, pt, 0, 0, dest = pipe_texture_map(pipe, pt, 0, 0,
PIPE_MAP_WRITE, 0, 0, PIPE_MAP_WRITE, 0, 0,
width, height, &transfer); width, height, &transfer);
if (!dest) { if (!dest) {
@@ -715,7 +715,7 @@ make_texture(struct st_context *st,
} }
/* unmap */ /* unmap */
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
/* restore */ /* restore */
ctx->_ImageTransferState = imageTransferStateSave; ctx->_ImageTransferState = imageTransferStateSave;
@@ -989,7 +989,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
usage = PIPE_MAP_WRITE; usage = PIPE_MAP_WRITE;
} }
stmap = pipe_transfer_map(pipe, strb->texture, stmap = pipe_texture_map(pipe, strb->texture,
strb->surface->u.tex.level, strb->surface->u.tex.level,
strb->surface->u.tex.first_layer, strb->surface->u.tex.first_layer,
usage, x, y, usage, x, y,
@@ -1120,7 +1120,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
_mesa_unmap_pbo_source(ctx, &clippedUnpack); _mesa_unmap_pbo_source(ctx, &clippedUnpack);
/* unmap the stencil buffer */ /* unmap the stencil buffer */
pipe_transfer_unmap(pipe, pt); pipe_texture_unmap(pipe, pt);
} }
@@ -1501,7 +1501,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
assert(util_format_get_blockheight(rbDraw->texture->format) == 1); assert(util_format_get_blockheight(rbDraw->texture->format) == 1);
/* map the stencil buffer */ /* map the stencil buffer */
drawMap = pipe_transfer_map(pipe, drawMap = pipe_texture_map(pipe,
rbDraw->texture, rbDraw->texture,
rbDraw->surface->u.tex.level, rbDraw->surface->u.tex.level,
rbDraw->surface->u.tex.first_layer, rbDraw->surface->u.tex.first_layer,
@@ -1530,7 +1530,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
free(buffer); free(buffer);
/* unmap the stencil buffer */ /* unmap the stencil buffer */
pipe_transfer_unmap(pipe, ptDraw); pipe_texture_unmap(pipe, ptDraw);
} }
+2 -2
View File
@@ -906,7 +906,7 @@ st_MapRenderbuffer(struct gl_context *ctx,
else else
y2 = y; y2 = y;
map = pipe_transfer_map(pipe, map = pipe_texture_map(pipe,
strb->texture, strb->texture,
strb->surface->u.tex.level, strb->surface->u.tex.level,
strb->surface->u.tex.first_layer, strb->surface->u.tex.first_layer,
@@ -944,7 +944,7 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
return; return;
} }
pipe_transfer_unmap(pipe, strb->transfer); pipe_texture_unmap(pipe, strb->transfer);
strb->transfer = NULL; strb->transfer = NULL;
} }
+3 -3
View File
@@ -59,7 +59,7 @@
* blits (because the smaller blits cannot be batched, and we have to wait * blits (because the smaller blits cannot be batched, and we have to wait
* for the GPU after each one). * for the GPU after each one).
* *
* (2) transfer_map implicitly involves a blit as well (for de-tiling, copy * (2) texture_map implicitly involves a blit as well (for de-tiling, copy
* from VRAM, etc.), so that it is beneficial to replace the * from VRAM, etc.), so that it is beneficial to replace the
* _mesa_readpixels path as well when possible. * _mesa_readpixels path as well when possible.
* *
@@ -533,7 +533,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
/* map resources */ /* map resources */
pixels = _mesa_map_pbo_dest(ctx, pack, pixels); pixels = _mesa_map_pbo_dest(ctx, pack, pixels);
map = pipe_transfer_map_3d(pipe, dst, 0, PIPE_MAP_READ, map = pipe_texture_map_3d(pipe, dst, 0, PIPE_MAP_READ,
dst_x, dst_y, 0, width, height, 1, &tex_xfer); dst_x, dst_y, 0, width, height, 1, &tex_xfer);
if (!map) { if (!map) {
_mesa_unmap_pbo_dest(ctx, pack); _mesa_unmap_pbo_dest(ctx, pack);
@@ -562,7 +562,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
} }
} }
pipe_transfer_unmap(pipe, tex_xfer); pipe_texture_unmap(pipe, tex_xfer);
_mesa_unmap_pbo_dest(ctx, pack); _mesa_unmap_pbo_dest(ctx, pack);
pipe_resource_reference(&dst, NULL); pipe_resource_reference(&dst, NULL);
return; return;
+6 -6
View File
@@ -1737,7 +1737,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
height = 1; height = 1;
} }
map = pipe_transfer_map_3d(pipe, src, 0, PIPE_MAP_WRITE, 0, 0, 0, map = pipe_texture_map_3d(pipe, src, 0, PIPE_MAP_WRITE, 0, 0, 0,
width, height, depth, &transfer); width, height, depth, &transfer);
if (!map) { if (!map) {
_mesa_unmap_teximage_pbo(ctx, unpack); _mesa_unmap_teximage_pbo(ctx, unpack);
@@ -1775,7 +1775,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
} }
} }
pipe_transfer_unmap(pipe, transfer); pipe_texture_unmap(pipe, transfer);
_mesa_unmap_teximage_pbo(ctx, unpack); _mesa_unmap_teximage_pbo(ctx, unpack);
/* Blit. */ /* Blit. */
@@ -2266,7 +2266,7 @@ st_GetTexSubImage(struct gl_context * ctx,
pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels); pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels);
map = pipe_transfer_map_3d(pipe, dst, 0, PIPE_MAP_READ, map = pipe_texture_map_3d(pipe, dst, 0, PIPE_MAP_READ,
0, 0, 0, width, height, depth, &tex_xfer); 0, 0, 0, width, height, depth, &tex_xfer);
if (!map) { if (!map) {
goto end; goto end;
@@ -2346,7 +2346,7 @@ st_GetTexSubImage(struct gl_context * ctx,
end: end:
if (map) if (map)
pipe_transfer_unmap(pipe, tex_xfer); pipe_texture_unmap(pipe, tex_xfer);
_mesa_unmap_pbo_dest(ctx, &ctx->Pack); _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
pipe_resource_reference(&dst, NULL); pipe_resource_reference(&dst, NULL);
@@ -2394,7 +2394,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
srcY = strb->Base.Height - srcY - height; srcY = strb->Base.Height - srcY - height;
} }
map = pipe_transfer_map(pipe, map = pipe_texture_map(pipe,
strb->texture, strb->texture,
strb->surface->u.tex.level, strb->surface->u.tex.level,
strb->surface->u.tex.first_layer, strb->surface->u.tex.first_layer,
@@ -2517,7 +2517,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
st_texture_image_unmap(st, stImage, slice); st_texture_image_unmap(st, stImage, slice);
err: err:
pipe->transfer_unmap(pipe, src_trans); pipe->texture_unmap(pipe, src_trans);
} }
+8 -5
View File
@@ -345,7 +345,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
sv_transfer[i][j] = NULL; sv_transfer[i][j] = NULL;
mip_addr[j] = (uintptr_t) mip_addr[j] = (uintptr_t)
pipe_transfer_map_3d(pipe, res, j, pipe_texture_map_3d(pipe, res, j,
PIPE_MAP_READ, 0, 0, PIPE_MAP_READ, 0, 0,
view->u.tex.first_layer, view->u.tex.first_layer,
u_minify(res->width0, j), u_minify(res->width0, j),
@@ -411,7 +411,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
height = u_minify(res->height0, img->u.tex.level); height = u_minify(res->height0, img->u.tex.level);
num_layers = img->u.tex.last_layer - img->u.tex.first_layer + 1; num_layers = img->u.tex.last_layer - img->u.tex.first_layer + 1;
addr = pipe_transfer_map_3d(pipe, res, img->u.tex.level, addr = pipe_texture_map_3d(pipe, res, img->u.tex.level,
PIPE_MAP_READ, 0, 0, PIPE_MAP_READ, 0, 0,
img->u.tex.first_layer, img->u.tex.first_layer,
width, height, num_layers, width, height, num_layers,
@@ -464,7 +464,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
for (unsigned i = 0; i < prog->info.num_images; i++) { for (unsigned i = 0; i < prog->info.num_images; i++) {
if (img_transfer[i]) { if (img_transfer[i]) {
draw_set_mapped_image(draw, PIPE_SHADER_VERTEX, i, 0, 0, 0, NULL, 0, 0, 0, 0); draw_set_mapped_image(draw, PIPE_SHADER_VERTEX, i, 0, 0, 0, NULL, 0, 0, 0, 0);
pipe_transfer_unmap(pipe, img_transfer[i]); if (img_transfer[i]->resource->target == PIPE_BUFFER)
pipe_buffer_unmap(pipe, img_transfer[i]);
else
pipe_texture_unmap(pipe, img_transfer[i]);
} }
} }
@@ -476,10 +479,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
if (view->texture->target != PIPE_BUFFER) { if (view->texture->target != PIPE_BUFFER) {
for (unsigned j = view->u.tex.first_level; for (unsigned j = view->u.tex.first_level;
j <= view->u.tex.last_level; j++) { j <= view->u.tex.last_level; j++) {
pipe_transfer_unmap(pipe, sv_transfer[i][j]); pipe_texture_unmap(pipe, sv_transfer[i][j]);
} }
} else { } else {
pipe_transfer_unmap(pipe, sv_transfer[i][0]); pipe_buffer_unmap(pipe, sv_transfer[i][0]);
} }
} }
} }
+4 -4
View File
@@ -278,7 +278,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
z += stImage->base.Face; z += stImage->base.Face;
map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage, map = pipe_texture_map_3d(st->pipe, stImage->pt, level, usage,
x, y, z, w, h, d, transfer); x, y, z, w, h, d, transfer);
if (map) { if (map) {
/* Enlarge the transfer array if it's not large enough. */ /* Enlarge the transfer array if it's not large enough. */
@@ -315,7 +315,7 @@ st_texture_image_unmap(struct st_context *st,
DBG("%s\n", __func__); DBG("%s\n", __func__);
pipe_transfer_unmap(pipe, *transfer); pipe_texture_unmap(pipe, *transfer);
*transfer = NULL; *transfer = NULL;
} }
@@ -337,11 +337,11 @@ print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
region.height = 1; region.height = 1;
region.depth = 1; region.depth = 1;
map = pipe->transfer_map(pipe, src, 0, PIPE_MAP_READ, &region, &xfer); map = pipe->texture_map(pipe, src, 0, PIPE_MAP_READ, &region, &xfer);
printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]); printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]);
pipe->transfer_unmap(pipe, xfer); pipe->texture_unmap(pipe, xfer);
} }