Update the supported render target format and pixel format
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 13 Jun 2013 03:31:36 +0000 (11:31 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 21 Jun 2013 04:19:02 +0000 (12:19 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen75_mfd.c
src/gen7_mfd.c
src/i965_drv_video.c
src/i965_render.c

index 6c6c4ff..11644d6 100644 (file)
@@ -2171,12 +2171,14 @@ gen75_mfd_jpeg_decode_init(VADriverContextP ctx,
     struct object_surface *obj_surface;
     VAPictureParameterBufferJPEGBaseline *pic_param;
     int subsampling = SUBSAMPLE_YUV420;
+    int fourcc = VA_FOURCC('I', 'M', 'C', '3');
 
     pic_param = (VAPictureParameterBufferJPEGBaseline *)decode_state->pic_param->buffer;
 
-    if (pic_param->num_components == 1)
+    if (pic_param->num_components == 1) {
         subsampling = SUBSAMPLE_YUV400;
-    else if (pic_param->num_components == 3) {
+        fourcc = VA_FOURCC('Y', '8', '0', '0');
+    } else if (pic_param->num_components == 3) {
         int h1 = pic_param->components[0].h_sampling_factor;
         int h2 = pic_param->components[1].h_sampling_factor;
         int h3 = pic_param->components[2].h_sampling_factor;
@@ -2185,27 +2187,34 @@ gen75_mfd_jpeg_decode_init(VADriverContextP ctx,
         int v3 = pic_param->components[2].v_sampling_factor;
 
         if (h1 == 2 && h2 == 1 && h3 == 1 &&
-            v1 == 2 && v2 == 1 && v3 == 1)
+            v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV420;
-        else if (h1 == 2 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('I', 'M', 'C', '3');
+        } else if (h1 == 2 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422H;
-        else if (h1 == 1 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '2', '2', 'H');
+        } else if (h1 == 1 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV444;
-        else if (h1 == 4 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '4', '4', 'P');
+        } else if (h1 == 4 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV411;
-        else if (h1 == 1 && h2 == 1 && h3 == 1 &&
-                 v1 == 2 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '1', '1', 'P');
+        } else if (h1 == 1 && h2 == 1 && h3 == 1 &&
+                   v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422V;
-        else if (h1 == 2 && h2 == 1 && h3 == 1 &&
-                 v1 == 2 && v2 == 2 && v3 == 2)
+            fourcc = VA_FOURCC('4', '2', '2', 'V');
+        } else if (h1 == 2 && h2 == 1 && h3 == 1 &&
+                   v1 == 2 && v2 == 2 && v3 == 2) {
             subsampling = SUBSAMPLE_YUV422H;
-        else if (h2 == 2 && h2 == 2 && h3 == 2 &&
-                 v1 == 2 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '2', '2', 'H');
+        } else if (h2 == 2 && h2 == 2 && h3 == 2 &&
+                   v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422V;
-        else
+            fourcc = VA_FOURCC('4', '2', '2', 'V');
+        } else
             assert(0);
     } else {
         assert(0);
@@ -2213,7 +2222,7 @@ gen75_mfd_jpeg_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('I','M','C','3'), subsampling);
+    i965_check_alloc_surface_bo(ctx, obj_surface, 1, fourcc, subsampling);
 
     dri_bo_unreference(gen7_mfd_context->pre_deblocking_output.bo);
     gen7_mfd_context->pre_deblocking_output.bo = obj_surface->bo;
index 1600fe0..8e0d503 100755 (executable)
@@ -1798,12 +1798,14 @@ gen7_mfd_jpeg_decode_init(VADriverContextP ctx,
     struct object_surface *obj_surface;
     VAPictureParameterBufferJPEGBaseline *pic_param;
     int subsampling = SUBSAMPLE_YUV420;
+    int fourcc = VA_FOURCC('I', 'M', 'C', '3');
 
     pic_param = (VAPictureParameterBufferJPEGBaseline *)decode_state->pic_param->buffer;
 
-    if (pic_param->num_components == 1)
+    if (pic_param->num_components == 1) {
         subsampling = SUBSAMPLE_YUV400;
-    else if (pic_param->num_components == 3) {
+        fourcc = VA_FOURCC('Y', '8', '0', '0');
+    } else if (pic_param->num_components == 3) {
         int h1 = pic_param->components[0].h_sampling_factor;
         int h2 = pic_param->components[1].h_sampling_factor;
         int h3 = pic_param->components[2].h_sampling_factor;
@@ -1812,27 +1814,34 @@ gen7_mfd_jpeg_decode_init(VADriverContextP ctx,
         int v3 = pic_param->components[2].v_sampling_factor;
 
         if (h1 == 2 && h2 == 1 && h3 == 1 &&
-            v1 == 2 && v2 == 1 && v3 == 1)
+            v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV420;
-        else if (h1 == 2 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('I', 'M', 'C', '3');
+        } else if (h1 == 2 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422H;
-        else if (h1 == 1 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '2', '2', 'H');
+        } else if (h1 == 1 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV444;
-        else if (h1 == 4 && h2 == 1 && h3 == 1 &&
-                 v1 == 1 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '4', '4', 'P');
+        } else if (h1 == 4 && h2 == 1 && h3 == 1 &&
+                   v1 == 1 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV411;
-        else if (h1 == 1 && h2 == 1 && h3 == 1 &&
-                 v1 == 2 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '1', '1', 'P');
+        } else if (h1 == 1 && h2 == 1 && h3 == 1 &&
+                   v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422V;
-        else if (h1 == 2 && h2 == 1 && h3 == 1 &&
-                 v1 == 2 && v2 == 2 && v3 == 2)
+            fourcc = VA_FOURCC('4', '2', '2', 'V');
+        } else if (h1 == 2 && h2 == 1 && h3 == 1 &&
+                   v1 == 2 && v2 == 2 && v3 == 2) {
             subsampling = SUBSAMPLE_YUV422H;
-        else if (h2 == 2 && h2 == 2 && h3 == 2 &&
-                 v1 == 2 && v2 == 1 && v3 == 1)
+            fourcc = VA_FOURCC('4', '2', '2', 'H');
+        } else if (h2 == 2 && h2 == 2 && h3 == 2 &&
+                   v1 == 2 && v2 == 1 && v3 == 1) {
             subsampling = SUBSAMPLE_YUV422V;
-        else
+            fourcc = VA_FOURCC('4', '2', '2', 'V');
+        } else
             assert(0);
     } else {
         assert(0);
@@ -1840,7 +1849,7 @@ gen7_mfd_jpeg_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('I','M','C','3'), subsampling);
+    i965_check_alloc_surface_bo(ctx, obj_surface, 1, fourcc, subsampling);
 
     dri_bo_unreference(gen7_mfd_context->pre_deblocking_output.bo);
     gen7_mfd_context->pre_deblocking_output.bo = obj_surface->bo;
index cc4049b..4021e5d 100755 (executable)
@@ -686,43 +686,12 @@ i965_surface_native_memory(VADriverContextP ctx,
         return VA_STATUS_SUCCESS;
 
     // todo, should we disable tiling for 422 format?
-    if (expected_fourcc != VA_FOURCC('N', 'V', '1', '2') &&
-        expected_fourcc != VA_FOURCC('R', 'G', 'B', 'X') &&
-        expected_fourcc != VA_FOURCC('R', 'G', 'B', 'A') &&
-        expected_fourcc != VA_FOURCC('I', 'M', 'C', '1') &&
-        expected_fourcc != VA_FOURCC('I', 'M', 'C', '3'))
+    if (expected_fourcc == VA_FOURCC('I', '4', '2', '0') ||
+        expected_fourcc == VA_FOURCC('I', 'Y', 'U', 'V') ||
+        expected_fourcc == VA_FOURCC('Y', 'V', '1', '2'))
         tiling = 0;
                
-    switch (format) {
-    case VA_RT_FORMAT_YUV420:
-        obj_surface->subsampling = SUBSAMPLE_YUV420;
-        break;
-
-    case VA_RT_FORMAT_YUV422:
-        obj_surface->subsampling = SUBSAMPLE_YUV422H;
-        break;
-
-    case VA_RT_FORMAT_YUV444:
-        obj_surface->subsampling = SUBSAMPLE_YUV444;
-        break;
-
-    case VA_RT_FORMAT_YUV411:
-        obj_surface->subsampling = SUBSAMPLE_YUV411;
-        break;
-
-    case VA_RT_FORMAT_YUV400:
-        obj_surface->subsampling = SUBSAMPLE_YUV400;
-        break;
-
-    case VA_RT_FORMAT_RGB32:
-        obj_surface->subsampling = SUBSAMPLE_RGBX;
-        break;
-
-    default:
-        return VA_STATUS_ERROR_INVALID_PARAMETER;
-    }
-
-    i965_check_alloc_surface_bo(ctx, obj_surface, tiling, expected_fourcc, obj_surface->subsampling);
+    i965_check_alloc_surface_bo(ctx, obj_surface, tiling, expected_fourcc, get_sampling_from_fourcc(expected_fourcc));
 
     return VA_STATUS_SUCCESS;
 }
@@ -801,9 +770,10 @@ i965_suface_external_memory(VADriverContextP ctx,
         break;
 
     case VA_FOURCC('Y', 'U', 'Y', '2'):
+    case VA_FOURCC('U', 'Y', 'V', 'Y'):
         assert(memory_attibute->num_planes == 1);
 
-        obj_surface->subsampling = SUBSAMPLE_YUV420;
+        obj_surface->subsampling = SUBSAMPLE_YUV422H;
         obj_surface->y_cb_offset = 0;
         obj_surface->y_cr_offset = 0;
         obj_surface->cb_cr_width = obj_surface->orig_width / 2;
@@ -2741,118 +2711,143 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
     obj_surface->x_cr_offset = 0;
 
     if (tiled) {
-        assert(fourcc == VA_FOURCC('N', 'V', '1', '2') ||
-               fourcc == VA_FOURCC('I', 'M', 'C', '1') ||
-               fourcc == VA_FOURCC('I', 'M', 'C', '3') || 
-               fourcc == VA_FOURCC('R', 'G', 'B', 'A') || 
-               fourcc == VA_FOURCC('R', 'G', 'B', 'X') || 
-               fourcc == VA_FOURCC('B', 'G', 'R', 'A') || 
-               fourcc == VA_FOURCC('B', 'G', 'R', 'X') || 
-               fourcc == VA_FOURCC('Y', 'U', 'Y', '2'));
+        assert(fourcc != VA_FOURCC('I', '4', '2', '0') &&
+               fourcc != VA_FOURCC('I', 'Y', 'U', 'V') &&
+               fourcc != VA_FOURCC('Y', 'V', '1', '2'));
 
         obj_surface->width = ALIGN(obj_surface->orig_width, 128);
         obj_surface->height = ALIGN(obj_surface->orig_height, 32);
         region_height = obj_surface->height;
 
-        if (fourcc == VA_FOURCC('N', 'V', '1', '2') ||
-            fourcc == VA_FOURCC('I', 'M', 'C', '1') ||
-            fourcc == VA_FOURCC('I', 'M', 'C', '3')) {
+        switch (fourcc) {
+        case VA_FOURCC('N', 'V', '1', '2'):
+            assert(subsampling == SUBSAMPLE_YUV420);
             obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->cb_cr_height = obj_surface->orig_height / 2;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->height;
             region_width = obj_surface->width;
-        }
-        else if (fourcc == VA_FOURCC('Y','U', 'Y', '2')) {
-            obj_surface->cb_cr_pitch = obj_surface->width * 2;
-            region_width = obj_surface->width * 2;
-        }
-        else if (fourcc == VA_FOURCC('R', 'G', 'B', 'A') || 
-                 fourcc == VA_FOURCC('R', 'G', 'B', 'X') || 
-                 fourcc == VA_FOURCC('B', 'G', 'R', 'A') || 
-                 fourcc == VA_FOURCC('B', 'G', 'R', 'X')) {
-            region_width = obj_surface->width * 4;
-        }
-        else {
-            assert(0);
-        }
-               
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32);
+            
+            break;
 
-        if (fourcc == VA_FOURCC('N', 'V', '1', '2')) {
+        case VA_FOURCC('I', 'M', 'C', '1'):
             assert(subsampling == SUBSAMPLE_YUV420);
-            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->cb_cr_height = obj_surface->orig_height / 2;
             obj_surface->y_cr_offset = obj_surface->height;
+            obj_surface->y_cb_offset = obj_surface->y_cr_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
+
+            break;
+
+        case VA_FOURCC('I', 'M', 'C', '3'):
+            assert(subsampling == SUBSAMPLE_YUV420);
+            obj_surface->cb_cr_pitch = obj_surface->width;
             obj_surface->cb_cr_width = obj_surface->orig_width / 2;
             obj_surface->cb_cr_height = obj_surface->orig_height / 2;
-            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32);
-        } else if (fourcc == VA_FOURCC('I', 'M', 'C', '1') ||
-                   fourcc == VA_FOURCC('I', 'M', 'C', '3') || 
-                   fourcc == VA_FOURCC('R', 'G', 'B', 'A') || 
-                   fourcc == VA_FOURCC('R', 'G', 'B', 'X') || 
-                   fourcc == VA_FOURCC('B', 'G', 'R', 'A') || 
-                   fourcc == VA_FOURCC('B', 'G', 'R', 'X') || 
-                   fourcc == VA_FOURCC('Y', 'U', 'Y', '2')) {
-            switch (subsampling) {
-            case SUBSAMPLE_YUV400:
-                obj_surface->cb_cr_width = 0;
-                obj_surface->cb_cr_height = 0;
-                break;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
+            
+            break;
 
-            case SUBSAMPLE_YUV420:
-                obj_surface->cb_cr_width = obj_surface->orig_width / 2;
-                obj_surface->cb_cr_height = obj_surface->orig_height / 2;
-                break;
+        case VA_FOURCC('4', '2', '2', 'H'):
+            assert(subsampling == SUBSAMPLE_YUV422H);
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->cb_cr_height = obj_surface->orig_height;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
 
-            case SUBSAMPLE_YUV422H:
-                obj_surface->cb_cr_width = obj_surface->orig_width / 2;
-                obj_surface->cb_cr_height = obj_surface->orig_height;
-                break;
+            break;
 
-            case SUBSAMPLE_YUV422V:
-                obj_surface->cb_cr_width = obj_surface->orig_width;
-                obj_surface->cb_cr_height = obj_surface->orig_height / 2;
-                break;
+        case VA_FOURCC('4', '2', '2', 'V'):
+            assert(subsampling == SUBSAMPLE_YUV422V);
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width;
+            obj_surface->cb_cr_height = obj_surface->orig_height / 2;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
 
-            case SUBSAMPLE_YUV444:
-                obj_surface->cb_cr_width = obj_surface->orig_width;
-                obj_surface->cb_cr_height = obj_surface->orig_height;
-                break;
+            break;
 
-            case SUBSAMPLE_YUV411:
-                obj_surface->cb_cr_width = obj_surface->orig_width / 4;
-                obj_surface->cb_cr_height = obj_surface->orig_height;
-                break;
-            case SUBSAMPLE_RGBX:
-                break;
-            default:
-                assert(0);
-                break;
-            }
+        case VA_FOURCC('4', '1', '1', 'P'):
+            assert(subsampling == SUBSAMPLE_YUV411);
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width / 4;
+            obj_surface->cb_cr_height = obj_surface->orig_height;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
+
+            break;
+
+        case VA_FOURCC('4', '4', '4', 'P'):
+            assert(subsampling == SUBSAMPLE_YUV444);
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = obj_surface->orig_width;
+            obj_surface->cb_cr_height = obj_surface->orig_height;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
+            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
 
+            break;
+
+        case VA_FOURCC('Y', '8', '0', '0'):
+            assert(subsampling == SUBSAMPLE_YUV400);
+            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_width = 0;
+            obj_surface->cb_cr_height = 0;
+            obj_surface->y_cb_offset = obj_surface->height;
+            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            region_width = obj_surface->width;
             region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
 
-            if (fourcc == VA_FOURCC('I', 'M', 'C', '1')) {
-                obj_surface->y_cr_offset = obj_surface->height;
-                obj_surface->y_cb_offset = obj_surface->y_cr_offset + ALIGN(obj_surface->cb_cr_height, 32);
-            } else if (fourcc == VA_FOURCC('I', 'M', 'C', '3')){
-                obj_surface->y_cb_offset = obj_surface->height;
-                obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
-            }
-            else if (fourcc == VA_FOURCC('Y','U', 'Y', '2')) {
-                obj_surface->y_cb_offset = 0; 
-                obj_surface->y_cr_offset = 0; 
-                region_height = obj_surface->height;
-            }
-            else if (fourcc == VA_FOURCC('R', 'G', 'B', 'A') || 
-                     fourcc == VA_FOURCC('R', 'G', 'B', 'X') || 
-                     fourcc == VA_FOURCC('B', 'G', 'R', 'A') || 
-                     fourcc == VA_FOURCC('B', 'G', 'R', 'X')) {
-                region_height = obj_surface->height;
-            }
+            break;
+
+        case VA_FOURCC('Y', 'U', 'Y', '2'):
+        case VA_FOURCC('U', 'Y', 'V', 'Y'):
+            assert(subsampling == SUBSAMPLE_YUV422H);
+            obj_surface->cb_cr_pitch = obj_surface->width * 2;
+            obj_surface->y_cb_offset = 0; 
+            obj_surface->y_cr_offset = 0; 
+            obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->cb_cr_height = obj_surface->orig_height / 2;
+            region_width = obj_surface->width * 2;
+            region_height = obj_surface->height;
+            
+            break;
+
+        case VA_FOURCC('R', 'G', 'B', 'A'):
+        case VA_FOURCC('R', 'G', 'B', 'X'):
+        case VA_FOURCC('B', 'G', 'R', 'A'):
+        case VA_FOURCC('B', 'G', 'R', 'X'):
+            assert(subsampling == SUBSAMPLE_RGBX);
+
+            region_width = obj_surface->width * 4;
+            region_height = obj_surface->height;
+            break;
+
+        default:
+            /* Never get here */
+            assert(0);
+            break;
         }
     } else {
-        assert(fourcc != VA_FOURCC('I', 'M', 'C', '1') &&
-               fourcc != VA_FOURCC('I', 'M', 'C', '3'));
         assert(subsampling == SUBSAMPLE_YUV420 || 
                subsampling == SUBSAMPLE_YUV422H || 
-               subsampling == SUBSAMPLE_YUV422V || 
+               subsampling == SUBSAMPLE_YUV422V ||
                subsampling == SUBSAMPLE_RGBX);
 
         region_width = obj_surface->width;
@@ -2884,7 +2879,8 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
             region_height = obj_surface->height + obj_surface->height / 2;
             break;
 
-        case VA_FOURCC('Y','U', 'Y', '2'):
+        case VA_FOURCC('Y', 'U', 'Y', '2'):
+        case VA_FOURCC('U', 'Y', 'V', 'Y'):
             obj_surface->y_cb_offset = 0;
             obj_surface->y_cr_offset = 0;
             obj_surface->cb_cr_width = obj_surface->orig_width / 2;
@@ -2902,6 +2898,7 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
             break;
 
         default:
+            /* Never get here */
             assert(0);
             break;
         }
@@ -3149,17 +3146,36 @@ static int
 get_sampling_from_fourcc(unsigned int fourcc)
 {
     int surface_sampling = -1;
+
     switch (fourcc) {
     case VA_FOURCC('N', 'V', '1', '2'):
     case VA_FOURCC('Y', 'V', '1', '2'):
     case VA_FOURCC('I', '4', '2', '0'):
+    case VA_FOURCC('I', 'Y', 'U', 'V'):
     case VA_FOURCC('I', 'M', 'C', '1'):
     case VA_FOURCC('I', 'M', 'C', '3'):
         surface_sampling = SUBSAMPLE_YUV420;
         break;
     case VA_FOURCC('Y', 'U', 'Y', '2'):
+    case VA_FOURCC('U', 'Y', 'V', 'Y'):
+    case VA_FOURCC('4', '2', '2', 'H'):
         surface_sampling = SUBSAMPLE_YUV422H;
         break;
+    case VA_FOURCC('4', '2', '2', 'V'):
+        surface_sampling = SUBSAMPLE_YUV422V;
+        break;
+        
+    case VA_FOURCC('4', '4', '4', 'P'):
+        surface_sampling = SUBSAMPLE_YUV444;
+        break;
+
+    case VA_FOURCC('4', '1', '1', 'P'):
+        surface_sampling = SUBSAMPLE_YUV411;
+        break;
+
+    case VA_FOURCC('Y', '8', '0', '0'):
+        surface_sampling = SUBSAMPLE_YUV400;
+        break;
     case VA_FOURCC('R','G','B','A'):
     case VA_FOURCC('R','G','B','X'):
     case VA_FOURCC('B','G','R','A'):
@@ -3167,8 +3183,12 @@ get_sampling_from_fourcc(unsigned int fourcc)
     surface_sampling = SUBSAMPLE_RGBX; 
         break;
     default:
+        /* Never get here */
+        assert(0);
         break;
+
     }
+
     return surface_sampling;
 }
 
index b49f9f1..21ec844 100644 (file)
@@ -1063,8 +1063,8 @@ i965_render_upload_constants(VADriverContextP ctx,
     constant_buffer = render_state->curbe.bo->virtual;
 
     if (obj_surface->subsampling == SUBSAMPLE_YUV400) {
-        assert(obj_surface->fourcc == VA_FOURCC('I', 'M', 'C', '1') ||
-               obj_surface->fourcc == VA_FOURCC('I', 'M', 'C', '3'));
+        assert(obj_surface->fourcc == VA_FOURCC('Y', '8', '0', '0'));
+
         *constant_buffer = 2;
     } else {
         if (obj_surface->fourcc == VA_FOURCC('N', 'V', '1', '2'))