[Libva] [Patch intel-driver 1/3] decoder: Add struct gen_codec_surface

Xiang, Haihao haihao.xiang at intel.com
Fri Jun 27 00:03:42 PDT 2014


From: "Xiang, Haihao" <haihao.xiang at intel.com>

It is the base of struct gen_avc_surface, and move frame_store_id
from gen_avc_surface to gen_codec_surface

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/gen6_mfd.c           |  2 +-
 src/gen75_mfd.c          |  2 +-
 src/gen7_mfd.c           |  2 +-
 src/gen8_mfd.c           |  2 +-
 src/i965_avc_bsd.c       |  2 +-
 src/i965_decoder_utils.c | 10 +++++-----
 src/intel_media.h        |  7 ++++++-
 7 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c
index 8128a80..b3a8ef4 100755
--- a/src/gen6_mfd.c
+++ b/src/gen6_mfd.c
@@ -61,7 +61,7 @@ gen6_mfd_init_avc_surface(VADriverContextP ctx,
 
     if (!gen6_avc_surface) {
         gen6_avc_surface = calloc(sizeof(GenAvcSurface), 1);
-        gen6_avc_surface->frame_store_id = -1;
+        gen6_avc_surface->base.frame_store_id = -1;
         assert((obj_surface->size & 0x3f) == 0);
         obj_surface->private_data = gen6_avc_surface;
     }
diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
index a89640d..b14db61 100644
--- a/src/gen75_mfd.c
+++ b/src/gen75_mfd.c
@@ -67,7 +67,7 @@ gen75_mfd_init_avc_surface(VADriverContextP ctx,
 
     if (!gen7_avc_surface) {
         gen7_avc_surface = calloc(sizeof(GenAvcSurface), 1);
-        gen7_avc_surface->frame_store_id = -1;
+        gen7_avc_surface->base.frame_store_id = -1;
         assert((obj_surface->size & 0x3f) == 0);
         obj_surface->private_data = gen7_avc_surface;
     }
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index 7ab2955..46a07a0 100755
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -65,7 +65,7 @@ gen7_mfd_init_avc_surface(VADriverContextP ctx,
 
     if (!gen7_avc_surface) {
         gen7_avc_surface = calloc(sizeof(GenAvcSurface), 1);
-        gen7_avc_surface->frame_store_id = -1;
+        gen7_avc_surface->base.frame_store_id = -1;
         assert((obj_surface->size & 0x3f) == 0);
         obj_surface->private_data = gen7_avc_surface;
     }
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
index 5e1b70b..d08dd43 100644
--- a/src/gen8_mfd.c
+++ b/src/gen8_mfd.c
@@ -74,7 +74,7 @@ gen8_mfd_init_avc_surface(VADriverContextP ctx,
 
     if (!gen7_avc_surface) {
         gen7_avc_surface = calloc(sizeof(GenAvcSurface), 1);
-        gen7_avc_surface->frame_store_id = -1;
+        gen7_avc_surface->base.frame_store_id = -1;
         assert((obj_surface->size & 0x3f) == 0);
         obj_surface->private_data = gen7_avc_surface;
     }
diff --git a/src/i965_avc_bsd.c b/src/i965_avc_bsd.c
index ebeb2a6..e6e86b0 100644
--- a/src/i965_avc_bsd.c
+++ b/src/i965_avc_bsd.c
@@ -51,7 +51,7 @@ i965_avc_bsd_init_avc_bsd_surface(VADriverContextP ctx,
 
     if (!avc_bsd_surface) {
         avc_bsd_surface = calloc(sizeof(GenAvcSurface), 1);
-        avc_bsd_surface->frame_store_id = -1;
+        avc_bsd_surface->base.frame_store_id = -1;
         assert((obj_surface->size & 0x3f) == 0);
         obj_surface->private_data = avc_bsd_surface;
     }
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index 7b259c6..4208bac 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -525,10 +525,10 @@ intel_update_avc_frame_store_index(
         if (!obj_surface)
             continue;
 
-        GenAvcSurface * const avc_surface = obj_surface->private_data;
-        if (avc_surface->frame_store_id >= 0) {
+        GenCodecSurface * const codec_surface = obj_surface->private_data;
+        if (codec_surface->frame_store_id >= 0) {
             GenFrameStore * const fs =
-                &frame_store[avc_surface->frame_store_id];
+                &frame_store[codec_surface->frame_store_id];
             if (fs->surface_id == obj_surface->base.id) {
                 fs->obj_surface = obj_surface;
                 fs->ref_age = age;
@@ -558,14 +558,14 @@ intel_update_avc_frame_store_index(
         if (!obj_surface || !(add_refs & (1 << i)))
             continue;
 
-        GenAvcSurface * const avc_surface = obj_surface->private_data;
+        GenCodecSurface * const codec_surface = obj_surface->private_data;
         if (n < num_free_refs) {
             GenFrameStore * const fs = free_refs[n++];
             fs->surface_id = obj_surface->base.id;
             fs->obj_surface = obj_surface;
             fs->frame_store_id = fs - frame_store;
             fs->ref_age = age;
-            avc_surface->frame_store_id = fs->frame_store_id;
+            codec_surface->frame_store_id = fs->frame_store_id;
             continue;
         }
         WARN_ONCE("No free slot found for DPB reference list!!!\n");
diff --git a/src/intel_media.h b/src/intel_media.h
index 55136d6..2b228e7 100644
--- a/src/intel_media.h
+++ b/src/intel_media.h
@@ -31,15 +31,20 @@
 #include <va/va.h>
 #include <intel_bufmgr.h>
 
+typedef struct gen_codec_surface GenCodecSurface;
 
+struct gen_codec_surface
+{
+    int frame_store_id;
+};
 
 typedef struct gen_avc_surface GenAvcSurface;
 struct gen_avc_surface
 {
+    GenCodecSurface base;
     dri_bo *dmv_top;
     dri_bo *dmv_bottom;
     int dmv_bottom_flag;
-    int frame_store_id; /* only used for H.264 on earlier generations (<HSW) */
 };
 
 extern void gen_free_avc_surface(void **data);
-- 
1.8.3.2



More information about the Libva mailing list