From: Zhao halley <halley.z...@intel.com> --- va/wayland/va_backend_wayland.h | 11 +++++++++-- va/wayland/va_wayland.c | 18 ++++++++++++++++++ va/wayland/va_wayland.h | 30 +++++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/va/wayland/va_backend_wayland.h b/va/wayland/va_backend_wayland.h index 0f076c7..e652c70 100755 --- a/va/wayland/va_backend_wayland.h +++ b/va/wayland/va_backend_wayland.h @@ -41,9 +41,16 @@ struct VADriverVTableWayland { /* Get wl_buffer from VASurface*/ VAStatus (*vaGetSurfaceBufferWl)( - struct VADriverContext *ctx, + struct VADriverContext *ctx, VASurfaceID va_surface, - struct wl_buffer **out_buffer + struct wl_buffer **out_buffer + ); + + /* Get wl_buffer from VAImageID*/ + VAStatus (*vaGetImageBufferWl)( + struct VADriverContext *ctx, + VAImageID va_image, + struct wl_buffer **out_buffer ); }; diff --git a/va/wayland/va_wayland.c b/va/wayland/va_wayland.c index a9ebc1e..7559c1b 100755 --- a/va/wayland/va_wayland.c +++ b/va/wayland/va_wayland.c @@ -173,3 +173,21 @@ vaGetSurfaceBufferWl( return ctx->vtable_wayland->vaGetSurfaceBufferWl(ctx, va_surface, out_buffer); } + +VAStatus +vaGetImageBufferWl( + VADisplay dpy, + VAImageID va_image, + struct wl_buffer **out_buffer +) +{ + VADriverContextP const ctx = get_driver_context(dpy); + + if (!ctx) + return VA_STATUS_ERROR_INVALID_DISPLAY; + if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaGetImageBufferWl) + return VA_STATUS_ERROR_UNIMPLEMENTED; + return ctx->vtable_wayland->vaGetImageBufferWl(ctx, + va_image, out_buffer); +} + diff --git a/va/wayland/va_wayland.h b/va/wayland/va_wayland.h index 2186eec..ba6d139 100755 --- a/va/wayland/va_wayland.h +++ b/va/wayland/va_wayland.h @@ -78,9 +78,9 @@ vaGetDisplayWl(struct wl_display *display); * format. if color conversion is required, vpp interface can help * before call this function * - * @param[in] dpy the VA display - * @param[in] va_surface the src VA surface - * @param[out] out_buffer wl_buffer wraps from va_surface + * @param[in] dpy the VA display + * @param[in] va_surface the src VA surface + * @param[out] out_buffer wl_buffer wraps from va_surface * @return VA_STATUS_SUCCESS if successful */ VAStatus @@ -90,6 +90,30 @@ vaGetSurfaceBufferWl( struct wl_buffer **out_buffer ); +/** + * \brief create a wl_buffer which is wraped from va_image + * + * This function is used to get a wl_buffer from va_image, + * usually they share the same buffer without additional copy. + * it's up to the client to manage the life cycle of these + * va_image and wl_buffer. (XXXX, life cycle of wl_buffer?) + * + * Implementation note: va_image and out_buffer has same + * format. if color conversion is required, vpp interface can help + * before call this function + * + * @param[in] dpy the VA display + * @param[in] va_image the src VA Image id + * @param[out] out_buffer wl_buffer wraps from va_surface + * @return VA_STATUS_SUCCESS if successful + */ +VAStatus +vaGetImageBufferWl( + VADisplay dpy, + VAImageID va_image, + struct wl_buffer **out_buffer +); + /**@}*/ #ifdef __cplusplus -- 1.7.5.4 _______________________________________________ Libva mailing list Libva@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libva