i965_drv_video: fix an assertion
authorXiang, Haihao <haihao.xiang@intel.com>
Wed, 7 Apr 2010 09:28:52 +0000 (17:28 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 7 Apr 2010 09:28:52 +0000 (17:28 +0800)
i965_avc_bsd.c

index 80d26d4..1ac0c3e 100644 (file)
@@ -443,21 +443,26 @@ i965_avc_bsd_buf_base_state(VADriverContextP ctx,
             obj_surface = SURFACE(va_pic->picture_id);
             assert(obj_surface);
             avc_bsd_surface = obj_surface->private_data;
-            assert(avc_bsd_surface);
-            assert(avc_bsd_surface->direct_mv_flag != -1);
-
-            OUT_BCS_RELOC(ctx, avc_bsd_surface->direct_mv_wr_top_bo,
-                          I915_GEM_DOMAIN_INSTRUCTION, 0,
-                          0);
+            
+            if (avc_bsd_surface == NULL) {
+                OUT_BCS_BATCH(ctx, 0);
+                OUT_BCS_BATCH(ctx, 0);
+            } else {
+                assert(avc_bsd_surface->direct_mv_flag != -1);
 
-            if (avc_bsd_surface->direct_mv_flag == 1)
-                OUT_BCS_RELOC(ctx, avc_bsd_surface->direct_mv_wr_bottom_bo,
-                              I915_GEM_DOMAIN_INSTRUCTION, 0,
-                              0);
-            else
                 OUT_BCS_RELOC(ctx, avc_bsd_surface->direct_mv_wr_top_bo,
                               I915_GEM_DOMAIN_INSTRUCTION, 0,
                               0);
+
+                if (avc_bsd_surface->direct_mv_flag == 1)
+                    OUT_BCS_RELOC(ctx, avc_bsd_surface->direct_mv_wr_bottom_bo,
+                                  I915_GEM_DOMAIN_INSTRUCTION, 0,
+                                  0);
+                else
+                    OUT_BCS_RELOC(ctx, avc_bsd_surface->direct_mv_wr_top_bo,
+                                  I915_GEM_DOMAIN_INSTRUCTION, 0,
+                                  0);
+            }
         } else {
             OUT_BCS_BATCH(ctx, 0);
             OUT_BCS_BATCH(ctx, 0);