panfrost: Take into account off-screen FBOs
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 4 Jul 2019 07:59:30 +0000 (09:59 +0200)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 4 Jul 2019 08:48:09 +0000 (10:48 +0200)
In that case, ctx->pipe_framebuffer.cbufs[0] can be NULL.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 5375d009be18 ("panfrost: Pass referenced BOs to the SUBMIT ioctls")
src/gallium/drivers/panfrost/pan_drm.c

index 8de4f483435c36f962cabcbee8d329a1245511e8..b89f8e66a877b624c5e13ecbf37c7c41ff70ea6f 100644 (file)
@@ -238,7 +238,6 @@ panfrost_drm_submit_job(struct panfrost_context *ctx, u64 job_desc, int reqs)
 int
 panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool is_scanout)
 {
-        struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
        int ret;
 
         struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
@@ -256,9 +255,12 @@ panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool
         }
 
         if (job->first_tiler.gpu || job->clear) {
-                struct panfrost_resource *res = pan_resource(surf->texture);
-                assert(res->bo);
-                panfrost_job_add_bo(job, res->bo);
+                struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
+                if (surf) {
+                        struct panfrost_resource *res = pan_resource(surf->texture);
+                        assert(res->bo);
+                        panfrost_job_add_bo(job, res->bo);
+                }
                 ret = panfrost_drm_submit_job(ctx, panfrost_fragment_job(ctx, has_draws), PANFROST_JD_REQ_FS);
                 assert(!ret);
         }