xref: /linux/include/uapi/drm/nova_drm.h (revision ab93e0dd72c37d378dd936f031ffb83ff2bd87ce)
1 /* SPDX-License-Identifier: MIT */
2 
3 #ifndef __NOVA_DRM_H__
4 #define __NOVA_DRM_H__
5 
6 #include "drm.h"
7 
8 /* DISCLAIMER: Do not use, this is not a stable uAPI.
9  *
10  * This uAPI serves only testing purposes as long as this driver is still in
11  * development. It is required to implement and test infrastructure which is
12  * upstreamed in the context of this driver. See also [1].
13  *
14  * [1] https://lore.kernel.org/dri-devel/Zfsj0_tb-0-tNrJy@cassiopeiae/T/#u
15  */
16 
17 #if defined(__cplusplus)
18 extern "C" {
19 #endif
20 
21 /*
22  * NOVA_GETPARAM_VRAM_BAR_SIZE
23  *
24  * Query the VRAM BAR size in bytes.
25  */
26 #define NOVA_GETPARAM_VRAM_BAR_SIZE	0x1
27 
28 /**
29  * struct drm_nova_getparam - query GPU and driver metadata
30  */
31 struct drm_nova_getparam {
32 	/**
33 	 * @param: The identifier of the parameter to query.
34 	 */
35 	__u64 param;
36 
37 	/**
38 	 * @value: The value for the specified parameter.
39 	 */
40 	__u64 value;
41 };
42 
43 /**
44  * struct drm_nova_gem_create - create a new DRM GEM object
45  */
46 struct drm_nova_gem_create {
47 	/**
48 	 * @handle: The handle of the new DRM GEM object.
49 	 */
50 	__u32 handle;
51 
52 	/**
53 	 * @pad: 32 bit padding, should be 0.
54 	 */
55 	__u32 pad;
56 
57 	/**
58 	 * @size: The size of the new DRM GEM object.
59 	 */
60 	__u64 size;
61 };
62 
63 /**
64  * struct drm_nova_gem_info - query DRM GEM object metadata
65  */
66 struct drm_nova_gem_info {
67 	/**
68 	 * @handle: The handle of the DRM GEM object to query.
69 	 */
70 	__u32 handle;
71 
72 	/**
73 	 * @pad: 32 bit padding, should be 0.
74 	 */
75 	__u32 pad;
76 
77 	/**
78 	 * @size: The size of the DRM GEM obejct.
79 	 */
80 	__u64 size;
81 };
82 
83 #define DRM_NOVA_GETPARAM		0x00
84 #define DRM_NOVA_GEM_CREATE		0x01
85 #define DRM_NOVA_GEM_INFO		0x02
86 
87 /* Note: this is an enum so that it can be resolved by Rust bindgen. */
88 enum {
89 	DRM_IOCTL_NOVA_GETPARAM		= DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GETPARAM,
90 						   struct drm_nova_getparam),
91 	DRM_IOCTL_NOVA_GEM_CREATE	= DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GEM_CREATE,
92 						   struct drm_nova_gem_create),
93 	DRM_IOCTL_NOVA_GEM_INFO		= DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GEM_INFO,
94 						   struct drm_nova_gem_info),
95 };
96 
97 #if defined(__cplusplus)
98 }
99 #endif
100 
101 #endif /* __NOVA_DRM_H__ */
102