[Libva] [PATCH 12/16] va wayland update to use vaGetSurfaceBufferWl
Zhao Halley
halley.zhao at intel.com
Tue Jun 5 02:07:00 PDT 2012
From: Zhao halley <halley.zhao at intel.com>
---
va/wayland/va_backend_wayland.h | 26 ++++---------
va/wayland/va_wayland.c | 52 +++++--------------------
va/wayland/va_wayland.h | 79 +++++++-------------------------------
3 files changed, 33 insertions(+), 124 deletions(-)
mode change 100644 => 100755 va/wayland/va_backend_wayland.h
mode change 100644 => 100755 va/wayland/va_wayland.c
mode change 100644 => 100755 va/wayland/va_wayland.h
diff --git a/va/wayland/va_backend_wayland.h b/va/wayland/va_backend_wayland.h
old mode 100644
new mode 100755
index a6fb585..45c1d6f
--- a/va/wayland/va_backend_wayland.h
+++ b/va/wayland/va_backend_wayland.h
@@ -30,30 +30,20 @@
#include <va/va.h>
#include <va/va_drmcommon.h>
#include <wayland-client.h>
+// #include <wayland-client-protocol.h>
+// #include <wayland-drm-client-protocol.h>
struct VADriverContext;
-struct va_wl_surface;
struct VADriverVTableWayland {
- /* Create a surface used for rendering to Wayland */
- VAStatus (*vaCreateSurfaceWL)(
+ struct wl_drm *wl_drm;
+ int name; // name of render_state->region->bo
+
+ /* Get wl_buffer from VASurface*/
+ VAStatus (*vaGetSurfaceBufferWl)(
struct VADriverContext *ctx,
- struct wl_surface *wl_surface,
- struct va_wl_surface **out_va_wl_surface
- );
-
- /* Destroy a VA/Waland surface */
- VAStatus (*vaDestroySurfaceWL)(
- struct VADriverContext *ctx,
- struct va_wl_surface *va_wl_surface
- );
-
- /* Attach a VA surface to a VA/WL surface */
- VAStatus (*vaAttachSurfaceWL)(
- struct VADriverContext *ctx,
- struct va_wl_surface *va_wl_surface,
VASurfaceID va_surface,
- unsigned int flags
+ struct wl_buffer *out_buffer
);
};
diff --git a/va/wayland/va_wayland.c b/va/wayland/va_wayland.c
old mode 100644
new mode 100755
index 4ebb3e0..d69cc30
--- a/va/wayland/va_wayland.c
+++ b/va/wayland/va_wayland.c
@@ -27,11 +27,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include "va_wayland.h"
-#include "va_wayland_drm.h"
-#include "va_wayland_private.h"
-#include "va_backend.h"
-#include "va_backend_wayland.h"
+#include "va/va_backend.h"
+#include "va/wayland/va_wayland.h"
+#include "va/wayland/va_wayland_drm.h"
+#include "va/wayland/va_wayland_private.h"
+#include "va/wayland/va_backend_wayland.h"
static inline VADriverContextP
get_driver_context(VADisplay dpy)
@@ -158,50 +158,18 @@ error:
}
VAStatus
-vaCreateSurfaceWL(
- VADisplay dpy,
- struct wl_surface *surface,
- VASurfaceWL *va_wl_surface
-)
-{
- VADriverContextP const ctx = get_driver_context(dpy);
-
- if (!ctx)
- return VA_STATUS_ERROR_INVALID_DISPLAY;
- if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaCreateSurfaceWL)
- return VA_STATUS_ERROR_UNIMPLEMENTED;
- return ctx->vtable_wayland->vaCreateSurfaceWL(ctx, surface, va_wl_surface);
-}
-
-VAStatus
-vaDestroySurfaceWL(
- VADisplay dpy,
- VASurfaceWL va_wl_surface
-)
-{
- VADriverContextP const ctx = get_driver_context(dpy);
-
- if (!ctx)
- return VA_STATUS_ERROR_INVALID_DISPLAY;
- if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaDestroySurfaceWL)
- return VA_STATUS_ERROR_UNIMPLEMENTED;
- return ctx->vtable_wayland->vaDestroySurfaceWL(ctx, va_wl_surface);
-}
-
-VAStatus
-vaAttachSurfaceWL(
+vaGetSurfaceBufferWl(
VADisplay dpy,
- VASurfaceWL va_wl_surface,
VASurfaceID va_surface,
- unsigned int flags
+ 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->vaAttachSurfaceWL)
+ if (!ctx->vtable_wayland || !ctx->vtable_wayland->vaGetSurfaceBufferWl)
return VA_STATUS_ERROR_UNIMPLEMENTED;
- return ctx->vtable_wayland->vaAttachSurfaceWL(ctx, va_wl_surface,
- va_surface, flags);
+ return ctx->vtable_wayland->vaGetSurfaceBufferWl(ctx,
+ va_surface, out_buffer);
}
diff --git a/va/wayland/va_wayland.h b/va/wayland/va_wayland.h
old mode 100644
new mode 100755
index 8e0bd31..025621d
--- a/va/wayland/va_wayland.h
+++ b/va/wayland/va_wayland.h
@@ -48,16 +48,12 @@ extern "C" {
*
* Theory of operations:
* - Create a VA display for an active Wayland display ;
- * - Create a VA/Wayland surface wrapping a Wayland surface ;
* - Perform normal VA-API operations, e.g. decode to a VA surface ;
- * - Attach a VA surface to a VA/Wayland surface whenever necessary ;
- * - Dispose the VA/Wayland surface before the child Wayland surface.
+ * - Get wl_buffer from a VA surface
+ * - Use wl_buffer to update wl_surface
+ * - Dispose the wl_buffer and vaSurface
*/
-/** \brief An opaque VA/Wayland surface. */
-struct va_wl_surface;
-typedef struct va_wl_surface *VASurfaceWL;
-
/**
* \brief Returns a VA display wrapping the specified Wayland display.
*
@@ -71,72 +67,27 @@ VADisplay
vaGetDisplayWL(struct wl_display *display);
/**
- * \brief Creates an opaque surface wrapping the specified Wayland surface.
- *
- * This functions creates an opaque VA/Wayland surface so that a VA
- * driver implementation could perform its housekeeping of objects
- * related to the @wl_surface in there.
- *
- * The application shall destroy this instance with vaDestroySurfaceWL()
- * prior to destroying the Wayland surface with wl_surface_destroy().
- *
- * Implementation note: it is not recommanded for the VA driver to use
- * wl_surface_set_user_data() to hold VA/Wayland specific data in there
- * as this data is ultimately dedicated to the client application.
- *
- * @param[in] dpy the VA display
- * @param[in] surface the Wayland surface
- * @param[out] va_wl_surface the newly created VA/Wayland surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus
-vaCreateSurfaceWL(
- VADisplay dpy,
- struct wl_surface *surface,
- VASurfaceWL *va_wl_surface
-);
-
-/**
- * \brief Destroys a VA/Wayland surface.
- *
- * This function is used to destroy VA driver resources associated
- * with the underlying Wayland surface. The application shall call
- * this function prior to destroying the Wayland surface with
- * wl_surface_destroy().
- *
- * @param[in] dpy the VA display
- * @param[in] va_wl_surface the VA/Wayland surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus
-vaDestroySurfaceWL(
- VADisplay dpy,
- VASurfaceWL va_wl_surface
-);
-
-/**
- * \brief Attaches a VA surface to a VA/Wayland surface.
+ * \brief create a wl_buffer which is wraped from va_surface
*
- * This function is used to attach a VA surface to the VA/Wayland
- * surface, and thus to the underlying Wayland surface. The @flags are
- * used to specify how the VA surface is to be rendered, e.g. either
- * field of an interleaved surface.
+ * This function is used to get a wl_buffer from VASurface,
+ * usually they share the same buffer without additional copy.
+ * it's up to the client to manage the life cycle of these
+ * va_surface and wl_buffer. (XXXX, life cycle of wl_buffer?)
*
- * Implementation note: the VA driver is expected to negotiate a
- * suitable surface format with the compositor.
+ * Implementation note: va_surface 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_wl_surface the VA/Wayland surface
- * @param[in] va_surface the VA surface to attach
- * @param[in] flags the rendering flags, e.g. either field
+ * @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
-vaAttachSurfaceWL(
+vaGetSurfaceBufferWl(
VADisplay dpy,
- VASurfaceWL va_wl_surface,
VASurfaceID va_surface,
- unsigned int flags
+ struct wl_buffer *out_buffer
);
/**@}*/
--
1.7.5.4
More information about the Libva
mailing list