• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

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

hardware/intel/common/libva


コミットメタ情報

リビジョン4cb1712312be9d852b71bdf4da5eadbb1dc1adc6 (tree)
日時2017-09-28 13:15:05
作者Xiang, Haihao <haihao.xiang@inte...>
コミッターXiang, Haihao

ログメッセージ

Fix segmentation fault in VA tracer

The first parameter of va_{error,info}Message is VADisplay

This fixes https://github.com/01org/libva/issues/123

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>

変更サマリ

差分

--- a/va/va_fool.c
+++ b/va/va_fool.c
@@ -262,7 +262,7 @@ VAStatus va_FoolBufferInfo(
262262 return 1; /* fool is valid */
263263 }
264264
265-static int va_FoolFillCodedBufEnc(struct fool_context *fool_ctx)
265+static int va_FoolFillCodedBufEnc(VADisplay dpy, struct fool_context *fool_ctx)
266266 {
267267 char file_name[1024];
268268 struct stat file_stat = {0};
@@ -287,10 +287,10 @@ static int va_FoolFillCodedBufEnc(struct fool_context *fool_ctx)
287287 fool_ctx->segbuf_enc = realloc(fool_ctx->segbuf_enc, file_stat.st_size);
288288 ret = read(fd, fool_ctx->segbuf_enc, file_stat.st_size);
289289 if (ret < file_stat.st_size)
290- va_errorMessage("Reading file %s failed.\n", file_name);
290+ va_errorMessage(dpy, "Reading file %s failed.\n", file_name);
291291 close(fd);
292292 } else
293- va_errorMessage("Open file %s failed:%s\n", file_name, strerror(errno));
293+ va_errorMessage(dpy, "Open file %s failed:%s\n", file_name, strerror(errno));
294294
295295 codedbuf = (VACodedBufferSegment *)fool_ctx->fool_buf[VAEncCodedBufferType];
296296 codedbuf->size = file_stat.st_size;
@@ -303,7 +303,7 @@ static int va_FoolFillCodedBufEnc(struct fool_context *fool_ctx)
303303 return 0;
304304 }
305305
306-static int va_FoolFillCodedBufJPG(struct fool_context *fool_ctx)
306+static int va_FoolFillCodedBufJPG(VADisplay dpy, struct fool_context *fool_ctx)
307307 {
308308 struct stat file_stat = {0};
309309 VACodedBufferSegment *codedbuf;
@@ -315,10 +315,10 @@ static int va_FoolFillCodedBufJPG(struct fool_context *fool_ctx)
315315 fool_ctx->segbuf_jpg = realloc(fool_ctx->segbuf_jpg, file_stat.st_size);
316316 ret = read(fd, fool_ctx->segbuf_jpg, file_stat.st_size);
317317 if (ret < file_stat.st_size)
318- va_errorMessage("Reading file %s failed.\n", fool_ctx->fn_jpg);
318+ va_errorMessage(dpy, "Reading file %s failed.\n", fool_ctx->fn_jpg);
319319 close(fd);
320320 } else
321- va_errorMessage("Open file %s failed:%s\n", fool_ctx->fn_jpg, strerror(errno));
321+ va_errorMessage(dpy, "Open file %s failed:%s\n", fool_ctx->fn_jpg, strerror(errno));
322322
323323 codedbuf = (VACodedBufferSegment *)fool_ctx->fool_buf[VAEncCodedBufferType];
324324 codedbuf->size = file_stat.st_size;
@@ -332,12 +332,12 @@ static int va_FoolFillCodedBufJPG(struct fool_context *fool_ctx)
332332 }
333333
334334
335-static int va_FoolFillCodedBuf(struct fool_context *fool_ctx)
335+static int va_FoolFillCodedBuf(VADisplay dpy, struct fool_context *fool_ctx)
336336 {
337337 if (fool_ctx->entrypoint == VAEntrypointEncSlice)
338- va_FoolFillCodedBufEnc(fool_ctx);
338+ va_FoolFillCodedBufEnc(dpy, fool_ctx);
339339 else if (fool_ctx->entrypoint == VAEntrypointEncPicture)
340- va_FoolFillCodedBufJPG(fool_ctx);
340+ va_FoolFillCodedBufJPG(dpy, fool_ctx);
341341
342342 return 0;
343343 }
@@ -361,7 +361,7 @@ VAStatus va_FoolMapBuffer(
361361
362362 /* it is coded buffer, fill coded segment from file */
363363 if (*pbuf && (buftype == VAEncCodedBufferType))
364- va_FoolFillCodedBuf(fool_ctx);
364+ va_FoolFillCodedBuf(dpy, fool_ctx);
365365
366366 return 1; /* fool is valid */
367367 }
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -561,13 +561,13 @@ static int open_tracing_specil_file(
561561 if(type == 0) {
562562 ptra_ctx->trace_codedbuf_fn = fn_env;
563563 ptra_ctx->trace_fp_codedbuf = fp;
564- va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
564+ va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
565565 fn_env);
566566 }
567567 else {
568568 ptra_ctx->trace_surface_fn = fn_env;
569569 ptra_ctx->trace_fp_surface = fp;
570- va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
570+ va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_SURFACE is on, save surface into %s\n",
571571 fn_env);
572572 }
573573
@@ -615,7 +615,7 @@ static int open_tracing_log_file(
615615 if(!pfp)
616616 goto FAIL;
617617
618- va_infoMessage("%s %s for the thread 0x%08x\n",
618+ va_infoMessage(pva_trace->dpy, "%s %s for the thread 0x%08x\n",
619619 new_fn_flag ? "Open new log file" : "Append to log file",
620620 plog_file->fn_log, thd_id);
621621
@@ -741,6 +741,8 @@ void va_TraceInit(VADisplay dpy)
741741 return;
742742 }
743743
744+ pva_trace->dpy = dpy;
745+
744746 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
745747 pva_trace->fn_log_env = strdup(env_value);
746748 trace_ctx->plog_file = start_tracing2log_file(pva_trace);
@@ -748,11 +750,11 @@ void va_TraceInit(VADisplay dpy)
748750 trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
749751 va_trace_flag = VA_TRACE_FLAG_LOG;
750752
751- va_infoMessage("LIBVA_TRACE is on, save log into %s\n",
753+ va_infoMessage(dpy, "LIBVA_TRACE is on, save log into %s\n",
752754 trace_ctx->plog_file->fn_log);
753755 }
754756 else
755- va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
757+ va_errorMessage(dpy, "Open file %s failed (%s)\n", env_value, strerror(errno));
756758 }
757759
758760 /* may re-get the global settings for multiple context */
@@ -810,7 +812,6 @@ void va_TraceInit(VADisplay dpy)
810812 pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM] = trace_ctx;
811813
812814 ((VADisplayContextP)dpy)->vatrace = (void *)pva_trace;
813- pva_trace->dpy = dpy;
814815
815816 if(!va_trace_flag)
816817 va_TraceEnd(dpy);
@@ -882,6 +883,7 @@ void va_TraceEnd(VADisplay dpy)
882883 }
883884 free(pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM]);
884885
886+ pva_trace->dpy = NULL;
885887 free(pva_trace);
886888 ((VADisplayContextP)dpy)->vatrace = NULL;
887889 }