v3dv: Use errno when logging an error to stderr

When logging a failed IOCTL, an errno is more useful than the output of
`drmIoctl()`. When the IOCTL fails, the return is usually -1 and this
value isn't very useful. On the other hand, the errno can help us to
debug the reason why the IOCTL failed.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29067>
This commit is contained in:
Maíra Canal 2024-05-06 09:46:03 -03:00 committed by Marge Bot
parent e2b9c5a9e3
commit 56f7b0297e

View file

@ -47,7 +47,8 @@ kperfmon_create(struct v3dv_device *device,
DRM_IOCTL_V3D_PERFMON_CREATE,
&req);
if (ret)
fprintf(stderr, "Failed to create perfmon for query %d: %s\n", query, strerror(ret));
fprintf(stderr, "Failed to create perfmon for query %d: %s\n", query,
strerror(errno));
pool->queries[query].perf.kperfmon_ids[i] = req.id;
}
@ -73,7 +74,7 @@ kperfmon_destroy(struct v3dv_device *device,
if (ret) {
fprintf(stderr, "Failed to destroy perfmon %u: %s\n",
req.id, strerror(ret));
req.id, strerror(errno));
}
}
}
@ -654,7 +655,7 @@ write_performance_query_result(struct v3dv_device *device,
&req);
if (ret) {
fprintf(stderr, "failed to get perfmon values: %s\n", strerror(ret));
fprintf(stderr, "failed to get perfmon values: %s\n", strerror(errno));
return vk_error(device, VK_ERROR_DEVICE_LOST);
}
}