iris: Check for cross-batch flushing whenever a buffer is newly written.
We need to perform cross-batch flushing if any batch writes to a BO
while others refer to it. We checked this case when recording a new
BO in the list which we'd never seen before. However, we neglected to
handle the case when we already read from a BO, but then began writing
to it. That new write may provoke a conflict between existing reads
in other batches, so we need to re-check the cross-batch flushing.
Caught by Piglit's copyteximage when forcing blits and copies to use
a new IRIS_BATCH_BLITTER that isn't upstream yet. But this bug could
be provoked by render/compute work today...we just hadn't noticed it.
Fixes: b21e916a62
("iris: Combine iris_use_pinned_bo and add_exec_bo")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13808>
This commit is contained in:
parent
76030964a6
commit
6e90984934
|
@ -302,8 +302,9 @@ flush_for_cross_batch_dependencies(struct iris_batch *batch,
|
|||
if (batch->measure && bo == batch->measure->bo)
|
||||
return;
|
||||
|
||||
/* This is the first time our batch has seen this BO. Before we use it,
|
||||
* we may need to flush and synchronize with other batches.
|
||||
/* When a batch uses a buffer for the first time, or newly writes a buffer
|
||||
* it had already referenced, we may need to flush other batches in order
|
||||
* to correctly synchronize them.
|
||||
*/
|
||||
for (int b = 0; b < ARRAY_SIZE(batch->other_batches); b++) {
|
||||
struct iris_batch *other_batch = batch->other_batches[b];
|
||||
|
@ -361,8 +362,10 @@ iris_use_pinned_bo(struct iris_batch *batch,
|
|||
|
||||
if (existing_index != -1) {
|
||||
/* The BO is already in the list; mark it writable */
|
||||
if (writable)
|
||||
if (writable && !BITSET_TEST(batch->bos_written, existing_index)) {
|
||||
BITSET_SET(batch->bos_written, existing_index);
|
||||
flush_for_cross_batch_dependencies(batch, bo, writable);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue