1 2 #ifndef _WINSYS_HANDLE_H_ 3 #define _WINSYS_HANDLE_H_ 4 5 #ifdef _WIN32 6 typedef void *HANDLE; 7 #endif 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #define WINSYS_HANDLE_TYPE_SHARED 0 14 #define WINSYS_HANDLE_TYPE_KMS 1 15 #define WINSYS_HANDLE_TYPE_FD 2 16 /* Win32 handles serve the same purpose as FD, just on Windows, so alias the value */ 17 #define WINSYS_HANDLE_TYPE_WIN32_HANDLE WINSYS_HANDLE_TYPE_FD 18 #define WINSYS_HANDLE_TYPE_SHMID 3 19 #define WINSYS_HANDLE_TYPE_D3D12_RES 4 20 #define WINSYS_HANDLE_TYPE_WIN32_NAME 5 21 #define WINSYS_HANDLE_TYPE_UNBACKED 5 22 23 /** 24 * For use with pipe_screen::{resource_from_handle|resource_get_handle}. 25 */ 26 struct winsys_handle 27 { 28 /** 29 * Input for resource_from_handle, valid values are 30 * WINSYS_HANDLE_TYPE_SHARED or WINSYS_HANDLE_TYPE_FD. 31 * Input to resource_get_handle, 32 * to select handle for kms, flink, or prime. 33 */ 34 unsigned type; 35 /** 36 * Input for resource_get_handle, allows to export the offset 37 * of a specific layer of an array texture. 38 */ 39 unsigned layer; 40 /** 41 * Input for resource_get_handle, allows to export of a specific plane of a 42 * texture. 43 */ 44 unsigned plane; 45 /** 46 * Input to resource_from_handle. 47 * Output for resource_get_handle. 48 */ 49 #ifdef _WIN32 50 HANDLE handle; 51 #else 52 unsigned handle; 53 #endif 54 /** 55 * Row stride 56 * Input to texture_from_handle. 57 * Output for texture_from_handle. 58 */ 59 unsigned stride; 60 /** 61 * Array layer stride 62 * Input to texture_from_handle. 63 * Output for texture_from_handle. 64 */ 65 unsigned array_stride; 66 /** 67 * 3D slice stride 68 * Input to texture_from_handle. 69 * Output for texture_from_handle. 70 */ 71 unsigned image_stride; 72 /** 73 * Input to texture_from_handle. 74 * Output for texture_from_handle. 75 */ 76 unsigned offset; 77 78 /** 79 * Input to resource_from_handle. 80 * Output from resource_get_handle. 81 */ 82 uint64_t format; 83 84 /** 85 * Input to resource_from_handle. 86 * Output from resource_get_handle. 87 */ 88 uint64_t modifier; 89 90 union 91 { 92 /** 93 * Input to resource_from_handle. 94 * Output for resource_get_handle. 95 */ 96 void *com_obj; 97 98 /** 99 * String name for an object. 100 * Input to resource_from_handle. 101 */ 102 const void *name; 103 }; 104 105 /** 106 * Total size of the object. 107 * Output for resource_get_handle. 108 */ 109 uint64_t size; 110 }; 111 112 #ifdef __cplusplus 113 } 114 #endif 115 116 #endif /* _WINSYS_HANDLE_H_ */ 117