[Libva] [PATCH V1][libva] optimize the coding style of va_trace.c

peng.chen peng.c.chen at intel.com
Thu Jun 16 06:51:47 UTC 2016


changes:
    if( --> if (
    for( --> for (

Signed-off-by: peng.chen <peng.c.chen at intel.com>
---
 va/va_trace.c | 258 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 129 insertions(+), 129 deletions(-)
 mode change 100644 => 100755 va/va_trace.c

diff --git a/va/va_trace.c b/va/va_trace.c
old mode 100644
new mode 100755
index 4e1b8e8..6db4dc7
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -164,19 +164,19 @@ struct va_trace {
 };
 
 #define LOCK_RESOURCE(pva_trace)                                    \
-    if(pva_trace)                                                   \
+    if (pva_trace)                                                  \
         pthread_mutex_lock(&pva_trace->resource_mutex)
 
 #define UNLOCK_RESOURCE(pva_trace)                                  \
-    if(pva_trace)                                                   \
+    if (pva_trace)                                                  \
         pthread_mutex_unlock(&pva_trace->resource_mutex)
 
 #define LOCK_CONTEXT(pva_trace)                                     \
-        if(pva_trace)                                               \
+        if (pva_trace)                                              \
             pthread_mutex_lock(&pva_trace->context_mutex)
 
 #define UNLOCK_CONTEXT(pva_trace)                                   \
-        if(pva_trace)                                               \
+        if (pva_trace)                                              \
             pthread_mutex_unlock(&pva_trace->context_mutex)
 
 #define DPY2TRACECTX(dpy, context, buf_id)                                  \
@@ -185,11 +185,11 @@ struct va_trace {
     int ctx_id = context;                                                   \
                                                                             \
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);     \
-    if(!pva_trace)                                                          \
+    if (!pva_trace)                                                         \
         return;                                                             \
                                                                             \
-    if(ctx_id == VA_INVALID_ID) {                                           \
-        if(buf_id != VA_INVALID_ID)                                         \
+    if (ctx_id == VA_INVALID_ID) {                                          \
+        if (buf_id != VA_INVALID_ID)                                        \
             ctx_id = get_ctx_by_buf(pva_trace, buf_id);                     \
         else                                                                \
             return;                                                         \
@@ -197,11 +197,11 @@ struct va_trace {
                                                                             \
     if (ctx_id != VA_INVALID_ID) {                                          \
         int temp_idx = get_valid_ctx_idx(pva_trace, ctx_id);                \
-        if(temp_idx < MAX_TRACE_CTX_NUM)                                    \
+        if (temp_idx < MAX_TRACE_CTX_NUM)                                   \
             trace_ctx = pva_trace->ptra_ctx[temp_idx];                      \
     }                                                                       \
                                                                             \
-    if(!trace_ctx                                                           \
+    if (!trace_ctx                                                          \
         || trace_ctx->trace_context != context) {                           \
         return;                                                             \
     }                                                                       \
@@ -212,12 +212,12 @@ struct va_trace {
     struct trace_context *trace_ctx = NULL;                                 \
                                                                             \
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);     \
-    if(!pva_trace)                                                          \
+    if (!pva_trace)                                                         \
         return;                                                             \
                                                                             \
     LOCK_CONTEXT(pva_trace);                                                \
     trace_ctx = pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM];                     \
-    if(!trace_ctx) {                                                        \
+    if (!trace_ctx) {                                                       \
         UNLOCK_CONTEXT(pva_trace);                                          \
         return;                                                             \
     }                                                                       \
@@ -277,7 +277,7 @@ static int get_valid_config_idx(
 
     pconfig_info = pva_trace->config_info;
     idx = config_id & TRACE_CTX_ID_MASK;
-    if(!pconfig_info[idx].valid
+    if (!pconfig_info[idx].valid
         || pconfig_info[idx].config_id != config_id)
         idx = MAX_TRACE_CTX_NUM;
 
@@ -300,7 +300,7 @@ static void add_trace_config_info(
 
     idx = config_id & TRACE_CTX_ID_MASK;
     pconfig_info = &pva_trace->config_info[idx];
-    if(!pconfig_info->valid ||
+    if (!pconfig_info->valid ||
         pconfig_info->config_id == config_id) {
         pconfig_info->valid = 1;
         pconfig_info->config_id = config_id;
@@ -324,7 +324,7 @@ static void delete_trace_config_info(
 
     idx = config_id & TRACE_CTX_ID_MASK;
     pconfig_info = &pva_trace->config_info[idx];
-    if(pconfig_info->valid &&
+    if (pconfig_info->valid &&
 		pconfig_info->config_id == config_id &&
 		pconfig_info->created_thd_id == thd_id) {
         pconfig_info->valid = 0;
@@ -345,12 +345,12 @@ static VAContextID get_ctx_by_buf(
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info)
+        if (!pbuf_info)
             break;
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id == buf_id) {
             context = pbuf_info[idx].ctx_id;
             break;
@@ -374,19 +374,19 @@ static void add_trace_buf_info(
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info) {
+        if (!pbuf_info) {
             pbuf_info = (struct trace_buf_info *)calloc(
                 sizeof(struct trace_buf_info) * MAX_TRACE_BUF_INFO_HASH_SIZE,
                 1);
-            if(!pbuf_info)
+            if (!pbuf_info)
                 break;
 
             pbuf_mgr->pbuf_info[i] = pbuf_info;
         }
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id != buf_id)
             continue;
 
@@ -396,7 +396,7 @@ static void add_trace_buf_info(
         break;
     }
 
-    if(i >= MAX_TRACE_BUF_INFO_HASH_LEVEL)
+    if (i >= MAX_TRACE_BUF_INFO_HASH_LEVEL)
         va_errorMessage("Add buf info failed\n");
 
     UNLOCK_RESOURCE(pva_trace);
@@ -413,12 +413,12 @@ static void delete_trace_buf_info(
     LOCK_RESOURCE(pva_trace);
 
     idx = buf_id & TRACE_BUF_INFO_HASH_ID_MASK;
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info)
+        if (!pbuf_info)
             break;
 
-        if(pbuf_info[idx].valid
+        if (pbuf_info[idx].valid
             && pbuf_info[idx].buf_id == buf_id) {
             pbuf_info[idx].valid = 0;
             break;
@@ -439,13 +439,13 @@ static void delete_trace_all_context_buf(
 
     LOCK_RESOURCE(pva_trace);
 
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
+    for (i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++) {
         pbuf_info = pbuf_mgr->pbuf_info[i];
-        if(!pbuf_info)
+        if (!pbuf_info)
             break;
 
-        for(j = 0;j < MAX_TRACE_BUF_INFO_HASH_SIZE;j++)
-            if(pbuf_info[j].valid
+        for (j = 0;j < MAX_TRACE_BUF_INFO_HASH_SIZE;j++)
+            if (pbuf_info[j].valid
                 && pbuf_info[j].ctx_id == context)
                 pbuf_info[j].valid = 0;
     }
@@ -464,7 +464,7 @@ static int get_free_ctx_idx(
     LOCK_RESOURCE(pva_trace);
 
     i = context & TRACE_CTX_ID_MASK;
-    if(!pva_trace->ptra_ctx[i]
+    if (!pva_trace->ptra_ctx[i]
         || pva_trace->ptra_ctx[i]->trace_context == context)
         idx = i;
 
@@ -483,7 +483,7 @@ static int get_valid_ctx_idx(
     LOCK_RESOURCE(pva_trace);
 
     i = context & TRACE_CTX_ID_MASK;
-    if(pva_trace->ptra_ctx[i]
+    if (pva_trace->ptra_ctx[i]
         && pva_trace->ptra_ctx[i]->trace_context == context)
         idx = i;
 
@@ -506,10 +506,10 @@ static void FILE_NAME_SUFFIX(
     if (suffix_str)
         strlen(suffix_str);
 
-    if(left < (size + 8 + 10))
+    if (left < (size + 8 + 10))
         return;
 
-    if(gettimeofday(&tv, NULL) == 0) {
+    if (gettimeofday(&tv, NULL) == 0) {
         sprintf(env_value + tmp,
             ".%02d%02d%02d.",
             (unsigned int)(tv.tv_sec/3600)%24,
@@ -520,7 +520,7 @@ static void FILE_NAME_SUFFIX(
         left -= 8;
     }
 
-    if(suffix_str) {
+    if (suffix_str) {
         strcat(env_value + tmp,
             suffix_str);
 
@@ -528,7 +528,7 @@ static void FILE_NAME_SUFFIX(
         left -= size;
     }
 
-    if(suffix_handle) {
+    if (suffix_handle) {
         sprintf(env_value + tmp,
             "0x%08x",
             suffix_handle);
@@ -550,17 +550,17 @@ static int open_tracing_specil_file(
         "ctx-", (unsigned int)ptra_ctx->trace_context);
 
     fn_env = strdup(env_value);
-    if(!fn_env)
+    if (!fn_env)
         return -1;
 
     fp = fopen(fn_env, "w");
-    if(!fp) {
+    if (!fp) {
         free(fn_env);
 
         return -1;
     }
 
-    if(type == 0) {
+    if (type == 0) {
         ptra_ctx->trace_codedbuf_fn = fn_env;
         ptra_ctx->trace_fp_codedbuf = fp;
         va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
@@ -584,36 +584,36 @@ static int open_tracing_log_file(
     FILE *pfp = NULL;
     int new_fn_flag = 0;
 
-    if(plog_file->used && plog_file->thread_id != thd_id) {
+    if (plog_file->used && plog_file->thread_id != thd_id) {
         va_errorMessage("Try to open a busy log file occupied by other thread\n");
 
         return -1;
     }
 
-    if(plog_file->thread_id != thd_id) {
+    if (plog_file->thread_id != thd_id) {
         char env_value[1024];
 
         strncpy(env_value, pva_trace->fn_log_env, 1024);
         FILE_NAME_SUFFIX(env_value, 1024,
             "thd-", (unsigned int)thd_id);
 
-        if(plog_file->fn_log)
+        if (plog_file->fn_log)
             free(plog_file->fn_log);
 
         plog_file->fn_log = strdup(env_value);
-        if(!plog_file->fn_log)
+        if (!plog_file->fn_log)
             goto FAIL;
 
         new_fn_flag = 1;
     }
 
-    if(!plog_file->used) {
-        if(new_fn_flag)
+    if (!plog_file->used) {
+        if (new_fn_flag)
             pfp = fopen(plog_file->fn_log, "w");
         else
             pfp = fopen(plog_file->fn_log, "a");
 
-        if(!pfp)
+        if (!pfp)
             goto FAIL;
 
         va_infoMessage("%s %s for the thread 0x%08x\n",
@@ -628,7 +628,7 @@ static int open_tracing_log_file(
     return 0;
 
 FAIL:
-    if(plog_file->fn_log) {
+    if (plog_file->fn_log) {
         free(plog_file->fn_log);
         plog_file->fn_log = NULL;
     }
@@ -644,15 +644,15 @@ static int get_log_file_idx_by_thd(
     int first_free_idx = MAX_TRACE_THREAD_NUM;
     int i = 0;
 
-    for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
-        if(plog_file[i].thread_id == thd_id)
+    for (i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
+        if (plog_file[i].thread_id == thd_id)
             break;
-        else if(!plog_file[i].used &&
+        else if (!plog_file[i].used &&
             first_free_idx >= MAX_TRACE_THREAD_NUM)
             first_free_idx = i;
     }
 
-    if(i >= MAX_TRACE_THREAD_NUM)
+    if (i >= MAX_TRACE_THREAD_NUM)
         i = first_free_idx;
 
     return i;
@@ -670,9 +670,9 @@ static struct trace_log_file *start_tracing2log_file(
 
     plog_files_mgr = &pva_trace->log_files_manager;
     i = get_log_file_idx_by_thd(plog_files_mgr, thd_id);
-    if(i < MAX_TRACE_THREAD_NUM) {
+    if (i < MAX_TRACE_THREAD_NUM) {
         plog_file = &plog_files_mgr->log_file[i];
-        if(open_tracing_log_file(pva_trace, plog_file, thd_id) < 0) {
+        if (open_tracing_log_file(pva_trace, plog_file, thd_id) < 0) {
             plog_file = NULL;
         }
     }
@@ -687,8 +687,8 @@ static void stop_tracing2log_file(
 {
     LOCK_RESOURCE(pva_trace);
 
-    if(--plog_file->used <= 0) {
-        if(plog_file->fp_log) {
+    if (--plog_file->used <= 0) {
+        if (plog_file->fp_log) {
             fclose(plog_file->fp_log);
             plog_file->fp_log = NULL;
         }
@@ -706,23 +706,23 @@ static void refresh_log_file(
     int i = 0;
 
     plog_file = ptra_ctx->plog_file;
-    if(plog_file && plog_file->thread_id != thd_id) {
+    if (plog_file && plog_file->thread_id != thd_id) {
         plog_file = start_tracing2log_file(pva_trace);
-        if(plog_file) {
+        if (plog_file) {
             int first_free_idx = -1;
 
             ptra_ctx->plog_file = plog_file;
 
-            for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
-                if(!ptra_ctx->plog_file_list[i]){
-                    if(first_free_idx < 0)
+            for (i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
+                if (!ptra_ctx->plog_file_list[i]){
+                    if (first_free_idx < 0)
                         first_free_idx = i;
                 }
-                else if(ptra_ctx->plog_file_list[i]->thread_id == thd_id)
+                else if (ptra_ctx->plog_file_list[i]->thread_id == thd_id)
                     break;
             }
 
-            if(i > MAX_TRACE_THREAD_NUM
+            if (i > MAX_TRACE_THREAD_NUM
                 && first_free_idx >= 0)
                 ptra_ctx->plog_file_list[first_free_idx] = plog_file;
         }
@@ -748,7 +748,7 @@ void va_TraceInit(VADisplay dpy)
     if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
         pva_trace->fn_log_env = strdup(env_value);
         trace_ctx->plog_file = start_tracing2log_file(pva_trace);
-        if(trace_ctx->plog_file) {
+        if (trace_ctx->plog_file) {
             trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
             trace_flag = VA_TRACE_FLAG_LOG;
 
@@ -815,7 +815,7 @@ void va_TraceInit(VADisplay dpy)
 
     ((VADisplayContextP)dpy)->vatrace = (void *)pva_trace;
 
-    if(!trace_flag)
+    if (!trace_flag)
         va_TraceEnd(dpy);
 }
 
@@ -825,58 +825,58 @@ void va_TraceEnd(VADisplay dpy)
     int i = 0, j = 0;
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
-    if(!pva_trace)
+    if (!pva_trace)
         return;
 
-    if(pva_trace->fn_log_env)
+    if (pva_trace->fn_log_env)
         free(pva_trace->fn_log_env);
 
-    if(pva_trace->fn_codedbuf_env)
+    if (pva_trace->fn_codedbuf_env)
         free(pva_trace->fn_codedbuf_env);
 
-    if(pva_trace->fn_surface_env)
+    if (pva_trace->fn_surface_env)
         free(pva_trace->fn_surface_env);
 
-    for(i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++)
-        if(pva_trace->buf_manager.pbuf_info[i])
+    for (i = 0;i < MAX_TRACE_BUF_INFO_HASH_LEVEL;i++)
+        if (pva_trace->buf_manager.pbuf_info[i])
             free(pva_trace->buf_manager.pbuf_info[i]);
 
-    for(i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
+    for (i = 0;i < MAX_TRACE_THREAD_NUM;i++) {
         struct trace_log_file *plog_file = NULL;
 
-        if(pva_trace->log_files_manager.num <= 0)
+        if (pva_trace->log_files_manager.num <= 0)
             break;
 
         plog_file = &pva_trace->log_files_manager.log_file[i];
-        if(plog_file) {
-            if(plog_file->fn_log)
+        if (plog_file) {
+            if (plog_file->fn_log)
                 free(plog_file->fn_log);
 
-            if(plog_file->fp_log)
+            if (plog_file->fp_log)
                 fclose(plog_file->fp_log);
 
             pva_trace->log_files_manager.num--;
         }
     }
 
-    for(i = 0;i < MAX_TRACE_CTX_NUM;i++) {
+    for (i = 0;i < MAX_TRACE_CTX_NUM;i++) {
         struct trace_context *trace_ctx = NULL;
 
-        if(pva_trace->context_num <= 0)
+        if (pva_trace->context_num <= 0)
             break;
 
         trace_ctx = pva_trace->ptra_ctx[i];
-        if(trace_ctx) {
-            if(trace_ctx->trace_codedbuf_fn)
+        if (trace_ctx) {
+            if (trace_ctx->trace_codedbuf_fn)
                 free(trace_ctx->trace_codedbuf_fn);
 
-            if(trace_ctx->trace_fp_codedbuf)
+            if (trace_ctx->trace_fp_codedbuf)
                 fclose(trace_ctx->trace_fp_codedbuf);
 
-            if(trace_ctx->trace_surface_fn)
+            if (trace_ctx->trace_surface_fn)
                 free(trace_ctx->trace_surface_fn);
 
-            if(trace_ctx->trace_fp_surface)
+            if (trace_ctx->trace_fp_surface)
                 fclose(trace_ctx->trace_fp_surface);
 
             free(pva_trace->ptra_ctx[i]);
@@ -926,7 +926,7 @@ static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
         va_TracePrint(trace_ctx, "[%04d.%06d]",
             (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
 
-    if(trace_ctx->trace_context != VA_INVALID_ID)
+    if (trace_ctx->trace_context != VA_INVALID_ID)
         va_TracePrint(trace_ctx,
             "[ctx 0x%08x]", trace_ctx->trace_context);
     else
@@ -1228,14 +1228,14 @@ static void internal_TraceUpdateContext (
     int i = 0, delete = 1;
     pid_t thd_id = syscall(__NR_gettid);
 
-    if(tra_ctx_idx >= MAX_TRACE_CTX_NUM)
+    if (tra_ctx_idx >= MAX_TRACE_CTX_NUM)
         return;
 
     LOCK_RESOURCE(pva_trace);
 
     trace_ctx = pva_trace->ptra_ctx[tra_ctx_idx];
-    if(trace_ctx) {
-        if(!new_trace_ctx &&
+    if (trace_ctx) {
+        if (!new_trace_ctx &&
             trace_ctx->created_thd_id != thd_id
             && !destroy_flag) {
             delete = 0;
@@ -1246,7 +1246,7 @@ static void internal_TraceUpdateContext (
         }
     }
 
-    if(new_trace_ctx) {
+    if (new_trace_ctx) {
         new_trace_ctx->created_thd_id = thd_id;
         pva_trace->ptra_ctx[tra_ctx_idx] = new_trace_ctx;
         pva_trace->context_num++;
@@ -1254,21 +1254,21 @@ static void internal_TraceUpdateContext (
 
     UNLOCK_RESOURCE(pva_trace);
 
-    if(trace_ctx && delete) {
-        for(i = 0;i < MAX_TRACE_THREAD_NUM;i++)
-            if(trace_ctx->plog_file_list[i])
+    if (trace_ctx && delete) {
+        for (i = 0;i < MAX_TRACE_THREAD_NUM;i++)
+            if (trace_ctx->plog_file_list[i])
                 stop_tracing2log_file(pva_trace, trace_ctx->plog_file_list[i]);
 
-        if(trace_ctx->trace_codedbuf_fn)
+        if (trace_ctx->trace_codedbuf_fn)
             free(trace_ctx->trace_codedbuf_fn);
 
-        if(trace_ctx->trace_fp_codedbuf)
+        if (trace_ctx->trace_fp_codedbuf)
             fclose(trace_ctx->trace_fp_codedbuf);
 
-        if(trace_ctx->trace_surface_fn)
+        if (trace_ctx->trace_surface_fn)
             free(trace_ctx->trace_surface_fn);
 
-        if(trace_ctx->trace_fp_surface)
+        if (trace_ctx->trace_fp_surface)
             fclose(trace_ctx->trace_fp_surface);
 
         //delete_trace_all_context_buf(pva_trace, context);
@@ -1295,7 +1295,7 @@ void va_TraceCreateContext(
     int i;
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
-    if(!context
+    if (!context
         || *context == VA_INVALID_ID
         || !pva_trace) {
         va_errorMessage("Invalid context id 0x%08x\n",
@@ -1306,7 +1306,7 @@ void va_TraceCreateContext(
     LOCK_CONTEXT(pva_trace);
 
     tra_ctx_id = get_free_ctx_idx(pva_trace, *context);
-    if(tra_ctx_id >= MAX_TRACE_CTX_NUM) {
+    if (tra_ctx_id >= MAX_TRACE_CTX_NUM) {
         va_errorMessage("Can't get trace context for ctx 0x%08x\n",
                 *context);
         
@@ -1314,7 +1314,7 @@ void va_TraceCreateContext(
     }
 
     trace_ctx = calloc(sizeof(struct trace_context), 1);
-    if(trace_ctx == NULL) {
+    if (trace_ctx == NULL) {
         va_errorMessage("Allocate trace context failed for ctx 0x%08x\n",
                 *context);
         
@@ -1322,7 +1322,7 @@ void va_TraceCreateContext(
     }
 
     i = get_valid_config_idx(pva_trace, config_id);
-    if(i >= MAX_TRACE_CTX_NUM) {
+    if (i >= MAX_TRACE_CTX_NUM) {
         va_errorMessage("Can't get trace config id for ctx 0x%08x cfg %x\n",
                 *context, config_id);
 
@@ -1331,9 +1331,9 @@ void va_TraceCreateContext(
     trace_ctx->trace_profile = pva_trace->config_info[i].trace_profile;
     trace_ctx->trace_entrypoint = pva_trace->config_info[i].trace_entrypoint;
 
-    if(trace_flag & VA_TRACE_FLAG_LOG) {
+    if (trace_flag & VA_TRACE_FLAG_LOG) {
         trace_ctx->plog_file = start_tracing2log_file(pva_trace);
-        if(!trace_ctx->plog_file) {
+        if (!trace_ctx->plog_file) {
             va_errorMessage("Can't get trace log file for ctx 0x%08x\n",
                     *context);
 
@@ -1379,7 +1379,7 @@ void va_TraceCreateContext(
     if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
         (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
         (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
-        if(open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
+        if (open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
             va_errorMessage("Open surface fail failed for ctx 0x%08x\n", *context);
 
             trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
@@ -1387,7 +1387,7 @@ void va_TraceCreateContext(
     }
 
     if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
-        if(open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) {
+        if (open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) {
             va_errorMessage("Open codedbuf fail failed for ctx 0x%08x\n", *context);
 
             trace_flag &= ~(VA_TRACE_FLAG_CODEDBUF);
@@ -1404,7 +1404,7 @@ FAIL:
 
     UNLOCK_CONTEXT(pva_trace);
 
-    if(trace_ctx)
+    if (trace_ctx)
         free(trace_ctx);
 }
 
@@ -1419,16 +1419,16 @@ void va_TraceDestroyContext (
 
     pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
 
-    if(!pva_trace)
+    if (!pva_trace)
         return;
 
     LOCK_CONTEXT(pva_trace);
 
     ctx_id = get_valid_ctx_idx(pva_trace, context);
-    if(ctx_id < MAX_TRACE_CTX_NUM) {
+    if (ctx_id < MAX_TRACE_CTX_NUM) {
         trace_ctx = pva_trace->ptra_ctx[ctx_id];
 
-        if(trace_ctx) {
+        if (trace_ctx) {
             refresh_log_file(pva_trace, trace_ctx);
 
             internal_TraceUpdateContext(pva_trace,
@@ -1663,7 +1663,7 @@ static void va_TraceVABuffers(
     
     va_TracePrint(trace_ctx, "--%s\n", buffer_type_to_string(type));
 
-    if(trace_ctx->plog_file)
+    if (trace_ctx->plog_file)
         fp = trace_ctx->plog_file->fp_log;
 
     if ((trace_flag & VA_TRACE_FLAG_BUFDATA) && fp) {
@@ -1945,12 +1945,12 @@ static void va_TraceVAPictureParameterBufferMPEG4(
     va_TraceMsg(trace_ctx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
     va_TraceMsg(trace_ctx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
     va_TraceMsg(trace_ctx,"\tsprite_trajectory_du =");
-    for(i=0;i<3;i++)
+    for (i=0;i<3;i++)
         va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_du[i]);
 
     va_TraceMsg(trace_ctx,"\n");
     va_TraceMsg(trace_ctx,"\tsprite_trajectory_dv =");
-    for(i=0;i<3;i++)
+    for (i=0;i<3;i++)
         va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_dv[i]);
     va_TraceMsg(trace_ctx,"\n");
     va_TraceMsg(trace_ctx,"\tvop_fields value = %d\n", p->vop_fields.value);
@@ -1990,11 +1990,11 @@ static void va_TraceVAIQMatrixBufferMPEG4(
     va_TraceMsg(trace_ctx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
     va_TraceMsg(trace_ctx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
     va_TraceMsg(trace_ctx,"\tintra_quant_mat =\n");
-    for(i=0;i<64;i++)
+    for (i=0;i<64;i++)
         va_TraceMsg(trace_ctx,"\t\t%d\n", p->intra_quant_mat[i]);
 
     va_TraceMsg(trace_ctx,"\tnon_intra_quant_mat =\n");
-    for(i=0;i<64;i++)
+    for (i=0;i<64;i++)
         va_TraceMsg(trace_ctx,"\t\t%d\n", p->non_intra_quant_mat[i]);
     va_TraceMsg(trace_ctx, NULL);
 
@@ -2402,7 +2402,7 @@ static void va_TraceVAEncSequenceParameterBufferHEVC(
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncSequenceParameterBufferHEVC\n");
@@ -2475,7 +2475,7 @@ static void va_TraceVAEncPictureParameterBufferHEVC(
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncPictureParameterBufferHEVC\n");
@@ -2484,7 +2484,7 @@ static void va_TraceVAEncPictureParameterBufferHEVC(
     va_TraceMsg(trace_ctx, "\tdecoded_curr_pic.pic_order_cnt = %d\n", p->decoded_curr_pic.pic_order_cnt);
     va_TraceMsg(trace_ctx, "\tdecoded_curr_pic.flags = %d\n", p->decoded_curr_pic.flags);
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\treference_frames[%d].picture_id = %d\n", i, p->reference_frames[i].picture_id);
         va_TraceMsg(trace_ctx, "\treference_frames[%d].pic_order_cnt = %d\n", i, p->reference_frames[i].pic_order_cnt);
@@ -2501,12 +2501,12 @@ static void va_TraceVAEncPictureParameterBufferHEVC(
     va_TraceMsg(trace_ctx, "\tnum_tile_columns_minus1 = %d\n", p->num_tile_columns_minus1);
     va_TraceMsg(trace_ctx, "\tnum_tile_rows_minus1 = %d\n", p->num_tile_rows_minus1);
 
-    for(i = 0; i < 19; i ++)
+    for (i = 0; i < 19; i ++)
     {
         va_TraceMsg(trace_ctx, "\tcolumn_width_minus1[%d] = %d\n", i, p->column_width_minus1[i]);
     }
 
-    for(i = 0; i < 21; i ++)
+    for (i = 0; i < 21; i ++)
     {
         va_TraceMsg(trace_ctx, "\trow_height_minus1[%d] = %d\n", i, p->row_height_minus1[i]);
     }
@@ -2555,7 +2555,7 @@ static void va_TraceVAEncSliceParameterBufferHEVC(
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(!p)
+    if (!p)
         return;
 
     va_TracePrint(trace_ctx, "\t--VAEncSliceParameterBufferHEVC\n");
@@ -2567,7 +2567,7 @@ static void va_TraceVAEncSliceParameterBufferHEVC(
     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
     va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\tref_pic_list0[%d].picture_id = %d\n", i, p->ref_pic_list0[i].picture_id);
         va_TraceMsg(trace_ctx, "\tref_pic_list0[%d].pic_order_cnt = %d\n", i, p->ref_pic_list0[i].pic_order_cnt);
@@ -2580,19 +2580,19 @@ static void va_TraceVAEncSliceParameterBufferHEVC(
     va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
     va_TraceMsg(trace_ctx, "\tdelta_chroma_log2_weight_denom = %d\n", p->delta_chroma_log2_weight_denom);
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\tdelta_luma_weight_l0[%d] = %d\n", i, p->delta_luma_weight_l0[i]);
         va_TraceMsg(trace_ctx, "\tdelta_luma_weight_l1[%d] = %d\n", i, p->delta_luma_weight_l1[i]);
     }
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\tluma_offset_l0[%d] = %d\n", i, p->luma_offset_l0[i]);
         va_TraceMsg(trace_ctx, "\tluma_offset_l1[%d] = %d\n", i, p->luma_offset_l1[i]);
     }
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l0[%d][0] = %d\n", i, p->delta_chroma_weight_l0[i][0]);
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l0[%d][1] = %d\n", i, p->delta_chroma_weight_l0[i][1]);
@@ -2600,7 +2600,7 @@ static void va_TraceVAEncSliceParameterBufferHEVC(
         va_TraceMsg(trace_ctx, "\tdelta_chroma_weight_l1[%d][1] = %d\n", i, p->delta_chroma_weight_l1[i][1]);
     }
 
-    for(i = 0; i < 15; i ++)
+    for (i = 0; i < 15; i ++)
     {
         va_TraceMsg(trace_ctx, "\tchroma_offset_l0[%d][0] = %d\n", i, p->chroma_offset_l0[i][0]);
         va_TraceMsg(trace_ctx, "\tchroma_offset_l0[%d][1] = %d\n", i, p->chroma_offset_l0[i][1]);
@@ -2811,7 +2811,7 @@ static void va_TraceVAIQMatrixBufferH264(
 
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
-    if(trace_ctx->plog_file)
+    if (trace_ctx->plog_file)
         fp = trace_ctx->plog_file->fp_log;
 
     va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferH264\n");
@@ -2881,7 +2881,7 @@ static void va_TraceVAEncSequenceParameterBufferH264(
     va_TraceMsg(trace_ctx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
     va_TraceMsg(trace_ctx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
     va_TraceMsg(trace_ctx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
-    for(i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
+    for (i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
         va_TraceMsg(trace_ctx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
     va_TraceMsg(trace_ctx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
     va_TraceMsg(trace_ctx, "\tframe_crop_left_offset = %u\n", p->frame_crop_left_offset);
@@ -3410,7 +3410,7 @@ static void va_TraceVAPictureParameterBufferVP8(
         p->uv_mode_probs[0], p->uv_mode_probs[1], p->uv_mode_probs[2]);
 
     va_TraceMsg(trace_ctx, "\tmv_probs[2][19]:\n");
-    for(i = 0; i<2; ++i) {
+    for (i = 0; i<2; ++i) {
         memset(tmp, 0, sizeof tmp);
         for (j=0; j<19; j++)
             sprintf(tmp + strlen(tmp), "%2x ", p->mv_probs[i][j]);
@@ -3446,7 +3446,7 @@ static void va_TraceVASliceParameterBufferVP8(
     va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
     va_TraceMsg(trace_ctx, "\tnum_of_partitions = %d\n", p->num_of_partitions);
 
-    for(i = 0; i<9; ++i)
+    for (i = 0; i<9; ++i)
         va_TraceMsg(trace_ctx, "\tpartition_size[%d] = %d\n", i, p->partition_size[i]);
 
     va_TraceMsg(trace_ctx, NULL);
@@ -3538,7 +3538,7 @@ static void va_TraceVAEncSequenceParameterBufferVP8(
     va_TraceMsg(trace_ctx, "\tkf_min_dist = %d\n", p->kf_min_dist);
     va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
 
-    for(i = 0; i<4; ++i)
+    for (i = 0; i<4; ++i)
         va_TraceMsg(trace_ctx, "\treference_frames[%d] = 0x%08x\n", i, p->reference_frames[i]);
 
     va_TraceMsg(trace_ctx, NULL);
@@ -3664,11 +3664,11 @@ static void va_TraceVAEncPictureParameterBufferVP8(
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.forced_lf_adjustment = %d\n", p->pic_flags.bits.forced_lf_adjustment);
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.reserved = %d\n", p->pic_flags.bits.reserved);
 
-    for(i=0;i<4;i++)
+    for (i=0;i<4;i++)
        va_TraceMsg(trace_ctx, "\tloop_filter_level[%d] = %d\n", i, p->loop_filter_level[i]);
-    for(i=0;i<4;i++)
+    for (i=0;i<4;i++)
        va_TraceMsg(trace_ctx, "\tref_lf_delta[%d] = %d\n", i, p->ref_lf_delta[i]);
-    for(i=0;i<4;i++)
+    for (i=0;i<4;i++)
        va_TraceMsg(trace_ctx, "\tmode_lf_delta[%d] = %d\n", i, p->mode_lf_delta[i]);
 
     va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->sharpness_level);
-- 
1.9.1



More information about the Libva mailing list