1 /* GStreamer 2 * Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_CUDA_LOADER_H__ 21 #define __GST_CUDA_LOADER_H__ 22 23 #include "stub/cuda.h" 24 25 #include <gst/gst.h> 26 27 G_BEGIN_DECLS 28 29 gboolean gst_cuda_load_library (void); 30 31 /* cuda.h */ 32 CUresult CUDAAPI CuInit (unsigned int Flags); 33 34 CUresult CUDAAPI CuGetErrorName (CUresult error, 35 const char **pStr); 36 37 CUresult CUDAAPI CuGetErrorString (CUresult error, 38 const char **pStr); 39 40 CUresult CUDAAPI CuCtxCreate (CUcontext * pctx, 41 unsigned int flags, 42 CUdevice dev); 43 44 CUresult CUDAAPI CuCtxDestroy (CUcontext ctx); 45 46 CUresult CUDAAPI CuCtxPopCurrent (CUcontext * pctx); 47 48 CUresult CUDAAPI CuCtxPushCurrent (CUcontext ctx); 49 50 CUresult CUDAAPI CuCtxEnablePeerAccess (CUcontext peerContext, 51 unsigned int Flags); 52 53 CUresult CUDAAPI CuCtxDisablePeerAccess (CUcontext peerContext); 54 55 CUresult CUDAAPI CuGraphicsMapResources (unsigned int count, 56 CUgraphicsResource * resources, 57 CUstream hStream); 58 59 CUresult CUDAAPI CuGraphicsUnmapResources (unsigned int count, 60 CUgraphicsResource * resources, 61 CUstream hStream); 62 63 CUresult CUDAAPI CuGraphicsSubResourceGetMappedArray (CUarray * pArray, 64 CUgraphicsResource resource, 65 unsigned int arrayIndex, 66 unsigned int mipLevel); 67 68 CUresult CUDAAPI CuGraphicsResourceGetMappedPointer (CUdeviceptr * pDevPtr, 69 size_t * pSize, 70 CUgraphicsResource resource); 71 72 CUresult CUDAAPI CuGraphicsUnregisterResource (CUgraphicsResource resource); 73 74 CUresult CUDAAPI CuMemAlloc (CUdeviceptr * dptr, 75 unsigned int bytesize); 76 77 CUresult CUDAAPI CuMemAllocPitch (CUdeviceptr * dptr, 78 size_t * pPitch, 79 size_t WidthInBytes, 80 size_t Height, 81 unsigned int ElementSizeBytes); 82 83 CUresult CUDAAPI CuMemAllocHost (void **pp, 84 unsigned int bytesize); 85 86 CUresult CUDAAPI CuMemcpy2D (const CUDA_MEMCPY2D * pCopy); 87 88 CUresult CUDAAPI CuMemcpy2DAsync (const CUDA_MEMCPY2D *pCopy, CUstream hStream); 89 90 CUresult CUDAAPI CuMemFree (CUdeviceptr dptr); 91 92 CUresult CUDAAPI CuMemFreeHost (void *p); 93 94 CUresult CUDAAPI CuStreamCreate (CUstream *phStream, 95 unsigned int Flags); 96 97 CUresult CUDAAPI CuStreamDestroy (CUstream hStream); 98 99 CUresult CUDAAPI CuStreamSynchronize (CUstream hStream); 100 101 CUresult CUDAAPI CuDeviceGet (CUdevice * device, 102 int ordinal); 103 104 CUresult CUDAAPI CuDeviceGetCount (int *count); 105 106 CUresult CUDAAPI CuDeviceGetName (char *name, 107 int len, 108 CUdevice dev); 109 110 CUresult CUDAAPI CuDeviceGetAttribute (int *pi, 111 CUdevice_attribute attrib, 112 CUdevice dev); 113 114 CUresult CUDAAPI CuDeviceCanAccessPeer (int *canAccessPeer, 115 CUdevice dev, 116 CUdevice peerDev); 117 118 CUresult CUDAAPI CuDriverGetVersion (int * driverVersion); 119 120 CUresult CUDAAPI CuModuleLoadData (CUmodule* module, 121 const void *image); 122 123 CUresult CUDAAPI CuModuleUnload (CUmodule module); 124 125 CUresult CUDAAPI CuModuleGetFunction (CUfunction* hfunc, 126 CUmodule hmod, 127 const char* name); 128 129 CUresult CUDAAPI CuTexObjectCreate (CUtexObject *pTexObject, 130 const CUDA_RESOURCE_DESC *pResDesc, 131 const CUDA_TEXTURE_DESC *pTexDesc, 132 const CUDA_RESOURCE_VIEW_DESC *pResViewDesc); 133 134 CUresult CUDAAPI CuTexObjectDestroy (CUtexObject texObject); 135 136 CUresult CUDAAPI CuLaunchKernel (CUfunction f, 137 unsigned int gridDimX, 138 unsigned int gridDimY, 139 unsigned int gridDimZ, 140 unsigned int blockDimX, 141 unsigned int blockDimY, 142 unsigned int blockDimZ, 143 unsigned int sharedMemBytes, 144 CUstream hStream, 145 void **kernelParams, 146 void **extra); 147 148 /* cudaGL.h */ 149 CUresult CUDAAPI CuGraphicsGLRegisterImage (CUgraphicsResource * pCudaResource, 150 unsigned int image, 151 unsigned int target, 152 unsigned int Flags); 153 154 CUresult CUDAAPI CuGraphicsGLRegisterBuffer (CUgraphicsResource * pCudaResource, 155 unsigned int buffer, 156 unsigned int Flags); 157 158 CUresult CUDAAPI CuGraphicsResourceSetMapFlags (CUgraphicsResource resource, 159 unsigned int flags); 160 161 CUresult CUDAAPI CuGLGetDevices (unsigned int * pCudaDeviceCount, 162 CUdevice * pCudaDevices, 163 unsigned int cudaDeviceCount, 164 CUGLDeviceList deviceList); 165 166 G_END_DECLS 167 #endif /* __GST_CUDA_LOADER_H__ */ 168