i965_drv_video: set surface state for B frame on Ivybridge
authorXiang, Haihao <haihao.xiang@intel.com>
Fri, 10 Jun 2011 05:31:43 +0000 (13:31 +0800)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 25 Aug 2011 12:28:59 +0000 (14:28 +0200)
surface state on Ivybridge is different from Sandybridge

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen6_vme.c

index 984e0c2..33cc2a0 100644 (file)
@@ -553,7 +553,7 @@ static VAStatus gen7_vme_surface_setup(VADriverContextP ctx,
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct object_surface *obj_surface;
-    VAEncPictureParameterBufferH264 *pPicParameter = (VAEncPictureParameterBufferH264 *)encode_state->pic_param->buffer;
+    VAEncPictureParameterBufferH264Ext *pPicParameter = (VAEncPictureParameterBufferH264Ext *)encode_state->pic_param->buffer;
 
     /*Setup surfaces state*/
     /* current picture for encoding */
@@ -562,15 +562,18 @@ static VAStatus gen7_vme_surface_setup(VADriverContextP ctx,
     gen7_vme_source_surface_state(ctx, 1, obj_surface, gen6_encoder_context);
     gen7_vme_media_source_surface_state(ctx, 4, obj_surface, gen6_encoder_context);
 
-    if ( ! is_intra ) {
+    if (!is_intra) {
         /* reference 0 */
-        obj_surface = SURFACE(pPicParameter->reference_picture);
+        obj_surface = SURFACE(pPicParameter->ReferenceFrames[0].picture_id);
+        assert(obj_surface);
+        if ( obj_surface->bo != NULL)
+            gen7_vme_source_surface_state(ctx, 2, obj_surface, gen6_encoder_context);
+
+        /* reference 1 */
+        obj_surface = SURFACE(pPicParameter->ReferenceFrames[1].picture_id);
         assert(obj_surface);
-        gen7_vme_source_surface_state(ctx, 2, obj_surface, gen6_encoder_context);
-        /* reference 1, FIXME: */
-        // obj_surface = SURFACE(pPicParameter->reference_picture);
-        // assert(obj_surface);
-        //gen7_vme_source_surface_state(ctx, 3, obj_surface);
+        if ( obj_surface->bo != NULL ) 
+            gen7_vme_source_surface_state(ctx, 3, obj_surface, gen6_encoder_context);
     }
 
     /* VME output */