panfrost: Fix NULL dereference adding cbuf to batch
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
This commit is contained in:
parent
7af037fc11
commit
03c2c0f0c4
|
@ -569,22 +569,27 @@ panfrost_batch_add_resource_bos(struct panfrost_batch *batch,
|
|||
panfrost_batch_add_bo(batch, rsrc->separate_stencil->bo, flags);
|
||||
}
|
||||
|
||||
/* Adds the BO backing surface to a batch if the surface is non-null */
|
||||
|
||||
static void
|
||||
panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
|
||||
panfrost_batch_add_surface(struct panfrost_batch *batch, struct pipe_surface *surf)
|
||||
{
|
||||
uint32_t flags = PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_WRITE |
|
||||
PAN_BO_ACCESS_VERTEX_TILER |
|
||||
PAN_BO_ACCESS_FRAGMENT;
|
||||
|
||||
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
|
||||
struct panfrost_resource *rsrc = pan_resource(batch->key.cbufs[i]->texture);
|
||||
if (surf) {
|
||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||
panfrost_batch_add_resource_bos(batch, rsrc, flags);
|
||||
}
|
||||
|
||||
if (batch->key.zsbuf) {
|
||||
struct panfrost_resource *rsrc = pan_resource(batch->key.zsbuf->texture);
|
||||
panfrost_batch_add_resource_bos(batch, rsrc, flags);
|
||||
}
|
||||
}
|
||||
static void
|
||||
panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
|
||||
{
|
||||
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i)
|
||||
panfrost_batch_add_surface(batch, batch->key.cbufs[i]);
|
||||
|
||||
panfrost_batch_add_surface(batch, batch->key.zsbuf);
|
||||
}
|
||||
|
||||
struct panfrost_bo *
|
||||
|
|
Loading…
Reference in New Issue