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

Mark Thompson sw at jkqxz.net
Tue Jun 19 01:26:47 EEST 2018


On 18/06/18 13:26, Jun Zhao wrote:
> 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>
> ---

Why?

Currently the devices which are logged are those which have passed both the platform and the device filter checks (allowing successive refinement).  You are changing this to logging devices on every platform which passes the platform filter check regardless of whether they pass the device filters, which seems inconsistent to me.

>  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];
> 


More information about the ffmpeg-devel mailing list