Module: Mesa
Branch: master
Commit: 94f7c011d6e099f1c6e7cfce90b61700fbd9c1e2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94f7c011d6e099f1c6e7cfce90b61700fbd9c1e2

Author: Eric Anholt <[email protected]>
Date:   Tue Jun 19 16:00:15 2018 -0700

v3d: Track write reference to the separate stencil buffer.

Otherwise, a blit from separate stencil may fail to flush the job that
initialized it, or new drawing could fail to flush a blit reading from
stencil.

Fixes:
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_basic
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_scale
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_stencil_only
dEQP-GLES3.functional.fbo.msaa.2_samples.depth32f_stencil8
dEQP-GLES3.functional.fbo.msaa.4_samples.depth32f_stencil8

---

 src/gallium/drivers/v3d/v3d_job.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/v3d/v3d_job.c 
b/src/gallium/drivers/v3d/v3d_job.c
index 7be568d623..a5c990d290 100644
--- a/src/gallium/drivers/v3d/v3d_job.c
+++ b/src/gallium/drivers/v3d/v3d_job.c
@@ -73,6 +73,11 @@ v3d_job_free(struct v3d_context *v3d, struct v3d_job *job)
                 }
         }
         if (job->zsbuf) {
+                struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
+                if (rsc->separate_stencil)
+                        remove_from_ht(v3d->write_jobs,
+                                       &rsc->separate_stencil->base);
+
                 remove_from_ht(v3d->write_jobs, job->zsbuf->texture);
                 pipe_surface_reference(&job->zsbuf, NULL);
         }
@@ -274,9 +279,19 @@ v3d_get_job(struct v3d_context *v3d,
                         _mesa_hash_table_insert(v3d->write_jobs,
                                                 cbufs[i]->texture, job);
         }
-        if (zsbuf)
+        if (zsbuf) {
                 _mesa_hash_table_insert(v3d->write_jobs, zsbuf->texture, job);
 
+                struct v3d_resource *rsc = v3d_resource(zsbuf->texture);
+                if (rsc->separate_stencil) {
+                        v3d_flush_jobs_reading_resource(v3d,
+                                                        
&rsc->separate_stencil->base);
+                        _mesa_hash_table_insert(v3d->write_jobs,
+                                                &rsc->separate_stencil->base,
+                                                job);
+                }
+        }
+
         memcpy(&job->key, &local_key, sizeof(local_key));
         _mesa_hash_table_insert(v3d->jobs, &job->key, job);
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to