OSDN Git Service

Fix: check the bo of reconstructed to ensure it is not NULL
authorPengfei Qu <Pengfei.Qu@intel.com>
Tue, 13 Sep 2016 02:07:00 +0000 (10:07 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 31 Oct 2016 01:58:57 +0000 (09:58 +0800)
Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
Tested-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit b5cd29990a690580e981b033fb1655417eba622e)

src/gen9_vme.c

index 5a3bd38..eb34cf6 100644 (file)
@@ -1854,6 +1854,7 @@ static VAStatus gen9_intel_hevc_input_check(VADriverContextP ctx,
     struct object_surface *obj_surface;
     GenHevcSurface *hevc_encoder_surface = NULL;
     int i;
+    int fourcc;
 
     obj_surface = SURFACE(encode_state->current_render_target);
     assert(obj_surface && obj_surface->bo);
@@ -1862,8 +1863,13 @@ static VAStatus gen9_intel_hevc_input_check(VADriverContextP ctx,
         hevc_encoder_surface->has_p010_to_nv12_done = 0;
     gen9_intel_init_hevc_surface(ctx,encoder_context,encode_state,obj_surface);
 
+    fourcc = obj_surface->fourcc;
     /* Setup current frame and current direct mv buffer*/
     obj_surface = encode_state->reconstructed_object;
+    if(fourcc == VA_FOURCC_P010)
+        i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_P010, SUBSAMPLE_YUV420);
+    else
+        i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
     hevc_encoder_surface = NULL;
     hevc_encoder_surface = (GenHevcSurface *) obj_surface->private_data;
     if(hevc_encoder_surface)