[Libva] [Libva-intel-driver PATCH 4/9] Call the wrapped function to free wrapped surface/buffer

Zhao Yakui yakui.zhao at intel.com
Sat Sep 5 18:39:11 PDT 2015


Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
Signed-off-by: Sean V Kelley <seanvk at posteo.de>
---
 src/i965_drv_video.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 8142ab2..bb657d7 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -1421,15 +1421,25 @@ i965_DestroySurfaces(VADriverContextP ctx,
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     int i;
+    VAStatus va_status = VA_STATUS_SUCCESS;
 
     for (i = num_surfaces; i--; ) {
         struct object_surface *obj_surface = SURFACE(surface_list[i]);
 
         ASSERT_RET(obj_surface, VA_STATUS_ERROR_INVALID_SURFACE);
+
+        if ((obj_surface->wrapper_surface != VA_INVALID_ID) &&
+            i965->wrapper_pdrvctx) {
+            CALL_VTABLE(i965->wrapper_pdrvctx, va_status,
+                        vaDestroySurfaces(i965->wrapper_pdrvctx,
+                                          &(obj_surface->wrapper_surface),
+                                          1));
+            obj_surface->wrapper_surface = VA_INVALID_ID;
+        }
         i965_destroy_surface(&i965->surface_heap, (struct object_base *)obj_surface);
     }
 
-    return VA_STATUS_SUCCESS;
+    return va_status;
 }
 
 VAStatus 
@@ -2356,12 +2366,21 @@ i965_DestroyBuffer(VADriverContextP ctx, VABufferID buffer_id)
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     struct object_buffer *obj_buffer = BUFFER(buffer_id);
+    VAStatus va_status = VA_STATUS_SUCCESS;
 
     ASSERT_RET(obj_buffer, VA_STATUS_ERROR_INVALID_BUFFER);
 
+    if ((obj_buffer->wrapper_buffer != VA_INVALID_ID) &&
+        i965->wrapper_pdrvctx) {
+        CALL_VTABLE(i965->wrapper_pdrvctx, va_status,
+                    vaDestroyBuffer(i965->wrapper_pdrvctx,
+                                    obj_buffer->wrapper_buffer));
+        obj_buffer->wrapper_buffer = VA_INVALID_ID;
+    }
+
     i965_destroy_buffer(&i965->buffer_heap, (struct object_base *)obj_buffer);
 
-    return VA_STATUS_SUCCESS;
+    return va_status;
 }
 
 VAStatus 
-- 
1.8.4.2



More information about the Libva mailing list