virgl: remove an incorrect check in virgl_res_needs_flush
authorChia-I Wu <olvaffe@gmail.com>
Wed, 8 May 2019 21:53:47 +0000 (14:53 -0700)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 24 May 2019 17:37:40 +0000 (17:37 +0000)
commitea1e0acfd04826d196c81d75bc16cde8a623caff
treef2f3a999df7c03579ecb3df1658585e0bc9a38e7
parent56f9b60e50df82c3007264bf46a0d4c467688395
virgl: remove an incorrect check in virgl_res_needs_flush

Imagine this

  resource_copy_region(ctx, dst, ..., src, ...);
  transfer_map(ctx, src, 0, PIPE_TRANSFER_WRITE, ...);

at the beginning of a cmdbuf.  We need to flush in transfer_map so
that the transfer is not reordered before the resource copy.  The
check for "vctx->num_draws == 0 && vctx->num_compute == 0" is not
enough.  Removing the optimization entirely.

Because of the more precise resource tracking in the previous
commit, I hope the performance impact is minimized.  We will have to
go with perfect resource tracking, or attempt a more limited
optimization, if there are specific cases we really need to optimize
for.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
src/gallium/drivers/virgl/virgl_resource.c