[FFmpeg-devel] OpenCL: convert meaningless "device id" output to "device name"

highgod0401 highgod0401 at gmail.com
Tue Sep 10 10:08:14 CEST 2013


From: Lenny Wang
Date: 2013-09-10 15:57
To: ffmpeg-devel
Subject: [FFmpeg-devel] OpenCL: convert meaningless "device id" output to "device name"
Greetings all,

The current verbose output from ffmpeg-opencl is like this "[OPENCLUTILS @
00bf4060] Platform Name: NVIDIA Corporation, device id: 0x35f1518".  The
"device id" is formatted to a hexadecimal integer from *cl_device_id* type.
 In OpenCL world, the *cl_device_id* value is used to identify a specific
OpenCL device, this value is dynamic and it gives no information about
which device is being used.  I argue that it should be changed to a
meaningful device name.  See patch attached.

diff --git a/libavutil/opencl.c b/libavutil/opencl.c
index 5887b50..e0b28c3 100644
--- a/libavutil/opencl.c
+++ b/libavutil/opencl.c
@@ -516,9 +516,9 @@ static int init_opencl_env(OpenclContext *opencl_ctx, AVOpenCLExternalEnv *ext_o
              * Use available platform.
-            av_log(opencl_ctx, AV_LOG_VERBOSE, "Platform Name: %s, device id: 0x%x\n",
+            av_log(opencl_ctx, AV_LOG_VERBOSE, "Platform Name: %s, Device Name: %s\n",
-                   (unsigned int)opencl_ctx->device_id);
+                   device_node->device_name);
             cps[0] = CL_CONTEXT_PLATFORM;
             cps[1] = (cl_context_properties)opencl_ctx->platform_id;
             cps[2] = 0;

Shouldn't the "Device Name" be written as "device name"?

Looks good to me, it make the print information meaningful.

ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org

More information about the ffmpeg-devel mailing list