OSDN Git Service

va_trace: refine the log format
[android-x86/hardware-intel-common-libva.git] / va / va.c
diff --git a/va/va.c b/va/va.c
index 45ff5f2..400273e 100644 (file)
--- a/va/va.c
+++ b/va/va.c
@@ -86,10 +86,10 @@ int va_parseConfig(char *env, char *env_value)
         fclose(fp);
 
     /* no setting in config file, use env setting */
-    if (getenv(env)) {
+    value = getenv(env);
+    if (value) {
         if (env_value)
-            strncpy(env_value, getenv(env), 1024);
-
+            strncpy(env_value, value, 1024);
         return 0;
     }
     
@@ -214,6 +214,12 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
         char *driver_path = (char *) malloc( strlen(driver_dir) +
                                              strlen(driver_name) +
                                              strlen(DRIVER_EXTENSION) + 2 );
+        if (!driver_path) {
+            va_errorMessage("%s L%d Out of memory!n",
+                                __FUNCTION__, __LINE__);
+            return VA_STATUS_ERROR_ALLOCATION_FAILED;
+        }
+
         strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
         strncat( driver_path, "/", strlen("/") );
         strncat( driver_path, driver_name, strlen(driver_name) );
@@ -621,7 +627,7 @@ VAStatus vaCreateConfig (
   vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
 
   /* record the current entrypoint for further trace/fool determination */
-  VA_TRACE_FUNC(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
+  VA_TRACE_LOG(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   
   return vaStatus;
@@ -889,7 +895,7 @@ VAStatus vaCreateContext (
                                       flag, render_targets, num_render_targets, context );
 
   /* keep current encode/decode resoluton */
-  VA_TRACE_FUNC(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
+  VA_TRACE_LOG(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
 
   return vaStatus;
 }
@@ -1033,7 +1039,7 @@ VAStatus vaBeginPicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  VA_TRACE_FUNC(va_TraceBeginPicture, dpy, context, render_target);
+  VA_TRACE_LOG(va_TraceBeginPicture, dpy, context, render_target);
   VA_FOOL_RETURN();
   
   va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
@@ -1064,19 +1070,16 @@ VAStatus vaEndPicture (
     VAContextID context
 )
 {
-  VAStatus va_status;
+  VAStatus va_status = VA_STATUS_SUCCESS;
   VADriverContextP ctx;
 
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  /* dump encode source surface */
-  VA_TRACE_SURFACE(va_TraceEndPicture, dpy, context, 0);
-  /* return directly if do dummy operation */
-  VA_FOOL_RETURN();
-  
-  va_status = ctx->vtable->vaEndPicture( ctx, context );
-  /* dump decode dest surface */
+  if (fool_codec == 0)
+      va_status = ctx->vtable->vaEndPicture( ctx, context );
+
+  /* dump surface content */
   VA_TRACE_SURFACE(va_TraceEndPicture, dpy, context, 1);
 
   return va_status;