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.

98 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. #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
  41. typedef unsigned long long CUdeviceptr;
  42. #else
  43. typedef unsigned int CUdeviceptr;
  44. #endif
  45. typedef enum cudaError_enum {
  46. CUDA_SUCCESS = 0
  47. } CUresult;
  48. typedef enum CUmemorytype_enum {
  49. CU_MEMORYTYPE_HOST = 1,
  50. CU_MEMORYTYPE_DEVICE = 2
  51. } CUmemorytype;
  52. typedef struct CUDA_MEMCPY2D_st {
  53. size_t srcXInBytes;
  54. size_t srcY;
  55. CUmemorytype srcMemoryType;
  56. const void *srcHost;
  57. CUdeviceptr srcDevice;
  58. CUarray srcArray;
  59. size_t srcPitch;
  60. size_t dstXInBytes;
  61. size_t dstY;
  62. CUmemorytype dstMemoryType;
  63. void *dstHost;
  64. CUdeviceptr dstDevice;
  65. CUarray dstArray;
  66. size_t dstPitch;
  67. size_t WidthInBytes;
  68. size_t Height;
  69. } CUDA_MEMCPY2D;
  70. typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
  71. typedef CUresult CUDAAPI tcuDeviceGetCount(int *count);
  72. typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
  73. typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
  74. typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, CUdevice dev);
  75. typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev);
  76. typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext *pctx);
  77. typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx);
  78. typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
  79. typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize);
  80. typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
  81. typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
  82. typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
  83. typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr);
  84. #endif