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

Gwenole Beauchesne gb.devel at gmail.com
Tue Jun 3 09:44:00 PDT 2014


The optimization by which the 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 e22e57a..437ad3b 100755
--- a/src/gen6_mfd.c
+++ b/src/gen6_mfd.c
@@ -830,8 +830,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;
 
     avc_ensure_surface_bo(ctx, decode_state, obj_surface, pic_param);
     gen6_mfd_init_avc_surface(ctx, pic_param, obj_surface);
diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
index 3ad8325..67d4c51 100644
--- a/src/gen75_mfd.c
+++ b/src/gen75_mfd.c
@@ -1051,8 +1051,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;
 
     avc_ensure_surface_bo(ctx, decode_state, obj_surface, pic_param);
     gen75_mfd_init_avc_surface(ctx, pic_param, obj_surface);
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index f2bcd61..bda104e 100755
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -748,8 +748,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;
 
     avc_ensure_surface_bo(ctx, decode_state, obj_surface, pic_param);
     gen7_mfd_init_avc_surface(ctx, pic_param, obj_surface);
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
index cf2cb0c..425d094 100644
--- a/src/gen8_mfd.c
+++ b/src/gen8_mfd.c
@@ -824,8 +824,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;
 
     avc_ensure_surface_bo(ctx, decode_state, obj_surface, pic_param);
     gen8_mfd_init_avc_surface(ctx, pic_param, obj_surface);
diff --git a/src/i965_avc_bsd.c b/src/i965_avc_bsd.c
index 43bace6..aca3c01 100644
--- a/src/i965_avc_bsd.c
+++ b/src/i965_avc_bsd.c
@@ -432,8 +432,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 568d05d..444096d 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -202,12 +202,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.7.9.5



More information about the Libva mailing list