examples: cuda: Fix build with old CUDA SDK
Some symbols are not available in old cuda headers. Use our stub headers instead Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8950>
This commit is contained in:
parent
864068c045
commit
ee59564d5c
@ -391,7 +391,7 @@ main (gint argc, gchar ** argv)
|
|||||||
resource_desc.res.pitch2D.devPtr = (CUdeviceptr) src_map.data;
|
resource_desc.res.pitch2D.devPtr = (CUdeviceptr) src_map.data;
|
||||||
|
|
||||||
texture_desc.filterMode = CU_TR_FILTER_MODE_LINEAR;
|
texture_desc.filterMode = CU_TR_FILTER_MODE_LINEAR;
|
||||||
texture_desc.flags = CU_TRSF_NORMALIZED_COORDINATES;
|
texture_desc.flags = 0x02; // CU_TRSF_NORMALIZED_COORDINATES
|
||||||
texture_desc.addressMode[0] = CU_TR_ADDRESS_MODE_CLAMP;
|
texture_desc.addressMode[0] = CU_TR_ADDRESS_MODE_CLAMP;
|
||||||
texture_desc.addressMode[1] = CU_TR_ADDRESS_MODE_CLAMP;
|
texture_desc.addressMode[1] = CU_TR_ADDRESS_MODE_CLAMP;
|
||||||
texture_desc.addressMode[2] = CU_TR_ADDRESS_MODE_CLAMP;
|
texture_desc.addressMode[2] = CU_TR_ADDRESS_MODE_CLAMP;
|
||||||
|
@ -2,56 +2,6 @@ if not gstcuda_dep.found()
|
|||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cuda_deps = []
|
|
||||||
cuda_inc_dir = []
|
|
||||||
if host_system == 'windows'
|
|
||||||
cuda_path = run_command(python3, '-c', 'import os; print(os.environ.get("CUDA_PATH"))', check: false).stdout().strip()
|
|
||||||
if cuda_path in ['', 'None']
|
|
||||||
subdir_done()
|
|
||||||
endif
|
|
||||||
|
|
||||||
cuda_inc_dir = include_directories(join_paths(cuda_path, 'include'))
|
|
||||||
if not cc.has_header('cuda.h', include_directories: cuda_inc_dir)
|
|
||||||
subdir_done()
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
# NOTE: meson dependency('cuda', version: '>=10'...) will return CUDA runtime
|
|
||||||
# library but we want to use CUDA driver API. Iterates
|
|
||||||
cuda_versions = [
|
|
||||||
'12.4',
|
|
||||||
'12.3',
|
|
||||||
'12.2',
|
|
||||||
'12.1',
|
|
||||||
'12.0',
|
|
||||||
'11.8',
|
|
||||||
'11.8',
|
|
||||||
'11.7',
|
|
||||||
'11.6',
|
|
||||||
'11.5',
|
|
||||||
'11.4',
|
|
||||||
'11.2',
|
|
||||||
'11.1',
|
|
||||||
'11.0',
|
|
||||||
'10.2',
|
|
||||||
'10.1',
|
|
||||||
'10.0',
|
|
||||||
]
|
|
||||||
|
|
||||||
cuda_dep = dependency('', required: false)
|
|
||||||
foreach ver : cuda_versions
|
|
||||||
cuda_dep = dependency('cuda-@0@'.format(ver), required: false)
|
|
||||||
if cuda_dep.found()
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
if not cuda_dep.found()
|
|
||||||
subdir_done()
|
|
||||||
endif
|
|
||||||
|
|
||||||
cuda_deps = [cuda_dep.partial_dependency(includes : true, compile_args: true)]
|
|
||||||
endif
|
|
||||||
|
|
||||||
gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
|
gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
|
||||||
required : false)
|
required : false)
|
||||||
if gl_header_dep.type_name() == 'internal'
|
if gl_header_dep.type_name() == 'internal'
|
||||||
@ -62,8 +12,8 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
executable('cudamemory-sync', 'cudamemory-sync.c',
|
executable('cudamemory-sync', 'cudamemory-sync.c',
|
||||||
include_directories : [configinc] + compat_includes + cuda_inc_dir,
|
include_directories : [configinc, cuda_stubinc] + compat_includes,
|
||||||
dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep] + cuda_deps,
|
dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep],
|
||||||
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
|
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
|
||||||
install: false)
|
install: false)
|
||||||
|
|
||||||
@ -74,8 +24,8 @@ executable('cuda-template',
|
|||||||
'template-plugin/cuda-transform-ip-template.c',
|
'template-plugin/cuda-transform-ip-template.c',
|
||||||
'template-plugin/plugin.c',
|
'template-plugin/plugin.c',
|
||||||
],
|
],
|
||||||
include_directories : [configinc] + compat_includes + cuda_inc_dir,
|
include_directories : [configinc, cuda_stubinc] + compat_includes,
|
||||||
dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep] + cuda_deps,
|
dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep],
|
||||||
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
|
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
|
||||||
install: false)
|
install: false)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user