From 89eaf5909259ba6b80bab6ce4ab3fe2ab51c5286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 5 May 2021 12:55:29 -0400 Subject: [PATCH] gallium: remove transfer_flush_region from u_resource_vtbl It's only used by buffers and only zink uses it privately for textures too. This is part of removing u_resource_vtbl. Reviewed-By: Mike Blumenkrantz Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/util/u_transfer.c | 8 -------- src/gallium/auxiliary/util/u_transfer.h | 9 --------- src/gallium/drivers/i915/i915_resource.c | 2 +- src/gallium/drivers/i915/i915_resource_buffer.c | 1 - src/gallium/drivers/i915/i915_resource_texture.c | 1 - src/gallium/drivers/nouveau/nouveau_buffer.c | 4 +--- src/gallium/drivers/nouveau/nouveau_buffer.h | 5 +++++ src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 1 - src/gallium/drivers/nouveau/nv30/nv30_resource.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 1 - src/gallium/drivers/nouveau/nv50/nv50_resource.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 1 - src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 2 +- src/gallium/drivers/r300/r300_screen_buffer.c | 1 - src/gallium/drivers/r300/r300_texture.c | 1 - src/gallium/drivers/r600/evergreen_compute.c | 9 +-------- src/gallium/drivers/r600/r600_buffer_common.c | 11 +++++++---- src/gallium/drivers/r600/r600_pipe_common.c | 2 +- src/gallium/drivers/r600/r600_pipe_common.h | 4 ++++ src/gallium/drivers/r600/r600_texture.c | 1 - src/gallium/drivers/radeonsi/si_buffer.c | 3 +-- src/gallium/drivers/radeonsi/si_texture.c | 2 -- src/gallium/drivers/svga/svga_resource.c | 2 +- src/gallium/drivers/svga/svga_resource_buffer.c | 3 +-- src/gallium/drivers/svga/svga_resource_buffer.h | 5 +++++ src/gallium/drivers/svga/svga_resource_texture.c | 1 - src/gallium/drivers/virgl/virgl_buffer.c | 7 +++---- src/gallium/drivers/virgl/virgl_resource.c | 2 +- src/gallium/drivers/virgl/virgl_resource.h | 4 ++++ src/gallium/drivers/virgl/virgl_texture.c | 1 - 30 files changed, 39 insertions(+), 59 deletions(-) diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index 7e2ff89bed1..9d080e82638 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -117,14 +117,6 @@ void *u_transfer_map_vtbl(struct pipe_context *context, transfer); } -void u_transfer_flush_region_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_flush_region(pipe, transfer, box); -} - void u_transfer_unmap_vtbl( struct pipe_context *pipe, struct pipe_transfer *transfer ) { diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 562a501aa3d..359c75b44f2 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -46,11 +46,6 @@ struct u_resource_vtbl { const struct pipe_box *, struct pipe_transfer **); - - void (*transfer_flush_region)( struct pipe_context *, - struct pipe_transfer *transfer, - const struct pipe_box *); - void (*transfer_unmap)( struct pipe_context *, struct pipe_transfer *transfer ); }; @@ -72,10 +67,6 @@ void *u_transfer_map_vtbl(struct pipe_context *context, const struct pipe_box *box, struct pipe_transfer **transfer); -void u_transfer_flush_region_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer, - const struct pipe_box *box); - void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx, struct pipe_transfer *transfer ); diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index fa856d02793..21746dcf9de 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -37,7 +37,7 @@ void i915_init_resource_functions(struct i915_context *i915 ) { i915->base.transfer_map = u_transfer_map_vtbl; - i915->base.transfer_flush_region = u_transfer_flush_region_vtbl; + i915->base.transfer_flush_region = u_default_transfer_flush_region; i915->base.transfer_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/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 7cc9cab0a48..69d2f8c826a 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -99,7 +99,6 @@ struct u_resource_vtbl i915_buffer_vtbl = { i915_buffer_destroy, /* resource_destroy */ i915_buffer_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ i915_buffer_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 492d36d951b..5bcd2cc1362 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -915,7 +915,6 @@ struct u_resource_vtbl i915_texture_vtbl = { i915_texture_destroy, /* resource_destroy */ i915_texture_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ i915_texture_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index f8246766430..92d37657393 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -506,7 +506,7 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, -static void +void nouveau_buffer_transfer_flush_region(struct pipe_context *pipe, struct pipe_transfer *transfer, const struct pipe_box *box) @@ -632,7 +632,6 @@ const struct u_resource_vtbl nouveau_buffer_vtbl = { nouveau_buffer_destroy, /* resource_destroy */ nouveau_buffer_transfer_map, /* transfer_map */ - nouveau_buffer_transfer_flush_region, /* transfer_flush_region */ nouveau_buffer_transfer_unmap, /* transfer_unmap */ }; @@ -671,7 +670,6 @@ const struct u_resource_vtbl nouveau_user_ptr_buffer_vtbl = { nouveau_user_ptr_destroy, /* resource_destroy */ nouveau_user_ptr_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ nouveau_user_ptr_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.h b/src/gallium/drivers/nouveau/nouveau_buffer.h index b43db81d298..4157c69da4f 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.h +++ b/src/gallium/drivers/nouveau/nouveau_buffer.h @@ -71,6 +71,11 @@ void * nouveau_resource_map_offset(struct nouveau_context *, struct nv04_resource *, uint32_t offset, uint32_t flags); +void +nouveau_buffer_transfer_flush_region(struct pipe_context *pipe, + struct pipe_transfer *transfer, + const struct pipe_box *box); + static inline void nouveau_resource_unmap(struct nv04_resource *res) { diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c index d26b5973d60..ae93241b4ea 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c @@ -405,7 +405,6 @@ nv30_miptree_transfer_unmap(struct pipe_context *pipe, const struct u_resource_vtbl nv30_miptree_vtbl = { nv30_miptree_destroy, nv30_miptree_transfer_map, - u_default_transfer_flush_region, nv30_miptree_transfer_unmap, }; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index a392e8586f6..ff185965655 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -84,7 +84,7 @@ void nv30_resource_init(struct pipe_context *pipe) { pipe->transfer_map = u_transfer_map_vtbl; - pipe->transfer_flush_region = u_transfer_flush_region_vtbl; + pipe->transfer_flush_region = nouveau_buffer_transfer_flush_region; pipe->transfer_unmap = u_transfer_unmap_vtbl; pipe->buffer_subdata = u_default_buffer_subdata; pipe->texture_subdata = u_default_texture_subdata; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c index 73c10ed20b5..9155849f8b5 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c @@ -206,7 +206,6 @@ const struct u_resource_vtbl nv50_miptree_vtbl = { nv50_miptree_destroy, /* resource_destroy */ nv50_miptree_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ nv50_miptree_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/src/gallium/drivers/nouveau/nv50/nv50_resource.c index 62f38e4a6d8..79d48aefedb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_resource.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.c @@ -95,7 +95,7 @@ void nv50_init_resource_functions(struct pipe_context *pcontext) { pcontext->transfer_map = u_transfer_map_vtbl; - pcontext->transfer_flush_region = u_transfer_flush_region_vtbl; + pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region; pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->buffer_subdata = u_default_buffer_subdata; pcontext->texture_subdata = u_default_texture_subdata; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c index 54efbd75df5..cf6290eeda0 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c @@ -440,7 +440,6 @@ const struct u_resource_vtbl nvc0_miptree_vtbl = { nv50_miptree_destroy, /* resource_destroy */ nvc0_miptree_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ nvc0_miptree_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c index ab4aac8a9c7..27c7ee29162 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c @@ -146,7 +146,7 @@ void nvc0_init_resource_functions(struct pipe_context *pcontext) { pcontext->transfer_map = u_transfer_map_vtbl; - pcontext->transfer_flush_region = u_transfer_flush_region_vtbl; + pcontext->transfer_flush_region = nouveau_buffer_transfer_flush_region; pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->buffer_subdata = u_default_buffer_subdata; pcontext->texture_subdata = u_default_texture_subdata; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 93f8e53253a..079e55d3942 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -150,7 +150,6 @@ static const struct u_resource_vtbl r300_buffer_vtbl = { r300_buffer_destroy, /* resource_destroy */ r300_buffer_transfer_map, /* transfer_map */ - NULL, /* transfer_flush_region */ r300_buffer_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 8e7dccfc980..5d86be42762 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -1061,7 +1061,6 @@ static const struct u_resource_vtbl r300_texture_vtbl = { r300_texture_destroy, /* resource_destroy */ r300_texture_transfer_map, /* transfer_map */ - NULL, /* transfer_flush_region */ r300_texture_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index d0d21dba310..104f0fe5477 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -1297,13 +1297,6 @@ static void r600_compute_global_transfer_unmap(struct pipe_context *ctx, assert (!"This function should not be called"); } -static void r600_compute_global_transfer_flush_region(struct pipe_context *ctx, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - assert(0 && "TODO"); -} - static void r600_compute_global_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *res) { @@ -1326,7 +1319,6 @@ static const struct u_resource_vtbl r600_global_buffer_vtbl = { r600_compute_global_buffer_destroy, /* resource_destroy */ r600_compute_global_transfer_map, /* transfer_map */ - r600_compute_global_transfer_flush_region,/* transfer_flush_region */ r600_compute_global_transfer_unmap, /* transfer_unmap */ }; @@ -1354,6 +1346,7 @@ struct pipe_resource *r600_compute_global_buffer_create(struct pipe_screen *scre result->base.b.vtbl = &r600_global_buffer_vtbl; result->base.b.b = *templ; result->base.b.b.screen = screen; + result->base.compute_global_bo = true; pipe_reference_init(&result->base.b.b.reference, 1); size_in_dw = (templ->width0+3) / 4; diff --git a/src/gallium/drivers/r600/r600_buffer_common.c b/src/gallium/drivers/r600/r600_buffer_common.c index b082d28df24..70fa6cd2148 100644 --- a/src/gallium/drivers/r600/r600_buffer_common.c +++ b/src/gallium/drivers/r600/r600_buffer_common.c @@ -502,13 +502,16 @@ static void r600_buffer_do_flush_region(struct pipe_context *ctx, box->x + box->width); } -static void r600_buffer_flush_region(struct pipe_context *ctx, - struct pipe_transfer *transfer, - const struct pipe_box *rel_box) +void r600_buffer_flush_region(struct pipe_context *ctx, + struct pipe_transfer *transfer, + const struct pipe_box *rel_box) { unsigned required_usage = PIPE_MAP_WRITE | PIPE_MAP_FLUSH_EXPLICIT; + if (r600_resource(transfer->resource)->compute_global_bo) + return; + if ((transfer->usage & required_usage) == required_usage) { struct pipe_box box; @@ -563,7 +566,6 @@ static const struct u_resource_vtbl r600_buffer_vtbl = { r600_buffer_destroy, /* resource_destroy */ r600_buffer_transfer_map, /* transfer_map */ - r600_buffer_flush_region, /* transfer_flush_region */ r600_buffer_transfer_unmap, /* transfer_unmap */ }; @@ -586,6 +588,7 @@ r600_alloc_buffer_struct(struct pipe_screen *screen, rbuffer->buf = NULL; rbuffer->bind_history = 0; rbuffer->immed_buffer = NULL; + rbuffer->compute_global_bo = false; util_range_init(&rbuffer->valid_buffer_range); return rbuffer; } diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 68430748e13..ab232e29dd3 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -590,7 +590,7 @@ 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.transfer_flush_region = u_transfer_flush_region_vtbl; + rctx->b.transfer_flush_region = r600_buffer_flush_region; rctx->b.transfer_unmap = u_transfer_unmap_vtbl; rctx->b.texture_subdata = u_default_texture_subdata; rctx->b.flush = r600_flush_from_st; diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h index 91c92dad50e..f50beb4028f 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.h +++ b/src/gallium/drivers/r600/r600_pipe_common.h @@ -167,6 +167,7 @@ struct r600_resource { /* Whether this resource is referenced by bindless handles. */ bool texture_handle_allocated; bool image_handle_allocated; + bool compute_global_bo; /* * EG/Cayman only - for RAT operations hw need an immediate buffer @@ -640,6 +641,9 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen, uint64_t size, unsigned alignment); bool r600_alloc_resource(struct r600_common_screen *rscreen, struct r600_resource *res); +void r600_buffer_flush_region(struct pipe_context *ctx, + struct pipe_transfer *transfer, + const struct pipe_box *rel_box); struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ, unsigned alignment); diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 745e1c5a183..ffd6ecd0ad0 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -1523,7 +1523,6 @@ static const struct u_resource_vtbl r600_texture_vtbl = { r600_texture_destroy, /* resource_destroy */ r600_texture_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ r600_texture_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c index b53aa3d1054..d64debe10b1 100644 --- a/src/gallium/drivers/radeonsi/si_buffer.c +++ b/src/gallium/drivers/radeonsi/si_buffer.c @@ -553,7 +553,6 @@ static void si_buffer_subdata(struct pipe_context *ctx, struct pipe_resource *bu static const struct u_resource_vtbl si_buffer_vtbl = { si_buffer_destroy, /* resource_destroy */ si_buffer_transfer_map, /* transfer_map */ - si_buffer_flush_region, /* transfer_flush_region */ si_buffer_transfer_unmap, /* transfer_unmap */ }; @@ -730,7 +729,7 @@ 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.transfer_flush_region = u_transfer_flush_region_vtbl; + sctx->b.transfer_flush_region = si_buffer_flush_region; sctx->b.transfer_unmap = u_transfer_unmap_vtbl; sctx->b.texture_subdata = u_default_texture_subdata; sctx->b.buffer_subdata = si_buffer_subdata; diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 16ee3c121a0..3a6b9caf64c 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1476,7 +1476,6 @@ static void si_auxiliary_texture_destroy(struct pipe_screen *screen, static const struct u_resource_vtbl si_auxiliary_texture_vtbl = { si_auxiliary_texture_destroy, /* resource_destroy */ NULL, /* transfer_map */ - NULL, /* transfer_flush_region */ NULL, /* transfer_unmap */ }; @@ -1963,7 +1962,6 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_tran static const struct u_resource_vtbl si_texture_vtbl = { si_texture_destroy, /* resource_destroy */ si_texture_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ si_texture_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index 942f2019c77..aeb9e05e20b 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -121,7 +121,7 @@ void svga_init_resource_functions(struct svga_context *svga) { svga->pipe.transfer_map = u_transfer_map_vtbl; - svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl; + svga->pipe.transfer_flush_region = svga_buffer_transfer_flush_region; svga->pipe.transfer_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/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index e04896eba20..d8fa7f72794 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -305,7 +305,7 @@ done: } -static void +void svga_buffer_transfer_flush_region(struct pipe_context *pipe, struct pipe_transfer *transfer, const struct pipe_box *box) @@ -426,7 +426,6 @@ struct u_resource_vtbl svga_buffer_vtbl = { svga_buffer_destroy, /* resource_destroy */ svga_buffer_transfer_map, /* transfer_map */ - svga_buffer_transfer_flush_region, /* transfer_flush_region */ svga_buffer_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h index 131b2ebf940..38d7da30097 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.h +++ b/src/gallium/drivers/svga/svga_resource_buffer.h @@ -373,4 +373,9 @@ svga_winsys_buffer_create(struct svga_context *svga, unsigned usage, unsigned size); +void +svga_buffer_transfer_flush_region(struct pipe_context *pipe, + struct pipe_transfer *transfer, + const struct pipe_box *box); + #endif /* SVGA_BUFFER_H */ diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index b1f4d4f4099..a0bb422ce08 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -879,7 +879,6 @@ struct u_resource_vtbl svga_texture_vtbl = { svga_texture_destroy, /* resource_destroy */ svga_texture_transfer_map, /* transfer_map */ - u_default_transfer_flush_region, /* transfer_flush_region */ svga_texture_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index eefee7cc55a..4d7a0d5f6cb 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -58,9 +58,9 @@ static void virgl_buffer_transfer_unmap(struct pipe_context *ctx, virgl_resource_destroy_transfer(vctx, trans); } -static void virgl_buffer_transfer_flush_region(struct pipe_context *ctx, - struct pipe_transfer *transfer, - const struct pipe_box *box) +void virgl_buffer_transfer_flush_region(struct pipe_context *ctx, + struct pipe_transfer *transfer, + const struct pipe_box *box) { struct virgl_transfer *trans = virgl_transfer(transfer); @@ -80,7 +80,6 @@ static const struct u_resource_vtbl virgl_buffer_vtbl = { virgl_resource_destroy, /* resource_destroy */ virgl_resource_transfer_map, /* transfer_map */ - virgl_buffer_transfer_flush_region, /* transfer_flush_region */ virgl_buffer_transfer_unmap, /* transfer_unmap */ }; diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 8bd66683f0e..abf1a89f979 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -673,7 +673,7 @@ 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->transfer_flush_region = u_transfer_flush_region_vtbl; + ctx->transfer_flush_region = virgl_buffer_transfer_flush_region; ctx->transfer_unmap = u_transfer_unmap_vtbl; ctx->buffer_subdata = virgl_buffer_subdata; ctx->texture_subdata = u_default_texture_subdata; diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h index 4f3f1d2e882..296724c1333 100644 --- a/src/gallium/drivers/virgl/virgl_resource.h +++ b/src/gallium/drivers/virgl/virgl_resource.h @@ -107,6 +107,10 @@ static inline struct virgl_transfer *virgl_transfer(struct pipe_transfer *trans) return (struct virgl_transfer *)trans; } +void virgl_buffer_transfer_flush_region(struct pipe_context *ctx, + struct pipe_transfer *transfer, + const struct pipe_box *box); + void virgl_buffer_init(struct virgl_resource *res); static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs, diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c index ceaa373f1b4..84f5d25dad5 100644 --- a/src/gallium/drivers/virgl/virgl_texture.c +++ b/src/gallium/drivers/virgl/virgl_texture.c @@ -306,7 +306,6 @@ static const struct u_resource_vtbl virgl_texture_vtbl = { virgl_resource_destroy, /* resource_destroy */ virgl_texture_transfer_map, /* transfer_map */ - NULL, /* transfer_flush_region */ virgl_texture_transfer_unmap, /* transfer_unmap */ };