You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.2KB

  1. /*
  2. * This copyright notice applies to this header file only:
  3. *
  4. * Copyright (c) 2016
  5. *
  6. * Permission is hereby granted, free of charge, to any person
  7. * obtaining a copy of this software and associated documentation
  8. * files (the "Software"), to deal in the Software without
  9. * restriction, including without limitation the rights to use,
  10. * copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the software, and to permit persons to whom the
  12. * software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be
  16. * included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  20. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  22. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  23. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  24. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  25. * OTHER DEALINGS IN THE SOFTWARE.
  26. */
  27. #if !defined(AV_COMPAT_DYNLINK_CUDA_H) && !defined(CUDA_VERSION)
  28. #define AV_COMPAT_DYNLINK_CUDA_H
  29. #include <stddef.h>
  30. #define CUDA_VERSION 7050
  31. #if defined(_WIN32) || defined(__CYGWIN__)
  32. #define CUDAAPI __stdcall
  33. #else
  34. #define CUDAAPI
  35. #endif
  36. #define CU_CTX_SCHED_BLOCKING_SYNC 4
  37. typedef int CUdevice;
  38. typedef void* CUarray;
  39. typedef void* CUcontext;
  40. typedef void* CUstream;
  41. #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
  42. typedef unsigned long long CUdeviceptr;
  43. #else
  44. typedef unsigned int CUdeviceptr;
  45. #endif
  46. typedef enum cudaError_enum {
  47. CUDA_SUCCESS = 0
  48. } CUresult;
  49. typedef enum CUmemorytype_enum {
  50. CU_MEMORYTYPE_HOST = 1,
  51. CU_MEMORYTYPE_DEVICE = 2
  52. } CUmemorytype;
  53. typedef struct CUDA_MEMCPY2D_st {
  54. size_t srcXInBytes;
  55. size_t srcY;
  56. CUmemorytype srcMemoryType;
  57. const void *srcHost;
  58. CUdeviceptr srcDevice;
  59. CUarray srcArray;
  60. size_t srcPitch;
  61. size_t dstXInBytes;
  62. size_t dstY;
  63. CUmemorytype dstMemoryType;
  64. void *dstHost;
  65. CUdeviceptr dstDevice;
  66. CUarray dstArray;
  67. size_t dstPitch;
  68. size_t WidthInBytes;
  69. size_t Height;
  70. } CUDA_MEMCPY2D;
  71. typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
  72. typedef CUresult CUDAAPI tcuDeviceGetCount(int *count);
  73. typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
  74. typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
  75. typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, CUdevice dev);
  76. typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev);
  77. typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext *pctx);
  78. typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx);
  79. typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
  80. typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize);
  81. typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
  82. typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
  83. typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
  84. typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr);
  85. #endif