diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c index f2f8a63c281..5e70765f55e 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c @@ -1599,10 +1599,10 @@ dd_context_clear_texture(struct pipe_context *_pipe, */ static void * -dd_context_transfer_map(struct pipe_context *_pipe, - struct pipe_resource *resource, unsigned level, - unsigned usage, const struct pipe_box *box, - struct pipe_transfer **transfer) +dd_context_buffer_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; @@ -1614,7 +1614,41 @@ dd_context_transfer_map(struct pipe_context *_pipe, dd_before_draw(dctx, record); } - void *ptr = pipe->transfer_map(pipe, resource, level, usage, box, transfer); + void *ptr = pipe->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) { record->call.info.transfer_map.transfer_ptr = *transfer; record->call.info.transfer_map.ptr = ptr; @@ -1660,7 +1694,7 @@ dd_context_transfer_flush_region(struct pipe_context *_pipe, } static void -dd_context_transfer_unmap(struct pipe_context *_pipe, +dd_context_buffer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer) { struct dd_context *dctx = dd_context(_pipe); @@ -1679,7 +1713,32 @@ dd_context_transfer_unmap(struct pipe_context *_pipe, 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) dd_after_draw(dctx, record); } @@ -1759,9 +1818,11 @@ dd_init_draw_functions(struct dd_context *dctx) CTX_INIT(flush_resource); CTX_INIT(generate_mipmap); 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_unmap); + CTX_INIT(buffer_unmap); + CTX_INIT(texture_unmap); CTX_INIT(buffer_subdata); CTX_INIT(texture_subdata); } diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index f107c71ecf9..a98567b641c 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -381,9 +381,11 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, ctx->end_query = noop_end_query; ctx->get_query_result = noop_get_query_result; 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_unmap = noop_transfer_unmap; + ctx->buffer_unmap = noop_transfer_unmap; + ctx->texture_unmap = noop_transfer_unmap; ctx->buffer_subdata = noop_buffer_subdata; ctx->texture_subdata = noop_texture_subdata; ctx->invalidate_resource = noop_invalidate_resource; diff --git a/src/gallium/auxiliary/driver_rbug/rbug_context.c b/src/gallium/auxiliary/driver_rbug/rbug_context.c index 5f5fd4a3ec6..40df61be758 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_context.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_context.c @@ -1107,7 +1107,7 @@ rbug_context_surface_destroy(struct pipe_context *_pipe, static void * -rbug_context_transfer_map(struct pipe_context *_context, +rbug_context_buffer_map(struct pipe_context *_context, struct pipe_resource *_resource, unsigned level, unsigned usage, @@ -1122,7 +1122,34 @@ rbug_context_transfer_map(struct pipe_context *_context, void *map; 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, level, usage, @@ -1152,7 +1179,7 @@ rbug_context_transfer_flush_region(struct pipe_context *_context, static void -rbug_context_transfer_unmap(struct pipe_context *_context, +rbug_context_buffer_unmap(struct pipe_context *_context, struct pipe_transfer *_transfer) { 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; 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); rbug_transfer_destroy(rb_pipe, 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.create_surface = rbug_context_create_surface; rb_pipe->base.surface_destroy = rbug_context_surface_destroy; - rb_pipe->base.transfer_map = rbug_context_transfer_map; - rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; + rb_pipe->base.buffer_map = rbug_context_buffer_map; + 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.buffer_subdata = rbug_context_buffer_subdata; rb_pipe->base.texture_subdata = rbug_context_texture_subdata; diff --git a/src/gallium/auxiliary/driver_rbug/rbug_core.c b/src/gallium/auxiliary/driver_rbug/rbug_core.c index 6d6ca7ec04b..aad4487f4a9 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_core.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_core.c @@ -267,7 +267,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_ } tex = tr_tex->resource; - map = pipe_transfer_map(context, tex, + map = pipe_texture_map(context, tex, gptr->level, gptr->face + gptr->zslice, PIPE_MAP_READ, 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, NULL); - context->transfer_unmap(context, t); + context->texture_unmap(context, t); mtx_unlock(&rb_screen->list_mutex); diff --git a/src/gallium/auxiliary/driver_rbug/rbug_objects.c b/src/gallium/auxiliary/driver_rbug/rbug_objects.c index bf2790cf298..09455cf6f2f 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_objects.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_objects.c @@ -186,7 +186,10 @@ rbug_transfer_create(struct rbug_context *rb_context, return &rb_transfer->base; 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; } diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c b/src/gallium/auxiliary/driver_trace/tr_context.c index 2454ff77d4c..5ef823bfcec 100644 --- a/src/gallium/auxiliary/driver_trace/tr_context.c +++ b/src/gallium/auxiliary/driver_trace/tr_context.c @@ -1572,7 +1572,10 @@ trace_context_transfer_map(struct pipe_context *_context, * to texture/buffer_subdata and ignore read transfers. */ - map = context->transfer_map(context, resource, level, usage, box, &result); + 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) return NULL; @@ -1672,7 +1675,10 @@ trace_context_transfer_unmap(struct pipe_context *_context, 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); } @@ -2160,8 +2166,8 @@ trace_context_create(struct trace_screen *tr_scr, TR_CTX_INIT(delete_image_handle); TR_CTX_INIT(make_image_handle_resident); - TR_CTX_INIT(transfer_map); - TR_CTX_INIT(transfer_unmap); + tr_ctx->base.buffer_map = tr_ctx->base.texture_map = trace_context_transfer_map; + tr_ctx->base.buffer_unmap = tr_ctx->base.texture_unmap = trace_context_transfer_unmap; TR_CTX_INIT(transfer_flush_region); TR_CTX_INIT(buffer_subdata); TR_CTX_INIT(texture_subdata); diff --git a/src/gallium/auxiliary/driver_trace/tr_texture.c b/src/gallium/auxiliary/driver_trace/tr_texture.c index fd9b3d41884..d9fba6d46ba 100644 --- a/src/gallium/auxiliary/driver_trace/tr_texture.c +++ b/src/gallium/auxiliary/driver_trace/tr_texture.c @@ -101,7 +101,10 @@ trace_transfer_create(struct trace_context *tr_ctx, return &tr_trans->base.b; 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; } diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c index c7f8aef0d1c..a372410b109 100644 --- a/src/gallium/auxiliary/hud/font.c +++ b/src/gallium/auxiliary/hud/font.c @@ -417,8 +417,8 @@ util_font_create_fixed_8x13(struct pipe_context *pipe, return FALSE; } - map = pipe_transfer_map(pipe, tex, 0, 0, PIPE_MAP_WRITE, 0, 0, - tex->width0, tex->height0, &transfer); + map = pipe_texture_map(pipe, tex, 0, 0, PIPE_MAP_WRITE, 0, 0, + tex->width0, tex->height0, &transfer); if (!map) { pipe_resource_reference(&tex, NULL); return FALSE; @@ -432,7 +432,7 @@ util_font_create_fixed_8x13(struct pipe_context *pipe, transfer->stride, i); } - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); pipe_resource_reference(&out_font->texture, NULL); out_font->texture = tex; diff --git a/src/gallium/auxiliary/util/u_debug_image.c b/src/gallium/auxiliary/util/u_debug_image.c index 91bfa10af88..fd0513f658b 100644 --- a/src/gallium/auxiliary/util/u_debug_image.c +++ b/src/gallium/auxiliary/util/u_debug_image.c @@ -113,10 +113,10 @@ debug_dump_surface(struct pipe_context *pipe, */ texture = surface->texture; - data = pipe_transfer_map(pipe, texture, surface->u.tex.level, - surface->u.tex.first_layer, - PIPE_MAP_READ, - 0, 0, surface->width, surface->height, &transfer); + data = pipe_texture_map(pipe, texture, surface->u.tex.level, + surface->u.tex.first_layer, + PIPE_MAP_READ, + 0, 0, surface->width, surface->height, &transfer); if (!data) return; @@ -128,7 +128,7 @@ debug_dump_surface(struct pipe_context *pipe, transfer->stride, 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; void *ptr; - ptr = pipe_transfer_map(pipe, texture, surface->u.tex.level, - surface->u.tex.first_layer, PIPE_MAP_READ, - 0, 0, surface->width, surface->height, &transfer); + ptr = pipe_texture_map(pipe, texture, surface->u.tex.level, + surface->u.tex.first_layer, PIPE_MAP_READ, + 0, 0, surface->width, surface->height, &transfer); debug_dump_transfer_bmp(pipe, filename, transfer, ptr); - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } void diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 30b1328480d..a8d79a2a79b 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -355,7 +355,7 @@ pipe_buffer_map_range(struct pipe_context *pipe, u_box_1d(offset, length, &box); - map = pipe->transfer_map(pipe, buffer, 0, access, &box, transfer); + map = pipe->buffer_map(pipe, buffer, 0, access, &box, transfer); if (!map) { return NULL; } @@ -384,7 +384,7 @@ static inline void pipe_buffer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { - pipe->transfer_unmap(pipe, transfer); + pipe->buffer_unmap(pipe, transfer); } static inline void @@ -504,21 +504,18 @@ pipe_buffer_read(struct pipe_context *pipe, * \param access bitmask of PIPE_MAP_x flags */ static inline void * -pipe_transfer_map(struct pipe_context *context, - struct pipe_resource *resource, - unsigned level, unsigned layer, - unsigned access, - unsigned x, unsigned y, - unsigned w, unsigned h, - struct pipe_transfer **transfer) +pipe_texture_map(struct pipe_context *context, + struct pipe_resource *resource, + unsigned level, unsigned layer, + unsigned access, + unsigned x, unsigned y, + unsigned w, unsigned h, + struct pipe_transfer **transfer) { struct pipe_box box; u_box_2d_zslice(x, y, layer, w, h, &box); - return context->transfer_map(context, - resource, - level, - access, - &box, transfer); + return context->texture_map(context, resource, level, access, + &box, transfer); } @@ -527,28 +524,25 @@ pipe_transfer_map(struct pipe_context *context, * \param access bitmask of PIPE_MAP_x flags */ static inline void * -pipe_transfer_map_3d(struct pipe_context *context, - struct pipe_resource *resource, - unsigned level, - unsigned access, - unsigned x, unsigned y, unsigned z, - unsigned w, unsigned h, unsigned d, - struct pipe_transfer **transfer) +pipe_texture_map_3d(struct pipe_context *context, + struct pipe_resource *resource, + unsigned level, + unsigned access, + unsigned x, unsigned y, unsigned z, + unsigned w, unsigned h, unsigned d, + struct pipe_transfer **transfer) { struct pipe_box box; u_box_3d(x, y, z, w, h, d, &box); - return context->transfer_map(context, - resource, - level, - access, - &box, transfer); + return context->texture_map(context, resource, level, access, + &box, transfer); } static inline void -pipe_transfer_unmap(struct pipe_context *context, - struct pipe_transfer *transfer) +pipe_texture_unmap(struct pipe_context *context, + struct pipe_transfer *transfer) { - context->transfer_unmap(context, transfer); + context->texture_unmap(context, transfer); } static inline void diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index 894ba275417..3ace5e703ed 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -69,7 +69,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe, int i, j; /* 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); /* @@ -92,7 +92,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe, } /* unmap */ - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 1a8acb3587c..3906a84b650 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -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 == (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) { + 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.depth == 1); 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 { + 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, src_format, dst_trans->stride, dst_trans->layer_stride, @@ -322,13 +349,13 @@ util_resource_copy_region(struct pipe_context *pipe, src_map, src_trans->stride, src_trans->layer_stride, 0, 0, 0); - } - pipe->transfer_unmap(pipe, dst_trans); -no_dst_map: - pipe->transfer_unmap(pipe, src_trans); -no_src_map: - ; + pipe->texture_unmap(pipe, dst_trans); + no_dst_map: + pipe->texture_unmap(pipe, src_trans); + no_src_map: + ; + } } static void @@ -361,7 +388,7 @@ util_clear_color_texture(struct pipe_context *pipe, struct pipe_transfer *dst_trans; ubyte *dst_map; - dst_map = pipe_transfer_map_3d(pipe, + dst_map = pipe_texture_map_3d(pipe, texture, level, 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, 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); dx = (dst->u.buf.first_element + dstx) * pixstride; w = width * pixstride; - dst_map = pipe_transfer_map(pipe, + dst_map = pipe_texture_map(pipe, dst->texture, 0, 0, PIPE_MAP_WRITE, @@ -422,7 +449,7 @@ util_clear_render_target(struct pipe_context *pipe, if (dst_map) { util_clear_color_texture_helper(dst_trans, dst_map, dst->format, color, width, height, 1); - pipe->transfer_unmap(pipe, dst_trans); + pipe->texture_unmap(pipe, dst_trans); } } else { @@ -562,7 +589,7 @@ util_clear_depth_stencil_texture(struct pipe_context *pipe, util_format_is_depth_and_stencil(format)) need_rmw = TRUE; - dst_map = pipe_transfer_map_3d(pipe, + dst_map = pipe_texture_map_3d(pipe, texture, level, (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, depth, zstencil); - pipe->transfer_unmap(pipe, dst_trans); + pipe->texture_unmap(pipe, dst_trans); } diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index bce9f8522e1..d50dc80ff48 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -231,10 +231,10 @@ util_probe_rect_rgba_multi(struct pipe_context *ctx, struct pipe_resource *tex, unsigned x,y,e,c; 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); 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 (y = 0; y < h; y++) { diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 7faf2a8987c..63cf5de68ee 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1981,80 +1981,100 @@ tc_improve_map_buffer_flags(struct threaded_context *tc, } static void * -tc_transfer_map(struct pipe_context *_pipe, - struct pipe_resource *resource, unsigned level, - unsigned usage, const struct pipe_box *box, - struct pipe_transfer **transfer) +tc_buffer_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; - 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 - * only get resource_copy_region. + /* Do a staging transfer within the threaded context. The driver should + * 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) { - 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). - */ - usage &= ~PIPE_MAP_UNSYNCHRONIZED & ~TC_TRANSFER_MAP_THREADED_UNSYNC; - tc->use_forced_staging_uploads = false; - } + 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. */ if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC)) { - tc_sync_msg(tc, resource->target != PIPE_BUFFER ? " texture" : - usage & PIPE_MAP_DISCARD_RANGE ? " discard_range" : + tc_sync_msg(tc, usage & PIPE_MAP_DISCARD_RANGE ? " discard_range" : usage & PIPE_MAP_READ ? " read" : " staging conflict"); tc_set_driver_thread(tc); } tc->bytes_mapped_estimate += box->width; - void *ret = pipe->transfer_map(pipe, tres->latest ? tres->latest : resource, - level, usage, box, transfer); - if (resource->target == PIPE_BUFFER) - threaded_transfer(*transfer)->valid_buffer_range = &tres->valid_buffer_range; + void *ret = pipe->buffer_map(pipe, tres->latest ? tres->latest : resource, + level, usage, box, transfer); + 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)) tc_clear_driver_thread(tc); @@ -2147,7 +2167,11 @@ tc_transfer_flush_region(struct pipe_context *_pipe, 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; bool was_staging_transfer; union { @@ -2157,9 +2181,9 @@ struct tc_transfer_unmap { }; 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) { 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); tc_drop_resource_reference(p->resource); } 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 -tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence, - unsigned flags); - -static void -tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer) +tc_buffer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer) { struct threaded_context *tc = threaded_context(_pipe); 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))); struct pipe_context *pipe = tc->pipe; - if (tres->b.target == PIPE_BUFFER) { - util_range_add(&tres->b, ttrans->valid_buffer_range, - transfer->box.x, transfer->box.x + transfer->box.width); - } - pipe->transfer_unmap(pipe, transfer); + util_range_add(&tres->b, ttrans->valid_buffer_range, + transfer->box.x, transfer->box.x + transfer->box.width); + + pipe->buffer_unmap(pipe, transfer); return; } bool was_staging_transfer = false; - if (tres->b.target == PIPE_BUFFER) { - if (transfer->usage & PIPE_MAP_WRITE && - !(transfer->usage & PIPE_MAP_FLUSH_EXPLICIT)) - tc_buffer_do_flush_region(tc, ttrans, &transfer->box); + if (transfer->usage & PIPE_MAP_WRITE && + !(transfer->usage & PIPE_MAP_FLUSH_EXPLICIT)) + tc_buffer_do_flush_region(tc, ttrans, &transfer->box); - if (ttrans->staging) { - was_staging_transfer = true; + if (ttrans->staging) { + was_staging_transfer = true; - tc_drop_resource_reference(ttrans->staging); - slab_free(&tc->pool_transfers, ttrans); - } + tc_drop_resource_reference(ttrans->staging); + 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) { tc_set_resource_reference(&p->resource, &tres->b); 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; } - /* 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. * 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, @@ -2287,10 +2338,10 @@ tc_buffer_subdata(struct pipe_context *_pipe, u_box_1d(offset, size, &box); - map = tc_transfer_map(_pipe, resource, 0, usage, &box, &transfer); + map = tc_buffer_map(_pipe, resource, 0, usage, &box, &transfer); if (map) { memcpy(map, data, size); - tc_transfer_unmap(_pipe, transfer); + tc_buffer_unmap(_pipe, transfer); } return; } @@ -3945,9 +3996,11 @@ threaded_context_create(struct pipe_context *pipe, CTX_INIT(sampler_view_destroy); CTX_INIT(create_surface); CTX_INIT(surface_destroy); - CTX_INIT(transfer_map); + CTX_INIT(buffer_map); + CTX_INIT(texture_map); CTX_INIT(transfer_flush_region); - CTX_INIT(transfer_unmap); + CTX_INIT(buffer_unmap); + CTX_INIT(texture_unmap); CTX_INIT(buffer_subdata); CTX_INIT(texture_subdata); CTX_INIT(texture_barrier); diff --git a/src/gallium/auxiliary/util/u_threaded_context_calls.h b/src/gallium/auxiliary/util/u_threaded_context_calls.h index 7b11f862c6d..7aae54f16e3 100644 --- a/src/gallium/auxiliary/util/u_threaded_context_calls.h +++ b/src/gallium/auxiliary/util/u_threaded_context_calls.h @@ -23,7 +23,8 @@ CALL(set_vertex_buffers) CALL(set_stream_output_targets) CALL(replace_buffer_storage) CALL(transfer_flush_region) -CALL(transfer_unmap) +CALL(buffer_unmap) +CALL(texture_unmap) CALL(buffer_subdata) CALL(texture_subdata) CALL(emit_string_marker) diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index d0354d5e766..7b4ee2b4113 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -31,12 +31,12 @@ void u_default_buffer_subdata(struct pipe_context *pipe, 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) return; memcpy(map, data, size); - pipe_transfer_unmap(pipe, transfer); + pipe_buffer_unmap(pipe, transfer); } 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 */ usage |= PIPE_MAP_DISCARD_RANGE; - map = pipe->transfer_map(pipe, + map = pipe->texture_map(pipe, resource, level, usage, @@ -81,7 +81,7 @@ void u_default_texture_subdata(struct pipe_context *pipe, layer_stride, /* bytes */ 0, 0, 0); - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); } void u_default_transfer_flush_region(UNUSED struct pipe_context *pipe, diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c index 47898e0bd92..d1e8d123a1a 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.c +++ b/src/gallium/auxiliary/util/u_transfer_helper.c @@ -213,7 +213,7 @@ transfer_map_msaa(struct pipe_context *pctx, map_box.x = 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); if (!ss_map) { free(trans); @@ -505,7 +505,7 @@ u_transfer_helper_transfer_unmap(struct pipe_context *pctx, * so don't call helper->vtbl->transfer_unmap() directly */ if (trans->ss) { - pctx->transfer_unmap(pctx, trans->trans); + pctx->texture_unmap(pctx, trans->trans); pipe_resource_reference(&trans->ss, NULL); } else { helper->vtbl->transfer_unmap(pctx, trans->trans); diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 95f434b36be..1dcbff71999 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -134,7 +134,7 @@ upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying) box->x, upload->offset - box->x); } - pipe_transfer_unmap(upload->pipe, upload->transfer); + pipe_buffer_unmap(upload->pipe, upload->transfer); upload->transfer = NULL; upload->map = NULL; } diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index ccee0d4889f..93680309194 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -718,7 +718,7 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale) if (!matrix) goto error_matrix; - f = pipe->transfer_map(pipe, matrix, 0, + f = pipe->texture_map(pipe, matrix, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, &rect, &buf_transfer); @@ -732,7 +732,7 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale) // transpose and 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)); u_sampler_view_default_template(&sv_templ, matrix, matrix->format); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index e6225d2ec72..149a017f8ae 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -628,7 +628,7 @@ vl_mpeg12_begin_frame(struct pipe_video_codec *decoder, rect.height = tex->height0; buf->texels = - dec->context->transfer_map(dec->context, tex, 0, + dec->context->texture_map(dec->context, tex, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, &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); 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[1] = dec->pos; diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index d225265d081..42ba13bd9a5 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -409,7 +409,7 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks if (!res) goto error_resource; - f = pipe->transfer_map(pipe, res, + f = pipe->texture_map(pipe, res, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, &rect, &buf_transfer); 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; } - pipe->transfer_unmap(pipe, buf_transfer); + pipe->texture_unmap(pipe, buf_transfer); memset(&sv_tmpl, 0, sizeof(sv_tmpl)); 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; - data = pipe->transfer_map(pipe, buffer->quant->texture, + data = pipe->texture_map(pipe, buffer->quant->texture, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, &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) 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 diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index a7d300e058c..e24579946b8 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -522,9 +522,11 @@ agx_create_context(struct pipe_screen *screen, pctx->end_query = agx_end_query; pctx->get_query_result = agx_get_query_result; 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_unmap = agx_transfer_unmap; + pctx->buffer_unmap = agx_transfer_unmap; + pctx->texture_unmap = agx_transfer_unmap; pctx->buffer_subdata = u_default_buffer_subdata; pctx->texture_subdata = u_default_texture_subdata; pctx->invalidate_resource = agx_invalidate_resource; diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp index 2b06b37c3c1..f8ebd4e1ccf 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.cpp +++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp @@ -1080,8 +1080,10 @@ d3d12_resource_make_writeable(struct pipe_context *pctx, void d3d12_context_resource_init(struct pipe_context *pctx) { - pctx->transfer_map = d3d12_transfer_map; - pctx->transfer_unmap = d3d12_transfer_unmap; + pctx->buffer_map = d3d12_transfer_map; + 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->buffer_subdata = u_default_buffer_subdata; diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index 53dbaa8b8f1..da93178dbaa 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -635,7 +635,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen, if (map) { 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->height0, level), &transfer); @@ -643,7 +643,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen, util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0, transfer->box.width, transfer->box.height, (const ubyte*)res_map, transfer->stride, 0, 0); - pipe_transfer_unmap(pctx, transfer); + pipe_texture_unmap(pctx, transfer); } winsys->displaytarget_unmap(winsys, res->dt); } diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c index 33b8e48de1f..9d745226410 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c @@ -508,9 +508,11 @@ etna_transfer_flush_region(struct pipe_context *pctx, void 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_unmap = etna_transfer_unmap; + pctx->buffer_unmap = etna_transfer_unmap; + pctx->texture_unmap = etna_transfer_unmap; pctx->buffer_subdata = u_default_buffer_subdata; pctx->texture_subdata = u_default_texture_subdata; } diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 8a6d22dae34..398604cbb80 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -1644,9 +1644,11 @@ fd_blit_pipe(struct pipe_context *pctx, void 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_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->texture_subdata = u_default_texture_subdata; pctx->create_surface = fd_create_surface; diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index 4897b4d117b..3790a52ec4b 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -36,9 +36,11 @@ i915_resource_from_handle(struct pipe_screen * screen, void 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_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.texture_subdata = u_default_texture_subdata; } diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index f5eb88ef7d5..38cdc161187 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -2396,9 +2396,11 @@ iris_init_resource_functions(struct pipe_context *ctx) { ctx->flush_resource = iris_flush_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_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->texture_subdata = iris_texture_subdata; } diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c index 4e0c8d3460c..ae757973d31 100644 --- a/src/gallium/drivers/lima/lima_resource.c +++ b/src/gallium/drivers/lima/lima_resource.c @@ -903,9 +903,11 @@ lima_resource_context_init(struct lima_context *ctx) 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_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; } diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index 9ba2b87b82e..8e905b8d7a0 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -65,7 +65,7 @@ lp_resource_copy_ms(struct pipe_context *pipe, &dst_box, &dst_trans); if (!dst_map) { - pipe->transfer_unmap(pipe, src_trans); + pipe->texture_unmap(pipe, src_trans); return; } @@ -77,8 +77,8 @@ lp_resource_copy_ms(struct pipe_context *pipe, src_map, src_trans->stride, src_trans->layer_stride, 0, 0, 0); - pipe->transfer_unmap(pipe, dst_trans); - pipe->transfer_unmap(pipe, src_trans); + pipe->texture_unmap(pipe, dst_trans); + pipe->texture_unmap(pipe, src_trans); } } 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, box->width, box->height, box->depth); } - pipe->transfer_unmap(pipe, dst_trans); + pipe->texture_unmap(pipe, dst_trans); } static void @@ -361,7 +361,7 @@ lp_clear_depth_stencil_texture_msaa(struct pipe_context *pipe, dst_trans->stride, dst_trans->layer_stride, box->width, box->height, box->depth, zstencil); - pipe->transfer_unmap(pipe, dst_trans); + pipe->texture_unmap(pipe, dst_trans); } static void @@ -456,7 +456,7 @@ llvmpipe_clear_buffer(struct pipe_context *pipe, char *dst; u_box_1d(offset, size, &box); - dst = pipe->transfer_map(pipe, + dst = pipe->buffer_map(pipe, res, 0, PIPE_MAP_WRITE, @@ -475,7 +475,7 @@ llvmpipe_clear_buffer(struct pipe_context *pipe, memcpy(&dst[i], clear_value, clear_value_size); break; } - pipe->transfer_unmap(pipe, dst_t); + pipe->buffer_unmap(pipe, dst_t); } void diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 040b49bcdc2..92396f38c1e 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -964,8 +964,10 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen) void llvmpipe_init_context_resource_funcs(struct pipe_context *pipe) { - pipe->transfer_map = llvmpipe_transfer_map; - pipe->transfer_unmap = llvmpipe_transfer_unmap; + pipe->buffer_map = llvmpipe_transfer_map; + 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->buffer_subdata = u_default_buffer_subdata; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index 53bd879ceac..f00e6ee44a8 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -92,9 +92,11 @@ nv30_resource_screen_init(struct pipe_screen *pscreen) void 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_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->texture_subdata = u_default_texture_subdata; pipe->create_surface = nv30_miptree_surface_new; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/src/gallium/drivers/nouveau/nv50/nv50_resource.c index bb6822725ea..4f53d2f58e3 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_resource.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.c @@ -103,9 +103,11 @@ nv50_invalidate_resource(struct pipe_context *pipe, struct pipe_resource *res) void 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_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->texture_subdata = u_default_texture_subdata; pcontext->create_surface = nv50_surface_create; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c index fbda9f825ba..1ba6978f95d 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c @@ -154,9 +154,11 @@ nvc0_resource_from_user_memory(struct pipe_screen *pipe, void 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_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->texture_subdata = u_default_texture_subdata; pcontext->create_surface = nvc0_surface_create; diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index f2a6511d892..68e60de5574 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -1352,8 +1352,10 @@ panfrost_resource_screen_init(struct pipe_screen *pscreen) void panfrost_resource_context_init(struct pipe_context *pctx) { - pctx->transfer_map = u_transfer_helper_transfer_map; - pctx->transfer_unmap = u_transfer_helper_transfer_unmap; + pctx->buffer_map = u_transfer_helper_transfer_map; + 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->surface_destroy = panfrost_surface_destroy; pctx->resource_copy_region = util_resource_copy_region; diff --git a/src/gallium/drivers/r300/r300_resource.c b/src/gallium/drivers/r300/r300_resource.c index b34a9b10fca..7eb99b724b4 100644 --- a/src/gallium/drivers/r300/r300_resource.c +++ b/src/gallium/drivers/r300/r300_resource.c @@ -40,9 +40,11 @@ r300_resource_create(struct pipe_screen *screen, 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_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.texture_subdata = u_default_texture_subdata; r300->context.create_surface = r300_create_surface; diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c index 58a5dffdfc0..03b0cc524c1 100644 --- a/src/gallium/drivers/r600/compute_memory_pool.c +++ b/src/gallium/drivers/r600/compute_memory_pool.c @@ -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); - map = pipe->transfer_map(pipe, src, 0, PIPE_MAP_READ_WRITE, + map = pipe->buffer_map(pipe, src, 0, PIPE_MAP_READ_WRITE, &box, &trans); 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); - pipe->transfer_unmap(pipe, trans); + pipe->buffer_unmap(pipe, trans); } } @@ -614,20 +614,20 @@ static void compute_memory_transfer( offset_in_chunk, size); 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, .height = 1, .depth = 1 }, &xfer); assert(xfer); assert(map); memcpy(data, map + internal_offset, size); - pipe->transfer_unmap(pipe, xfer); + pipe->buffer_unmap(pipe, xfer); } 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, .height = 1, .depth = 1 }, &xfer); assert(xfer); assert(map); memcpy(map + internal_offset, data, size); - pipe->transfer_unmap(pipe, xfer); + pipe->buffer_unmap(pipe, xfer); } } diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 80c0334956c..ca58cbd7efe 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -555,7 +555,7 @@ static void evergreen_compute_upload_input(struct pipe_context *ctx, } 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, 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, &box, &transfer); @@ -582,7 +582,7 @@ static void evergreen_compute_upload_input(struct pipe_context *ctx, ((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. * LLVM will preferably use ID=0, but it does not work for dynamic diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 639de602c46..c42d3605b97 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -590,9 +590,11 @@ bool r600_common_context_init(struct r600_common_context *rctx, rctx->b.invalidate_resource = r600_invalidate_resource; 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_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.flush = r600_flush_from_st; rctx->b.set_debug_callback = r600_set_debug_callback; diff --git a/src/gallium/drivers/r600/r600_test_dma.c b/src/gallium/drivers/r600/r600_test_dma.c index e8e54fb99f6..50b78c9672b 100644 --- a/src/gallium/drivers/r600/r600_test_dma.c +++ b/src/gallium/drivers/r600/r600_test_dma.c @@ -59,7 +59,7 @@ static void set_random_pixels(struct pipe_context *ctx, uint8_t *map; 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, tex->array_size, &t); 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, @@ -94,7 +94,7 @@ static bool compare_textures(struct pipe_context *ctx, int y,z; 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, tex->array_size, &t); assert(map); @@ -112,7 +112,7 @@ static bool compare_textures(struct pipe_context *ctx, } } done: - pipe_transfer_unmap(ctx, t); + pipe_texture_unmap(ctx, t); return pass; } diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c index d2255d532c3..3f27f2a9157 100644 --- a/src/gallium/drivers/radeonsi/si_buffer.c +++ b/src/gallium/drivers/radeonsi/si_buffer.c @@ -745,9 +745,11 @@ void si_init_screen_buffer_functions(struct si_screen *sscreen) void si_init_buffer_functions(struct si_context *sctx) { 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_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.buffer_subdata = si_buffer_subdata; sctx->b.resource_commit = si_resource_commit; diff --git a/src/gallium/drivers/radeonsi/si_test_blit.c b/src/gallium/drivers/radeonsi/si_test_blit.c index c4351ad5f8a..74a45f7783b 100644 --- a/src/gallium/drivers/radeonsi/si_test_blit.c +++ b/src/gallium/drivers/radeonsi/si_test_blit.c @@ -58,7 +58,7 @@ static void set_random_pixels(struct pipe_context *ctx, struct pipe_resource *te uint8_t *map; 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); 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, @@ -89,7 +89,7 @@ static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex bool pass = true; 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); assert(map); @@ -105,7 +105,7 @@ static bool compare_textures(struct pipe_context *ctx, struct pipe_resource *tex } } done: - pipe_transfer_unmap(ctx, t); + pipe_texture_unmap(ctx, t); return pass; } diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index 7a1009a8c9c..30bca75570d 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -74,10 +74,10 @@ sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc) /*assert(tc->entries[pos].x < 0);*/ } if (tc->transfer) { - tc->pipe->transfer_unmap(tc->pipe, tc->transfer); + tc->pipe->texture_unmap(tc->pipe, tc->transfer); } if (tc->tex_trans) { - tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans); + tc->pipe->texture_unmap(tc->pipe, tc->tex_trans); } 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); 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_map = NULL; } @@ -230,7 +230,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, unsigned width, height, layer; 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_map = NULL; } @@ -246,7 +246,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } tc->tex_trans_map = - pipe_transfer_map(tc->pipe, tc->texture, + pipe_texture_map(tc->pipe, tc->texture, addr.bits.level, layer, PIPE_MAP_READ | PIPE_MAP_UNSYNCHRONIZED, diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index b4624f50e5d..4a89e4c36f7 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -512,8 +512,10 @@ softpipe_user_buffer_create(struct pipe_screen *screen, void softpipe_init_texture_funcs(struct pipe_context *pipe) { - pipe->transfer_map = softpipe_transfer_map; - pipe->transfer_unmap = softpipe_transfer_unmap; + pipe->buffer_map = softpipe_transfer_map; + 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->buffer_subdata = u_default_buffer_subdata; diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 81121d49fdb..b185320a36b 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -149,7 +149,7 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc) int i; for (i = 0; i < tc->num_maps; 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_map); @@ -176,7 +176,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, return; 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_map[i] = NULL; } @@ -200,7 +200,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, if (ps->texture->target != PIPE_BUFFER) { 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, PIPE_MAP_READ_WRITE | PIPE_MAP_UNSYNCHRONIZED, diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index d6e6fa61cd5..986381c5b62 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -120,9 +120,11 @@ svga_can_create_resource(struct pipe_screen *screen, void 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_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.texture_subdata = u_default_texture_subdata; diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index 33fa27c5efd..8498a6b1076 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -555,8 +555,10 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags) ctx->pipe.priv = priv; ctx->pipe.create_surface = swr_create_surface; ctx->pipe.surface_destroy = swr_surface_destroy; - ctx->pipe.transfer_map = swr_transfer_map; - ctx->pipe.transfer_unmap = swr_transfer_unmap; + ctx->pipe.buffer_map = swr_transfer_map; + 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.buffer_subdata = u_default_buffer_subdata; diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c index e75a7c96e6f..b7dc73bb1be 100644 --- a/src/gallium/drivers/tegra/tegra_context.c +++ b/src/gallium/drivers/tegra/tegra_context.c @@ -916,9 +916,15 @@ tegra_transfer_map(struct pipe_context *pcontext, if (!transfer) return NULL; - transfer->map = context->gpu->transfer_map(context->gpu, resource->gpu, - level, usage, box, - &transfer->gpu); + if (presource->target == PIPE_BUFFER) { + transfer->map = context->gpu->buffer_map(context->gpu, resource->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)); transfer->base.resource = NULL; 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_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); 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.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_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.texture_subdata = tegra_texture_subdata; diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 350bedaa57d..412e92cbdb1 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -1161,9 +1161,11 @@ v3d_resource_screen_init(struct pipe_screen *pscreen) void 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_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->texture_subdata = v3d_texture_subdata; pctx->create_surface = v3d_create_surface; diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index ca4be44fef5..8ecfb9507e6 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -1099,7 +1099,7 @@ vc4_get_shadow_index_buffer(struct pipe_context *pctx, } if (src_transfer) - pctx->transfer_unmap(pctx, src_transfer); + pctx->buffer_unmap(pctx, src_transfer); return shadow_rsc; } @@ -1142,9 +1142,11 @@ vc4_resource_screen_init(struct pipe_screen *pscreen) void 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_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->texture_subdata = vc4_texture_subdata; pctx->create_surface = vc4_create_surface; diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 42f73832d89..fe4407bb239 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -672,9 +672,11 @@ static void virgl_buffer_subdata(struct pipe_context *pipe, 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_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->texture_subdata = u_default_texture_subdata; } diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index dcd44174557..86d4b94e246 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1351,8 +1351,10 @@ zink_screen_resource_init(struct pipe_screen *pscreen) void zink_context_resource_init(struct pipe_context *pctx) { - pctx->transfer_map = u_transfer_helper_deinterleave_transfer_map; - pctx->transfer_unmap = u_transfer_helper_deinterleave_transfer_unmap; + pctx->buffer_map = u_transfer_helper_deinterleave_transfer_map; + 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->buffer_subdata = zink_buffer_subdata; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 26c01baa2a2..3e6f0abbf12 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1077,7 +1077,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen, if (map) { 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->height0, level), &transfer); @@ -1085,7 +1085,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen, util_copy_rect((ubyte*)map, pres->format, res->dt_stride, 0, 0, transfer->box.width, transfer->box.height, (const ubyte*)res_map, transfer->stride, 0, 0); - pipe_transfer_unmap(pcontext, transfer); + pipe_texture_unmap(pcontext, transfer); } winsys->displaytarget_unmap(winsys, res->dt); } diff --git a/src/gallium/frontends/clover/core/resource.cpp b/src/gallium/frontends/clover/core/resource.cpp index 87f4e42a67f..6ace714a86d 100644 --- a/src/gallium/frontends/clover/core/resource.cpp +++ b/src/gallium/frontends/clover/core/resource.cpp @@ -233,7 +233,7 @@ mapping::mapping(command_queue &q, resource &r, PIPE_MAP_DISCARD_RANGE : 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); if (!p) { pxfer = NULL; @@ -252,7 +252,7 @@ mapping::mapping(mapping &&m) : mapping::~mapping() { if (pxfer) { - pctx->transfer_unmap(pctx, pxfer); + pctx->buffer_unmap(pctx, pxfer); } pipe_resource_reference(&pres, NULL); } diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index d70715077c7..0220513368e 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -1697,7 +1697,7 @@ dri2_map_image(__DRIcontext *context, __DRIimage *image, if (flags & __DRI_IMAGE_TRANSFER_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); if (map) { *data = trans; @@ -1713,7 +1713,7 @@ dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data) struct dri_context *ctx = dri_context(context); 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 diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index 70fd08e6155..498522564c6 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -421,7 +421,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, get_drawable_info(dPriv, &x, &y, &w, &h); - map = pipe_transfer_map(pipe, res, + map = pipe_texture_map(pipe, res, 0, 0, // level, layer, PIPE_MAP_WRITE, x, y, w, h, &transfer); @@ -439,7 +439,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, ximage_stride); } - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); } static __DRIimageExtension driSWImageExtension = { diff --git a/src/gallium/frontends/glx/xlib/xm_api.c b/src/gallium/frontends/glx/xlib/xm_api.c index d22c4cdbe07..56dd17f9ae8 100644 --- a/src/gallium/frontends/glx/xlib/xm_api.c +++ b/src/gallium/frontends/glx/xlib/xm_api.c @@ -1495,7 +1495,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, internal_format = choose_pixel_format(drawable->xm_visual); - map = pipe_transfer_map(pipe, res, + map = pipe_texture_map(pipe, res, 0, 0, /* level, layer */ PIPE_MAP_WRITE, x, y, @@ -1512,7 +1512,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, ZPixmap); if (!img) { - pipe_transfer_unmap(pipe, tex_xfer); + pipe_texture_unmap(pipe, tex_xfer); return; } @@ -1524,7 +1524,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, &img->data[line * img->bytes_per_line], byte_width); - pipe_transfer_unmap(pipe, tex_xfer); + pipe_texture_unmap(pipe, tex_xfer); st->teximage(st, ST_TEXTURE_2D, diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 30b09a2ba0d..2716453102d 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -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.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->regions[i].imageSubresource.mipLevel, 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.height = 1; dbox.depth = 1; - dst_data = state->pctx->transfer_map(state->pctx, + dst_data = state->pctx->buffer_map(state->pctx, copycmd->dst->bo, 0, PIPE_MAP_WRITE, @@ -1877,8 +1877,8 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd, box.depth, src_data, src_t->stride, src_t->layer_stride, 0, 0, 0); } - state->pctx->transfer_unmap(state->pctx, src_t); - state->pctx->transfer_unmap(state->pctx, dst_t); + state->pctx->texture_unmap(state->pctx, src_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.height = 1; sbox.depth = 1; - src_data = state->pctx->transfer_map(state->pctx, + src_data = state->pctx->buffer_map(state->pctx, copycmd->src->bo, 0, 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.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->regions[i].imageSubresource.mipLevel, PIPE_MAP_WRITE, @@ -1960,8 +1960,8 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd, src_data, buffer_row_len, img_stride, 0, 0, 0); } - state->pctx->transfer_unmap(state->pctx, src_t); - state->pctx->transfer_unmap(state->pctx, dst_t); + state->pctx->buffer_unmap(state->pctx, src_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; 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, 0, PIPE_MAP_WRITE, @@ -2137,7 +2137,7 @@ static void handle_update_buffer(struct lvp_cmd_buffer_entry *cmd, &dst_t); 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, @@ -2418,12 +2418,12 @@ static void handle_copy_query_pool_results(struct lvp_cmd_buffer_entry *cmd, box.width = copycmd->stride; box.height = 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, &src_t); memset(map, 0, box.width); - state->pctx->transfer_unmap(state->pctx, src_t); + state->pctx->buffer_unmap(state->pctx, src_t); } } } diff --git a/src/gallium/frontends/nine/buffer9.c b/src/gallium/frontends/nine/buffer9.c index da5dc04303a..3dd1db4393c 100644 --- a/src/gallium/frontends/nine/buffer9.c +++ b/src/gallium/frontends/nine/buffer9.c @@ -475,11 +475,11 @@ NineBuffer9_Lock( struct NineBuffer9 *This, else 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); if (!data) { - DBG("pipe::transfer_map failed\n" + DBG("pipe::buffer_map failed\n" " usage = %x\n" " box.x = %u\n" " box.width = %u\n", @@ -517,7 +517,7 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) pipe = This->maps[i].is_pipe_secondary ? device->pipe_secondary : 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 */ if (This->maps[i].is_pipe_secondary) pipe->flush(pipe, NULL, 0); diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index 3783bd7ec3d..0479f8af86f 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -393,14 +393,14 @@ NineDevice9_ctor( struct NineDevice9 *This, return D3DERR_OUTOFVIDEOMEMORY; 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_DISCARD_WHOLE_RESOURCE, &box, &transfer); assert(data); assert(transfer); 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; @@ -834,7 +834,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This, 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_DISCARD_WHOLE_RESOURCE, &box, &transfer); @@ -876,7 +876,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This, NineSurface9_UnlockRect(surf); } - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); /* hide cursor if we emulate it */ if (!hw_cursor) @@ -3321,7 +3321,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This, pipe_sw->stream_output_target_destroy(pipe_sw, target); 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); if (!map) { hr = D3DERR_DRIVERINTERNALERROR; @@ -3332,7 +3332,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This, dst, DestIndex, VertexCount, map, &so); if (transfer) - pipe_sw->transfer_unmap(pipe_sw, transfer); + pipe_sw->buffer_unmap(pipe_sw, transfer); out: nine_state_after_draw_sw(This); diff --git a/src/gallium/frontends/nine/nine_buffer_upload.c b/src/gallium/frontends/nine/nine_buffer_upload.c index ff56857ed1c..38737e71538 100644 --- a/src/gallium/frontends/nine/nine_buffer_upload.c +++ b/src/gallium/frontends/nine/nine_buffer_upload.c @@ -122,7 +122,7 @@ nine_upload_destroy_buffer_group(struct nine_buffer_upload *upload, assert(group->refcount == 0); if (group->transfer) - pipe_transfer_unmap(upload->pipe, group->transfer); + pipe_buffer_unmap(upload->pipe, group->transfer); if (group->resource) pipe_resource_reference(&group->resource, NULL); group->transfer = NULL; @@ -276,7 +276,7 @@ nine_upload_release_buffer(struct nine_buffer_upload *upload, } else { /* lonely buffer */ if (buf->transfer) - pipe_transfer_unmap(upload->pipe, buf->transfer); + pipe_buffer_unmap(upload->pipe, buf->transfer); pipe_resource_reference(&buf->resource, NULL); } diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index d1a0d24aa97..7be4df041af 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -2571,7 +2571,7 @@ CSMT_ITEM_NO_WAIT_WITH_COUNTER(nine_context_box_upload, return; } - map = pipe->transfer_map(pipe, + map = pipe->texture_map(pipe, res, level, 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->depth); - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); } 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, 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])); vtxbuf.is_user_buffer = true; vtxbuf.buffer.user = userbuf; @@ -3290,7 +3290,7 @@ nine_state_after_draw_sw(struct NineDevice9 *device) for (i = 0; i < 4; i++) { pipe_sw->set_vertex_buffers(pipe_sw, i, 0, 1, false, NULL); 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; } nine_context_get_pipe_release(device); diff --git a/src/gallium/frontends/nine/surface9.c b/src/gallium/frontends/nine/surface9.c index 28fb4ce89d3..5fe7f51521b 100644 --- a/src/gallium/frontends/nine/surface9.c +++ b/src/gallium/frontends/nine/surface9.c @@ -217,7 +217,7 @@ NineSurface9_dtor( struct NineSurface9 *This ) if (This->transfer) { 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; } @@ -529,13 +529,13 @@ NineSurface9_LockRect( struct NineSurface9 *This, pipe = nine_context_get_pipe_acquire(This->base.base.device); else 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->transfer); if (no_refs) nine_context_get_pipe_release(This->base.base.device); if (!This->transfer) { - DBG("transfer_map failed\n"); + DBG("texture_map failed\n"); if (Flags & D3DLOCK_DONOTWAIT) return D3DERR_WASSTILLDRAWING; return D3DERR_INVALIDCALL; @@ -561,7 +561,7 @@ NineSurface9_UnlockRect( struct NineSurface9 *This ) user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { 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); This->transfer = NULL; } @@ -749,7 +749,7 @@ NineSurface9_CopyDefaultToMem( struct NineSurface9 *This, nine_csmt_process(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, &src_box, &transfer); p_dst = nine_get_pointer(This->base.base.device->allocator, This->data); @@ -762,7 +762,7 @@ NineSurface9_CopyDefaultToMem( struct NineSurface9 *This, p_src, transfer->stride, 0, 0); - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); nine_pointer_weakrelease(This->base.base.device->allocator, This->data); } diff --git a/src/gallium/frontends/nine/volume9.c b/src/gallium/frontends/nine/volume9.c index 7d0b8c86a83..19ad3c3f3a3 100644 --- a/src/gallium/frontends/nine/volume9.c +++ b/src/gallium/frontends/nine/volume9.c @@ -148,7 +148,7 @@ NineVolume9_dtor( struct NineVolume9 *This ) if (This->transfer) { 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; } @@ -343,7 +343,7 @@ NineVolume9_LockBox( struct NineVolume9 *This, else pipe = NineDevice9_GetPipe(This->base.device); pLockedVolume->pBits = - pipe->transfer_map(pipe, resource, This->level, usage, + pipe->texture_map(pipe, resource, This->level, usage, &box, &This->transfer); if (no_refs) nine_context_get_pipe_release(This->base.device); @@ -374,7 +374,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { pipe = nine_context_get_pipe_acquire(This->base.device); - pipe->transfer_unmap(pipe, This->transfer); + pipe->texture_unmap(pipe, This->transfer); This->transfer = NULL; nine_context_get_pipe_release(This->base.device); } diff --git a/src/gallium/frontends/omx/bellagio/vid_enc.c b/src/gallium/frontends/omx/bellagio/vid_enc.c index c0a174c5a81..20696540d58 100644 --- a/src/gallium/frontends/omx/bellagio/vid_enc.c +++ b/src/gallium/frontends/omx/bellagio/vid_enc.c @@ -311,7 +311,7 @@ static OMX_ERRORTYPE enc_AllocateBackTexture(omx_base_PortType *port, box.width = (*resource)->width0; box.height = (*resource)->height0; 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) *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], &resource, &transfer, NULL); 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); 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) { enc_ReleaseTasks(&inp->tasks); 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); FREE(inp); } @@ -737,7 +737,7 @@ static OMX_ERRORTYPE vid_enc_FreeOutBuffer(omx_base_PortType *port, OMX_U32 idx, if (buf->pOutputPortPrivate) { struct output_buf_private *outp = buf->pOutputPortPrivate; 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); FREE(outp); buf->pOutputPortPrivate = NULL; diff --git a/src/gallium/frontends/omx/tizonia/h264einport.c b/src/gallium/frontends/omx/tizonia/h264einport.c index 7c3719f38ae..faf4609fedc 100644 --- a/src/gallium/frontends/omx/tizonia/h264einport.c +++ b/src/gallium/frontends/omx/tizonia/h264einport.c @@ -69,7 +69,7 @@ static OMX_ERRORTYPE enc_AllocateBackTexture(OMX_HANDLETYPE ap_hdl, box.width = (*resource)->width0; box.height = (*resource)->height0; 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) *map = ptr; @@ -157,7 +157,7 @@ static OMX_ERRORTYPE h264e_inport_FreeBuffer(const void * ap_obj, OMX_HANDLETYPE if (inp) { enc_ReleaseTasks(&inp->tasks); 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); FREE(inp); } diff --git a/src/gallium/frontends/omx/tizonia/h264eoutport.c b/src/gallium/frontends/omx/tizonia/h264eoutport.c index 775e04278a4..c40be512beb 100644 --- a/src/gallium/frontends/omx/tizonia/h264eoutport.c +++ b/src/gallium/frontends/omx/tizonia/h264eoutport.c @@ -84,7 +84,7 @@ static OMX_ERRORTYPE h264e_outport_FreeBuffer(const void * ap_obj, OMX_HANDLETYP if (outp) { 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); FREE(outp); buf->pOutputPortPrivate = NULL; diff --git a/src/gallium/frontends/omx/vid_dec_common.c b/src/gallium/frontends/omx/vid_dec_common.c index b22883b13de..74264fb2911 100644 --- a/src/gallium/frontends/omx/vid_dec_common.c +++ b/src/gallium/frontends/omx/vid_dec_common.c @@ -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_transfer *transfer; 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); if (!map) 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, box.width, box.height, map, transfer->stride, 0, 0); - pipe_transfer_unmap(priv->pipe, transfer); + pipe_texture_unmap(priv->pipe, transfer); } } } diff --git a/src/gallium/frontends/omx/vid_enc_common.c b/src/gallium/frontends/omx/vid_enc_common.c index 6777bd53334..6035e99a2c7 100644 --- a/src/gallium/frontends/omx/vid_enc_common.c +++ b/src/gallium/frontends/omx/vid_enc_common.c @@ -147,7 +147,7 @@ void vid_enc_BufferEncoded_common(vid_enc_PrivateType * priv, OMX_BUFFERHEADERTY /* ------------- map result buffer ----------------- */ 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(&task->bitstream, NULL); @@ -156,7 +156,7 @@ void vid_enc_BufferEncoded_common(vid_enc_PrivateType * priv, OMX_BUFFERHEADERTY box.height = outp->bitstream->height0; 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, &box, &outp->transfer); @@ -425,7 +425,7 @@ OMX_ERRORTYPE enc_LoadImage_common(vid_enc_PrivateType * priv, OMX_VIDEO_PORTDEF } else { 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: * @@ -545,7 +545,7 @@ OMX_ERRORTYPE enc_LoadImage_common(vid_enc_PrivateType * priv, OMX_VIDEO_PORTDEF box.width = inp->resource->width0; box.height = inp->resource->height0; 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, &inp->transfer); } diff --git a/src/gallium/frontends/osmesa/osmesa.c b/src/gallium/frontends/osmesa/osmesa.c index 2d06cb5963d..49764d9b0b2 100644 --- a/src/gallium/frontends/osmesa/osmesa.c +++ b/src/gallium/frontends/osmesa/osmesa.c @@ -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); 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); /* @@ -221,7 +221,7 @@ osmesa_read_buffer(OSMesaContext osmesa, struct pipe_resource *res, void *dst, src += transfer->stride; } - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } diff --git a/src/gallium/frontends/va/buffer.c b/src/gallium/frontends/va/buffer.c index ffc61a5e51b..f29811e4526 100644 --- a/src/gallium/frontends/va/buffer.c +++ b/src/gallium/frontends/va/buffer.c @@ -132,7 +132,7 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff) box.width = resource->width0; box.height = resource->height0; 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); mtx_unlock(&drv->mutex); diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c index 1b63c22ec78..284f0401ce2 100644 --- a/src/gallium/frontends/va/image.c +++ b/src/gallium/frontends/va/image.c @@ -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_transfer *transfer; 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); if (!map) { 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, 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); @@ -675,7 +675,7 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image, struct pipe_transfer *transfer = NULL; uint8_t *map = NULL; - map = drv->pipe->transfer_map(drv->pipe, + map = drv->pipe->texture_map(drv->pipe, tex, 0, 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, transfer->stride, tex->array_size, map, dst_box.width, dst_box.height); - pipe_transfer_unmap(drv->pipe, transfer); + pipe_texture_unmap(drv->pipe, transfer); } else { drv->pipe->texture_subdata(drv->pipe, tex, 0, PIPE_MAP_WRITE, &dst_box, diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index ecfae5a6bf6..de42e5401ea 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -200,7 +200,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst, struct pipe_transfer *transfer; 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); if (!map) return; @@ -209,7 +209,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst, dst_box->width, dst_box->height, src, src_stride, src_x, src_y); - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } static VAStatus diff --git a/src/gallium/frontends/vdpau/output.c b/src/gallium/frontends/vdpau/output.c index f33bc8de515..8c7013da83b 100644 --- a/src/gallium/frontends/vdpau/output.c +++ b/src/gallium/frontends/vdpau/output.c @@ -221,7 +221,7 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface, res = vlsurface->sampler_view->texture; 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) { mtx_unlock(&vlsurface->device->mutex); return VDP_STATUS_RESOURCES; @@ -230,7 +230,7 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface, util_copy_rect(*destination_data, res->format, *destination_pitches, 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); return VDP_STATUS_OK; diff --git a/src/gallium/frontends/vdpau/surface.c b/src/gallium/frontends/vdpau/surface.c index 0171001f6e5..a5c3d0cfa43 100644 --- a/src/gallium/frontends/vdpau/surface.c +++ b/src/gallium/frontends/vdpau/surface.c @@ -260,7 +260,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, struct pipe_transfer *transfer; uint8_t *map; - map = pipe->transfer_map(pipe, sv->texture, 0, + map = pipe->texture_map(pipe, sv->texture, 0, PIPE_MAP_READ, &box, &transfer); if (!map) { mtx_unlock(&vlsurface->device->mutex); @@ -285,7 +285,7 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, box.width, box.height, map, transfer->stride, 0, 0); } - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); } } mtx_unlock(&vlsurface->device->mutex); @@ -400,7 +400,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, struct pipe_transfer *transfer; uint8_t *map; - map = pipe->transfer_map(pipe, tex, 0, usage, + map = pipe->texture_map(pipe, tex, 0, usage, &dst_box, &transfer); if (!map) { mtx_unlock(&p_surf->device->mutex); @@ -411,7 +411,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, i, j, transfer->stride, tex->array_size, map, dst_box.width, dst_box.height); - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); } else { pipe->texture_subdata(pipe, tex, 0, PIPE_MAP_WRITE, &dst_box, diff --git a/src/gallium/frontends/xa/xa_context.c b/src/gallium/frontends/xa/xa_context.c index 4307e3f9a73..a1dad5db871 100644 --- a/src/gallium/frontends/xa/xa_context.c +++ b/src/gallium/frontends/xa/xa_context.c @@ -114,7 +114,7 @@ xa_surface_dma(struct xa_context *ctx, w = boxes->x2 - boxes->x1; 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, w, h, &transfer); if (!map) @@ -128,7 +128,7 @@ xa_surface_dma(struct xa_context *ctx, boxes->x1, boxes->y1, w, h, map, transfer->stride, 0, 0); } - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } return XA_ERR_NONE; } @@ -163,7 +163,7 @@ xa_surface_map(struct xa_context *ctx, if (!(gallium_usage & (PIPE_MAP_READ_WRITE))) return NULL; - map = pipe_transfer_map(pipe, srf->tex, 0, 0, + map = pipe_texture_map(pipe, srf->tex, 0, 0, gallium_usage, 0, 0, srf->tex->width0, srf->tex->height0, &srf->transfer); @@ -180,7 +180,7 @@ xa_surface_unmap(struct xa_surface *srf) if (srf->transfer) { struct pipe_context *pipe = srf->mapping_pipe; - pipe->transfer_unmap(pipe, srf->transfer); + pipe->texture_unmap(pipe, srf->transfer); srf->transfer = NULL; } } diff --git a/src/gallium/frontends/xvmc/subpicture.c b/src/gallium/frontends/xvmc/subpicture.c index aa6253bed5e..a9ceff219ca 100644 --- a/src/gallium/frontends/xvmc/subpicture.c +++ b/src/gallium/frontends/xvmc/subpicture.c @@ -210,7 +210,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst, struct pipe_transfer *transfer; 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); if (!map) return; @@ -219,7 +219,7 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst, dst_box->width, dst_box->height, src, src_stride, src_x, src_y); - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } static void @@ -231,7 +231,7 @@ upload_sampler_convert(struct pipe_context *pipe, struct pipe_sampler_view *dst, int i, j; 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); if (!map) 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); } - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); } PUBLIC @@ -393,7 +393,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh dst = subpicture_priv->sampler; /* 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); if (!map) 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, dst_box.width, dst_box.height, &uc); - pipe->transfer_unmap(pipe, transfer); + pipe->texture_unmap(pipe, transfer); return Success; } diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 61e3bb4ae91..26da7006892 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -762,14 +762,14 @@ struct pipe_context { * * out_transfer will contain the transfer object that must be passed * to all the other transfer functions. It also contains useful - * information (like texture strides). + * information (like texture strides for texture_map). */ - void *(*transfer_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 *(*buffer_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); /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the * regions specified with this call are guaranteed to be written to @@ -779,8 +779,18 @@ struct pipe_context { struct pipe_transfer *transfer, const struct pipe_box *); - void (*transfer_unmap)(struct pipe_context *, - struct pipe_transfer *transfer); + void (*buffer_unmap)(struct pipe_context *, + 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 * pointer. diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 0462d6aa2cd..4523c405555 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -249,7 +249,7 @@ enum pipe_map_flags 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). */ PIPE_MAP_WRITE = 1 << 1, diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index f9bddccdaf7..d6a2d284378 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -331,7 +331,7 @@ static void init_tex( void ) { struct pipe_transfer *t; uint32_t *ptr; - ptr = pipe_transfer_map(ctx, samptex, + ptr = pipe_texture_map(ctx, samptex, 0, 0, /* level, layer */ PIPE_MAP_READ, 0, 0, SIZE, SIZE, &t); /* x, y, width, height */ @@ -341,7 +341,7 @@ static void init_tex( void ) exit(9); } - ctx->transfer_unmap(ctx, t); + ctx->texture_unmap(ctx, t); } memset(&sv_template, 0, sizeof sv_template); diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h index ca813b6b87c..3ea2c482d17 100644 --- a/src/gallium/tests/graw/graw_util.h +++ b/src/gallium/tests/graw/graw_util.h @@ -261,21 +261,19 @@ graw_util_create_tex2d(const struct graw_info *info, { struct pipe_transfer *t; uint32_t *ptr; - t = pipe_transfer_map(info->ctx, samptex, + t = pipe_texture_map(info->ctx, samptex, 0, 0, /* level, layer */ PIPE_MAP_READ, 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) { assert(0); exit(9); } - info->ctx->transfer_unmap(info->ctx, t); - - info->ctx->transfer_destroy(info->ctx, t); + info->ctx->texture_unmap(info->ctx, t); } #endif diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 4d8f5c31f15..d57537d7534 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -421,7 +421,7 @@ static void init_tex( void ) { struct pipe_transfer *t; uint32_t *ptr; - ptr = pipe_transfer_map(ctx, samptex, + ptr = pipe_texture_map(ctx, samptex, 0, 0, /* level, layer */ PIPE_MAP_READ, 0, 0, SIZE, SIZE, &t); /* x, y, width, height */ @@ -431,7 +431,7 @@ static void init_tex( void ) exit(9); } - ctx->transfer_unmap(ctx, t); + ctx->texture_unmap(ctx, t); } memset(&sv_template, 0, sizeof sv_template); diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 912df7e7aac..56b8b77caa1 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -246,7 +246,7 @@ static void init_tex( void ) { struct pipe_transfer *t; uint32_t *ptr; - ptr = pipe_transfer_map(ctx, samptex, + ptr = pipe_texture_map(ctx, samptex, 0, 0, /* level, layer */ PIPE_MAP_READ, 0, 0, SIZE, SIZE, &t); /* x, y, width, height */ @@ -256,7 +256,7 @@ static void init_tex( void ) exit(9); } - ctx->transfer_unmap(ctx, t); + ctx->texture_unmap(ctx, t); } memset(&sv_template, 0, sizeof sv_template); diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 23e642b47bd..7f9a6eeb982 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -319,7 +319,7 @@ static void init_tex( void ) { struct pipe_transfer *t; uint32_t *ptr; - ptr = pipe_transfer_map(ctx, samptex, + ptr = pipe_texture_map(ctx, samptex, 0, 0, /* level, layer */ PIPE_MAP_READ, 0, 0, SIZE, SIZE, &t); /* x, y, width, height */ @@ -329,7 +329,7 @@ static void init_tex( void ) exit(9); } - ctx->transfer_unmap(ctx, t); + ctx->texture_unmap(ctx, t); } memset(&sv_template, 0, sizeof sv_template); diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c index a1ca7f3c306..5c57b1e5f4c 100644 --- a/src/gallium/tests/trivial/compute.c +++ b/src/gallium/tests/trivial/compute.c @@ -204,7 +204,7 @@ static void init_tex(struct context *ctx, int slot, *tex = ctx->screen->resource_create(ctx->screen, &ttex); 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, .height = h, .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; } @@ -246,7 +246,7 @@ static void check_tex(struct context *ctx, int slot, if (!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, .height = tex->height0, .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) printf("(%d, %d): \x1b[31mFAIL\x1b[0m (%d)\n", x, y, err); diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index 79e9c39cab1..85c35a45bdd 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -177,12 +177,12 @@ static void init_prog(struct program *p) box.height = 2; 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[1] = 0xff0000ff; ptr[2] = 0xff00ff00; 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); diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 529d40d153a..a61a4458f28 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -105,7 +105,7 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride) struct pipe_transfer *tr; void *map; - map = pipe_transfer_map(pipe, tex, 0, 0, + map = pipe_texture_map(pipe, tex, 0, 0, PIPE_MAP_READ_WRITE, 0, 0, wdt->tex->width0, wdt->tex->height0, &tr); if (!map) @@ -114,7 +114,7 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride) *stride = tr->stride; wdt->stride = tr->stride; - pipe->transfer_unmap(pipe, tr); + pipe->texture_unmap(pipe, tr); return true; } @@ -221,7 +221,7 @@ wsw_dt_map(struct sw_winsys *ws, assert(!wdt->transfer); - ptr = pipe_transfer_map(pipe, tex, 0, 0, + ptr = pipe_texture_map(pipe, tex, 0, 0, PIPE_MAP_READ_WRITE, 0, 0, wdt->tex->width0, wdt->tex->height0, &tr); if (!ptr) @@ -239,7 +239,7 @@ wsw_dt_map(struct sw_winsys *ws, return wdt->ptr; err: - pipe->transfer_unmap(pipe, tr); + pipe->texture_unmap(pipe, tr); return NULL; } @@ -257,7 +257,7 @@ wsw_dt_unmap(struct sw_winsys *ws, if (wdt->map_count) return; - pipe->transfer_unmap(pipe, wdt->transfer); + pipe->texture_unmap(pipe, wdt->transfer); pipe->flush(pipe, NULL, 0); wdt->transfer = NULL; } diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index b198641b305..423310d7d04 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -54,7 +54,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt) uint *dest; uint i, j; - dest = (uint *) pipe_transfer_map(pipe, + dest = (uint *) pipe_texture_map(pipe, pt, 0, 0, PIPE_MAP_WRITE, 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); } /** diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 731616c8295..ffa6dcb3f07 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -143,7 +143,7 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height, return NULL; } - dest = pipe_transfer_map(st->pipe, pt, 0, 0, + dest = pipe_texture_map(st->pipe, pt, 0, 0, PIPE_MAP_WRITE, 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); /* Release transfer */ - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); return pt; } @@ -406,7 +406,7 @@ create_cache_trans(struct st_context *st) /* Map the texture transfer. * 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, BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, &cache->trans); @@ -442,7 +442,7 @@ st_flush_bitmap_cache(struct st_context *st) if (cache->trans && cache->buffer) { if (0) print_cache(cache); - pipe_transfer_unmap(pipe, cache->trans); + pipe_texture_unmap(pipe, cache->trans); cache->buffer = NULL; cache->trans = NULL; } @@ -810,7 +810,7 @@ st_destroy_bitmap(struct st_context *st) struct st_bitmap_cache *cache = &st->bitmap.cache; 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); } diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index aae732ea372..4909576292e 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -584,7 +584,7 @@ fallback_copy_image(struct st_context *st, dst_x, dst_y, dst_w, dst_h, GL_MAP_WRITE_BIT, &dst, &dst_stride); } 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, dst_x, dst_y, dst_w, dst_h, &dst_transfer); @@ -597,7 +597,7 @@ fallback_copy_image(struct st_context *st, src_x, src_y, src_w, src_h, GL_MAP_READ_BIT, &src, &src_stride); } 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, src_x, src_y, src_w, src_h, &src_transfer); @@ -613,13 +613,13 @@ fallback_copy_image(struct st_context *st, if (dst_image) { st->ctx->Driver.UnmapTextureImage(st->ctx, dst_image, dst_z); } else { - pipe_transfer_unmap(st->pipe, dst_transfer); + pipe_texture_unmap(st->pipe, dst_transfer); } if (src_image) { st->ctx->Driver.UnmapTextureImage(st->ctx, src_image, src_z); } else { - pipe_transfer_unmap(st->pipe, src_transfer); + pipe_texture_unmap(st->pipe, src_transfer); } } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index ad337e913ae..62ee6ad2a7e 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -669,7 +669,7 @@ make_texture(struct st_context *st, ctx->_ImageTransferState = 0x0; /* map texture transfer */ - dest = pipe_transfer_map(pipe, pt, 0, 0, + dest = pipe_texture_map(pipe, pt, 0, 0, PIPE_MAP_WRITE, 0, 0, width, height, &transfer); if (!dest) { @@ -715,7 +715,7 @@ make_texture(struct st_context *st, } /* unmap */ - pipe_transfer_unmap(pipe, transfer); + pipe_texture_unmap(pipe, transfer); /* restore */ ctx->_ImageTransferState = imageTransferStateSave; @@ -989,7 +989,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, 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.first_layer, usage, x, y, @@ -1120,7 +1120,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, _mesa_unmap_pbo_source(ctx, &clippedUnpack); /* 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); /* map the stencil buffer */ - drawMap = pipe_transfer_map(pipe, + drawMap = pipe_texture_map(pipe, rbDraw->texture, rbDraw->surface->u.tex.level, rbDraw->surface->u.tex.first_layer, @@ -1530,7 +1530,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, free(buffer); /* unmap the stencil buffer */ - pipe_transfer_unmap(pipe, ptDraw); + pipe_texture_unmap(pipe, ptDraw); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 18e1841b2de..50c9a4220e0 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -906,7 +906,7 @@ st_MapRenderbuffer(struct gl_context *ctx, else y2 = y; - map = pipe_transfer_map(pipe, + map = pipe_texture_map(pipe, strb->texture, strb->surface->u.tex.level, strb->surface->u.tex.first_layer, @@ -944,7 +944,7 @@ st_UnmapRenderbuffer(struct gl_context *ctx, return; } - pipe_transfer_unmap(pipe, strb->transfer); + pipe_texture_unmap(pipe, strb->transfer); strb->transfer = NULL; } diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 3811f6e1d23..72dc56dec1a 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -59,7 +59,7 @@ * blits (because the smaller blits cannot be batched, and we have to wait * 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 * _mesa_readpixels path as well when possible. * @@ -533,7 +533,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, /* map resources */ 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); if (!map) { _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); pipe_resource_reference(&dst, NULL); return; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3a4762d949a..36cf9a72729 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1737,7 +1737,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, 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); if (!map) { _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); /* Blit. */ @@ -2266,7 +2266,7 @@ st_GetTexSubImage(struct gl_context * ctx, 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); if (!map) { goto end; @@ -2346,7 +2346,7 @@ st_GetTexSubImage(struct gl_context * ctx, end: if (map) - pipe_transfer_unmap(pipe, tex_xfer); + pipe_texture_unmap(pipe, tex_xfer); _mesa_unmap_pbo_dest(ctx, &ctx->Pack); pipe_resource_reference(&dst, NULL); @@ -2394,7 +2394,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, srcY = strb->Base.Height - srcY - height; } - map = pipe_transfer_map(pipe, + map = pipe_texture_map(pipe, strb->texture, strb->surface->u.tex.level, strb->surface->u.tex.first_layer, @@ -2517,7 +2517,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, st_texture_image_unmap(st, stImage, slice); err: - pipe->transfer_unmap(pipe, src_trans); + pipe->texture_unmap(pipe, src_trans); } diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 1de2ce27a17..010730fb246 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -345,7 +345,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, sv_transfer[i][j] = NULL; mip_addr[j] = (uintptr_t) - pipe_transfer_map_3d(pipe, res, j, + pipe_texture_map_3d(pipe, res, j, PIPE_MAP_READ, 0, 0, view->u.tex.first_layer, 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); 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, img->u.tex.first_layer, 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++) { if (img_transfer[i]) { 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) { for (unsigned j = view->u.tex.first_level; j <= view->u.tex.last_level; j++) { - pipe_transfer_unmap(pipe, sv_transfer[i][j]); + pipe_texture_unmap(pipe, sv_transfer[i][j]); } } else { - pipe_transfer_unmap(pipe, sv_transfer[i][0]); + pipe_buffer_unmap(pipe, sv_transfer[i][0]); } } } diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index d63628fcd87..fbe5534690c 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -278,7 +278,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, 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); if (map) { /* 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__); - pipe_transfer_unmap(pipe, *transfer); + pipe_texture_unmap(pipe, *transfer); *transfer = NULL; } @@ -337,11 +337,11 @@ print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src) region.height = 1; region.depth = 1; - map = pipe->transfer_map(pipe, src, 0, PIPE_MAP_READ, ®ion, &xfer); + map = pipe->texture_map(pipe, src, 0, PIPE_MAP_READ, ®ion, &xfer); 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); }