Implementation for i965_SyncSurface and i965_QuerySurfaceStatus
authorDmitry Ermilov <dmitry.ermilov@intel.com>
Fri, 15 Jun 2012 04:24:37 +0000 (00:24 -0400)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 15 Jun 2012 02:25:10 +0000 (10:25 +0800)
(cherry picked from commit 25673c458932caa09ae3f47c6dbe7e040dbae032)

src/i965_drv_video.c

index 80a788f..7096fd3 100755 (executable)
@@ -1871,6 +1871,9 @@ i965_SyncSurface(VADriverContextP ctx,
 
     assert(obj_surface);
 
+    if(obj_surface->bo)
+        drm_intel_bo_wait_rendering(obj_surface->bo);
+
     return VA_STATUS_SUCCESS;
 }
 
@@ -1884,15 +1887,16 @@ i965_QuerySurfaceStatus(VADriverContextP ctx,
 
     assert(obj_surface);
 
-    /* Usually GEM will handle synchronization with the graphics hardware */
-#if 0
     if (obj_surface->bo) {
-        dri_bo_map(obj_surface->bo, 0);
-        dri_bo_unmap(obj_surface->bo);
+        if (drm_intel_bo_busy(obj_surface->bo)){
+            *status = VASurfaceRendering;
+        }
+        else {
+            *status = VASurfaceReady;
+        }
+    } else {
+        *status = VASurfaceReady;
     }
-#endif
-    
-    *status = obj_surface->status;
 
     return VA_STATUS_SUCCESS;
 }