vafool: fix the vaMapBuffer for the buffer from vaDeriveImage
authorAustin Yuan <shengquan.yuan@intel.com>
Thu, 27 Feb 2014 07:36:17 +0000 (15:36 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 8 Sep 2014 17:16:43 +0000 (01:16 +0800)
It is not desired to run into FOOL path for the vaMapBuffer
from vaDeriveImage

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
(cherry picked from commit 2896166fefa36772ea6946ebc5df85024928dd6c)

va/va_fool.c
va/va_trace.c

index 95d1880..9f7a045 100644 (file)
@@ -252,8 +252,14 @@ VAStatus va_FoolBufferInfo(
     unsigned int *num_elements /* out */
 )
 {
+    unsigned int magic;
+    
     DPY2FOOLCTX_CHK(dpy);
 
+    magic = buf_id & FOOL_BUFID_MASK;
+    if (magic != FOOL_BUFID_MAGIC)
+        return 0; /* could be VAImageBufferType from vaDeriveImage */
+    
     *type = buf_id & 0xff;
     *size = fool_ctx->fool_buf_size[*type];
     *num_elements = fool_ctx->fool_buf_element[*type];;
@@ -342,9 +348,13 @@ VAStatus va_FoolMapBuffer(
     void **pbuf        /* out */
 )
 {
-    unsigned int buftype;
+    unsigned int magic, buftype;
     DPY2FOOLCTX_CHK(dpy);
 
+    magic = buf_id & FOOL_BUFID_MASK;
+    if (magic != FOOL_BUFID_MAGIC)
+        return 0; /* could be VAImageBufferType from vaDeriveImage */
+    
     buftype = buf_id & 0xff;
     *pbuf = fool_ctx->fool_buf[buftype];
 
index c2479cd..5df619a 100644 (file)
@@ -2938,7 +2938,7 @@ void va_TraceRenderPicture(
 
         case VAProfileNone:
             for (j=0; j<num_elements; j++) {
-                va_TraceMsg(trace_ctx, "\telement[%d] = ", j);
+                va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
                 va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
             }
@@ -2946,7 +2946,7 @@ void va_TraceRenderPicture(
 
         case VAProfileVP8Version0_3:
             for (j=0; j<num_elements; j++) {
-                va_TraceMsg(trace_ctx, "\telement[%d] = ", j);
+                va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
 
                 va_TraceVP8Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
             }