|
| 1 | +#if __aarch64__ && FF_HAVE_DRM |
| 2 | + |
| 3 | +#include <drm.h> |
| 4 | +#include <fcntl.h> |
| 5 | +#include <sys/ioctl.h> |
| 6 | + |
| 7 | +#if __has_include(<drm/asahi_drm.h>) |
| 8 | + |
| 9 | +#include <drm/asahi_drm.h> |
| 10 | + |
| 11 | +#else |
| 12 | + |
| 13 | +// https://github.com/AsahiLinux/linux/blob/asahi/include/uapi/drm/asahi_drm.h |
| 14 | +/* SPDX-License-Identifier: MIT */ |
| 15 | +/* Copyright (C) The Asahi Linux Contributors */ |
| 16 | + |
| 17 | +#define DRM_ASAHI_UNSTABLE_UABI_VERSION10011 |
| 18 | + |
| 19 | +#define DRM_ASAHI_GET_PARAMS0x00 |
| 20 | +#define DRM_ASAHI_MAX_CLUSTERS32 |
| 21 | +struct drm_asahi_params_global |
| 22 | +{ |
| 23 | + __u32 unstable_uabi_version; |
| 24 | + __u32 pad0; |
| 25 | + |
| 26 | + __u64 feat_compat; |
| 27 | + __u64 feat_incompat; |
| 28 | + |
| 29 | + __u32 gpu_generation; |
| 30 | + __u32 gpu_variant; |
| 31 | + __u32 gpu_revision; |
| 32 | + __u32 chip_id; |
| 33 | + |
| 34 | + __u32 num_dies; |
| 35 | + __u32 num_clusters_total; |
| 36 | + __u32 num_cores_per_cluster; |
| 37 | + __u32 num_frags_per_cluster; |
| 38 | + __u32 num_gps_per_cluster; |
| 39 | + __u32 num_cores_total_active; |
| 40 | + __u64 core_masks[DRM_ASAHI_MAX_CLUSTERS]; |
| 41 | + |
| 42 | + __u32 vm_page_size; |
| 43 | + __u32 pad1; |
| 44 | + __u64 vm_user_start; |
| 45 | + __u64 vm_user_end; |
| 46 | + __u64 vm_usc_start; |
| 47 | + __u64 vm_usc_end; |
| 48 | + __u64 vm_kernel_min_size; |
| 49 | + |
| 50 | + __u32 max_syncs_per_submission; |
| 51 | + __u32 max_commands_per_submission; |
| 52 | + __u32 max_commands_in_flight; |
| 53 | + __u32 max_attachments; |
| 54 | + |
| 55 | + __u32 timer_frequency_hz; |
| 56 | + __u32 min_frequency_khz; |
| 57 | + __u32 max_frequency_khz; |
| 58 | + __u32 max_power_mw; |
| 59 | + |
| 60 | + __u32 result_render_size; |
| 61 | + __u32 result_compute_size; |
| 62 | + |
| 63 | + __u32 firmware_version[4]; |
| 64 | +}; |
| 65 | + |
| 66 | +struct drm_asahi_get_params |
| 67 | +{ |
| 68 | + /** @extensions: Pointer to the first extension struct, if any */ |
| 69 | + __u64 extensions; |
| 70 | + |
| 71 | + /** @param: Parameter group to fetch (MBZ) */ |
| 72 | + __u32 param_group; |
| 73 | + |
| 74 | + /** @pad: MBZ */ |
| 75 | + __u32 pad; |
| 76 | + |
| 77 | + /** @value: User pointer to write parameter struct */ |
| 78 | + __u64 pointer; |
| 79 | + |
| 80 | + /** @value: Size of user buffer, max size supported on return */ |
| 81 | + __u64 size; |
| 82 | +}; |
| 83 | + |
| 84 | +enum |
| 85 | +{ |
| 86 | + DRM_IOCTL_ASAHI_GET_PARAMS = DRM_IOWR(DRM_COMMAND_BASE + DRM_ASAHI_GET_PARAMS, struct drm_asahi_get_params), |
| 87 | +}; |
| 88 | + |
| 89 | +#endif // __has_include |
| 90 | + |
| 91 | +#endif // FF_HAVE_DRM |
0 commit comments