[FFmpeg-devel] libavutil/opencl: output program build log

Michael Niedermayer michaelni at gmx.at
Wed Dec 24 20:39:49 CET 2014


On Wed, Dec 24, 2014 at 07:02:11PM +0000, Titov, Alexey wrote:
> Patch attached
> 
diff --git a/libavutil/opencl.c b/libavutil/opencl.c
index 36cb6fe..3cd2bf8 100644
--- a/libavutil/opencl.c
+++ b/libavutil/opencl.c
@@ -449,10 +449,32 @@ cl_program av_opencl_compile(const char *program_name, const char *build_opts)
     }
     status = clBuildProgram(program, 1, &(opencl_ctx.device_id), build_opts, NULL, NULL);
     if (status != CL_SUCCESS) {
+        size_t log_size;
+        char *log;
         av_log(&opencl_ctx, AV_LOG_ERROR,
-               "Compilation failed with OpenCL program: %s\n", program_name);
+            "Compilation failed with OpenCL program: '%s' with error %d \n", program_name, status);
+
+        // Determine the size of the log
+        clGetProgramBuildInfo(program, opencl_ctx.device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
+
+        if( log_size <= AV_OPENCL_MAX_PROG_BUILD_LOG_SIZE) {
+
+          // Allocate memory for the log
+          log = av_malloc(log_size+1);
+
+          // Get the log
+          clGetProgramBuildInfo(program, opencl_ctx.device_id, CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
+          log[log_size] = '\0';

missing malloc failure check
indention depth is not what it is in the surrounding code

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141224/142e764b/attachment.asc>


More information about the ffmpeg-devel mailing list