anv/trtt: don't avoid the TR-TT submission when there is stuff to signal

When an application issues a sparse binding operation, it may be the
case that the state the app is setting is the state that is already
there. In that case, both n_l3l2_binds and n_l1_binds are zero, so the
batch doesn't contain anything and, since 0802bbd486, we just skip
the batch submission and return.

The problem is that skipping the batch submission and returning
ignores the synchronization: there may be syncobjs that we have to
wait and, more importantly, there may be syncobjs that we have to
signal.

This case is exercised by vkd3d-proton's test suite, but I'm not aware
of any other workload that triggers it. This commit only affects
Meteor Lake and older, as TR-TT is only the default behavior for the
platforms running i915.ko.

Testcase: vkd3d-proton/d3d12/test_sparse_buffer_memory_lifetime
Fixes: 0802bbd486 ("anv/trtt: don't submit empty batches when there are no binds to do")
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35078>
(cherry picked from commit d77b49eb0a)
This commit is contained in:
Paulo Zanoni 2025-05-20 12:06:26 -07:00 committed by Eric Engestrom
parent 25316916b1
commit 32c297e991
2 changed files with 3 additions and 2 deletions

View file

@ -2144,7 +2144,7 @@
"description": "anv/trtt: don't avoid the TR-TT submission when there is stuff to signal",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "0802bbd486415026ce98bbba97e2be012637db97",
"notes": null

View file

@ -820,7 +820,8 @@ anv_sparse_bind_trtt(struct anv_device *device,
/* This is not an error, the application is simply trying to reset state
* that was already there. */
if (n_l3l2_binds == 0 && n_l1_binds == 0)
if (n_l3l2_binds == 0 && n_l1_binds == 0 &&
sparse_submit->wait_count == 0 && sparse_submit->signal_count == 0)
goto out_dynarrays;
anv_genX(device->info, write_trtt_entries)(&submit->base,