xref: /aosp_15_r20/external/libva/va/win32/va_win32.h (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef _VA_WIN32_H_
25 #define _VA_WIN32_H_
26 
27 #include <va/va.h>
28 #include <windows.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /** \brief HANDLE memory type
35  *
36  * The HANDLE type can be used with D3D12 sharing resource functions such as:
37  * https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-opensharedhandle
38  * https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createsharedhandle
39  *
40  * When used with VASurfaceAttribExternalBufferDescriptor for vaCreateSurfaces(...,num_surfaces,...),
41  * the associated VAGenericValueTypePointer is of type HANDLE[num_surfaces]
42  * to create each of num_surfaces from the corresponding HANDLE element
43  *
44  * When used for vaAcquire/ReleaseBufferHandle VABufferInfo.handle type is HANDLE
45  * When used for vlVaExportSurfaceHandle, descriptor parameter type is HANDLE*
46  */
47 #define VA_SURFACE_ATTRIB_MEM_TYPE_NTHANDLE       0x00010000
48 /** \brief ID3D12Resource memory type
49  * When used with VASurfaceAttribExternalBufferDescriptor for vaCreateSurfaces(...,num_surfaces,...),
50  * the associated VAGenericValueTypePointer is of type ID3D12Resource*[num_surfaces]
51  * to create each of num_surfaces from the corresponding ID3D12Resource* element
52  *
53  * When used for vaAcquire/ReleaseBufferHandle VABufferInfo.handle type is ID3D12Resource*
54  * When used for vlVaExportSurfaceHandle, descriptor parameter type is ID3D12Resource**
55  */
56 #define VA_SURFACE_ATTRIB_MEM_TYPE_D3D12_RESOURCE 0x00020000
57 
58 /*
59  * Returns a suitable VADisplay for VA API
60  */
61 VADisplay vaGetDisplayWin32(
62     /* Can be null for adapter autoselection in the VA driver */
63     const LUID* adapter_luid
64 );
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* _VA_WIN32_H_ */
71