diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-08-09 15:15:42 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-09-06 17:52:24 +0200 |
commit | 20a6254291fbdee4ede9eff314ac69febc677e46 (patch) | |
tree | 8a5b138041a9a1ae728bc6ab8f05fa70b723fb8d | |
parent | f78e9dd3e2a305f8a468c6fff9f310ffea034c65 (diff) |
egl: add vaGetBufferAttributeEGL() API.{obsolete}/13.egl
Change vaGet{Surface,Image}BufferEGL() functions to return a standard
EGLClientBuffer instead of a custom data structure holding that buffer
handle and additional info. Besides, make it possible to query for
those additional info with the newly introduced vaGetBufferAttributeEGL()
function.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r-- | va/egl/va_backend_egl.h | 29 | ||||
-rw-r--r-- | va/egl/va_egl.c | 33 | ||||
-rw-r--r-- | va/egl/va_egl.h | 55 |
3 files changed, 78 insertions, 39 deletions
diff --git a/va/egl/va_backend_egl.h b/va/egl/va_backend_egl.h index da25f13..c3e633d 100644 --- a/va/egl/va_backend_egl.h +++ b/va/egl/va_backend_egl.h @@ -28,6 +28,7 @@ #include <stdint.h> #include <va/va.h> #include <va/va_backend.h> +#include <EGL/egl.h> /** \brief VTable version (major) id for VA/EGL hooks. */ #define VA_EGL_ID (0x45474c00) /* EGL0 */ @@ -37,7 +38,6 @@ #define VA_EGL_CLIENT_BUFFER_VERSION (VA_EGL_ID + 1) /* Forward declarations */ -struct _VABufferInfoEGL; struct va_egl_client_buffer; /** @@ -172,22 +172,31 @@ struct VADriverVTableEGL { * * Implementations shall set this field to \ref VA_EGL_VTABLE_VERSION. */ - unsigned int version; + unsigned int version; - /** \brief Hook to return buffer info associated with the VA surface. */ + /** \brief Hook to return EGL buffer associated with the VA surface. */ VAStatus (*vaGetSurfaceBufferEGL)( - VADriverContextP ctx, - VASurfaceID surface, - struct _VABufferInfoEGL *out_buffer_info + VADriverContextP ctx, + VASurfaceID surface, + EGLClientBuffer *out_buffer ); - /** \brief Hook to return buffer info associated with the VA image. */ + /** \brief Hook to return EGL buffer associated with the VA image. */ VAStatus (*vaGetImageBufferEGL)( - VADriverContextP ctx, - VAImageID image, - struct _VABufferInfoEGL *out_buffer_info + VADriverContextP ctx, + VAImageID image, + EGLClientBuffer *out_buffer + ); + + /** \brief Hook to query VA/EGL buffer attributes. */ + VAStatus + (*vaGetBufferAttributeEGL)( + VADriverContextP ctx, + EGLClientBuffer buffer, + EGLenum attribute, + EGLint *value ); }; diff --git a/va/egl/va_egl.c b/va/egl/va_egl.c index b6bf932..9cd32e1 100644 --- a/va/egl/va_egl.c +++ b/va/egl/va_egl.c @@ -92,12 +92,12 @@ vaGetEGLClientBufferFromSurface ( return va_egl->vaGetEGLClientBufferFromSurface(ctx, surface, buffer); } -/* Returns the EGL client buffer info associated with a VA surface */ +/* Returns the EGL client buffer associated with a VA surface */ VAStatus vaGetSurfaceBufferEGL( VADisplay dpy, VASurfaceID surface, - VABufferInfoEGL *out_buffer_info + EGLClientBuffer *out_buffer ) { VADriverContextP ctx; @@ -109,15 +109,15 @@ vaGetSurfaceBufferEGL( vtable = ctx->vtable_egl; if (!check_vtable(vtable) || !vtable->vaGetSurfaceBufferEGL) return VA_STATUS_ERROR_UNIMPLEMENTED; - return vtable->vaGetSurfaceBufferEGL(ctx, surface, out_buffer_info); + return vtable->vaGetSurfaceBufferEGL(ctx, surface, out_buffer); } -/* Returns the EGL client buffer info associated with a VA image */ +/* Returns the EGL client buffer associated with a VA image */ VAStatus vaGetImageBufferEGL( VADisplay dpy, VAImageID image, - VABufferInfoEGL *out_buffer_info + EGLClientBuffer *out_buffer ) { VADriverContextP ctx; @@ -129,5 +129,26 @@ vaGetImageBufferEGL( vtable = ctx->vtable_egl; if (!check_vtable(vtable) || !vtable->vaGetImageBufferEGL) return VA_STATUS_ERROR_UNIMPLEMENTED; - return vtable->vaGetImageBufferEGL(ctx, image, out_buffer_info); + return vtable->vaGetImageBufferEGL(ctx, image, out_buffer); +} + +/* Queries VA/EGL buffer attributes */ +VAStatus +vaGetBufferAttributeEGL( + VADisplay dpy, + EGLClientBuffer buffer, + EGLenum attribute, + EGLint *value +) +{ + VADriverContextP ctx; + struct VADriverVTableEGL *vtable; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + + vtable = ctx->vtable_egl; + if (!check_vtable(vtable) || !vtable->vaGetBufferAttributeEGL) + return VA_STATUS_ERROR_UNIMPLEMENTED; + return vtable->vaGetBufferAttributeEGL(ctx, buffer, attribute, value); } diff --git a/va/egl/va_egl.h b/va/egl/va_egl.h index 5a04e80..5572c8b 100644 --- a/va/egl/va_egl.h +++ b/va/egl/va_egl.h @@ -27,7 +27,6 @@ #include <va/va.h> #include <EGL/egl.h> -#include <EGL/eglext.h> #ifdef __cplusplus extern "C" { @@ -86,28 +85,16 @@ enum { VA_EGL_PICTURE_STRUCTURE_BOTTOM_FIELD = VA_BOTTOM_FIELD }; -/** \brief VA buffer info specific to the EGL backend. */ -typedef struct _VABufferInfoEGL { - /** \brief Underlying surface buffer suitable for eglCreateImageKHR(). */ - EGLClientBuffer buffer; - /** \brief Buffer structure, see VA_EGL_BUFFER_STRUCTURE_xxx. */ - unsigned int structure; - /** \brief Surface width in pixels. */ - unsigned int width; - /** \brief Surface height in pixels. */ - unsigned int height; -} VABufferInfoEGL; - /** - * \brief Returns the EGL client buffer info associated with a VA surface. + * \brief Returns the EGL client buffer associated with a VA surface. * * This functions returns the underlying surface buffer handle * suitable to eglCreateImageKHR() along with some additional * information describing the VA @surface size and buffer structure. * - * @param[in] dpy the VA display - * @param[in] surface the VA surface - * @param[out] out_buffer_info the returned VA/EGL buffer information + * @param[in] dpy the VA display + * @param[in] surface the VA surface + * @param[out] out_buffer the returned VA/EGL client buffer handle * @return VA_STATUS_SUCCESS if operation is successful, another #VAStatus * value otherwise. */ @@ -115,11 +102,11 @@ VAStatus vaGetSurfaceBufferEGL( VADisplay dpy, VASurfaceID surface, - VABufferInfoEGL *out_buffer_info + EGLClientBuffer *out_buffer ); /** - * \brief Returns the EGL client buffer info associated with a VA image. + * \brief Returns the EGL client buffer associated with a VA image. * * This functions returns the underlying image buffer handle suitable * to eglCreateImageKHR() along with some additional information @@ -128,9 +115,9 @@ vaGetSurfaceBufferEGL( * Note: paletted formats are not supported. In this case, * VA_STATUS_ERROR_INVALID_IMAGE_FORMAT is returned. * - * @param[in] dpy the VA display - * @param[in] image the VA image - * @param[out] out_buffer_info the returned VA/EGL buffer information + * @param[in] dpy the VA display + * @param[in] image the VA image + * @param[out] out_buffer the returned VA/EGL client buffer handle * @return VA_STATUS_SUCCESS if operation is successful, another #VAStatus * value otherwise. */ @@ -138,7 +125,29 @@ VAStatus vaGetImageBufferEGL( VADisplay dpy, VAImageID image, - VABufferInfoEGL *out_buffer_info + EGLClientBuffer *out_buffer +); + +/** + * \brief Queries VA/EGL buffer attributes. + * + * This function returns the value associated with the supplied EGL + * attribute. The accepted values for @attribute are #EGL_WIDTH, + * #EGL_HEIGHT and #EGL_TEXTURE_FORMAT. + * + * @param[in] dpy the VA display + * @param[in] buffer the VA/EGL client buffer + * @param[in] attribute the EGL attribute to query + * @param[out] value the associated value + * @return VA_STATUS_SUCCESS if operation is successful, another #VAStatus + * value otherwise. + */ +VAStatus +vaGetBufferAttributeEGL( + VADisplay dpy, + EGLClientBuffer buffer, + EGLenum attribute, + EGLint *value ); /**@}*/ |