Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * va_wayland.h - Wayland API
  3.  *
  4.  * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person obtaining a
  7.  * copy of this software and associated documentation files (the
  8.  * "Software"), to deal in the Software without restriction, including
  9.  * without limitation the rights to use, copy, modify, merge, publish,
  10.  * distribute, sub license, and/or sell copies of the Software, and to
  11.  * permit persons to whom the Software is furnished to do so, subject to
  12.  * the following conditions:
  13.  *
  14.  * The above copyright notice and this permission notice (including the
  15.  * next paragraph) shall be included in all copies or substantial portions
  16.  * of the Software.
  17.  *
  18.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21.  * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
  22.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  */
  26.  
  27. #ifndef VA_WAYLAND_H
  28. #define VA_WAYLAND_H
  29.  
  30. #include <va/va.h>
  31. #include <wayland-client.h>
  32.  
  33. /**
  34.  * \file va_wayland.h
  35.  * \brief The Wayland rendering API
  36.  *
  37.  * This file contains the \ref api_wayland "Wayland rendering API".
  38.  */
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. /**
  45.  * \defgroup api_wayland Wayland rendering API
  46.  *
  47.  * @{
  48.  *
  49.  * Theory of operations:
  50.  * - Create a VA display for an active Wayland display ;
  51.  * - Perform normal VA-API operations, e.g. decode to a VA surface ;
  52.  * - Get wl_buffer associated to the VA surface ;
  53.  * - Attach wl_buffer to wl_surface ;
  54.  */
  55.  
  56. /**
  57.  * \brief Returns a VA display wrapping the specified Wayland display.
  58.  *
  59.  * This functions returns a (possibly cached) VA display from the
  60.  * specified Wayland @display.
  61.  *
  62.  * @param[in]   display         the native Wayland display
  63.  * @return the VA display
  64.  */
  65. VADisplay
  66. vaGetDisplayWl(struct wl_display *display);
  67.  
  68. /**
  69.  * \brief Returns the Wayland buffer associated with a VA surface.
  70.  *
  71.  * This function returns a wl_buffer handle that can be used as an
  72.  * argument to wl_surface_attach(). This buffer references the
  73.  * underlying VA @surface. As such, the VA @surface and Wayland
  74.  * @out_buffer have the same size and color format. Should specific
  75.  * color conversion be needed, then VA/VPP API can fulfill this
  76.  * purpose.
  77.  *
  78.  * The @flags describe the desired picture structure. This is useful
  79.  * to expose a de-interlaced buffer. If the VA driver does not support
  80.  * any of the supplied flags, then #VA_STATUS_ERROR_FLAG_NOT_SUPPORTED
  81.  * is returned. The following flags are allowed: \c VA_FRAME_PICTURE,
  82.  * \c VA_TOP_FIELD, \c VA_BOTTOM_FIELD.
  83.  *
  84.  * @param[in]   dpy         the VA display
  85.  * @param[in]   surface     the VA surface
  86.  * @param[in]   flags       the deinterlacing flags
  87.  * @param[out]  out_buffer  a wl_buffer wrapping the VA @surface
  88.  * @return VA_STATUS_SUCCESS if successful
  89.  */
  90. VAStatus
  91. vaGetSurfaceBufferWl(
  92.     VADisplay           dpy,
  93.     VASurfaceID         surface,
  94.     unsigned int        flags,
  95.     struct wl_buffer  **out_buffer
  96. );
  97.  
  98. /**
  99.  * \brief Returns the Wayland buffer associated with a VA image.
  100.  *
  101.  * This function returns a wl_buffer handle that can be used as an
  102.  * argument to wl_surface_attach(). This buffer references the
  103.  * underlying VA @image. As such, the VA @image and Wayland
  104.  * @out_buffer have the same size and color format. Should specific
  105.  * color conversion be needed, then VA/VPP API can fulfill this
  106.  * purpose.
  107.  *
  108.  * The @flags describe the desired picture structure. See
  109.  * vaGetSurfaceBufferWl() description for more details.
  110.  *
  111.  * @param[in]   dpy         the VA display
  112.  * @param[in]   image       the VA image
  113.  * @param[in]   flags       the deinterlacing flags
  114.  * @param[out]  out_buffer  a wl_buffer wrapping the VA @image
  115.  * @return VA_STATUS_SUCCESS if successful
  116.  */
  117. VAStatus
  118. vaGetImageBufferWl(
  119.     VADisplay           dpy,
  120.     VAImageID           image,
  121.     unsigned int        flags,
  122.     struct wl_buffer  **out_buffer
  123. );
  124.  
  125. /**@}*/
  126.  
  127. #ifdef __cplusplus
  128. }
  129. #endif
  130.  
  131. #endif /* VA_WAYLAND_H */
  132.