v3d: emit 'Wait for transform feedback' commands when needed
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 20 Jun 2019 10:14:17 +0000 (12:14 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 2 Jul 2019 06:57:20 +0000 (08:57 +0200)
commit88cbc4f7f6c01edd182bac0dcb2bd973d2cce5f2
treea621b8aeb4561874f24125d8b5cb80036990c98f
parentc7dff0e614c93c1c890851456477723d5fb22495
v3d: emit 'Wait for transform feedback' commands when needed

The hardware can flush transform feedback writes before reads in the same
job by inserting this command.

This patch detects when the rendering state for the current draw call reads
resources that had been previously written by transform feedback in the
same job and inserts the 'Wait for transform feedback' command before
emitting the new draw.

v2 (Eric):
  - this was intended to look at job->tf_write_prscs for TF jobs.
  - clear job->tf_write_prscs after we emit the TF flush.
  - can skip flushes for fragment shader reads from TF.

v3 (Eric):
  - all resources in job->tf_write_prscs are resources written by TF so
   we don't need to check if they are bound to PIPE_BIND_STREAM_OUTPUT.
  - documented optimization opportunity for geometry stages.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/v3d/v3dx_draw.c