[FFmpeg-devel] libavutil/opencl: output program build log
Titov, Alexey
Alexey.Titov at amd.com
Wed Dec 24 20:55:13 CET 2014
Attached corrected patch
-----Original Message-----
From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Michael Niedermayer
Sent: Wednesday, December 24, 2014 11:40 AM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] libavutil/opencl: output program build log
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: 0001-libavutil-opencl-output-program-build-failure-log.zip
Type: application/x-zip-compressed
Size: 1196 bytes
Desc: 0001-libavutil-opencl-output-program-build-failure-log.zip
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141224/bb53d7e9/attachment.bin>
More information about the ffmpeg-devel
mailing list