nak/bindings: Use an enum for IOCTL numbers

This should be more robust against weird bindgen shenanigans because it
forces LLVM to constant-fold and give us an actual thing we can generate
bindings for.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12008
Fixes: cd7128c2e3 ("nak: Add a bare HW shader runner")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31727>
This commit is contained in:
Faith Ekstrand
2024-10-17 18:26:38 -05:00
committed by Marge Bot
parent b88bcacf2b
commit aee0ce980b
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -190,7 +190,7 @@ impl<'a> Runner {
};
let err = drmIoctl(
self.dev.as_ref().fd,
DRM_RS_IOCTL_NOUVEAU_EXEC,
DRM_RS_IOCTL_NOUVEAU_EXEC.into(),
&exec as *const _ as *mut std::os::raw::c_void,
);
if err != 0 {
@@ -226,7 +226,7 @@ impl<'a> Runner {
};
let err = drmIoctl(
self.dev.as_ref().fd,
DRM_RS_IOCTL_NOUVEAU_EXEC,
DRM_RS_IOCTL_NOUVEAU_EXEC.into(),
ptr::from_mut(&mut exec).cast(),
);
if err != 0 {
+4 -2
View File
@@ -13,6 +13,8 @@
#include "drm-uapi/nouveau_drm.h"
#define DRM_RS_IOCTL(FOO) \
static const unsigned long DRM_RS_IOCTL_##FOO = DRM_IOCTL_##FOO
DRM_RS_IOCTL_##FOO = DRM_IOCTL_##FOO
DRM_RS_IOCTL(NOUVEAU_EXEC);
enum ENUM_PACKED drm_rs_ioctls {
DRM_RS_IOCTL(NOUVEAU_EXEC),
};