• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/common/libva


Commit MetaInfo

Revisionf1f1f5a562693dccdae43e50909ca75556308486 (tree)
Time2017-09-27 13:48:16
AuthorMark Thompson <sw@jkqx...>
CommiterXiang, Haihao

Log Message

Make logging callbacks library-safe

Move the logging callbacks into the display context, rather than
having them as global state. Add user-context parameter as well so
that users can distinguish between callbacks in different instances.

The default behaviour does not change, and LIBVA_MESSAGING_LEVEL
continues to be respected in that case.

Since we're breaking API here, also rename vaMessageCallback to
VAMessageCallback to be consistent with all other types.

Signed-off-by: Mark Thompson <sw@jkqxz.net>

Change Summary

Incremental Difference

--- a/va/va.c
+++ b/va/va.c
@@ -52,9 +52,9 @@
5252 #define DRIVER_EXTENSION "_drv_video.so"
5353
5454 #define ASSERT assert
55-#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
56-#define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
57-#define CHECK_STRING(s, ctx, var) if (!va_checkString(ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
55+#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(dpy, ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
56+#define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(dpy, ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
57+#define CHECK_STRING(s, ctx, var) if (!va_checkString(dpy, ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
5858
5959 /*
6060 * read a config "env" for libva.conf or from environment setting
@@ -114,8 +114,17 @@ int vaDisplayIsValid(VADisplay dpy)
114114 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
115115 }
116116
117-static void default_log_error(const char *buffer)
117+/*
118+ * Global log level configured from the config file or environment, which sets
119+ * whether default logging appears or not (always overridden by explicitly
120+ * user-configured logging).
121+ */
122+static int default_log_level = 2;
123+
124+static void default_log_error(void *user_context, const char *buffer)
118125 {
126+ if (default_log_level < 1)
127+ return;
119128 # ifdef ANDROID
120129 ALOGE("%s", buffer);
121130 # else
@@ -123,8 +132,10 @@ static void default_log_error(const char *buffer)
123132 # endif
124133 }
125134
126-static void default_log_info(const char *buffer)
135+static void default_log_info(void *user_context, const char *buffer)
127136 {
137+ if (default_log_level < 2)
138+ return;
128139 # ifdef ANDROID
129140 ALOGI("%s", buffer);
130141 # else
@@ -132,17 +143,24 @@ static void default_log_info(const char *buffer)
132143 # endif
133144 }
134145
135-static vaMessageCallback va_log_error = default_log_error;
136-static vaMessageCallback va_log_info = default_log_info;
137-
138146 /**
139147 * Set the callback for error messages, or NULL for no logging.
140148 * Returns the previous one, or NULL if it was disabled.
141149 */
142-vaMessageCallback vaSetErrorCallback(vaMessageCallback callback)
150+VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void *user_context)
143151 {
144- vaMessageCallback old_callback = va_log_error;
145- va_log_error = callback;
152+ VADisplayContextP dctx;
153+ VAMessageCallback old_callback;
154+
155+ if (!vaDisplayIsValid(dpy))
156+ return NULL;
157+
158+ dctx = (VADisplayContextP)dpy;
159+ old_callback = dctx->error_callback;
160+
161+ dctx->error_callback = callback;
162+ dctx->error_callback_user_context = user_context;
163+
146164 return old_callback;
147165 }
148166
@@ -150,39 +168,46 @@ vaMessageCallback vaSetErrorCallback(vaMessageCallback callback)
150168 * Set the callback for info messages, or NULL for no logging.
151169 * Returns the previous one, or NULL if it was disabled.
152170 */
153-vaMessageCallback vaSetInfoCallback(vaMessageCallback callback)
171+VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context)
154172 {
155- vaMessageCallback old_callback = va_log_info;
156- va_log_info = callback;
173+ VADisplayContextP dctx;
174+ VAMessageCallback old_callback;
175+
176+ if (!vaDisplayIsValid(dpy))
177+ return NULL;
178+
179+ dctx = (VADisplayContextP)dpy;
180+ old_callback = dctx->error_callback;
181+
182+ dctx->info_callback = callback;
183+ dctx->info_callback_user_context = user_context;
184+
157185 return old_callback;
158186 }
159187
160-void va_MessagingInit()
188+static void va_MessagingInit()
161189 {
162190 #if ENABLE_VA_MESSAGING
163191 char env_value[1024];
192+ int ret;
164193
165194 if (va_parseConfig("LIBVA_MESSAGING_LEVEL", &env_value[0]) == 0) {
166- if (strcmp(env_value, "0") == 0) {
167- vaSetInfoCallback(NULL);
168- vaSetErrorCallback(NULL);
169- }
170-
171- if (strcmp(env_value, "1") == 0) {
172- vaSetInfoCallback(NULL);
173- }
195+ ret = sscanf(env_value, "%d", &default_log_level);
196+ if (ret < 1 || default_log_level < 0 || default_log_level > 2)
197+ default_log_level = 2;
174198 }
175199 #endif
176200 }
177201
178-void va_errorMessage(const char *msg, ...)
202+void va_errorMessage(VADisplay dpy, const char *msg, ...)
179203 {
180204 #if ENABLE_VA_MESSAGING
205+ VADisplayContextP dctx = (VADisplayContextP)dpy;
181206 char buf[512], *dynbuf;
182207 va_list args;
183208 int n, len;
184209
185- if (va_log_error == NULL)
210+ if (dctx->error_callback == NULL)
186211 return;
187212
188213 va_start(args, msg);
@@ -197,22 +222,23 @@ void va_errorMessage(const char *msg, ...)
197222 n = vsnprintf(dynbuf, len + 1, msg, args);
198223 va_end(args);
199224 if (n == len)
200- va_log_error(dynbuf);
225+ dctx->error_callback(dctx->error_callback_user_context, dynbuf);
201226 free(dynbuf);
202227 }
203228 else if (len > 0)
204- va_log_error(buf);
229+ dctx->error_callback(dctx->error_callback_user_context, buf);
205230 #endif
206231 }
207232
208-void va_infoMessage(const char *msg, ...)
233+void va_infoMessage(VADisplay dpy, const char *msg, ...)
209234 {
210235 #if ENABLE_VA_MESSAGING
236+ VADisplayContextP dctx = (VADisplayContextP)dpy;
211237 char buf[512], *dynbuf;
212238 va_list args;
213239 int n, len;
214240
215- if (va_log_info == NULL)
241+ if (dctx->info_callback == NULL)
216242 return;
217243
218244 va_start(args, msg);
@@ -227,11 +253,11 @@ void va_infoMessage(const char *msg, ...)
227253 n = vsnprintf(dynbuf, len + 1, msg, args);
228254 va_end(args);
229255 if (n == len)
230- va_log_info(dynbuf);
256+ dctx->info_callback(dctx->info_callback_user_context, dynbuf);
231257 free(dynbuf);
232258 }
233259 else if (len > 0)
234- va_log_info(buf);
260+ dctx->info_callback(dctx->info_callback_user_context, buf);
235261 #endif
236262 }
237263
@@ -243,31 +269,34 @@ VADisplayContextP va_newDisplayContext(void)
243269
244270 dctx->vadpy_magic = VA_DISPLAY_MAGIC;
245271
272+ dctx->error_callback = default_log_error;
273+ dctx->info_callback = default_log_info;
274+
246275 return dctx;
247276 }
248277
249-static bool va_checkVtable(void *ptr, char *function)
278+static bool va_checkVtable(VADisplay dpy, void *ptr, char *function)
250279 {
251280 if (!ptr) {
252- va_errorMessage("No valid vtable entry for va%s\n", function);
281+ va_errorMessage(dpy, "No valid vtable entry for va%s\n", function);
253282 return false;
254283 }
255284 return true;
256285 }
257286
258-static bool va_checkMaximum(int value, char *variable)
287+static bool va_checkMaximum(VADisplay dpy, int value, char *variable)
259288 {
260289 if (!value) {
261- va_errorMessage("Failed to define max_%s in init\n", variable);
290+ va_errorMessage(dpy, "Failed to define max_%s in init\n", variable);
262291 return false;
263292 }
264293 return true;
265294 }
266295
267-static bool va_checkString(const char* value, char *variable)
296+static bool va_checkString(VADisplay dpy, const char* value, char *variable)
268297 {
269298 if (!value) {
270- va_errorMessage("Failed to define str_%s in init\n", variable);
299+ va_errorMessage(dpy, "Failed to define str_%s in init\n", variable);
271300 return false;
272301 }
273302 return true;
@@ -309,9 +338,9 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
309338 strlen(driver_name) +
310339 strlen(DRIVER_EXTENSION) + 2 );
311340 if (!driver_path) {
312- va_errorMessage("%s L%d Out of memory!n",
313- __FUNCTION__, __LINE__);
314- free(search_path);
341+ va_errorMessage(dpy, "%s L%d Out of memory!n",
342+ __FUNCTION__, __LINE__);
343+ free(search_path);
315344 return VA_STATUS_ERROR_ALLOCATION_FAILED;
316345 }
317346
@@ -320,7 +349,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
320349 strncat( driver_path, driver_name, strlen(driver_name) );
321350 strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
322351
323- va_infoMessage("Trying to open %s\n", driver_path);
352+ va_infoMessage(dpy, "Trying to open %s\n", driver_path);
324353 #ifndef ANDROID
325354 handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
326355 #else
@@ -329,7 +358,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
329358 if (!handle) {
330359 /* Don't give errors for non-existing files */
331360 if (0 == access( driver_path, F_OK))
332- va_errorMessage("dlopen of %s failed: %s\n", driver_path, dlerror());
361+ va_errorMessage(dpy, "dlopen of %s failed: %s\n", driver_path, dlerror());
333362 } else {
334363 VADriverInit init_func = NULL;
335364 char init_func_s[256];
@@ -349,14 +378,14 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
349378 compatible_versions[i].minor)) {
350379 init_func = (VADriverInit)dlsym(handle, init_func_s);
351380 if (init_func) {
352- va_infoMessage("Found init function %s\n", init_func_s);
381+ va_infoMessage(dpy, "Found init function %s\n", init_func_s);
353382 break;
354383 }
355384 }
356385 }
357386
358387 if (compatible_versions[i].major < 0) {
359- va_errorMessage("%s has no function %s\n",
388+ va_errorMessage(dpy, "%s has no function %s\n",
360389 driver_path, init_func_s);
361390 dlclose(handle);
362391 } else {
@@ -433,7 +462,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
433462 CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
434463 }
435464 if (VA_STATUS_SUCCESS != vaStatus) {
436- va_errorMessage("%s init failed\n", driver_path);
465+ va_errorMessage(dpy, "%s init failed\n", driver_path);
437466 dlclose(handle);
438467 }
439468 if (VA_STATUS_SUCCESS == vaStatus)
@@ -550,13 +579,13 @@ VAStatus vaSetDriverName(
550579
551580 if (geteuid() != getuid()) {
552581 vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
553- va_errorMessage("no permission to vaSetDriverName\n");
582+ va_errorMessage(dpy, "no permission to vaSetDriverName\n");
554583 return vaStatus;
555584 }
556585
557586 if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
558587 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
559- va_errorMessage("vaSetDriverName returns %s\n",
588+ va_errorMessage(dpy, "vaSetDriverName returns %s\n",
560589 vaErrorStr(vaStatus));
561590 return vaStatus;
562591 }
@@ -573,7 +602,7 @@ VAStatus vaSetDriverName(
573602
574603 if (!found) {
575604 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
576- va_errorMessage("vaSetDriverName returns %s. Incorrect parameter\n",
605+ va_errorMessage(dpy, "vaSetDriverName returns %s. Incorrect parameter\n",
577606 vaErrorStr(vaStatus));
578607 return vaStatus;
579608 }
@@ -582,7 +611,7 @@ VAStatus vaSetDriverName(
582611
583612 if (!override_driver_name) {
584613 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
585- va_errorMessage("vaSetDriverName returns %s. Out of Memory\n",
614+ va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n",
586615 vaErrorStr(vaStatus));
587616 return vaStatus;
588617 }
@@ -612,12 +641,12 @@ VAStatus vaInitialize (
612641
613642 va_MessagingInit();
614643
615- va_infoMessage("VA-API version %s\n", VA_VERSION_S);
644+ va_infoMessage(dpy, "VA-API version %s\n", VA_VERSION_S);
616645
617646 vaStatus = va_getDriverName(dpy, &driver_name);
618647
619648 if (!ctx->override_driver_name) {
620- va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
649+ va_infoMessage(dpy, "va_getDriverName() returns %d\n", vaStatus);
621650
622651 driver_name_env = getenv("LIBVA_DRIVER_NAME");
623652 } else if (vaStatus == VA_STATUS_SUCCESS) {
@@ -627,11 +656,11 @@ VAStatus vaInitialize (
627656 driver_name = strdup(ctx->override_driver_name);
628657 if (!driver_name) {
629658 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
630- va_errorMessage("vaInitialize() failed with %s, out of memory\n",
659+ va_errorMessage(dpy, "vaInitialize() failed with %s, out of memory\n",
631660 vaErrorStr(vaStatus));
632661 return vaStatus;
633662 }
634- va_infoMessage("User requested driver '%s'\n", driver_name);
663+ va_infoMessage(dpy, "User requested driver '%s'\n", driver_name);
635664 }
636665
637666 if (driver_name_env && (geteuid() == getuid())) {
@@ -641,17 +670,17 @@ VAStatus vaInitialize (
641670
642671 driver_name = strdup(driver_name_env);
643672 vaStatus = VA_STATUS_SUCCESS;
644- va_infoMessage("User requested driver '%s'\n", driver_name);
673+ va_infoMessage(dpy, "User requested driver '%s'\n", driver_name);
645674 }
646675
647676 if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
648677 vaStatus = va_openDriver(dpy, driver_name);
649- va_infoMessage("va_openDriver() returns %d\n", vaStatus);
678+ va_infoMessage(dpy, "va_openDriver() returns %d\n", vaStatus);
650679
651680 *major_version = VA_MAJOR_VERSION;
652681 *minor_version = VA_MINOR_VERSION;
653682 } else
654- va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n",
683+ va_errorMessage(dpy, "va_getDriverName() failed with %s,driver_name=%s\n",
655684 vaErrorStr(vaStatus), driver_name);
656685
657686 if (driver_name)
--- a/va/va.h
+++ b/va/va.h
@@ -241,19 +241,19 @@ typedef struct _VAMotionVector {
241241 } VAMotionVector;
242242
243243 /** Type of a message callback, used for both error and info log. */
244-typedef void (*vaMessageCallback)(const char *message);
244+typedef void (*VAMessageCallback)(void *user_context, const char *message);
245245
246246 /**
247247 * Set the callback for error messages, or NULL for no logging.
248248 * Returns the previous one, or NULL if it was disabled.
249249 */
250-vaMessageCallback vaSetErrorCallback(vaMessageCallback);
250+VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
251251
252252 /**
253253 * Set the callback for info messages, or NULL for no logging.
254254 * Returns the previous one, or NULL if it was disabled.
255255 */
256-vaMessageCallback vaSetInfoCallback(vaMessageCallback);
256+VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
257257
258258 /**
259259 * Initialization:
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -553,6 +553,11 @@ struct VADisplayContext
553553 void *opaque; /* opaque for display extensions (e.g. GLX) */
554554 void *vatrace; /* opaque for VA trace context */
555555 void *vafool; /* opaque for VA fool context */
556+
557+ VAMessageCallback error_callback;
558+ void *error_callback_user_context;
559+ VAMessageCallback info_callback;
560+ void *info_callback_user_context;
556561 };
557562
558563 typedef VAStatus (*VADriverInit) (
--- a/va/va_fool.c
+++ b/va/va_fool.c
@@ -115,23 +115,23 @@ void va_FoolInit(VADisplay dpy)
115115
116116 if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) {
117117 fool_postp = 1;
118- va_infoMessage("LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n");
118+ va_infoMessage(dpy, "LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n");
119119 }
120120
121121 if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) {
122122 fool_codec |= VA_FOOL_FLAG_DECODE;
123- va_infoMessage("LIBVA_FOOL_DECODE is on, dummy decode\n");
123+ va_infoMessage(dpy, "LIBVA_FOOL_DECODE is on, dummy decode\n");
124124 }
125125 if (va_parseConfig("LIBVA_FOOL_ENCODE", &env_value[0]) == 0) {
126126 fool_codec |= VA_FOOL_FLAG_ENCODE;
127127 fool_ctx->fn_enc = strdup(env_value);
128- va_infoMessage("LIBVA_FOOL_ENCODE is on, load encode data from file with patten %s\n",
128+ va_infoMessage(dpy, "LIBVA_FOOL_ENCODE is on, load encode data from file with patten %s\n",
129129 fool_ctx->fn_enc);
130130 }
131131 if (va_parseConfig("LIBVA_FOOL_JPEG", &env_value[0]) == 0) {
132132 fool_codec |= VA_FOOL_FLAG_JPEG;
133133 fool_ctx->fn_jpg = strdup(env_value);
134- va_infoMessage("LIBVA_FOOL_JPEG is on, load encode data from file with patten %s\n",
134+ va_infoMessage(dpy, "LIBVA_FOOL_JPEG is on, load encode data from file with patten %s\n",
135135 fool_ctx->fn_jpg);
136136 }
137137
@@ -200,9 +200,9 @@ int va_FoolCreateConfig(
200200 fool_ctx->enabled = 1;
201201 }
202202 if (fool_ctx->enabled)
203- va_infoMessage("FOOL is enabled for this context\n");
203+ va_infoMessage(dpy, "FOOL is enabled for this context\n");
204204 else
205- va_infoMessage("FOOL is not enabled for this context\n");
205+ va_infoMessage(dpy, "FOOL is not enabled for this context\n");
206206
207207
208208 return 0; /* continue */
--- a/va/va_internal.h
+++ b/va/va_internal.h
@@ -28,8 +28,8 @@
2828 #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
2929 #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
3030
31-void va_errorMessage(const char *msg, ...);
32-void va_infoMessage(const char *msg, ...);
31+void va_errorMessage(VADisplay dpy, const char *msg, ...);
32+void va_infoMessage(VADisplay dpy, const char *msg, ...);
3333
3434 int va_parseConfig(char *env, char *env_value);
3535
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -162,6 +162,7 @@ struct va_trace {
162162
163163 pthread_mutex_t resource_mutex;
164164 pthread_mutex_t context_mutex;
165+ VADisplay dpy;
165166 };
166167
167168 #define LOCK_RESOURCE(pva_trace) \
@@ -392,7 +393,7 @@ static void add_trace_buf_info(
392393 }
393394
394395 if(i >= MAX_TRACE_BUF_INFO_HASH_LEVEL)
395- va_errorMessage("Add buf info failed\n");
396+ va_errorMessage(pva_trace->dpy, "Add buf info failed\n");
396397
397398 UNLOCK_RESOURCE(pva_trace);
398399 }
@@ -581,7 +582,7 @@ static int open_tracing_log_file(
581582 int new_fn_flag = 0;
582583
583584 if(plog_file->used && plog_file->thread_id != thd_id) {
584- va_errorMessage("Try to open a busy log file occupied by other thread\n");
585+ va_errorMessage(pva_trace->dpy, "Try to open a busy log file occupied by other thread\n");
585586
586587 return -1;
587588 }
@@ -757,7 +758,7 @@ void va_TraceInit(VADisplay dpy)
757758 if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
758759 trace_flag |= VA_TRACE_FLAG_BUFDATA;
759760
760- va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
761+ va_infoMessage(dpy, "LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
761762 }
762763
763764 /* per-context setting */
@@ -793,7 +794,7 @@ void va_TraceInit(VADisplay dpy)
793794 p = q+1; /* skip "+" */
794795 trace_ctx->trace_surface_yoff = strtod(p, &q);
795796
796- va_infoMessage("LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
797+ va_infoMessage(dpy, "LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
797798 trace_ctx->trace_surface_width,
798799 trace_ctx->trace_surface_height,
799800 trace_ctx->trace_surface_xoff,
@@ -808,6 +809,7 @@ void va_TraceInit(VADisplay dpy)
808809 pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM] = trace_ctx;
809810
810811 ((VADisplayContextP)dpy)->vatrace = (void *)pva_trace;
812+ pva_trace->dpy = dpy;
811813
812814 if(!trace_flag)
813815 va_TraceEnd(dpy);
@@ -1291,7 +1293,7 @@ void va_TraceCreateContext(
12911293 if(!context
12921294 || *context == VA_INVALID_ID
12931295 || !pva_trace) {
1294- va_errorMessage("Invalid context id 0x%08x\n",
1296+ va_errorMessage(dpy, "Invalid context id 0x%08x\n",
12951297 context == NULL ? 0 : (int)*context);
12961298 return;
12971299 }
@@ -1300,7 +1302,7 @@ void va_TraceCreateContext(
13001302
13011303 tra_ctx_id = get_free_ctx_idx(pva_trace, *context);
13021304 if(tra_ctx_id >= MAX_TRACE_CTX_NUM) {
1303- va_errorMessage("Can't get trace context for ctx 0x%08x\n",
1305+ va_errorMessage(dpy, "Can't get trace context for ctx 0x%08x\n",
13041306 *context);
13051307
13061308 goto FAIL;
@@ -1308,7 +1310,7 @@ void va_TraceCreateContext(
13081310
13091311 trace_ctx = calloc(sizeof(struct trace_context), 1);
13101312 if(trace_ctx == NULL) {
1311- va_errorMessage("Allocate trace context failed for ctx 0x%08x\n",
1313+ va_errorMessage(dpy, "Allocate trace context failed for ctx 0x%08x\n",
13121314 *context);
13131315
13141316 goto FAIL;
@@ -1316,7 +1318,7 @@ void va_TraceCreateContext(
13161318
13171319 i = get_valid_config_idx(pva_trace, config_id);
13181320 if(i >= MAX_TRACE_CTX_NUM) {
1319- va_errorMessage("Can't get trace config id for ctx 0x%08x cfg %x\n",
1321+ va_errorMessage(dpy, "Can't get trace config id for ctx 0x%08x cfg %x\n",
13201322 *context, config_id);
13211323
13221324 goto FAIL;
@@ -1327,13 +1329,13 @@ void va_TraceCreateContext(
13271329 if(trace_flag & VA_TRACE_FLAG_LOG) {
13281330 trace_ctx->plog_file = start_tracing2log_file(pva_trace);
13291331 if(!trace_ctx->plog_file) {
1330- va_errorMessage("Can't get trace log file for ctx 0x%08x\n",
1332+ va_errorMessage(dpy, "Can't get trace log file for ctx 0x%08x\n",
13311333 *context);
13321334
13331335 goto FAIL;
13341336 }
13351337 else
1336- va_infoMessage("Save context 0x%08x into log file %s\n", *context,
1338+ va_infoMessage(dpy, "Save context 0x%08x into log file %s\n", *context,
13371339 trace_ctx->plog_file->fn_log);
13381340
13391341 trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
@@ -1373,7 +1375,7 @@ void va_TraceCreateContext(
13731375 (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
13741376 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
13751377 if(open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
1376- va_errorMessage("Open surface fail failed for ctx 0x%08x\n", *context);
1378+ va_errorMessage(dpy, "Open surface fail failed for ctx 0x%08x\n", *context);
13771379
13781380 trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
13791381 }
@@ -1381,7 +1383,7 @@ void va_TraceCreateContext(
13811383
13821384 if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
13831385 if(open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) {
1384- va_errorMessage("Open codedbuf fail failed for ctx 0x%08x\n", *context);
1386+ va_errorMessage(dpy, "Open codedbuf fail failed for ctx 0x%08x\n", *context);
13851387
13861388 trace_flag &= ~(VA_TRACE_FLAG_CODEDBUF);
13871389 }