[FFmpeg-devel] [PATCH 1/2] hwcontext_opencl: improve the debug log in multi-platform/multi-device system.

Jun Zhao mypopydev at gmail.com
Mon Jun 18 15:26:35 EEST 2018


after the change, use the cmd:
./ffmpeg -init_hw_device opencl=ocl:,device_type=gpu -loglevel 99
in a multi-platforms/multi-devices system get more clean log like:

2 OpenCL platforms found.
1 OpenCL devices found on platform "Portable Computing Language".
0.0: Portable Computing Language / pthread-Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
"pthread-Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz" does not match device type "gpu".
2 OpenCL devices found on platform "Intel(R) OpenCL".
1.0: Intel(R) OpenCL / Intel(R) HD Graphics
1.1: Intel(R) OpenCL / Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
"Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz" does not match device type "gpu".

Signed-off-by: Jun Zhao <mypopydev at gmail.com>
---
 libavutil/hwcontext_opencl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 07458c2..65b4a0c 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -428,7 +428,8 @@ static int opencl_filter_device(AVHWDeviceContext *hwdev,
         }
 
         if (!(device_type & match_type)) {
-            av_log(hwdev, AV_LOG_DEBUG, "device_type does not match.\n");
+            av_log(hwdev, AV_LOG_DEBUG, "\"%s\" does not match device type \"%s\".\n",
+                   device_name, param->value);
             return 1;
         }
     }
@@ -550,6 +551,9 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev,
             else
                 device_name = "Unknown Device";
 
+            av_log(hwdev, AV_LOG_VERBOSE, "%d.%d: %s / %s\n", p, d,
+                   platform_name, device_name);
+
             if (selector->filter_device) {
                 err = selector->filter_device(hwdev, devices[d],
                                               device_name,
@@ -560,9 +564,6 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev,
                     continue;
             }
 
-            av_log(hwdev, AV_LOG_VERBOSE, "%d.%d: %s / %s\n", p, d,
-                   platform_name, device_name);
-
             ++found;
             platform_id      = platforms[p];
             hwctx->device_id = devices[d];
-- 
2.7.4



More information about the ffmpeg-devel mailing list