Fix the surface format in vaPutImage()
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 2 Feb 2012 03:09:40 +0000 (11:09 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 2 Feb 2012 03:09:40 +0000 (11:09 +0800)
Set the format of surface format to the format
of the input image if the usage is unknown

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

index 5bfcaee..4db32f2 100644 (file)
@@ -689,7 +689,18 @@ i965_PutImage(VADriverContextP ctx,
         dest_y + dest_height > obj_surface->orig_height)
         return VA_STATUS_ERROR_INVALID_PARAMETER;
 
-    i965_check_alloc_surface_bo(ctx, obj_surface, HAS_TILED_SURFACE(i965), VA_FOURCC('N', 'V', '1', '2'), SUBSAMPLE_YUV420);
+    if (!obj_surface->bo) {
+        unsigned int tiling, swizzle;
+        dri_bo_get_tiling(obj_image->bo, &tiling, &swizzle);
+
+        i965_check_alloc_surface_bo(ctx,
+                                    obj_surface,
+                                    !!tiling,
+                                    obj_image->image.format.fourcc,
+                                    SUBSAMPLE_YUV420);
+    }
+
+    assert(obj_surface->fourcc);
 
     src_surface.id = image;
     src_surface.type = I965_SURFACE_TYPE_IMAGE;