From 535adfee37b7be8064e302e4f17b1df1ca14ae14 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 17 May 2018 21:49:25 +0900 Subject: [PATCH] nvenc: Fix build warning error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'cuDeviceComputeCapability' was deprecated as of CUDA 5.0 gstnvenc.c: In function ‘gst_nvenc_create_cuda_context’: gstnvenc.c:290:9: error: ‘cuDeviceComputeCapability’ is deprecated [-Werror=deprecated-declarations] && cuDeviceComputeCapability (&maj, &min, cdev) == CUDA_SUCCESS) { ^ https://bugzilla.gnome.org/show_bug.cgi?id=796203 --- sys/nvenc/gstnvenc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/nvenc/gstnvenc.c b/sys/nvenc/gstnvenc.c index a157006c82..a2edb7ee7d 100644 --- a/sys/nvenc/gstnvenc.c +++ b/sys/nvenc/gstnvenc.c @@ -287,9 +287,13 @@ gst_nvenc_create_cuda_context (guint device_id) for (i = 0; i < dev_count; ++i) { if (cuDeviceGet (&cdev, i) == CUDA_SUCCESS && cuDeviceGetName (name, sizeof (name), cdev) == CUDA_SUCCESS - && cuDeviceComputeCapability (&maj, &min, cdev) == CUDA_SUCCESS) { - GST_INFO ("GPU #%d supports NVENC: %s (%s) (Compute SM %d.%d)", - i, (((maj << 4) + min) >= 0x30) ? "yes" : "no", name, maj, min); + && cuDeviceGetAttribute (&maj, + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cdev) == CUDA_SUCCESS + && cuDeviceGetAttribute (&min, + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, + cdev) == CUDA_SUCCESS) { + GST_INFO ("GPU #%d supports NVENC: %s (%s) (Compute SM %d.%d)", i, + (((maj << 4) + min) >= 0x30) ? "yes" : "no", name, maj, min); if (i == device_id) { cuda_dev = cdev; }