mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
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 <michael.blumenkrantz@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10659>
This commit is contained in:
parent
078e129d54
commit
89eaf59092
30 changed files with 39 additions and 59 deletions
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue