[Libva] [PATCH 1/2] API: vpp: add rotation state.

Gwenole Beauchesne gb.devel at gmail.com
Fri Jul 13 05:56:33 PDT 2012


Add the ability to rotate a source surface clockwise by a fixed number
of degrees (VA_ROTATION_xxx flags). The outcome of this operation is
scaled to fit the specified output_region.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 va/va.h     |   14 +++++++++++++-
 va/va_vpp.h |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/va/va.h b/va/va.h
index 7bea527..0daad64 100644
--- a/va/va.h
+++ b/va/va.h
@@ -2219,11 +2219,23 @@ typedef struct _VARectangle
  * before calling vaPutSurface()
  */
 
-/* attribute value for VADisplayAttribRotation   */
+/**
+ * @name Rotation angles
+ *
+ * Those values could be used for VADisplayAttribRotation attribute or
+ * VAProcPipelineParameterBuffer::rotation_state. The rotation operation
+ * is clockwise.
+ */
+/**@{*/
+/** \brief No rotation. */
 #define VA_ROTATION_NONE        0x00000000
+/** \brief Rotation by 90° clockwise. */
 #define VA_ROTATION_90          0x00000001
+/** \brief Rotation by 180° clockwise. */
 #define VA_ROTATION_180         0x00000002
+/** \brief Rotation by 270° clockwise. */
 #define VA_ROTATION_270         0x00000003
+/**@}*/
 
 /* attribute value for VADisplayAttribOutOfLoopDeblock */
 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
diff --git a/va/va_vpp.h b/va/va_vpp.h
index 1a0870d..1f2acbc 100644
--- a/va/va_vpp.h
+++ b/va/va_vpp.h
@@ -341,6 +341,32 @@ typedef struct _VAProcPipelineCaps {
     unsigned int        pipeline_flags;
     /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
     unsigned int        filter_flags;
+    /**
+     * \brief Rotation flags.
+     *
+     * For each rotation angle supported by the underlying hardware,
+     * the corresponding bit is set in \ref rotation_flags. See
+     * "Rotation angles" for a description of rotation angles.
+     *
+     * A value of 0 means the underlying hardware does not support any
+     * rotation. Otherwise, a check for a specific rotation angle can be
+     * performed as follows:
+     *
+     * \code
+     * VAProcPipelineCaps pipeline_caps;
+     * ...
+     * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
+     *     filter_bufs, num_filter_bufs,
+     *     &pipeline_caps
+     * );
+     * ...
+     * if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_xxx)) {
+     *     // Clockwise rotation by xxx degrees is supported
+     *     ...
+     * }
+     * \endcode
+     */
+    unsigned int        rotation_flags;
     /** \brief Number of forward reference frames that are needed. */
     unsigned int        num_forward_references;
     /** \brief Number of backward reference frames that are needed. */
@@ -455,6 +481,31 @@ typedef struct _VAProcPipelineParameterBuffer {
      */
     VAProcColorStandardType output_color_standard;
     /**
+     * \brief Rotation state. See rotation angles.
+     *
+     * The rotation angle is clockwise. There is no specific rotation
+     * center for this operation. Rather, The source \ref surface is
+     * first rotated by the specified angle and then scaled to fit the
+     * \ref output_region.
+     *
+     * This means that the top-left hand corner (0,0) of the output
+     * (rotated) surface is expressed as follows:
+     * - \ref VA_ROTATION_NONE: (0,0) is the top left corner of the
+     *   source surface -- no rotation is performed ;
+     * - \ref VA_ROTATION_90: (0,0) is the bottom-left corner of the
+     *   source surface ;
+     * - \ref VA_ROTATION_180: (0,0) is the bottom-right corner of the
+     *   source surface -- the surface is flipped around the X axis ;
+     * - \ref VA_ROTATION_270: (0,0) is the top-right corner of the
+     *   source surface.
+     *
+     * Check VAProcPipelineCaps::rotation_flags first prior to
+     * defining a specific rotation angle. Otherwise, the hardware can
+     * perfectly ignore this variable if it does not support any
+     * rotation.
+     */
+    unsigned int        rotation_state;
+    /**
      * \brief Pipeline filters. See video pipeline flags.
      *
      * Flags to control the pipeline, like whether to apply subpictures
-- 
1.7.9.5



More information about the Libva mailing list