[Libva] [PATCH intel-driver 2/2] surface: drop SURFACE_DISPLAYED flag.

Gwenole Beauchesne gb.devel at gmail.com
Fri May 9 07:43:51 PDT 2014


The optimization by which VA surface storage is deallocated after it
is displayed and not used for reference or vaDeriveImage() purposes
cannot be implemented safely. We need to honour explicit lifetimes
defined by the upper codec layer.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 src/gen6_mfd.c        | 6 ++++--
 src/gen75_mfd.c       | 6 ++++--
 src/gen7_mfd.c        | 6 ++++--
 src/gen8_mfd.c        | 6 ++++--
 src/i965_avc_bsd.c    | 6 ++++--
 src/i965_drv_video.h  | 4 ----
 src/i965_output_dri.c | 1 -
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c
index 4a22052..22d8a51 100755
--- a/src/gen6_mfd.c
+++ b/src/gen6_mfd.c
@@ -838,8 +838,10 @@ gen6_mfd_avc_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-    obj_surface->flags |= (pic_param->pic_fields.bits.reference_pic_flag ? SURFACE_REFERENCED : 0);
+    if (pic_param->pic_fields.bits.reference_pic_flag)
+        obj_surface->flags |= SURFACE_REFERENCED;
+    else
+        obj_surface->flags &= ~SURFACE_REFERENCED;
     i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
 
     /* initial uv component for YUV400 case */
diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
index 2d4e236..cb85996 100644
--- a/src/gen75_mfd.c
+++ b/src/gen75_mfd.c
@@ -1082,8 +1082,10 @@ gen75_mfd_avc_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-    obj_surface->flags |= (pic_param->pic_fields.bits.reference_pic_flag ? SURFACE_REFERENCED : 0);
+    if (pic_param->pic_fields.bits.reference_pic_flag)
+        obj_surface->flags |= SURFACE_REFERENCED;
+    else
+        obj_surface->flags &= ~SURFACE_REFERENCED;
     i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
 
     /* initial uv component for YUV400 case */
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index e91cfd3..9891cee 100755
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -756,8 +756,10 @@ gen7_mfd_avc_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-    obj_surface->flags |= (pic_param->pic_fields.bits.reference_pic_flag ? SURFACE_REFERENCED : 0);
+    if (pic_param->pic_fields.bits.reference_pic_flag)
+        obj_surface->flags |= SURFACE_REFERENCED;
+    else
+        obj_surface->flags &= ~SURFACE_REFERENCED;
     i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
 
     /* initial uv component for YUV400 case */
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
index 1742bea..c1f80e4 100644
--- a/src/gen8_mfd.c
+++ b/src/gen8_mfd.c
@@ -843,8 +843,10 @@ gen8_mfd_avc_decode_init(VADriverContextP ctx,
 
     /* Current decoded picture */
     obj_surface = decode_state->render_object;
-    obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-    obj_surface->flags |= (pic_param->pic_fields.bits.reference_pic_flag ? SURFACE_REFERENCED : 0);
+    if (pic_param->pic_fields.bits.reference_pic_flag)
+        obj_surface->flags |= SURFACE_REFERENCED;
+    else
+        obj_surface->flags &= ~SURFACE_REFERENCED;
     i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
 
     /* initial uv component for YUV400 case */
diff --git a/src/i965_avc_bsd.c b/src/i965_avc_bsd.c
index 72b8307..858d4ac 100644
--- a/src/i965_avc_bsd.c
+++ b/src/i965_avc_bsd.c
@@ -448,8 +448,10 @@ i965_avc_bsd_buf_base_state(VADriverContextP ctx,
 
     va_pic = &pic_param->CurrPic;
     obj_surface = decode_state->render_object;
-    obj_surface->flags &= ~SURFACE_REF_DIS_MASK;
-    obj_surface->flags |= (pic_param->pic_fields.bits.reference_pic_flag ? SURFACE_REFERENCED : 0);
+    if (pic_param->pic_fields.bits.reference_pic_flag)
+        obj_surface->flags |= SURFACE_REFERENCED;
+    else
+        obj_surface->flags &= ~SURFACE_REFERENCED;
     i965_check_alloc_surface_bo(ctx, obj_surface, 0, VA_FOURCC_NV12, SUBSAMPLE_YUV420);
 
     /* initial uv component for YUV400 case */
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 535402f..922d680 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -194,12 +194,8 @@ struct object_context
 };
 
 #define SURFACE_REFERENCED      (1 << 0)
-#define SURFACE_DISPLAYED       (1 << 1)
 #define SURFACE_DERIVED         (1 << 2)
-#define SURFACE_REF_DIS_MASK    ((SURFACE_REFERENCED) | \
-                                 (SURFACE_DISPLAYED))
 #define SURFACE_ALL_MASK        ((SURFACE_REFERENCED) | \
-                                 (SURFACE_DISPLAYED) |  \
                                  (SURFACE_DERIVED))
 
 struct object_surface 
diff --git a/src/i965_output_dri.c b/src/i965_output_dri.c
index 8102e83..57cd712 100644
--- a/src/i965_output_dri.c
+++ b/src/i965_output_dri.c
@@ -206,7 +206,6 @@ i965_put_surface_dri(
 
     if (!getenv("INTEL_DEBUG_BENCH"))
         dri_vtable->swap_buffer(ctx, dri_drawable);
-    obj_surface->flags |= SURFACE_DISPLAYED;
 
     _i965UnlockMutex(&i965->render_mutex);
 
-- 
1.9.1



More information about the Libva mailing list