[Libva] [PATCH] vaBeginPicture: allow processing surfaces exported to dmabuf

Julien Isorce julien.isorce at gmail.com
Mon Sep 28 15:05:29 PDT 2015


is_surface_busy looks for locked or derived.
If VPP and surface is not locked it should only check fail
for derived if it is not exported to dmabuf.

XXX: maybe checking CODEC_PROC + not locked is enough
to allow processing.

Signed-off-by: Julien Isorce <j.isorce at samsung.com>
---
 src/i965_drv_video.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index bf599d6..0d6f513 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2610,8 +2610,28 @@ i965_BeginPicture(VADriverContextP ctx,
     obj_config = obj_context->obj_config;
     ASSERT_RET(obj_config, VA_STATUS_ERROR_INVALID_CONFIG);
 
-    if (is_surface_busy(i965, obj_surface))
-        return VA_STATUS_ERROR_SURFACE_BUSY;
+    if (obj_context->codec_type == CODEC_PROC) {
+        if (obj_surface->locked_image_id != VA_INVALID_ID)
+            return VA_STATUS_ERROR_SURFACE_BUSY;
+
+        if (obj_surface->derived_image_id != VA_INVALID_ID) {
+            /* Allow derived surface exported to dmabuf. */
+            struct object_buffer *obj_buffer = NULL;
+            struct object_image *obj_image = IMAGE(obj_surface->derived_image_id);
+            if (!obj_image)
+                return VA_STATUS_ERROR_INVALID_IMAGE;
+
+            obj_buffer = BUFFER(obj_image->image.buf);
+            if (!obj_buffer)
+                return VA_STATUS_ERROR_INVALID_BUFFER;
+
+            if (obj_buffer->export_state.mem_type != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME)
+                return VA_STATUS_ERROR_SURFACE_BUSY;
+        }
+    } else {
+        if (is_surface_busy(i965, obj_surface))
+            return VA_STATUS_ERROR_SURFACE_BUSY;
+    }
 
     if (obj_context->codec_type == CODEC_PROC) {
         obj_context->codec_state.proc.current_render_target = render_target;
-- 
1.9.1



More information about the Libva mailing list