anv: Fix calculation of syncs required in Xe KMD
num_syncs was being incremented by one if 'utrace_submit != NULL' but a sync was only being set if also 'util_dynarray_num_elements(&utrace_submit->batch_bos) == 0'. This mismatch could cause application to abort due to 'assert(count == num_syncs)'. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27244>
This commit is contained in:

committed by
Marge Bot

parent
38e92556a0
commit
d5ec2fa52f
@@ -114,9 +114,15 @@ xe_exec_process_syncs(struct anv_queue *queue,
|
|||||||
struct drm_xe_sync **ret, uint32_t *ret_count)
|
struct drm_xe_sync **ret, uint32_t *ret_count)
|
||||||
{
|
{
|
||||||
struct anv_device *device = queue->device;
|
struct anv_device *device = queue->device;
|
||||||
uint32_t num_syncs = wait_count + signal_count + extra_sync_count +
|
/* Signal the utrace sync only if it doesn't have a batch. Otherwise the
|
||||||
(utrace_submit ? 1 : 0) +
|
* it's the utrace batch that should signal its own sync.
|
||||||
((queue->sync && !is_companion_rcs_queue) ? 1 : 0);
|
*/
|
||||||
|
const bool has_utrace_sync = utrace_submit &&
|
||||||
|
util_dynarray_num_elements(&utrace_submit->batch_bos, struct anv_bo *) == 0;
|
||||||
|
const uint32_t num_syncs = wait_count + signal_count + extra_sync_count +
|
||||||
|
(has_utrace_sync ? 1 : 0) +
|
||||||
|
((queue->sync && !is_companion_rcs_queue) ? 1 : 0);
|
||||||
|
|
||||||
if (!num_syncs)
|
if (!num_syncs)
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
|
||||||
@@ -128,12 +134,7 @@ xe_exec_process_syncs(struct anv_queue *queue,
|
|||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
/* Signal the utrace sync only if it doesn't have a batch. Otherwise the
|
if (has_utrace_sync) {
|
||||||
* it's the utrace batch that should signal its own sync.
|
|
||||||
*/
|
|
||||||
if (utrace_submit &&
|
|
||||||
util_dynarray_num_elements(&utrace_submit->batch_bos,
|
|
||||||
struct anv_bo *) == 0) {
|
|
||||||
struct drm_xe_sync *xe_sync = &xe_syncs[count++];
|
struct drm_xe_sync *xe_sync = &xe_syncs[count++];
|
||||||
|
|
||||||
xe_exec_fill_sync(xe_sync, utrace_submit->sync, 0, TYPE_SIGNAL);
|
xe_exec_fill_sync(xe_sync, utrace_submit->sync, 0, TYPE_SIGNAL);
|
||||||
|
Reference in New Issue
Block a user