Files
geramyloveless 96eb5f42e4 linuxu: DRM ioctl numbers and stack zeroing as a Linux build has them
linuxu's drm/drm.h redefined DRM_COMMAND_BASE as 0 and DRM_COMMAND_END
as 0x0f over the uapi's 0x40 and 0xA0. Every DRM_IOCTL_AMDGPU_* number
was therefore not the Linux one, and drm_ioctl() sent the core ioctls
below 0x0f (DRM_IOCTL_VERSION, GET_UNIQUE, ...) to the driver's table:
a render-node client issuing Linux ioctl numbers, as libdrm and Mesa do,
reached the wrong handlers. The uapi band now stands.

Linux builds with CONFIG_INIT_STACK_ALL_ZERO, the default whenever the
compiler supports it, and upstream depends on it: amdgpu_vm_bo_update()
returns an uninitialized r for the PRT mapping when nothing needs
updating, which the first AMDGPU_CS of every render client hits. Host and
DriverKit builds now pass -ftrivial-auto-var-init=zero as Linux does.
2026-10-02 21:31:13 -07:00

24 lines
863 B
C

/* linuxu: SHIM (drm/drm.h — kernel-side wrapper over the uapi copy) */
#ifndef _LINUXU_DRM_KERNEL_H
#define _LINUXU_DRM_KERNEL_H
/*
* Upstream <drm/drm.h> is a thin kernel-side wrapper that pulls in the
* uapi definitions plus a handful of kernel-only helpers. In the linuxu
* shadow tree the uapi copy lives at uapi/drm/drm.h (verbatim), and the
* kernel-only helpers (DRM_IOCTL_DEF, drm_ioctl_call, ...) are all
* declared here so that <drm/drm_ioctl.h> and the KMD's ioctl tables
* resolve.
*/
#include <uapi/drm/drm.h>
#include <uapi/drm/drm_mode.h>
/*
* The ioctl command band is the uapi's: DRM_COMMAND_BASE 0x40 to
* DRM_COMMAND_END 0xA0. Driver ioctl numbers (DRM_IOCTL_AMDGPU_*) are
* DRM_COMMAND_BASE + their index, as on Linux, and drm_ioctl() routes
* numbers below the band to the core table (DRM_IOCTL_VERSION is 0x00).
*/
#endif