Add support for UYVY
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 28 Jun 2012 04:01:32 +0000 (12:01 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 28 Jun 2012 04:48:39 +0000 (12:48 +0800)
Tested on SNB and IVB.

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

index 6b44bba..41f8b0f 100755 (executable)
@@ -108,6 +108,8 @@ i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = {
       { VA_FOURCC('N','V','1','2'), VA_LSB_FIRST, 12, } },
     { I965_SURFACETYPE_YUV,
       { VA_FOURCC('Y','U','Y','2'), VA_LSB_FIRST, 16, } },
+    { I965_SURFACETYPE_YUV,
+      { VA_FOURCC('U','Y','V','Y'), VA_LSB_FIRST, 16, } },
 };
 
 /* List of supported subpicture formats */
@@ -2109,6 +2111,7 @@ i965_CreateImage(VADriverContextP ctx,
         image->data_size  = size + 2 * size2;
         break;
     case VA_FOURCC('Y','U','Y','2'):
+    case VA_FOURCC('U','Y','V','Y'):
         image->num_planes = 1;
         image->pitches[0] = width * 2;
         image->offsets[0] = 0;
index 32ae4ce..e40e9b4 100644 (file)
@@ -43,7 +43,7 @@
 #define I965_MAX_PROFILES                       11
 #define I965_MAX_ENTRYPOINTS                    5
 #define I965_MAX_CONFIG_ATTRIBUTES              10
-#define I965_MAX_IMAGE_FORMATS                  4
+#define I965_MAX_IMAGE_FORMATS                  10
 #define I965_MAX_SUBPIC_FORMATS                 4
 #define I965_MAX_DISPLAY_ATTRIBUTES             4
 
index 499d786..b3d5f81 100755 (executable)
@@ -1365,7 +1365,7 @@ gen7_pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_proc
     const int V = (fourcc == VA_FOURCC('Y', 'V', '1', '2') ||
                    fourcc == VA_FOURCC('I', 'M', 'C', '1')) ? 1 : 2;
     int interleaved_uv = fourcc == VA_FOURCC('N', 'V', '1', '2');
-    int packed_yuv = (fourcc == VA_FOURCC('Y', 'U', 'Y', '2'));
+    int packed_yuv = (fourcc == VA_FOURCC('Y', 'U', 'Y', '2') || fourcc == VA_FOURCC('U', 'Y', 'V', 'Y'));
 
     if (surface->type == I965_SURFACE_TYPE_SURFACE) {
         obj_surface = SURFACE(surface->id);
@@ -1458,6 +1458,10 @@ gen7_pp_set_media_rw_message_surface(VADriverContextP ctx, struct i965_post_proc
             format0 = SURFACE_FORMAT_YCRCB_NORMAL;
             break;
 
+        case VA_FOURCC('U', 'Y', 'V', 'Y'):
+            format0 = SURFACE_FORMAT_YCRCB_SWAPY;
+            break;
+
         default:
             break;
         }
@@ -2203,6 +2207,10 @@ static void gen7_update_src_surface_uv_offset(VADriverContextP    ctx,
         pp_static_parameter->grf2.di_destination_packed_y_component_offset = 0;
         pp_static_parameter->grf2.di_destination_packed_u_component_offset = 1;
         pp_static_parameter->grf2.di_destination_packed_v_component_offset = 3;
+    } else if (fourcc == VA_FOURCC('U', 'Y', 'V', 'Y')) {
+        pp_static_parameter->grf2.di_destination_packed_y_component_offset = 1;
+        pp_static_parameter->grf2.di_destination_packed_u_component_offset = 0;
+        pp_static_parameter->grf2.di_destination_packed_v_component_offset = 2;
     }
 }
 
@@ -4021,7 +4029,8 @@ i965_image_pl3_processing(VADriverContextP ctx,
                                                  dst_rect,
                                                  PP_PL3_LOAD_SAVE_PL3,
                                                  NULL);
-    } else if (fourcc == VA_FOURCC('Y', 'U', 'Y', '2')) {
+    } else if (fourcc == VA_FOURCC('Y', 'U', 'Y', '2') ||
+               fourcc == VA_FOURCC('U', 'Y', 'V', 'Y')) {
         vaStatus = i965_post_processing_internal(ctx, i965->pp_context,
                                                  src_surface,
                                                  src_rect,
@@ -4070,7 +4079,8 @@ i965_image_pl2_processing(VADriverContextP ctx,
                                                  dst_rect,
                                                  PP_NV12_LOAD_SAVE_PL3,
                                                  NULL);
-    } else if (fourcc == VA_FOURCC('Y', 'U', 'Y', '2')) {
+    } else if (fourcc == VA_FOURCC('Y', 'U', 'Y', '2') ||
+               fourcc == VA_FOURCC('U', 'Y', 'V', 'Y')) {
         vaStatus = i965_post_processing_internal(ctx, i965->pp_context,
                                                  src_surface,
                                                  src_rect,
@@ -4159,6 +4169,7 @@ i965_image_processing(VADriverContextP ctx,
                                                dst_rect);
             break;
         case  VA_FOURCC('Y', 'U', 'Y', '2'):
+        case VA_FOURCC('U', 'Y', 'V', 'Y'):
             status = i965_image_pl1_processing(ctx,
                                                src_surface,
                                                src_rect,