From fb3bbd0c1cc115d477ce13a8e0af1bba20624bda Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 15 Feb 2019 23:59:58 +0000 Subject: [PATCH] panfrost: Stub out separate stencil functions This is not yet functional, but it resolves a crash in various apps and provides a framework for further work. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_resource.c | 27 ++++++++++++++++++--- src/gallium/drivers/panfrost/pan_resource.h | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index ce603dfac92..f26f33db96b 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -527,15 +527,34 @@ panfrost_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *pr //fprintf(stderr, "TODO %s\n", __func__); } +static enum pipe_format +panfrost_resource_get_internal_format(struct pipe_resource *prsrc) +{ + return prsrc->format; +} + +static void +panfrost_resource_set_stencil(struct pipe_resource *prsrc, + struct pipe_resource *stencil) +{ + pan_resource(prsrc)->separate_stencil = pan_resource(stencil); +} + +static struct pipe_resource * +panfrost_resource_get_stencil(struct pipe_resource *prsrc) +{ + return &pan_resource(prsrc)->separate_stencil->base; +} + static const struct u_transfer_vtbl transfer_vtbl = { .resource_create = panfrost_resource_create, .resource_destroy = panfrost_resource_destroy, .transfer_map = panfrost_transfer_map, .transfer_unmap = panfrost_transfer_unmap, .transfer_flush_region = u_default_transfer_flush_region, - //.get_internal_format = panfrost_resource_get_internal_format, - //.set_stencil = panfrost_resource_set_stencil, - //.get_stencil = panfrost_resource_get_stencil, + .get_internal_format = panfrost_resource_get_internal_format, + .set_stencil = panfrost_resource_set_stencil, + .get_stencil = panfrost_resource_get_stencil, }; void @@ -548,7 +567,7 @@ panfrost_resource_screen_init(struct panfrost_screen *pscreen) pscreen->base.resource_from_handle = panfrost_resource_from_handle; pscreen->base.resource_get_handle = panfrost_resource_get_handle; pscreen->base.transfer_helper = u_transfer_helper_create(&transfer_vtbl, - true, true, + true, false, true, true); pb_slabs_init(&pscreen->slabs, diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h index dea2332dbfa..b0b5cc15a0c 100644 --- a/src/gallium/drivers/panfrost/pan_resource.h +++ b/src/gallium/drivers/panfrost/pan_resource.h @@ -76,6 +76,8 @@ struct panfrost_resource { struct panfrost_bo *bo; struct renderonly_scanout *scanout; + + struct panfrost_resource *separate_stencil; }; static inline struct panfrost_resource * -- 2.30.2