Re: [Mesa-dev] [PATCH v2] panfrost: Remove panfrost_context.depth_stencil_buffer

2019-07-10 Thread Alyssa Rosenzweig
A step in the right direction, but not totally right I don't think.

> +struct pipe_surface *surf = ctx->pipe_framebuffer.zsbuf;
> +struct panfrost_resource *rsrc = pan_resource(surf->texture);
> +sfbd->depth_buffer = rsrc->bo->gpu;

Critically, ctx->pipe_framebuffer is an arbitrary pipe_surface bound as
an FBO (whether that's scanout or not is irrelevant right now). It may
or may not havea  zsbuf defined; it's perfectly valid for no Z/S buffer
to be defined in which case zsbuf is NULL and this code crashes due to a
NULL poinnter dereference in the next line.

The right way to do it is hoist all of this logic into a dedicated SFBD
Z/S setup function. See the corresponding MFBD code for inspiration on
how the setup for colour buffers and Z/S buffers are cleanly separated.


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2] panfrost: Remove panfrost_context.depth_stencil_buffer

2019-07-10 Thread Tomeu Vizoso
This was stale code that was causing a SIGSEGV when using SFBD, as we
stopped creating the corresponding BO.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.h | 1 -
 src/gallium/drivers/panfrost/pan_sfbd.c| 8 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.h 
b/src/gallium/drivers/panfrost/pan_context.h
index a913c8581ef5..b26abea369d3 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -134,7 +134,6 @@ struct panfrost_context {
 struct panfrost_memory varying_mem;
 struct panfrost_memory tiler_polygon_list;
 struct panfrost_memory tiler_dummy;
-struct panfrost_memory depth_stencil_buffer;
 
 struct panfrost_query *occlusion_query;
 
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c 
b/src/gallium/drivers/panfrost/pan_sfbd.c
index 76267b746ac0..b8c314d222f0 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -55,14 +55,18 @@ panfrost_sfbd_clear(
 sfbd->clear_depth_3 = job->clear_depth;
 sfbd->clear_depth_4 = job->clear_depth;
 
-sfbd->depth_buffer = ctx->depth_stencil_buffer.bo->gpu;
+struct pipe_surface *surf = ctx->pipe_framebuffer.zsbuf;
+struct panfrost_resource *rsrc = pan_resource(surf->texture);
+sfbd->depth_buffer = rsrc->bo->gpu;
 sfbd->depth_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
 if (job->clear & PIPE_CLEAR_STENCIL) {
 sfbd->clear_stencil = job->clear_stencil;
 
-sfbd->stencil_buffer = ctx->depth_stencil_buffer.bo->gpu;
+struct pipe_surface *surf = ctx->pipe_framebuffer.zsbuf;
+struct panfrost_resource *rsrc = pan_resource(surf->texture);
+sfbd->stencil_buffer = rsrc->bo->gpu;
 sfbd->stencil_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev