[Mesa-dev] [PATCH] panfrost: Stub out separate stencil functions

Alyssa Rosenzweig alyssa at rosenzweig.io
Mon Feb 18 05:27:30 UTC 2019


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 <alyssa at rosenzweig.io>
---
 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 a38ab5e9928..0a00033780e 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -536,15 +536,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
@@ -557,7 +576,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 af92fa48ec9..8ebff16fac4 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -70,6 +70,8 @@ struct panfrost_resource {
 
         struct panfrost_bo *bo;
         struct renderonly_scanout *scanout;
+
+        struct panfrost_resource *separate_stencil;
 };
 
 static inline struct panfrost_resource *
-- 
2.20.1



More information about the mesa-dev mailing list