OSDN Git Service

dri: return error for unimplemented surface formats
[android-x86/hardware-intel-common-vaapi.git] / src / i965_output_dri.c
index 717ee9a..ae3bcf6 100644 (file)
@@ -123,11 +123,8 @@ i965_put_surface_dri(
     union dri_buffer *buffer;
     struct intel_region *dest_region;
     struct object_surface *obj_surface; 
-    unsigned int pp_flag = 0;
-    bool new_region = false;
     uint32_t name;
     int i, ret;
-    unsigned int color_flag = 0;
 
     /* Currently don't support DRI1 */
     if (!VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_DRI2))
@@ -137,8 +134,10 @@ i965_put_surface_dri(
      * will get here
      */
     obj_surface = SURFACE(surface);
-    if (!obj_surface || !obj_surface->bo)
-        return VA_STATUS_SUCCESS;
+    ASSERT_RET(obj_surface && obj_surface->bo, VA_STATUS_SUCCESS);
+    ASSERT_RET(obj_surface->fourcc != VA_FOURCC_YUY2 &&
+               obj_surface->fourcc != VA_FOURCC_UYVY,
+               VA_STATUS_ERROR_UNIMPLEMENTED);
 
     _i965LockMutex(&i965->render_mutex);
 
@@ -149,27 +148,21 @@ i965_put_surface_dri(
     assert(buffer);
     
     dest_region = render_state->draw_region;
+    if (dest_region == NULL) {
+        dest_region = (struct intel_region *)calloc(1, sizeof(*dest_region));
+        assert(dest_region);
+        render_state->draw_region = dest_region;
+    }
 
-    if (dest_region) {
-        assert(dest_region->bo);
+    if (dest_region->bo) {
         dri_bo_flink(dest_region->bo, &name);
-        
         if (buffer->dri2.name != name) {
-            new_region = True;
             dri_bo_unreference(dest_region->bo);
-        }
-    } else {
-        dest_region = (struct intel_region *)calloc(1, sizeof(*dest_region));
-        assert(dest_region);
-        render_state->draw_region = dest_region;
-        new_region = True;
+           dest_region->bo = NULL;
+       }
     }
 
-    if (new_region) {
-        dest_region->x = dri_drawable->x;
-        dest_region->y = dri_drawable->y;
-        dest_region->width = dri_drawable->width;
-        dest_region->height = dri_drawable->height;
+    if (dest_region->bo == NULL) {
         dest_region->cpp = buffer->dri2.cpp;
         dest_region->pitch = buffer->dri2.pitch;
 
@@ -180,21 +173,15 @@ i965_put_surface_dri(
         assert(ret == 0);
     }
 
-    color_flag = flags & VA_SRC_COLOR_MASK;
-    if (color_flag == 0)
-        color_flag = VA_SRC_BT601;
-
-    pp_flag = color_flag;
-
-    if ((flags & VA_FILTER_SCALING_MASK) == VA_FILTER_SCALING_NL_ANAMORPHIC)
-        pp_flag |= I965_PP_FLAG_AVS;
+    dest_region->x = dri_drawable->x;
+    dest_region->y = dri_drawable->y;
+    dest_region->width = dri_drawable->width;
+    dest_region->height = dri_drawable->height;
 
-    if (flags & VA_TOP_FIELD)
-        pp_flag |= I965_PP_FLAG_TOP_FIELD;
-    else if (flags & VA_BOTTOM_FIELD)
-        pp_flag |= I965_PP_FLAG_BOTTOM_FIELD;
+    if (!(flags & VA_SRC_COLOR_MASK))
+        flags |= VA_SRC_BT601;
 
-    intel_render_put_surface(ctx, obj_surface, src_rect, dst_rect, pp_flag);
+    intel_render_put_surface(ctx, obj_surface, src_rect, dst_rect, flags);
 
     for (i = 0; i < I965_MAX_SUBPIC_SUM; i++) {
         if (obj_surface->obj_subpic[i] != NULL) {
@@ -204,18 +191,8 @@ i965_put_surface_dri(
         }
     }
 
-    if (!getenv("INTEL_DEBUG_BENCH"))
+    if (!(g_intel_debug_option_flags & VA_INTEL_DEBUG_OPTION_BENCH))
         dri_vtable->swap_buffer(ctx, dri_drawable);
-    obj_surface->flags |= SURFACE_DISPLAYED;
-
-    if ((obj_surface->flags & SURFACE_ALL_MASK) == SURFACE_DISPLAYED) {
-        dri_bo_unreference(obj_surface->bo);
-        obj_surface->bo = NULL;
-        obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-
-        if (obj_surface->free_private_data)
-            obj_surface->free_private_data(&obj_surface->private_data);
-    }
 
     _i965UnlockMutex(&i965->render_mutex);