Check the reference surface id against VA_INVALID_SURFACE
authorXiang, Haihao <haihao.xiang@intel.com>
Sun, 29 Sep 2013 05:11:10 +0000 (13:11 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 13 Nov 2013 07:28:04 +0000 (15:28 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 0c2def319f52bdb222e5480d81feea486cbf3e11)

src/gen6_mfc_common.c
src/gen6_vme.c
src/gen75_vme.c
src/gen7_vme.c

index 88a8d61..d66f4c5 100644 (file)
@@ -1036,7 +1036,7 @@ intel_mfc_avc_ref_idx_state(VADriverContextP ctx,
     if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
         slice_obj_surface = NULL;
         ref_surface_id = slice_param->RefPicList0[0].picture_id;
-        if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+        if (ref_surface_id != VA_INVALID_SURFACE) {
             slice_obj_surface = SURFACE(ref_surface_id);
         }
         if (slice_obj_surface && slice_obj_surface->bo) {
@@ -1067,7 +1067,7 @@ intel_mfc_avc_ref_idx_state(VADriverContextP ctx,
     if (slice_type == SLICE_TYPE_B) {
         slice_obj_surface = NULL;
         ref_surface_id = slice_param->RefPicList1[0].picture_id;
-        if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+        if (ref_surface_id != VA_INVALID_SURFACE) {
             slice_obj_surface = SURFACE(ref_surface_id);
         }
         if (slice_obj_surface && slice_obj_surface->bo) {
index 1d47517..1345466 100644 (file)
@@ -223,7 +223,7 @@ gen6_vme_surface_setup(VADriverContextP ctx,
        if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList0[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {
@@ -239,7 +239,7 @@ gen6_vme_surface_setup(VADriverContextP ctx,
             /* reference 1 */
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList1[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {
index 515d8c0..e9ddf0b 100644 (file)
@@ -284,7 +284,7 @@ gen75_vme_surface_setup(VADriverContextP ctx,
        if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList0[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {
@@ -300,7 +300,7 @@ gen75_vme_surface_setup(VADriverContextP ctx,
             /* reference 1 */
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList1[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {
index e6de3af..2f167ab 100644 (file)
@@ -269,7 +269,7 @@ gen7_vme_surface_setup(VADriverContextP ctx,
        if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList0[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {
@@ -285,7 +285,7 @@ gen7_vme_surface_setup(VADriverContextP ctx,
             /* reference 1 */
             slice_obj_surface = NULL;
             ref_surface_id = slice_param->RefPicList1[0].picture_id;
-            if (ref_surface_id != 0 && ref_surface_id != VA_INVALID_SURFACE) {
+            if (ref_surface_id != VA_INVALID_SURFACE) {
                 slice_obj_surface = SURFACE(ref_surface_id);
             }
             if (slice_obj_surface && slice_obj_surface->bo) {