nvcodec: Fix crash on 32-bit Windows
[platform/upstream/gstreamer.git] / sys / nvcodec / stub / cuda.h
1 /* CUDA stub header
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Library General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef __GST_CUDA_STUB_H__
20 #define __GST_CUDA_STUB_H__
21
22 #include <glib.h>
23
24 G_BEGIN_DECLS
25
26 typedef gpointer CUcontext;
27 typedef gpointer CUgraphicsResource;
28 typedef gpointer CUstream;
29 typedef gpointer CUarray;
30
31 typedef guintptr CUdeviceptr;
32 typedef gint CUdevice;
33
34 typedef enum
35 {
36   CUDA_SUCCESS = 0,
37 } CUresult;
38
39 typedef enum
40 {
41   CU_MEMORYTYPE_HOST = 1,
42   CU_MEMORYTYPE_DEVICE = 2,
43   CU_MEMORYTYPE_ARRAY = 3,
44   CU_MEMORYTYPE_UNIFIED = 4,
45 } CUmemorytype;
46
47 typedef enum
48 {
49   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,
50   CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,
51 } CUdevice_attribute;
52
53 typedef enum
54 {
55   CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00,
56   CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 0x01,
57   CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 0x02,
58 } CUgraphicsRegisterFlags;
59
60 typedef enum
61 {
62   CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00,
63   CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01,
64   CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
65 } CUgraphicsMapResourceFlags;
66
67 typedef enum
68 {
69   CU_STREAM_DEFAULT = 0x0,
70   CU_STREAM_NON_BLOCKING = 0x1
71 } CUstream_flags;
72
73 typedef struct
74 {
75   gsize srcXInBytes;
76   gsize srcY;
77   CUmemorytype srcMemoryType;
78   gconstpointer srcHost;
79   CUdeviceptr srcDevice;
80   CUarray srcArray;
81   gsize srcPitch;
82
83   gsize dstXInBytes;
84   gsize dstY;
85   CUmemorytype dstMemoryType;
86   gpointer dstHost;
87   CUdeviceptr dstDevice;
88   CUarray dstArray;
89   gsize dstPitch;
90
91   gsize WidthInBytes;
92   gsize Height;
93 } CUDA_MEMCPY2D;
94
95 #define CUDA_VERSION 10000
96
97 #ifdef _WIN32
98 #define CUDAAPI __stdcall
99 #else
100 #define CUDAAPI
101 #endif
102
103 #define cuCtxCreate cuCtxCreate_v2
104 #define cuCtxDestroy cuCtxDestroy_v2
105 #define cuCtxPopCurrent cuCtxPopCurrent_v2
106 #define cuCtxPushCurrent cuCtxPushCurrent_v2
107 #define cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer_v2
108 #define cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags_v2
109
110 #define cuMemAlloc cuMemAlloc_v2
111 #define cuMemAllocPitch cuMemAllocPitch_v2
112 #define cuMemcpy2D cuMemcpy2D_v2
113 #define cuMemcpy2DAsync cuMemcpy2DAsync_v2
114 #define cuMemFree cuMemFree_v2
115
116 G_END_DECLS
117
118 #endif /* __GST_CUDA_STUB_H__ */