aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-12-21 17:17:22 -0500
committerEric Anholt <eric@anholt.net>2018-01-18 15:17:03 -0500
commitf61145f1a4bd7966aa0b15c5cd3950835b284f55 (patch)
tree64d739595e416db2ea78f4a86ffe00d0c2776889 /drivers
parent75f195f46f27a2524b249b95e6f241cd13c7e549 (diff)
drm/vc4: Flush the caches before the bin jobs, as well.
If the frame samples from a render target that was just written, its cache flush during the binning step may have occurred before the previous frame's RCL was completed. Flush the texture caches again before starting each RCL job to make sure that the sampling of the previous RCL's output is correct. Fixes flickering in the top left of 3DMMES Taiji. Signed-off-by: Eric Anholt <eric@anholt.net> Fixes: ca26d28bbaa3 ("drm/vc4: improve throughput by pipelining binning and rendering jobs") Link: https://patchwork.freedesktop.org/patch/msgid/20171221221722.23809-1-eric@anholt.net Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/vc4/vc4_gem.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 638540943c61..e3e868cdee79 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -436,6 +436,19 @@ vc4_flush_caches(struct drm_device *dev)
436 VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC)); 436 VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC));
437} 437}
438 438
439static void
440vc4_flush_texture_caches(struct drm_device *dev)
441{
442 struct vc4_dev *vc4 = to_vc4_dev(dev);
443
444 V3D_WRITE(V3D_L2CACTL,
445 V3D_L2CACTL_L2CCLR);
446
447 V3D_WRITE(V3D_SLCACTL,
448 VC4_SET_FIELD(0xf, V3D_SLCACTL_T1CC) |
449 VC4_SET_FIELD(0xf, V3D_SLCACTL_T0CC));
450}
451
439/* Sets the registers for the next job to be actually be executed in 452/* Sets the registers for the next job to be actually be executed in
440 * the hardware. 453 * the hardware.
441 * 454 *
@@ -474,6 +487,14 @@ vc4_submit_next_render_job(struct drm_device *dev)
474 if (!exec) 487 if (!exec)
475 return; 488 return;
476 489
490 /* A previous RCL may have written to one of our textures, and
491 * our full cache flush at bin time may have occurred before
492 * that RCL completed. Flush the texture cache now, but not
493 * the instructions or uniforms (since we don't write those
494 * from an RCL).
495 */
496 vc4_flush_texture_caches(dev);
497
477 submit_cl(dev, 1, exec->ct1ca, exec->ct1ea); 498 submit_cl(dev, 1, exec->ct1ca, exec->ct1ea);
478} 499}
479 500