diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-11-30 22:19:31 +0000 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2017-12-04 15:45:18 -0800 |
commit | d7eb778b4ba743bf68f3bf12e17da67038d8bbb6 (patch) | |
tree | b677fa1251edbeb0f35e5f04d43e614847fdd8e9 /src/i965_drv_video.c | |
parent | 76d9e597205bb08fdd6d339c9d6ec3b4daa65759 (diff) | |
download | libva-intel-driver-d7eb778b4ba743bf68f3bf12e17da67038d8bbb6.tar.gz |
Add new functions for logging
These use the error and info callbacks added recently to libva.
Signed-off-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'src/i965_drv_video.c')
-rw-r--r-- | src/i965_drv_video.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 2bb2f425..976debe8 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -6904,6 +6904,53 @@ VAStatus i965_QueryVideoProcPipelineCaps( return VA_STATUS_SUCCESS; } +void i965_log_error(VADriverContextP ctx, const char *format, ...) +{ + va_list vl; + + va_start(vl, format); + + if (!ctx->error_callback) { + // No error callback: this is a error message which should be + // user-visible, so print it to stderr instead. + vfprintf(stderr, format, vl); + } else { + // Put the message on the stack. If it overruns the size of the + // then it will just be truncated - callers shouldn't be sending + // messages which are too long. + char tmp[1024]; + int ret; + ret = vsnprintf(tmp, sizeof(tmp), format, vl); + if (ret > 0) + ctx->error_callback(ctx, tmp); + } + + va_end(vl); +} + +void i965_log_info(VADriverContextP ctx, const char *format, ...) +{ + va_list vl; + + va_start(vl, format); + + if (!ctx->info_callback) { + // No info callback: this message is only useful for developers, + // so just discard it. + } else { + // Put the message on the stack. If it overruns the size of the + // then it will just be truncated - callers shouldn't be sending + // messages which are too long. + char tmp[1024]; + int ret; + ret = vsnprintf(tmp, sizeof(tmp), format, vl); + if (ret > 0) + ctx->info_callback(ctx, tmp); + } + + va_end(vl); +} + extern struct hw_codec_info *i965_get_codec_info(int devid); static bool |