From 078e129d543445b5855ce836d6b536d4133ba66c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 5 May 2021 11:37:30 -0400 Subject: [PATCH] gallium: remove resource_get_handle from u_resource_vtbl This is the initial step towards removing u_resource_vtbl. Reviewed-By: Mike Blumenkrantz Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/util/u_transfer.c | 20 -------------------- src/gallium/auxiliary/util/u_transfer.h | 15 --------------- src/gallium/drivers/i915/i915_resource.c | 2 +- src/gallium/drivers/i915/i915_resource.h | 7 +++++++ src/gallium/drivers/i915/i915_resource_buffer.c | 10 ---------- src/gallium/drivers/i915/i915_resource_texture.c | 14 +++++++++----- src/gallium/drivers/nouveau/nouveau_buffer.c | 2 -- src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 10 +++++++--- src/gallium/drivers/nouveau/nv30/nv30_resource.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_resource.h | 7 +++++++ src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 8 ++++++-- src/gallium/drivers/nouveau/nv50/nv50_resource.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_resource.h | 4 +++- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 9 +++++---- src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 7 +++++++ src/gallium/drivers/r300/r300_screen_buffer.c | 1 - src/gallium/drivers/r300/r300_texture.c | 1 - src/gallium/drivers/r600/evergreen_compute.c | 1 - src/gallium/drivers/r600/r600_buffer_common.c | 1 - src/gallium/drivers/r600/r600_texture.c | 1 - src/gallium/drivers/radeonsi/si_buffer.c | 1 - src/gallium/drivers/radeonsi/si_texture.c | 2 -- src/gallium/drivers/svga/svga_resource.c | 2 +- src/gallium/drivers/svga/svga_resource_buffer.c | 1 - src/gallium/drivers/svga/svga_resource_texture.c | 14 +++++++++----- src/gallium/drivers/svga/svga_resource_texture.h | 7 +++++++ src/gallium/drivers/virgl/virgl_buffer.c | 1 - src/gallium/drivers/virgl/virgl_resource.c | 6 ++++-- src/gallium/drivers/virgl/virgl_resource.h | 4 +++- src/gallium/drivers/virgl/virgl_texture.c | 1 - 31 files changed, 79 insertions(+), 86 deletions(-) diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index be08cb6..7e2ff89 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -84,16 +84,6 @@ void u_default_texture_subdata(struct pipe_context *pipe, pipe_transfer_unmap(pipe, transfer); } - -bool u_default_resource_get_handle(UNUSED struct pipe_screen *screen, - UNUSED struct pipe_resource *resource, - UNUSED struct winsys_handle *handle) -{ - return FALSE; -} - - - void u_default_transfer_flush_region(UNUSED struct pipe_context *pipe, UNUSED struct pipe_transfer *transfer, UNUSED const struct pipe_box *box) @@ -108,16 +98,6 @@ u_resource( struct pipe_resource *res ) return (struct u_resource *)res; } -bool u_resource_get_handle_vtbl(struct pipe_screen *screen, - UNUSED struct pipe_context *ctx, - struct pipe_resource *resource, - struct winsys_handle *handle, - UNUSED unsigned usage) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->resource_get_handle(screen, resource, handle); -} - void u_resource_destroy_vtbl(struct pipe_screen *screen, struct pipe_resource *resource) { diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 94cf545..562a501 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -14,10 +14,6 @@ struct winsys_handle; extern "C" { #endif -bool u_default_resource_get_handle(struct pipe_screen *screen, - struct pipe_resource *resource, - struct winsys_handle *handle); - void u_default_buffer_subdata(struct pipe_context *pipe, struct pipe_resource *resource, unsigned usage, unsigned offset, @@ -40,11 +36,6 @@ void u_default_transfer_flush_region( struct pipe_context *pipe, * to exist in a single driver. This is intended to be transitionary! */ struct u_resource_vtbl { - - bool (*resource_get_handle)(struct pipe_screen *, - struct pipe_resource *tex, - struct winsys_handle *handle); - void (*resource_destroy)(struct pipe_screen *, struct pipe_resource *pt); @@ -71,12 +62,6 @@ struct u_resource { }; -bool u_resource_get_handle_vtbl(struct pipe_screen *screen, - struct pipe_context *ctx, - struct pipe_resource *resource, - struct winsys_handle *handle, - unsigned usage); - void u_resource_destroy_vtbl(struct pipe_screen *screen, struct pipe_resource *resource); diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index 8e5572b..fa856d0 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -48,6 +48,6 @@ i915_init_screen_resource_functions(struct i915_screen *is) { is->base.resource_create = i915_resource_create; is->base.resource_from_handle = i915_resource_from_handle; - is->base.resource_get_handle = u_resource_get_handle_vtbl; + is->base.resource_get_handle = i915_resource_get_handle; is->base.resource_destroy = u_resource_destroy_vtbl; } diff --git a/src/gallium/drivers/i915/i915_resource.h b/src/gallium/drivers/i915/i915_resource.h index 0afd095..e45095d 100644 --- a/src/gallium/drivers/i915/i915_resource.h +++ b/src/gallium/drivers/i915/i915_resource.h @@ -113,6 +113,13 @@ i915_texture_create(struct pipe_screen *screen, const struct pipe_resource *template, boolean force_untiled); +bool +i915_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, + struct pipe_resource *texture, + struct winsys_handle *whandle, + unsigned usage); + struct pipe_resource * i915_texture_from_handle(struct pipe_screen * screen, const struct pipe_resource *template, diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 4b2e145..7cc9cab 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -40,15 +40,6 @@ #include "i915_resource.h" - -static bool -i915_buffer_get_handle(struct pipe_screen *screen, - struct pipe_resource *resource, - struct winsys_handle *handle) -{ - return FALSE; -} - static void i915_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *resource) @@ -106,7 +97,6 @@ i915_buffer_subdata(struct pipe_context *rm_ctx, struct u_resource_vtbl i915_buffer_vtbl = { - i915_buffer_get_handle, /* get_handle */ i915_buffer_destroy, /* resource_destroy */ i915_buffer_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index afc4237..492d36d 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -681,11 +681,16 @@ i945_texture_layout(struct i915_texture * tex) -static bool -i915_texture_get_handle(struct pipe_screen * screen, - struct pipe_resource *texture, - struct winsys_handle *whandle) +bool +i915_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, + struct pipe_resource *texture, + struct winsys_handle *whandle, + unsigned usage) { + if (texture->target == PIPE_BUFFER) + return false; + struct i915_screen *is = i915_screen(screen); struct i915_texture *tex = i915_texture(texture); struct i915_winsys *iws = is->iws; @@ -908,7 +913,6 @@ out: struct u_resource_vtbl i915_texture_vtbl = { - i915_texture_get_handle, /* get_handle */ i915_texture_destroy, /* resource_destroy */ i915_texture_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 5e289bd..f824676 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -630,7 +630,6 @@ nouveau_resource_map_offset(struct nouveau_context *nv, const struct u_resource_vtbl nouveau_buffer_vtbl = { - u_default_resource_get_handle, /* get_handle */ nouveau_buffer_destroy, /* resource_destroy */ nouveau_buffer_transfer_map, /* transfer_map */ nouveau_buffer_transfer_flush_region, /* transfer_flush_region */ @@ -670,7 +669,6 @@ nouveau_user_ptr_transfer_unmap(struct pipe_context *pipe, const struct u_resource_vtbl nouveau_user_ptr_buffer_vtbl = { - u_default_resource_get_handle, /* get_handle */ nouveau_user_ptr_destroy, /* resource_destroy */ nouveau_user_ptr_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c index 2cc069b..d26b597 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c @@ -46,11 +46,16 @@ layer_offset(struct pipe_resource *pt, unsigned level, unsigned layer) return lvl->offset + (layer * lvl->zslice_size); } -static bool +bool nv30_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, struct pipe_resource *pt, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { + if (pt->target == PIPE_BUFFER) + return false; + struct nv30_miptree *mt = nv30_miptree(pt); unsigned stride; @@ -398,7 +403,6 @@ nv30_miptree_transfer_unmap(struct pipe_context *pipe, } const struct u_resource_vtbl nv30_miptree_vtbl = { - nv30_miptree_get_handle, nv30_miptree_destroy, nv30_miptree_transfer_map, u_default_transfer_flush_region, diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index 85625cc..a392e85 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -76,7 +76,7 @@ nv30_resource_screen_init(struct pipe_screen *pscreen) { pscreen->resource_create = nv30_resource_create; pscreen->resource_from_handle = nv30_resource_from_handle; - pscreen->resource_get_handle = u_resource_get_handle_vtbl; + pscreen->resource_get_handle = nv30_miptree_get_handle; pscreen->resource_destroy = u_resource_destroy_vtbl; } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.h b/src/gallium/drivers/nouveau/nv30/nv30_resource.h index 20d86b6..c04e999 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.h +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.h @@ -58,6 +58,13 @@ nv30_miptree_surface_new(struct pipe_context *, struct pipe_resource *, void nv30_miptree_surface_del(struct pipe_context *, struct pipe_surface *); +bool +nv30_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, + struct pipe_resource *pt, + struct winsys_handle *handle, + unsigned usage); + void nv30_resource_copy_region(struct pipe_context *pipe, struct pipe_resource *dst, unsigned dst_level, diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c index 64f139f..73c10ed 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c @@ -180,9 +180,14 @@ nv50_miptree_destroy(struct pipe_screen *pscreen, struct pipe_resource *pt) bool nv50_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, struct pipe_resource *pt, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { + if (pt->target == PIPE_BUFFER) + return false; + struct nv50_miptree *mt = nv50_miptree(pt); unsigned stride; @@ -199,7 +204,6 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen, const struct u_resource_vtbl nv50_miptree_vtbl = { - nv50_miptree_get_handle, /* get_handle */ nv50_miptree_destroy, /* resource_destroy */ nv50_miptree_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/src/gallium/drivers/nouveau/nv50/nv50_resource.c index e26f10d..62f38e4 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_resource.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.c @@ -109,6 +109,6 @@ nv50_screen_init_resource_functions(struct pipe_screen *pscreen) { pscreen->resource_create = nv50_resource_create; pscreen->resource_from_handle = nv50_resource_from_handle; - pscreen->resource_get_handle = u_resource_get_handle_vtbl; + pscreen->resource_get_handle = nv50_miptree_get_handle; pscreen->resource_destroy = u_resource_destroy_vtbl; } diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.h b/src/gallium/drivers/nouveau/nv50/nv50_resource.h index f3ee8ae..e95884e 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_resource.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.h @@ -88,8 +88,10 @@ nv50_miptree_from_handle(struct pipe_screen *pscreen, bool nv50_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, struct pipe_resource *pt, - struct winsys_handle *whandle); + struct winsys_handle *whandle, + unsigned usage); struct nv50_surface { struct pipe_surface base; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c index 2baec1e..54efbd7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c @@ -339,15 +339,17 @@ nvc0_miptree_get_modifier(struct pipe_screen *pscreen, struct nv50_miptree *mt) NVC0_TILE_MODE_Y(config->nvc0.tile_mode)); } -static bool +bool nvc0_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, struct pipe_resource *pt, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct nv50_miptree *mt = nv50_miptree(pt); bool ret; - ret = nv50_miptree_get_handle(pscreen, pt, whandle); + ret = nv50_miptree_get_handle(pscreen, context, pt, whandle, usage); if (!ret) return ret; @@ -436,7 +438,6 @@ nvc0_miptree_select_best_modifier(struct pipe_screen *pscreen, const struct u_resource_vtbl nvc0_miptree_vtbl = { - nvc0_miptree_get_handle, /* get_handle */ nv50_miptree_destroy, /* resource_destroy */ nvc0_miptree_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c index b22bc41..ab4aac8 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c @@ -163,7 +163,7 @@ nvc0_screen_init_resource_functions(struct pipe_screen *pscreen) pscreen->query_dmabuf_modifiers = nvc0_query_dmabuf_modifiers; pscreen->is_dmabuf_modifier_supported = nvc0_is_dmabuf_modifier_supported; pscreen->resource_from_handle = nvc0_resource_from_handle; - pscreen->resource_get_handle = u_resource_get_handle_vtbl; + pscreen->resource_get_handle = nvc0_miptree_get_handle; pscreen->resource_destroy = u_resource_destroy_vtbl; pscreen->resource_from_user_memory = nvc0_resource_from_user_memory; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h index 73195f8..c507134 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h @@ -53,6 +53,13 @@ nvc0_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp, const uint64_t *modifiers, unsigned int count); +bool +nvc0_miptree_get_handle(struct pipe_screen *pscreen, + struct pipe_context *context, + struct pipe_resource *pt, + struct winsys_handle *whandle, + unsigned usage); + extern const struct u_resource_vtbl nvc0_miptree_vtbl; struct pipe_surface * diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 741c010..93f8e53 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -148,7 +148,6 @@ static void r300_buffer_transfer_unmap( struct pipe_context *pipe, static const struct u_resource_vtbl r300_buffer_vtbl = { - NULL, /* get_handle */ r300_buffer_destroy, /* resource_destroy */ r300_buffer_transfer_map, /* transfer_map */ NULL, /* transfer_flush_region */ diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index b04c349..8e7dccf 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -1059,7 +1059,6 @@ bool r300_resource_get_handle(struct pipe_screen* screen, static const struct u_resource_vtbl r300_texture_vtbl = { - NULL, /* get_handle */ r300_texture_destroy, /* resource_destroy */ r300_texture_transfer_map, /* transfer_map */ NULL, /* transfer_flush_region */ diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 0602a54..d0d21db 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -1324,7 +1324,6 @@ static void r600_compute_global_buffer_destroy(struct pipe_screen *screen, static const struct u_resource_vtbl r600_global_buffer_vtbl = { - u_default_resource_get_handle, /* get_handle */ r600_compute_global_buffer_destroy, /* resource_destroy */ r600_compute_global_transfer_map, /* transfer_map */ r600_compute_global_transfer_flush_region,/* transfer_flush_region */ diff --git a/src/gallium/drivers/r600/r600_buffer_common.c b/src/gallium/drivers/r600/r600_buffer_common.c index c390b2b..b082d28 100644 --- a/src/gallium/drivers/r600/r600_buffer_common.c +++ b/src/gallium/drivers/r600/r600_buffer_common.c @@ -561,7 +561,6 @@ void r600_buffer_subdata(struct pipe_context *ctx, static const struct u_resource_vtbl r600_buffer_vtbl = { - NULL, /* get_handle */ r600_buffer_destroy, /* resource_destroy */ r600_buffer_transfer_map, /* transfer_map */ r600_buffer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index c910bd0..745e1c5 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -1521,7 +1521,6 @@ static void r600_texture_transfer_unmap(struct pipe_context *ctx, static const struct u_resource_vtbl r600_texture_vtbl = { - NULL, /* get_handle */ r600_texture_destroy, /* resource_destroy */ r600_texture_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c index c05d61b..b53aa3d 100644 --- a/src/gallium/drivers/radeonsi/si_buffer.c +++ b/src/gallium/drivers/radeonsi/si_buffer.c @@ -551,7 +551,6 @@ static void si_buffer_subdata(struct pipe_context *ctx, struct pipe_resource *bu } static const struct u_resource_vtbl si_buffer_vtbl = { - NULL, /* get_handle */ si_buffer_destroy, /* resource_destroy */ si_buffer_transfer_map, /* transfer_map */ si_buffer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 9e13d81..16ee3c1 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1474,7 +1474,6 @@ static void si_auxiliary_texture_destroy(struct pipe_screen *screen, } static const struct u_resource_vtbl si_auxiliary_texture_vtbl = { - NULL, /* get_handle */ si_auxiliary_texture_destroy, /* resource_destroy */ NULL, /* transfer_map */ NULL, /* transfer_flush_region */ @@ -1962,7 +1961,6 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_tran } static const struct u_resource_vtbl si_texture_vtbl = { - NULL, /* get_handle */ si_texture_destroy, /* resource_destroy */ si_texture_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index 320d42d..942f201 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -138,7 +138,7 @@ svga_init_screen_resource_functions(struct svga_screen *is) { is->screen.resource_create = svga_resource_create; is->screen.resource_from_handle = svga_resource_from_handle; - is->screen.resource_get_handle = u_resource_get_handle_vtbl; + is->screen.resource_get_handle = svga_resource_get_handle; is->screen.resource_destroy = u_resource_destroy_vtbl; is->screen.can_create_resource = svga_can_create_resource; } diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index f36f0c8..e04896e 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -424,7 +424,6 @@ svga_buffer_destroy(struct pipe_screen *screen, struct u_resource_vtbl svga_buffer_vtbl = { - u_default_resource_get_handle, /* get_handle */ svga_buffer_destroy, /* resource_destroy */ svga_buffer_transfer_map, /* transfer_map */ svga_buffer_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 39ac45e..b1f4d4f 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -196,14 +196,19 @@ svga_transfer_dma(struct svga_context *svga, -static bool -svga_texture_get_handle(struct pipe_screen *screen, - struct pipe_resource *texture, - struct winsys_handle *whandle) +bool +svga_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, + struct pipe_resource *texture, + struct winsys_handle *whandle, + unsigned usage) { struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen); unsigned stride; + if (texture->target == PIPE_BUFFER) + return false; + assert(svga_texture(texture)->key.cachable == 0); svga_texture(texture)->key.cachable = 0; @@ -872,7 +877,6 @@ format_has_depth(enum pipe_format format) struct u_resource_vtbl svga_texture_vtbl = { - svga_texture_get_handle, /* get_handle */ svga_texture_destroy, /* resource_destroy */ svga_texture_transfer_map, /* transfer_map */ u_default_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/svga/svga_resource_texture.h b/src/gallium/drivers/svga/svga_resource_texture.h index 0c1bb8c..5178ce7 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.h +++ b/src/gallium/drivers/svga/svga_resource_texture.h @@ -282,6 +282,13 @@ struct pipe_resource * svga_texture_create(struct pipe_screen *screen, const struct pipe_resource *template); +bool +svga_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, + struct pipe_resource *texture, + struct winsys_handle *whandle, + unsigned usage); + struct pipe_resource * svga_texture_from_handle(struct pipe_screen * screen, const struct pipe_resource *template, diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 63bf078..eefee7c 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -78,7 +78,6 @@ static void virgl_buffer_transfer_flush_region(struct pipe_context *ctx, static const struct u_resource_vtbl virgl_buffer_vtbl = { - u_default_resource_get_handle, /* get_handle */ virgl_resource_destroy, /* resource_destroy */ virgl_resource_transfer_map, /* transfer_map */ virgl_buffer_transfer_flush_region, /* transfer_flush_region */ diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 4fc2eab..8bd6668 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -641,7 +641,7 @@ void virgl_init_screen_resource_functions(struct pipe_screen *screen) { screen->resource_create = virgl_resource_create; screen->resource_from_handle = virgl_resource_from_handle; - screen->resource_get_handle = u_resource_get_handle_vtbl; + screen->resource_get_handle = virgl_resource_get_handle; screen->resource_destroy = u_resource_destroy_vtbl; } @@ -772,8 +772,10 @@ void virgl_resource_destroy(struct pipe_screen *screen, } bool virgl_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, struct pipe_resource *resource, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct virgl_screen *vs = virgl_screen(screen); struct virgl_resource *res = virgl_resource(resource); diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h index 1107643..4f3f1d2 100644 --- a/src/gallium/drivers/virgl/virgl_resource.h +++ b/src/gallium/drivers/virgl/virgl_resource.h @@ -188,8 +188,10 @@ void virgl_resource_destroy(struct pipe_screen *screen, struct pipe_resource *resource); bool virgl_resource_get_handle(struct pipe_screen *screen, + struct pipe_context *context, struct pipe_resource *resource, - struct winsys_handle *whandle); + struct winsys_handle *whandle, + unsigned usage); void virgl_resource_dirty(struct virgl_resource *res, uint32_t level); diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c index 926cbe6..ceaa373 100644 --- a/src/gallium/drivers/virgl/virgl_texture.c +++ b/src/gallium/drivers/virgl/virgl_texture.c @@ -304,7 +304,6 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx, static const struct u_resource_vtbl virgl_texture_vtbl = { - virgl_resource_get_handle, /* get_handle */ virgl_resource_destroy, /* resource_destroy */ virgl_texture_transfer_map, /* transfer_map */ NULL, /* transfer_flush_region */ -- 2.7.4