• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef _WINSYS_HANDLE_H_
3 #define _WINSYS_HANDLE_H_
4 
5 #ifdef _WIN32
6 #include <windows.h>
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 
22 /**
23  * For use with pipe_screen::{resource_from_handle|resource_get_handle}.
24  */
25 struct winsys_handle
26 {
27    /**
28     * Input for resource_from_handle, valid values are
29     * WINSYS_HANDLE_TYPE_SHARED or WINSYS_HANDLE_TYPE_FD.
30     * Input to resource_get_handle,
31     * to select handle for kms, flink, or prime.
32     */
33    unsigned type;
34    /**
35     * Input for resource_get_handle, allows to export the offset
36     * of a specific layer of an array texture.
37     */
38    unsigned layer;
39    /**
40     * Input for resource_get_handle, allows to export of a specific plane of a
41     * texture.
42     */
43    unsigned plane;
44    /**
45     * Input to resource_from_handle.
46     * Output for resource_get_handle.
47     */
48 #ifdef _WIN32
49    HANDLE handle;
50 #else
51    unsigned handle;
52 #endif
53    /**
54     * Input to resource_from_handle.
55     * Output for resource_get_handle.
56     */
57    unsigned stride;
58    /**
59     * Input to resource_from_handle.
60     * Output for resource_get_handle.
61     */
62    unsigned offset;
63 
64    /**
65     * Input to resource_from_handle.
66     * Output from resource_get_handle.
67     */
68    uint64_t format;
69 
70    /**
71     * Input to resource_from_handle.
72     * Output from resource_get_handle.
73     */
74    uint64_t modifier;
75 
76    union
77    {
78       /**
79        * Input to resource_from_handle.
80        * Output for resource_get_handle.
81        */
82       void *com_obj;
83 
84       /**
85        * String name for an object.
86        * Input to resource_from_handle.
87        */
88       const void *name;
89    };
90 
91    /**
92     * Total size of the object.
93     * Output for resource_get_handle.
94     */
95    uint64_t size;
96 };
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* _WINSYS_HANDLE_H_ */
103