mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
amd/vpelib: Document public API structures
Doxygen style inline comments are added to the public API functions and structures. Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Chih-Wei Chien <Chih-Wei.Chien@amd.com> Signed-off-by: Navid Assadian <navid.assadian@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31605>
This commit is contained in:
parent
ded1a2b3f0
commit
338760d9b5
5 changed files with 572 additions and 291 deletions
2
src/amd/vpelib/docs/VPEDoxy.in
Normal file
2
src/amd/vpelib/docs/VPEDoxy.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
OUTPUT_DIRECTORY = @CMAKE_CURRENT_SOURCE_DIR@/VPE_API_manual/
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/inc/
|
||||
|
|
@ -22,6 +22,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vpe_hw_types.h
|
||||
* @brief This is the file containing the API hardware structures for the VPE library.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
@ -36,6 +40,11 @@ extern "C" {
|
|||
* Note: do *not* add any types which are *not* used for HW programming.
|
||||
* this will ensure separation of Logic layer from HW layer
|
||||
***********************************************************************/
|
||||
|
||||
/** @union large_integer
|
||||
* @brief 64 bits integers, either with one 64 bit integer or two 32 bits. Mainly used to store
|
||||
* memory addresses.
|
||||
*/
|
||||
union large_integer {
|
||||
struct {
|
||||
uint32_t low_part;
|
||||
|
|
@ -43,31 +52,46 @@ union large_integer {
|
|||
};
|
||||
|
||||
struct {
|
||||
uint32_t low_part;
|
||||
int32_t high_part;
|
||||
} u;
|
||||
uint32_t low_part; /**< Bits [0:31] of the integer */
|
||||
int32_t high_part; /**< Bits [32:63] of the integer */
|
||||
} u; /**< Structure of one unsigend integer for [0:31] bits of the integer and one signed
|
||||
* integer for [32:63].
|
||||
*/
|
||||
|
||||
int64_t quad_part;
|
||||
int64_t quad_part; /**< One 64 bits integer. */
|
||||
};
|
||||
|
||||
/** @def PHYSICAL_ADDRESS_LOC
|
||||
*
|
||||
* @brief Large integer to store memory address
|
||||
*/
|
||||
#define PHYSICAL_ADDRESS_LOC union large_integer
|
||||
|
||||
/** @enum vpe_plane_addr_type
|
||||
* @brief Plane address types
|
||||
*/
|
||||
enum vpe_plane_addr_type {
|
||||
VPE_PLN_ADDR_TYPE_GRAPHICS = 0,
|
||||
VPE_PLN_ADDR_TYPE_VIDEO_PROGRESSIVE
|
||||
VPE_PLN_ADDR_TYPE_GRAPHICS = 0, /**< For RGB planes */
|
||||
VPE_PLN_ADDR_TYPE_VIDEO_PROGRESSIVE, /**< For YCbCr planes */
|
||||
};
|
||||
|
||||
/** @struct vpe_plane_address
|
||||
*
|
||||
* @brief The width and height of the surface
|
||||
*/
|
||||
struct vpe_plane_address {
|
||||
enum vpe_plane_addr_type type;
|
||||
bool tmz_surface;
|
||||
enum vpe_plane_addr_type type; /**< Type of the plane address */
|
||||
bool tmz_surface; /**< Boolean to determine if the surface is allocated from tmz */
|
||||
union {
|
||||
struct {
|
||||
PHYSICAL_ADDRESS_LOC addr;
|
||||
PHYSICAL_ADDRESS_LOC meta_addr;
|
||||
union large_integer dcc_const_color;
|
||||
} grph;
|
||||
} grph; /**< Only used for RGB planes. Struct of two \ref PHYSICAL_ADDRESS_LOC to
|
||||
* store address and meta address, and one \ref large_integer to store
|
||||
* dcc constant color.
|
||||
*/
|
||||
|
||||
/*video progressive*/
|
||||
struct {
|
||||
PHYSICAL_ADDRESS_LOC luma_addr;
|
||||
PHYSICAL_ADDRESS_LOC luma_meta_addr;
|
||||
|
|
@ -76,57 +100,85 @@ struct vpe_plane_address {
|
|||
PHYSICAL_ADDRESS_LOC chroma_addr;
|
||||
PHYSICAL_ADDRESS_LOC chroma_meta_addr;
|
||||
union large_integer chroma_dcc_const_color;
|
||||
} video_progressive;
|
||||
} video_progressive; /**< Only used for YUV planes. Struct of four \ref
|
||||
* PHYSICAL_ADDRESS_LOC to store address and meta addresses of both
|
||||
* luma and chroma planes, and two \ref large_integer to store dcc
|
||||
* constant color for each plane. For packed YUV formats, the chroma
|
||||
* plane addresses should be blank.
|
||||
*/
|
||||
};
|
||||
};
|
||||
|
||||
/* Rotation angle */
|
||||
/** @enum vpe_rotation_angle
|
||||
* @brief Plane clockwise rotation angle
|
||||
*/
|
||||
enum vpe_rotation_angle {
|
||||
VPE_ROTATION_ANGLE_0 = 0,
|
||||
VPE_ROTATION_ANGLE_90,
|
||||
VPE_ROTATION_ANGLE_180,
|
||||
VPE_ROTATION_ANGLE_270,
|
||||
VPE_ROTATION_ANGLE_0 = 0, /**< No rotation */
|
||||
VPE_ROTATION_ANGLE_90, /**< 90 degrees clockwise rotation */
|
||||
VPE_ROTATION_ANGLE_180, /**< 180 degrees clockwise rotation */
|
||||
VPE_ROTATION_ANGLE_270, /**< 270 degrees clockwise rotation */
|
||||
VPE_ROTATION_ANGLE_COUNT
|
||||
};
|
||||
|
||||
/* mirror */
|
||||
/** @enum vpe_mirror
|
||||
* @brief Mirroring type
|
||||
*/
|
||||
enum vpe_mirror {
|
||||
VPE_MIRROR_NONE,
|
||||
VPE_MIRROR_HORIZONTAL,
|
||||
VPE_MIRROR_VERTICAL
|
||||
VPE_MIRROR_NONE, /**< No mirroring */
|
||||
VPE_MIRROR_HORIZONTAL, /**< Horizontal mirroring */
|
||||
VPE_MIRROR_VERTICAL /**< Vertical mirroring */
|
||||
};
|
||||
|
||||
/** @enum vpe_scan_direction
|
||||
* @brief Plane memory scan pattern
|
||||
*/
|
||||
enum vpe_scan_direction {
|
||||
VPE_SCAN_PATTERN_0_DEGREE = 0,
|
||||
VPE_SCAN_PATTERN_90_DEGREE = 1,
|
||||
VPE_SCAN_PATTERN_180_DEGREE = 2,
|
||||
VPE_SCAN_PATTERN_270_DEGREE = 3,
|
||||
VPE_SCAN_PATTERN_0_DEGREE =
|
||||
0, /**< Left to Right, Top to Bottom. 0 Degree Rotation and no Mirroring */
|
||||
VPE_SCAN_PATTERN_90_DEGREE =
|
||||
1, /**< Bottom to Top, Left to Right. 90 Degree Rotation and no Mirroring */
|
||||
VPE_SCAN_PATTERN_180_DEGREE =
|
||||
2, /**< Right to Left, Bottom to Top. 180 Degree Rotation and no Mirroring */
|
||||
VPE_SCAN_PATTERN_270_DEGREE =
|
||||
3, /**< Top to Bottom, Right to Left. 270 Degree Rotation and no Mirroring */
|
||||
};
|
||||
|
||||
/** @struct vpe_size
|
||||
* @brief The width and height of the surface
|
||||
*/
|
||||
struct vpe_size {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t width; /**< Width of the surface in pixels */
|
||||
uint32_t height; /**< Height of the surface in pixels */
|
||||
};
|
||||
|
||||
/** @struct vpe_rect
|
||||
* @brief A rectangle used in vpe is specified by the position of the left most top corner of the
|
||||
* rectangle and the width and height of the rectangle.
|
||||
*/
|
||||
struct vpe_rect {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int32_t x; /**< The x coordinate of the left most top corner */
|
||||
int32_t y; /**< The y coordinate of the left most top corner */
|
||||
uint32_t width; /**< Width of the surface in pixels */
|
||||
uint32_t height; /**< Height of the rectangle in pixels */
|
||||
};
|
||||
|
||||
/** @struct vpe_plane_size
|
||||
* @brief Size and pitch alignment for vpe surface plane(s)
|
||||
*/
|
||||
struct vpe_plane_size {
|
||||
struct vpe_rect surface_size;
|
||||
struct vpe_rect chroma_size;
|
||||
|
||||
// actual aligned pitch and height
|
||||
uint32_t surface_pitch;
|
||||
uint32_t chroma_pitch;
|
||||
|
||||
uint32_t surface_aligned_height;
|
||||
uint32_t chrome_aligned_height;
|
||||
struct vpe_rect surface_size; /**< Plane rectangle */
|
||||
struct vpe_rect chroma_size; /**< Chroma plane rectangle for semi-planar YUV formats */
|
||||
uint32_t surface_pitch; /**< Horizintal pitch alignment of the plane in pixels */
|
||||
uint32_t chroma_pitch; /**< Horizintal pitch alignment of the chroma plane for
|
||||
semi-planar YUV formats in pixels */
|
||||
uint32_t surface_aligned_height; /**< Vertical alignment of the plane in pixels */
|
||||
uint32_t chrome_aligned_height; /**< Vertical alignment of the chroma plane for semi-planar
|
||||
YUV formats in pixels */
|
||||
};
|
||||
|
||||
/** @struct vpe_plane_dcc_param
|
||||
* @brief Not used
|
||||
*/
|
||||
struct vpe_plane_dcc_param {
|
||||
bool enable;
|
||||
|
||||
|
|
@ -139,7 +191,18 @@ struct vpe_plane_dcc_param {
|
|||
uint8_t dcc_ind_blk_c;
|
||||
};
|
||||
|
||||
/** Displayable pixel format in fb */
|
||||
/** @enum vpe_surface_pixel_format
|
||||
* @brief Surface formats
|
||||
*
|
||||
* The order of components are MSB to LSB. For example, for VPE_SURFACE_PIXEL_FORMAT_GRPH_ARGB1555,
|
||||
* the most significant bit is reserved for alpha and the 5 least significant bits are reserved for
|
||||
* the blue channel, i.e.
|
||||
*
|
||||
* <pre>
|
||||
* MSB _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ LSB
|
||||
* A R R R R R G G G G G B B B B B
|
||||
* </pre>
|
||||
*/
|
||||
enum vpe_surface_pixel_format {
|
||||
VPE_SURFACE_PIXEL_FORMAT_GRPH_BEGIN = 0,
|
||||
/*16 bpp*/
|
||||
|
|
@ -209,6 +272,9 @@ enum vpe_surface_pixel_format {
|
|||
/*grow 444 video here if necessary */
|
||||
};
|
||||
|
||||
/** @enum vpe_swizzle_mode_values
|
||||
* @brief Surface swizzle modes
|
||||
*/
|
||||
enum vpe_swizzle_mode_values {
|
||||
VPE_SW_LINEAR = 0,
|
||||
VPE_SW_256B_S = 1,
|
||||
|
|
@ -246,13 +312,17 @@ enum vpe_swizzle_mode_values {
|
|||
VPE_SW_UNKNOWN = VPE_SW_MAX
|
||||
};
|
||||
|
||||
/** specify the number of taps.
|
||||
* if 0 is specified, it will use 4 taps by default */
|
||||
/** @struct vpe_scaling_taps
|
||||
* @brief Number of taps used for scaling
|
||||
*
|
||||
* If the number of taps are set to 0, VPElib internally chooses the best tap based on the scaling
|
||||
* ratio.
|
||||
*/
|
||||
struct vpe_scaling_taps {
|
||||
uint32_t v_taps;
|
||||
uint32_t h_taps;
|
||||
uint32_t v_taps_c;
|
||||
uint32_t h_taps_c;
|
||||
uint32_t v_taps; /**< Number of vertical taps */
|
||||
uint32_t h_taps; /**< Number of horizontal taps */
|
||||
uint32_t v_taps_c; /**< Number of vertical taps for chroma plane */
|
||||
uint32_t h_taps_c; /**< Number of horizontal taps for chroma plane */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vpe_types.h
|
||||
* @brief This is the file containing the API structures for the VPE library.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
|
@ -36,101 +40,124 @@ extern "C" {
|
|||
|
||||
struct vpe;
|
||||
|
||||
#define MAX_NB_POLYPHASE_COEFFS \
|
||||
(8 * 33) /* currently vpe supports up to 8 taps and 64 phases, only (32+1) phases needed*/
|
||||
|
||||
/** @def MAX_NB_POLYPHASE_COEFFS
|
||||
*
|
||||
* @brief Maximum number of filter coefficients for polyphase scaling.
|
||||
* VPE library supports up to 8 taps and 64 phases, only (32+1) phases needed
|
||||
*/
|
||||
#define MAX_NB_POLYPHASE_COEFFS (8 * 33)
|
||||
|
||||
/** @enum vpe_status
|
||||
* @brief The status of VPE to indicate whether it supports the given job or not.
|
||||
*/
|
||||
enum vpe_status {
|
||||
VPE_STATUS_OK = 1,
|
||||
VPE_STATUS_ERROR,
|
||||
VPE_STATUS_NO_MEMORY,
|
||||
|
||||
// errors for not supported operations
|
||||
VPE_STATUS_NOT_SUPPORTED,
|
||||
VPE_STATUS_INPUT_DCC_NOT_SUPPORTED,
|
||||
VPE_STATUS_OUTPUT_DCC_NOT_SUPPORTED,
|
||||
VPE_STATUS_SWIZZLE_NOT_SUPPORTED,
|
||||
VPE_STATUS_NUM_STREAM_NOT_SUPPORTED,
|
||||
VPE_STATUS_PIXEL_FORMAT_NOT_SUPPORTED,
|
||||
VPE_STATUS_COLOR_SPACE_VALUE_NOT_SUPPORTED,
|
||||
VPE_STATUS_SCALING_RATIO_NOT_SUPPORTED,
|
||||
VPE_STATUS_PITCH_ALIGNMENT_NOT_SUPPORTED,
|
||||
VPE_STATUS_ROTATION_NOT_SUPPORTED,
|
||||
VPE_STATUS_MIRROR_NOT_SUPPORTED,
|
||||
VPE_STATUS_ALPHA_BLENDING_NOT_SUPPORTED,
|
||||
VPE_STATUS_VIEWPORT_SIZE_NOT_SUPPORTED,
|
||||
VPE_STATUS_LUMA_KEYING_NOT_SUPPORTED,
|
||||
VPE_STATUS_PLANE_ADDR_NOT_SUPPORTED,
|
||||
VPE_STATUS_ADJUSTMENT_NOT_SUPPORTED,
|
||||
VPE_STATUS_CMD_OVERFLOW_ERROR,
|
||||
VPE_STATUS_SEGMENT_WIDTH_ERROR,
|
||||
VPE_STATUS_PARAM_CHECK_ERROR,
|
||||
VPE_STATUS_TONE_MAP_NOT_SUPPORTED,
|
||||
VPE_STATUS_BAD_TONE_MAP_PARAMS,
|
||||
VPE_STATUS_BAD_HDR_METADATA,
|
||||
VPE_STATUS_BUFFER_OVERFLOW,
|
||||
VPE_STATUS_BUFFER_UNDERRUN,
|
||||
VPE_STATUS_BG_COLOR_OUT_OF_RANGE,
|
||||
VPE_STATUS_REPEAT_ITEM,
|
||||
VPE_STATUS_PATCH_OVER_MAXSIZE,
|
||||
VPE_STATUS_INVALID_BUFFER_SIZE,
|
||||
VPE_STATUS_SCALER_NOT_SET,
|
||||
VPE_STATUS_GEOMETRICSCALING_ERROR
|
||||
VPE_STATUS_OK = 1, /**< VPE supports the job. */
|
||||
VPE_STATUS_ERROR, /**< Unknown Error in VPE. */
|
||||
VPE_STATUS_NO_MEMORY, /**< VPE is out of memory. */
|
||||
VPE_STATUS_NOT_SUPPORTED, /**< VPE is out of memory. */
|
||||
VPE_STATUS_INPUT_DCC_NOT_SUPPORTED, /**< Input DCC is not supported. */
|
||||
VPE_STATUS_OUTPUT_DCC_NOT_SUPPORTED, /**< Output DCC is not supported. */
|
||||
VPE_STATUS_SWIZZLE_NOT_SUPPORTED, /**< Swizzle mode is not supported. */
|
||||
VPE_STATUS_NUM_STREAM_NOT_SUPPORTED, /**< Number of streams is not supported. Too many
|
||||
streams. */
|
||||
VPE_STATUS_PIXEL_FORMAT_NOT_SUPPORTED, /**< Pixel format is not supported. */
|
||||
VPE_STATUS_COLOR_SPACE_VALUE_NOT_SUPPORTED, /**< Input DCC is not supported. */
|
||||
VPE_STATUS_SCALING_RATIO_NOT_SUPPORTED, /**< Given scaling is not supported. */
|
||||
VPE_STATUS_PITCH_ALIGNMENT_NOT_SUPPORTED, /**< Given pitch alignment is not supported. */
|
||||
VPE_STATUS_ROTATION_NOT_SUPPORTED, /**< Given rotation is not supported. */
|
||||
VPE_STATUS_MIRROR_NOT_SUPPORTED, /**< Given mirror is not supported. */
|
||||
VPE_STATUS_ALPHA_BLENDING_NOT_SUPPORTED, /**< Alpha blending is not supported. */
|
||||
VPE_STATUS_VIEWPORT_SIZE_NOT_SUPPORTED, /**< Given viewport size is not supported. */
|
||||
VPE_STATUS_LUMA_KEYING_NOT_SUPPORTED, /**< Luma keying is not supported. */
|
||||
VPE_STATUS_PLANE_ADDR_NOT_SUPPORTED, /**< Given plane address is not supported. */
|
||||
VPE_STATUS_ADJUSTMENT_NOT_SUPPORTED, /**< Color adjustment is not supported. */
|
||||
VPE_STATUS_CMD_OVERFLOW_ERROR, /**< More than 256 commands/jobs. */
|
||||
VPE_STATUS_SEGMENT_WIDTH_ERROR, /**< Calculated segment width is not supported. */
|
||||
VPE_STATUS_PARAM_CHECK_ERROR, /**< Given parametrs is not supported. */
|
||||
VPE_STATUS_TONE_MAP_NOT_SUPPORTED, /**< Tone mapping is not supported for the given
|
||||
job. */
|
||||
VPE_STATUS_BAD_TONE_MAP_PARAMS, /**< Invalid tone mapping parameters. */
|
||||
VPE_STATUS_BAD_HDR_METADATA, /**< Ivalid HDR metadata. */
|
||||
VPE_STATUS_BUFFER_OVERFLOW, /**< Buffer overflow. */
|
||||
VPE_STATUS_BUFFER_UNDERRUN, /**< Buffer does not have enough capacity. */
|
||||
VPE_STATUS_BG_COLOR_OUT_OF_RANGE, /**< Given backgroud color does not lie in the
|
||||
range of output color. */
|
||||
VPE_STATUS_REPEAT_ITEM, /**< Descriptor writer is on a repeated job.
|
||||
Used internally */
|
||||
VPE_STATUS_PATCH_OVER_MAXSIZE, /**< Descriptor writer patch size is larger than
|
||||
supported path size. */
|
||||
VPE_STATUS_INVALID_BUFFER_SIZE, /**< Provided buffer size is less than required
|
||||
buffer size. */
|
||||
VPE_STATUS_SCALER_NOT_SET, /**< Scaler parameters are not set. */
|
||||
VPE_STATUS_GEOMETRICSCALING_ERROR, /**< Geometric scaling is not supported for the
|
||||
given case. */
|
||||
};
|
||||
|
||||
/** HW IP level */
|
||||
/** @enum vpe_ip_level
|
||||
* @brief HW IP level
|
||||
*/
|
||||
enum vpe_ip_level {
|
||||
VPE_IP_LEVEL_UNKNOWN = (-1),
|
||||
VPE_IP_LEVEL_1_0,
|
||||
VPE_IP_LEVEL_1_1
|
||||
VPE_IP_LEVEL_1_0, /**< vpe 1.0 */
|
||||
VPE_IP_LEVEL_1_1, /**< vpe 1.1 */
|
||||
};
|
||||
|
||||
/****************************************
|
||||
* Plane Caps
|
||||
****************************************/
|
||||
|
||||
/** @struct vpe_pixel_format_support
|
||||
* @brief Capability to support formats
|
||||
*/
|
||||
struct vpe_pixel_format_support {
|
||||
uint32_t argb_packed_32b : 1;
|
||||
uint32_t nv12 : 1;
|
||||
uint32_t fp16 : 1;
|
||||
uint32_t p010 : 1; /**< planar 4:2:0 10-bit */
|
||||
uint32_t p016 : 1; /**< planar 4:2:0 16-bit */
|
||||
uint32_t ayuv : 1; /**< packed 4:4:4 */
|
||||
uint32_t yuy2 : 1; /**< packed 4:2:2 */
|
||||
uint32_t argb_packed_32b : 1; /**< Packed RGBA formats 32-bits per pixel */
|
||||
uint32_t nv12 : 1; /**< planar 4:2:0 8-bits */
|
||||
uint32_t fp16 : 1; /**< Floating point RGB 16-bits */
|
||||
uint32_t p010 : 1; /**< planar 4:2:0 10-bits */
|
||||
uint32_t p016 : 1; /**< planar 4:2:0 16-bits */
|
||||
uint32_t ayuv : 1; /**< packed 4:4:4 8-bits */
|
||||
uint32_t yuy2 : 1; /**< packed 4:2:2 8-bits */
|
||||
};
|
||||
|
||||
/** @struct vpe_plane_caps
|
||||
* @brief Capability to support given plane
|
||||
*/
|
||||
struct vpe_plane_caps {
|
||||
uint32_t per_pixel_alpha : 1;
|
||||
uint32_t per_pixel_alpha : 1; /**< Per-pixel alpha */
|
||||
|
||||
struct vpe_pixel_format_support input_pixel_format_support;
|
||||
struct vpe_pixel_format_support output_pixel_format_support;
|
||||
struct vpe_pixel_format_support
|
||||
input_pixel_format_support; /**< Input pixel format capability */
|
||||
struct vpe_pixel_format_support
|
||||
output_pixel_format_support; /**< Output pixel format capability */
|
||||
|
||||
/* max upscaling factor x 1000
|
||||
* upscaling factors are always >= 1
|
||||
* e.g. 1080p -> 8K is 4.0 => 4000
|
||||
*/
|
||||
uint32_t max_upscale_factor;
|
||||
uint32_t max_upscale_factor; /**< Maximum upscaling factor (dst/src) x 1000.
|
||||
E.g. 1080p -> 4k is 4000 */
|
||||
uint32_t max_downscale_factor; /**< Maximum downscaling factor (dst/src) x 1000.
|
||||
E.g. 4k -> 1080p is 250 */
|
||||
|
||||
/* max downscale factor x1000
|
||||
* downscale factors are always <= 1
|
||||
* e.g 8K -> 1080p is 0.25 => 250
|
||||
*/
|
||||
uint32_t max_downscale_factor;
|
||||
|
||||
uint32_t pitch_alignment; /**< alignment in bytes */
|
||||
uint32_t addr_alignment; /**< alignment in bytes */
|
||||
uint32_t max_viewport_width;
|
||||
uint32_t pitch_alignment; /**< Pitch alignment in bytes */
|
||||
uint32_t addr_alignment; /**< Plane address alignment in bytes */
|
||||
uint32_t max_viewport_width; /**< Maximum viewport size */
|
||||
};
|
||||
|
||||
/*************************
|
||||
* Color management caps
|
||||
*************************/
|
||||
|
||||
/** @struct vpe_rom_curve_caps
|
||||
* @brief Capability to support given transfer function
|
||||
*/
|
||||
struct vpe_rom_curve_caps {
|
||||
uint32_t srgb : 1;
|
||||
uint32_t bt2020 : 1;
|
||||
uint32_t gamma2_2 : 1;
|
||||
uint32_t pq : 1;
|
||||
uint32_t hlg : 1;
|
||||
uint32_t srgb : 1; /**< SRGB Gamma */
|
||||
uint32_t bt2020 : 1; /**< BT 2020 */
|
||||
uint32_t gamma2_2 : 1; /**< Gamma 2.2 */
|
||||
uint32_t pq : 1; /**< Perceptual Quantizer */
|
||||
uint32_t hlg : 1; /**< Hybrid log-gamma */
|
||||
};
|
||||
|
||||
/** @struct dpp_color_caps
|
||||
* @brief Color management caps for dpp layer
|
||||
*/
|
||||
struct dpp_color_caps {
|
||||
uint32_t pre_csc : 1;
|
||||
uint32_t luma_key : 1;
|
||||
|
|
@ -143,29 +170,36 @@ struct dpp_color_caps {
|
|||
struct vpe_rom_curve_caps dgam_rom_caps;
|
||||
};
|
||||
|
||||
/** @struct mpc_color_caps
|
||||
* @brief Color management caps for mpc layer
|
||||
*/
|
||||
struct mpc_color_caps {
|
||||
uint32_t gamut_remap : 1;
|
||||
uint32_t ogam_ram : 1;
|
||||
uint32_t ocsc : 1;
|
||||
uint32_t gamut_remap : 1; /**< Gamut remap */
|
||||
uint32_t ogam_ram : 1; /**< Ogam */
|
||||
uint32_t ocsc : 1; /**< OCSC */
|
||||
uint32_t shared_3d_lut : 1; /**< can be in either dpp or mpc, but single instance */
|
||||
uint32_t global_alpha : 1; /**< e.g. top plane 30 %. bottom 70 % */
|
||||
uint32_t top_bottom_blending : 1; /**< two-layer blending */
|
||||
};
|
||||
|
||||
/** @struct vpe_color_caps
|
||||
* @brief VPE color management caps
|
||||
*/
|
||||
struct vpe_color_caps {
|
||||
struct dpp_color_caps dpp;
|
||||
struct mpc_color_caps mpc;
|
||||
struct dpp_color_caps dpp; /**< DPP color caps */
|
||||
struct mpc_color_caps mpc; /**< MPC color caps */
|
||||
};
|
||||
|
||||
/**************************************************
|
||||
* VPE Capabilities.
|
||||
* @struct vpe_caps
|
||||
* @brief VPE Capabilities.
|
||||
*
|
||||
* Those depend on the condition like input format
|
||||
* shall be queried by vpe_cap_funcs
|
||||
* shall be queried by @ref vpe_cap_funcs
|
||||
**************************************************/
|
||||
struct vpe_caps {
|
||||
uint32_t max_downscale_ratio; /**< max downscaling ratio in hundred.
|
||||
ratio as src/dest x 100. e.g 600 */
|
||||
uint32_t max_downscale_ratio; /**< max downscaling ratio (src/dest) x 100.
|
||||
E.g. 4k -> 1080p is 400 */
|
||||
uint64_t lut_size; /**< 3dlut size */
|
||||
|
||||
uint32_t rotation_support : 1;
|
||||
|
|
@ -189,7 +223,9 @@ struct vpe_caps {
|
|||
/***********************************
|
||||
* Conditional Capabilities
|
||||
***********************************/
|
||||
/** DCC CAP */
|
||||
/** @struct vpe_dcc_surface_param
|
||||
* @brief DCC surface parameters
|
||||
*/
|
||||
struct vpe_dcc_surface_param {
|
||||
struct vpe_size surface_size;
|
||||
enum vpe_surface_pixel_format format;
|
||||
|
|
@ -198,6 +234,9 @@ struct vpe_dcc_surface_param {
|
|||
enum vpe_mirror mirror;
|
||||
};
|
||||
|
||||
/** @struct vpe_dcc_setting
|
||||
* @brief DCC Settings
|
||||
*/
|
||||
struct vpe_dcc_setting {
|
||||
unsigned int max_compressed_blk_size;
|
||||
unsigned int max_uncompressed_blk_size;
|
||||
|
|
@ -211,6 +250,9 @@ struct vpe_dcc_setting {
|
|||
} dcc_controls;
|
||||
};
|
||||
|
||||
/** @struct vpe_surface_dcc_cap
|
||||
* @brief DCC Capabilities
|
||||
*/
|
||||
struct vpe_surface_dcc_cap {
|
||||
union {
|
||||
struct {
|
||||
|
|
@ -228,20 +270,31 @@ struct vpe_surface_dcc_cap {
|
|||
|
||||
};
|
||||
|
||||
/** Conditional Capability functions */
|
||||
/** @struct vpe_cap_funcs
|
||||
* @brief Conditional Capability functions
|
||||
*/
|
||||
struct vpe_cap_funcs {
|
||||
/**
|
||||
/** @brief
|
||||
* Get DCC support and setting according to the format,
|
||||
* scan direction and swizzle mdoe.
|
||||
* scan direction and swizzle mode for output.
|
||||
*
|
||||
* @param[in] vpe vpe instance
|
||||
* @param[in] input surface and scan properties
|
||||
* @param[in/out] output dcc capable result and related settings
|
||||
* @param[in] params surface properties
|
||||
* @param[in/out] cap dcc capable result and related settings
|
||||
* @return true if supported
|
||||
*/
|
||||
bool (*get_dcc_compression_output_cap)(const struct vpe *vpe,
|
||||
const struct vpe_dcc_surface_param *params, struct vpe_surface_dcc_cap *cap);
|
||||
|
||||
/** @brief
|
||||
* Get DCC support and setting according to the format,
|
||||
* scan direction and swizzle mode for input.
|
||||
*
|
||||
* @param[in] vpe vpe instance
|
||||
* @param[in] params surface properties
|
||||
* @param[in/out] cap dcc capable result and related settings
|
||||
* @return true if supported
|
||||
*/
|
||||
bool (*get_dcc_compression_input_cap)(const struct vpe *vpe,
|
||||
const struct vpe_dcc_surface_param *params, struct vpe_surface_dcc_cap *cap);
|
||||
};
|
||||
|
|
@ -249,35 +302,41 @@ struct vpe_cap_funcs {
|
|||
/****************************************
|
||||
* VPE Init Param
|
||||
****************************************/
|
||||
/** Log function
|
||||
* @param[in] log_ctx given in the struct vpe_init_params
|
||||
/** @brief Log function
|
||||
* @param[in] log_ctx given in the struct @ref vpe_init_data
|
||||
* @param[in] fmt format string
|
||||
*/
|
||||
typedef void (*vpe_log_func_t)(void *log_ctx, const char *fmt, ...);
|
||||
|
||||
/** system memory zalloc, allocated memory initailized with 0
|
||||
/** @brief system memory zalloc, allocated memory initailized with 0
|
||||
*
|
||||
* @param[in] mem_ctx given in the struct vpe_init_params
|
||||
* @param[in] mem_ctx given in the struct @ref vpe_init_data
|
||||
* @param[in] size number of bytes
|
||||
* @return allocated memory
|
||||
*/
|
||||
typedef void *(*vpe_zalloc_func_t)(void *mem_ctx, size_t size);
|
||||
|
||||
/** system memory free
|
||||
* @param[in] mem_ctx given in the struct vpe_init_params
|
||||
/** @brief system memory free
|
||||
* @param[in] mem_ctx given in the struct @ref vpe_init_data
|
||||
* @param[in] ptr number of bytes
|
||||
*/
|
||||
typedef void (*vpe_free_func_t)(void *mem_ctx, void *ptr);
|
||||
|
||||
/** @struct vpe_callback_funcs
|
||||
* @brief Callback functions.
|
||||
*/
|
||||
struct vpe_callback_funcs {
|
||||
void *log_ctx; /**< optional. provided by the caller and pass back to callback */
|
||||
vpe_log_func_t log;
|
||||
vpe_log_func_t log; /**< Logging function */
|
||||
|
||||
void *mem_ctx; /**< optional. provided by the caller and pass back to callback */
|
||||
vpe_zalloc_func_t zalloc;
|
||||
vpe_free_func_t free;
|
||||
vpe_zalloc_func_t zalloc; /**< Memory allocation */
|
||||
vpe_free_func_t free; /**< Free memory. In sync with @ref zalloc */
|
||||
};
|
||||
|
||||
/** @struct vpe_mem_low_power_enable_options
|
||||
* @brief Component activation on low power mode. Only used for debugging.
|
||||
*/
|
||||
struct vpe_mem_low_power_enable_options {
|
||||
// override flags
|
||||
struct {
|
||||
|
|
@ -293,30 +352,42 @@ struct vpe_mem_low_power_enable_options {
|
|||
} bits;
|
||||
};
|
||||
|
||||
/** @enum vpe_expansion_mode
|
||||
* @brief Color component expansion mode
|
||||
*/
|
||||
enum vpe_expansion_mode {
|
||||
VPE_EXPANSION_MODE_DYNAMIC,
|
||||
VPE_EXPANSION_MODE_ZERO
|
||||
VPE_EXPANSION_MODE_DYNAMIC, /**< Dynamic expansion */
|
||||
VPE_EXPANSION_MODE_ZERO /**< Zero expansion */
|
||||
};
|
||||
|
||||
/** @enum vpe_clamping_range
|
||||
* @brief Color clamping
|
||||
*/
|
||||
enum vpe_clamping_range {
|
||||
VPE_CLAMPING_FULL_RANGE = 0, /* No Clamping */
|
||||
VPE_CLAMPING_LIMITED_RANGE_8BPC, /* 8 bpc: Clamping 1 to FE */
|
||||
VPE_CLAMPING_LIMITED_RANGE_10BPC, /* 10 bpc: Clamping 4 to 3FB */
|
||||
VPE_CLAMPING_LIMITED_RANGE_12BPC, /* 12 bpc: Clamping 10 to FEF */
|
||||
/* Use programmable clampping value on FMT_CLAMP_COMPONENT_R/G/B. */
|
||||
VPE_CLAMPING_LIMITED_RANGE_PROGRAMMABLE
|
||||
VPE_CLAMPING_FULL_RANGE = 0, /**< No Clamping */
|
||||
VPE_CLAMPING_LIMITED_RANGE_8BPC, /**< 8 bpc: Clamping 1 to FE */
|
||||
VPE_CLAMPING_LIMITED_RANGE_10BPC, /**< 10 bpc: Clamping 4 to 3FB */
|
||||
VPE_CLAMPING_LIMITED_RANGE_12BPC, /**< 12 bpc: Clamping 10 to FEF */
|
||||
VPE_CLAMPING_LIMITED_RANGE_PROGRAMMABLE, /**< Programmable. Use programmable clampping value on
|
||||
FMT_CLAMP_COMPONENT_R/G/B. */
|
||||
};
|
||||
|
||||
/** @struct vpe_clamping_params
|
||||
* @brief Upper and lower bound of each color channel for clamping.
|
||||
*/
|
||||
struct vpe_clamping_params {
|
||||
enum vpe_clamping_range clamping_range;
|
||||
uint32_t r_clamp_component_upper;
|
||||
uint32_t b_clamp_component_upper;
|
||||
uint32_t g_clamp_component_upper;
|
||||
uint32_t r_clamp_component_lower;
|
||||
uint32_t b_clamp_component_lower;
|
||||
uint32_t g_clamp_component_lower;
|
||||
uint32_t r_clamp_component_upper; /**< Red channel upper bound */
|
||||
uint32_t b_clamp_component_upper; /**< Blue channel upper bound */
|
||||
uint32_t g_clamp_component_upper; /**< Green channel upper bound */
|
||||
uint32_t r_clamp_component_lower; /**< Red channel lower bound */
|
||||
uint32_t b_clamp_component_lower; /**< Blue channel lower bound */
|
||||
uint32_t g_clamp_component_lower; /**< Green channel lower bound */
|
||||
};
|
||||
|
||||
/** @struct vpe_visual_confirm
|
||||
* @brief Configurable parameters for visual confirm bar
|
||||
*/
|
||||
struct vpe_visual_confirm {
|
||||
union {
|
||||
struct {
|
||||
|
|
@ -328,7 +399,9 @@ struct vpe_visual_confirm {
|
|||
};
|
||||
};
|
||||
|
||||
/** configurable params for debugging purpose */
|
||||
/** @struct vpe_debug_options
|
||||
* @brief Configurable parameters for debugging purpose
|
||||
*/
|
||||
struct vpe_debug_options {
|
||||
// override flags
|
||||
struct {
|
||||
|
|
@ -387,20 +460,21 @@ struct vpe_debug_options {
|
|||
struct vpe_visual_confirm visual_confirm_params;
|
||||
};
|
||||
|
||||
/** @struct vpe_init_data
|
||||
* @brief VPE ip info and debug/callback functions
|
||||
*/
|
||||
struct vpe_init_data {
|
||||
/** vpe ip info */
|
||||
uint8_t ver_major;
|
||||
uint8_t ver_minor;
|
||||
uint8_t ver_rev;
|
||||
|
||||
/** function callbacks */
|
||||
struct vpe_callback_funcs funcs;
|
||||
|
||||
/** debug options */
|
||||
struct vpe_debug_options debug;
|
||||
uint8_t ver_major; /**< vpe major version */
|
||||
uint8_t ver_minor; /**< vpe minor version */
|
||||
uint8_t ver_rev; /**< vpe revision version */
|
||||
struct vpe_callback_funcs funcs; /**< function callbacks */
|
||||
struct vpe_debug_options debug; /**< debug options */
|
||||
};
|
||||
|
||||
/** VPE instance created through vpelib entry function vpe_create() */
|
||||
/** @struct vpe
|
||||
* @brief VPE instance created through vpelib entry function vpe_create()
|
||||
*/
|
||||
struct vpe {
|
||||
uint32_t version; /**< API version */
|
||||
enum vpe_ip_level level; /**< HW IP level */
|
||||
|
|
@ -412,147 +486,215 @@ struct vpe {
|
|||
/*****************************************************
|
||||
* Structures for build VPE command
|
||||
*****************************************************/
|
||||
|
||||
/** @enum vpe_pixel_encoding
|
||||
* @brief Color space format
|
||||
*/
|
||||
enum vpe_pixel_encoding {
|
||||
VPE_PIXEL_ENCODING_YCbCr,
|
||||
VPE_PIXEL_ENCODING_RGB,
|
||||
VPE_PIXEL_ENCODING_YCbCr, /**< YCbCr Color space format */
|
||||
VPE_PIXEL_ENCODING_RGB, /**< RGB Color space format */
|
||||
VPE_PIXEL_ENCODING_COUNT
|
||||
};
|
||||
|
||||
/** @enum vpe_color_range
|
||||
* @brief Color Range
|
||||
*/
|
||||
enum vpe_color_range {
|
||||
VPE_COLOR_RANGE_FULL,
|
||||
VPE_COLOR_RANGE_STUDIO,
|
||||
VPE_COLOR_RANGE_FULL, /**< Full range */
|
||||
VPE_COLOR_RANGE_STUDIO, /**< Studio/limited range */
|
||||
VPE_COLOR_RANGE_COUNT
|
||||
};
|
||||
|
||||
/** @enum vpe_chroma_cositing
|
||||
* @brief Chroma Cositing
|
||||
*
|
||||
* The position of the chroma for the chroma sub-sampled pixel formats.
|
||||
*/
|
||||
enum vpe_chroma_cositing {
|
||||
VPE_CHROMA_COSITING_NONE,
|
||||
VPE_CHROMA_COSITING_LEFT,
|
||||
VPE_CHROMA_COSITING_TOPLEFT,
|
||||
VPE_CHROMA_COSITING_NONE, /**< No cositing */
|
||||
VPE_CHROMA_COSITING_LEFT, /**< Left cositing */
|
||||
VPE_CHROMA_COSITING_TOPLEFT, /**< Top-left cositing */
|
||||
VPE_CHROMA_COSITING_COUNT
|
||||
};
|
||||
|
||||
/** @enum vpe_color_primaries
|
||||
* @brief Color Primaries
|
||||
*/
|
||||
enum vpe_color_primaries {
|
||||
VPE_PRIMARIES_BT601,
|
||||
VPE_PRIMARIES_BT709,
|
||||
VPE_PRIMARIES_BT2020,
|
||||
VPE_PRIMARIES_JFIF,
|
||||
VPE_PRIMARIES_BT601, /**< BT. 601, Rec. 601 */
|
||||
VPE_PRIMARIES_BT709, /**< BT. 709, Rec. 709 */
|
||||
VPE_PRIMARIES_BT2020, /**< BT. 2020, Rec. 2020 */
|
||||
VPE_PRIMARIES_JFIF, /**< JPEG File Interchange Format */
|
||||
VPE_PRIMARIES_COUNT
|
||||
};
|
||||
|
||||
/** @enum vpe_transfer_function
|
||||
* @brief Gamma Transfer function
|
||||
*/
|
||||
enum vpe_transfer_function {
|
||||
VPE_TF_G22,
|
||||
VPE_TF_G24,
|
||||
VPE_TF_G10,
|
||||
VPE_TF_PQ,
|
||||
VPE_TF_PQ_NORMALIZED,
|
||||
VPE_TF_HLG,
|
||||
VPE_TF_SRGB,
|
||||
VPE_TF_BT709,
|
||||
VPE_TF_G22, /**< Gamma 2.2 */
|
||||
VPE_TF_G24, /**< Gamma 2.4 */
|
||||
VPE_TF_G10, /**< Linear */
|
||||
VPE_TF_PQ, /**< Perceptual Quantizer */
|
||||
VPE_TF_PQ_NORMALIZED, /**< Normalized Perceptual Quantizer */
|
||||
VPE_TF_HLG, /**< Hybrid Log-Gamma */
|
||||
VPE_TF_SRGB, /**< Standard RGB */
|
||||
VPE_TF_BT709, /**< BT 709 */
|
||||
VPE_TF_COUNT
|
||||
};
|
||||
|
||||
/** @enum vpe_alpha_mode
|
||||
* @brief Alpha mode of the stream.
|
||||
*/
|
||||
enum vpe_alpha_mode {
|
||||
VPE_ALPHA_OPAQUE,
|
||||
VPE_ALPHA_BGCOLOR
|
||||
VPE_ALPHA_OPAQUE, /**< Opaque. In this mode, If output has alpha channel, it is set to
|
||||
* maximum value. For FP16 format it is set to 125.0f,
|
||||
* and 2^(AlphaChannelBitDepth)-1 for other formats.
|
||||
*/
|
||||
VPE_ALPHA_BGCOLOR /**< If the output has alpha channel, sets the output alpha to be the
|
||||
* alpha value of the user-provided background color.
|
||||
*/
|
||||
};
|
||||
|
||||
/** @struct vpe_color_space
|
||||
* @brief Color space parameters.
|
||||
*/
|
||||
struct vpe_color_space {
|
||||
enum vpe_pixel_encoding encoding;
|
||||
enum vpe_color_range range;
|
||||
enum vpe_transfer_function tf;
|
||||
enum vpe_chroma_cositing cositing;
|
||||
enum vpe_color_primaries primaries;
|
||||
enum vpe_pixel_encoding encoding; /**< Color space format. RGBA vs. YCbCr */
|
||||
enum vpe_color_range range; /**< Color range. Full vs. Studio */
|
||||
enum vpe_transfer_function tf; /**< Transfer Function/Gamma */
|
||||
enum vpe_chroma_cositing cositing; /**< Chroma Cositing */
|
||||
enum vpe_color_primaries primaries; /**< Color primaries */
|
||||
};
|
||||
|
||||
/* component values are in the range: 0 - 1.0f */
|
||||
/** @struct vpe_color_rgba
|
||||
* @brief Color value of each channel for RGBA color space formats.
|
||||
*
|
||||
* Component values are in the range: 0.0f - 1.0f
|
||||
*/
|
||||
struct vpe_color_rgba {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
float r; /**< Red Channel*/
|
||||
float g; /**< Green Channel*/
|
||||
float b; /**< Blue Channel*/
|
||||
float a; /**< Alpha Channel*/
|
||||
};
|
||||
|
||||
/** @struct vpe_color_ycbcra
|
||||
* @brief Color value of each channel for YCbCr color space formats.
|
||||
*
|
||||
* Component values are in the range: 0.0f - 1.0f
|
||||
*/
|
||||
struct vpe_color_ycbcra {
|
||||
float y;
|
||||
float cb;
|
||||
float cr;
|
||||
float a;
|
||||
float y; /**< Luminance/Luma Channel */
|
||||
float cb; /**< Blue-difference Chrominance/Chroma Channel */
|
||||
float cr; /**< Red-difference Chrominance/Chroma Channel */
|
||||
float a; /**< Alpha Channel */
|
||||
};
|
||||
|
||||
/** @struct vpe_color
|
||||
* @brief Color value of each pixel
|
||||
*/
|
||||
struct vpe_color {
|
||||
bool is_ycbcr;
|
||||
bool is_ycbcr; /**< Set if the color space format is YCbCr.
|
||||
If Ture, use @ref ycbcra. If False, use @ref rgba. */
|
||||
union {
|
||||
struct vpe_color_rgba rgba;
|
||||
struct vpe_color_ycbcra ycbcra;
|
||||
struct vpe_color_rgba rgba; /**< RGBA value */
|
||||
struct vpe_color_ycbcra ycbcra; /**< YCbCr value */
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/** @struct vpe_color_adjust
|
||||
* @brief Color adjustment values
|
||||
* <pre>
|
||||
* Adjustment Min Max default step
|
||||
* Brightness -100.0f, 100.0f, 0.0f, 0.1f
|
||||
* Contrast 0.0f, 2.0f, 1.0f, 0.01f
|
||||
* Hue -180.0f, 180.0f, 0.0f, 1.0f
|
||||
* Saturation 0.0f, 3.0f, 1.0f, 0.01f
|
||||
*
|
||||
* Brightness -100.0f, 100.0f, 0.0f, 0.1f
|
||||
*
|
||||
* Contrast 0.0f, 2.0f, 1.0f, 0.01f
|
||||
*
|
||||
* Hue -180.0f, 180.0f, 0.0f, 1.0f
|
||||
*
|
||||
* Saturation 0.0f, 3.0f, 1.0f, 0.01f
|
||||
* </pre>
|
||||
*/
|
||||
struct vpe_color_adjust {
|
||||
float brightness;
|
||||
float contrast;
|
||||
float hue;
|
||||
float saturation;
|
||||
float brightness; /**< Brightness */
|
||||
float contrast; /**< Contrast */
|
||||
float hue; /**< Hue */
|
||||
float saturation; /**< Saturation */
|
||||
};
|
||||
|
||||
/** @struct vpe_surface_info
|
||||
* @brief Surface address and properties
|
||||
*
|
||||
*/
|
||||
struct vpe_surface_info {
|
||||
|
||||
/** surface addressing info */
|
||||
struct vpe_plane_address address;
|
||||
enum vpe_swizzle_mode_values swizzle;
|
||||
struct vpe_plane_address address; /**< Address */
|
||||
enum vpe_swizzle_mode_values swizzle; /**< Swizzle mode */
|
||||
|
||||
/** surface properties */
|
||||
struct vpe_plane_size plane_size; /**< pitch */
|
||||
struct vpe_plane_size plane_size; /**< Pitch */
|
||||
struct vpe_plane_dcc_param dcc;
|
||||
enum vpe_surface_pixel_format format;
|
||||
enum vpe_surface_pixel_format format; /**< Surface pixel format */
|
||||
|
||||
struct vpe_color_space cs;
|
||||
struct vpe_color_space cs; /**< Surface color space */
|
||||
};
|
||||
|
||||
struct vpe_blend_info {
|
||||
bool blending; /**< enable blending */
|
||||
bool pre_multiplied_alpha; /**< is the pixel value pre-multiplied with alpha */
|
||||
bool global_alpha; /**< enable global alpha */
|
||||
float global_alpha_value; /**< global alpha value, should be 0.0~1.0 */
|
||||
bool blending; /**< Enable blending */
|
||||
bool pre_multiplied_alpha; /**< Is the pixel value pre-multiplied with alpha */
|
||||
bool global_alpha; /**< Enable global alpha */
|
||||
float global_alpha_value; /**< Global alpha value. In range of 0.0-1.0 */
|
||||
};
|
||||
|
||||
/** @struct vpe_scaling_info
|
||||
* @brief Data needs to calculate scaling data.
|
||||
*/
|
||||
struct vpe_scaling_info {
|
||||
struct vpe_rect src_rect;
|
||||
struct vpe_rect dst_rect;
|
||||
struct vpe_scaling_taps taps;
|
||||
struct vpe_rect src_rect; /**< Input frame/stream rectangle*/
|
||||
struct vpe_rect dst_rect; /**< Output rectangle on the destination surface. */
|
||||
struct vpe_scaling_taps taps; /**< Number of taps to be used for scaler.
|
||||
* If taps are set to 0, vpe internally calculates the
|
||||
* required number of taps based on the scaling ratio.
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
/** @struct vpe_scaling_filter_coeffs
|
||||
* @brief Filter coefficients for polyphase scaling
|
||||
*
|
||||
* If the number of taps are set to be 0, vpe internally calculates the number of taps and filter
|
||||
* coefficients based on the scaling ratio.
|
||||
*/
|
||||
struct vpe_scaling_filter_coeffs {
|
||||
|
||||
struct vpe_scaling_taps taps;
|
||||
unsigned int nb_phases;
|
||||
uint16_t horiz_polyphase_coeffs[MAX_NB_POLYPHASE_COEFFS]; /*max nb of taps is 4, max nb of
|
||||
phases 33 = (32+1)*/
|
||||
uint16_t vert_polyphase_coeffs[MAX_NB_POLYPHASE_COEFFS]; /*max nb of taps is 4, max nb of
|
||||
phases 33 = (32+1)*/
|
||||
struct vpe_scaling_taps taps; /**< Number of taps for polyphase
|
||||
scaling */
|
||||
unsigned int nb_phases; /**< Number of phases for polyphase
|
||||
scaling */
|
||||
uint16_t horiz_polyphase_coeffs[MAX_NB_POLYPHASE_COEFFS]; /**< Filter coefficients for
|
||||
horizontal polyphase scaling */
|
||||
uint16_t vert_polyphase_coeffs[MAX_NB_POLYPHASE_COEFFS]; /**< Filter coefficients for
|
||||
vertical polyphase scaling */
|
||||
};
|
||||
|
||||
/** @struct vpe_hdr_metadata
|
||||
* @brief HDR metadata
|
||||
*/
|
||||
struct vpe_hdr_metadata {
|
||||
uint16_t redX;
|
||||
uint16_t redY;
|
||||
uint16_t greenX;
|
||||
uint16_t greenY;
|
||||
uint16_t blueX;
|
||||
uint16_t blueY;
|
||||
uint16_t whiteX;
|
||||
uint16_t whiteY;
|
||||
uint16_t redX; /**< Red point chromaticity X-value */
|
||||
uint16_t redY; /**< Red point chromaticity Y-value */
|
||||
uint16_t greenX; /**< Green point chromaticity X-value */
|
||||
uint16_t greenY; /**< Green point chromaticity Y-value */
|
||||
uint16_t blueX; /**< Blue point chromaticity X-value */
|
||||
uint16_t blueY; /**< Blue point chromaticity Y-value */
|
||||
uint16_t whiteX; /**< White point chromaticity X-value */
|
||||
uint16_t whiteY; /**< White point chromaticity Y-value */
|
||||
|
||||
uint32_t min_mastering; // luminance in 1/10000 nits
|
||||
uint32_t max_mastering; // luminance in nits
|
||||
uint32_t max_content;
|
||||
uint32_t avg_content;
|
||||
uint32_t min_mastering; /**< Minimum luminance for HDR frame/stream in 1/10000 nits */
|
||||
uint32_t max_mastering; /**< Maximum luminance for HDR frame/stream in nits */
|
||||
uint32_t max_content; /**< Maximum stream's content light level */
|
||||
uint32_t avg_content; /**< Frame's average light level */
|
||||
};
|
||||
|
||||
struct vpe_reserved_param {
|
||||
|
|
@ -560,61 +702,88 @@ struct vpe_reserved_param {
|
|||
uint32_t size;
|
||||
};
|
||||
|
||||
/** @struct vpe_tonemap_params
|
||||
* @brief Tone mapping parameters
|
||||
*/
|
||||
struct vpe_tonemap_params {
|
||||
uint64_t UID; /* Unique ID for tonemap params */
|
||||
enum vpe_transfer_function shaper_tf;
|
||||
enum vpe_transfer_function lut_out_tf;
|
||||
enum vpe_color_primaries lut_in_gamut;
|
||||
enum vpe_color_primaries lut_out_gamut;
|
||||
uint16_t input_pq_norm_factor;
|
||||
uint16_t lut_dim;
|
||||
uint64_t UID; /**< Unique ID for tonemap params provided by
|
||||
* user. If tone mapping is not needed, set
|
||||
* to 0, otherwise, each update to the
|
||||
* tonemap parameter should use a new ID to
|
||||
* signify a tonemap update.
|
||||
*/
|
||||
enum vpe_transfer_function shaper_tf; /**< Shaper LUT transfer function */
|
||||
enum vpe_transfer_function lut_out_tf; /**< Output transfer function */
|
||||
enum vpe_color_primaries lut_in_gamut; /**< Input color primary */
|
||||
enum vpe_color_primaries lut_out_gamut; /**< Output color primary */
|
||||
uint16_t input_pq_norm_factor; /**< Perceptual Quantizer normalization
|
||||
factor. */
|
||||
uint16_t lut_dim; /**< Size of one dimension of the 3D-LUT */
|
||||
union {
|
||||
uint16_t *lut_data; //CPU accessible
|
||||
void *dma_lut_data; //GPU accessible only for fast load
|
||||
uint16_t *lut_data; /**< Accessible to CPU */
|
||||
void *dma_lut_data; /**< Accessible to GPU. Only for fast load */
|
||||
};
|
||||
bool is_dma_lut;
|
||||
bool enable_3dlut;
|
||||
bool enable_3dlut; /**< Enable/Disable 3D-LUT */
|
||||
};
|
||||
|
||||
/** @struct vpe_stream
|
||||
* @brief Input stream/frame properties to be passed to vpelib
|
||||
*/
|
||||
struct vpe_stream {
|
||||
struct vpe_surface_info surface_info;
|
||||
struct vpe_scaling_info scaling_info;
|
||||
struct vpe_blend_info blend_info;
|
||||
struct vpe_color_adjust color_adj;
|
||||
struct vpe_tonemap_params tm_params;
|
||||
struct vpe_hdr_metadata hdr_metadata;
|
||||
struct vpe_scaling_filter_coeffs polyphase_scaling_coeffs;
|
||||
enum vpe_rotation_angle rotation;
|
||||
bool horizontal_mirror;
|
||||
bool vertical_mirror;
|
||||
bool use_external_scaling_coeffs;
|
||||
bool enable_luma_key;
|
||||
float lower_luma_bound;
|
||||
float upper_luma_bound;
|
||||
struct vpe_surface_info surface_info; /**< Stream plane information. */
|
||||
struct vpe_scaling_info scaling_info; /**< Scaling information. */
|
||||
struct vpe_blend_info blend_info; /**< Alpha blending */
|
||||
struct vpe_color_adjust color_adj; /**< Color adjustment. Brightness,
|
||||
contrast, hue and saturation.*/
|
||||
struct vpe_tonemap_params tm_params; /**< Tone mapping parameters*/
|
||||
struct vpe_hdr_metadata hdr_metadata; /**< HDR metadata */
|
||||
struct vpe_scaling_filter_coeffs polyphase_scaling_coeffs; /**< Filter coefficients for
|
||||
polyphase scaling. */
|
||||
enum vpe_rotation_angle rotation; /**< Rotation angle of the
|
||||
stream/frame */
|
||||
bool horizontal_mirror; /**< Set if the stream is flipped
|
||||
horizontally */
|
||||
bool vertical_mirror; /**< Set if the stream is flipped
|
||||
vertically */
|
||||
bool use_external_scaling_coeffs; /**< Use provided polyphase scaling
|
||||
* filter coefficients.
|
||||
* See @ref vpe_scaling_filter_coeffs
|
||||
*/
|
||||
bool enable_luma_key; /**< Enable luma keying. Only
|
||||
* works if vpe version supports
|
||||
* luma keying.
|
||||
*/
|
||||
float lower_luma_bound; /**< Lowest range of the luma */
|
||||
float upper_luma_bound; /**< Highest range of the luma */
|
||||
struct vpe_reserved_param reserved_param;
|
||||
|
||||
struct {
|
||||
uint32_t hdr_metadata : 1;
|
||||
uint32_t geometric_scaling : 1; /* support 1 input stream only,
|
||||
* if set, gamut/gamma remapping will be disabled,
|
||||
* blending will be disabled
|
||||
* dst rect must equal to target rect */
|
||||
uint32_t geometric_scaling : 1; /**< Enables geometric scaling.
|
||||
* Support 1 input stream only.
|
||||
* If set, gamut/gamma remapping will be disabled,
|
||||
* as well as blending.
|
||||
* Destination rect must equal to target rect.
|
||||
*/
|
||||
uint32_t reserved : 30;
|
||||
} flags;
|
||||
};
|
||||
|
||||
/** @struct vpe_build_param
|
||||
* @brief Build parametrs for vpelib. Must get populated before vpe_check_support() call.
|
||||
*/
|
||||
struct vpe_build_param {
|
||||
/** source */
|
||||
uint32_t num_streams;
|
||||
struct vpe_stream *streams;
|
||||
|
||||
/** destination */
|
||||
struct vpe_surface_info dst_surface;
|
||||
struct vpe_rect target_rect; /**< rectangle in target surface to be blt'd. Ranges out of rect
|
||||
won't be touched */
|
||||
struct vpe_color bg_color;
|
||||
enum vpe_alpha_mode alpha_mode;
|
||||
struct vpe_hdr_metadata hdr_metadata;
|
||||
uint32_t num_streams; /**< Number of source streams */
|
||||
struct vpe_stream *streams; /**< List of input streams */
|
||||
struct vpe_surface_info dst_surface; /**< Destination/Output surface */
|
||||
struct vpe_rect target_rect; /**< rectangle in target surface to be blt'd.
|
||||
Ranges out of target_rect won't be touched */
|
||||
struct vpe_color bg_color; /**< Background Color */
|
||||
enum vpe_alpha_mode alpha_mode; /**< Alpha Mode. Output alpha in the output
|
||||
surface */
|
||||
struct vpe_hdr_metadata hdr_metadata; /**< HDR Metadata */
|
||||
struct vpe_reserved_param dst_reserved_param;
|
||||
|
||||
// data flags
|
||||
|
|
@ -623,11 +792,14 @@ struct vpe_build_param {
|
|||
uint32_t reserved : 31;
|
||||
} flags;
|
||||
|
||||
uint16_t num_instances;
|
||||
bool collaboration_mode;
|
||||
uint16_t num_instances; /**< Number of instances for the collaboration mode */
|
||||
bool collaboration_mode; /**< Collaboration mode. If set, multiple instances of VPE being
|
||||
used. */
|
||||
};
|
||||
|
||||
/** reported through vpe_check_support()
|
||||
/** @struct vpe_bufs_req
|
||||
* @brief Command buffer and Embedded buffer required sizes reported through vpe_check_support()
|
||||
*
|
||||
* Once the operation is supported,
|
||||
* it returns the required memory for storing
|
||||
* 1. command buffer
|
||||
|
|
@ -641,13 +813,19 @@ struct vpe_bufs_req {
|
|||
uint64_t emb_buf_size; /**< total size for storing all embedded data */
|
||||
};
|
||||
|
||||
/** @struct vpe_buf
|
||||
* @brief Buffer information
|
||||
*/
|
||||
struct vpe_buf {
|
||||
uint64_t gpu_va; /**< GPU start address of the buffer */
|
||||
uint64_t cpu_va;
|
||||
uint64_t size;
|
||||
bool tmz; /**< allocated from tmz */
|
||||
uint64_t cpu_va; /**< CPU start address of the buffer */
|
||||
uint64_t size; /**< Size of the buffer */
|
||||
bool tmz; /**< allocated from tmz */
|
||||
};
|
||||
|
||||
/** @struct vpe_build_bufs
|
||||
* @brief Command buffer and Embedded buffer
|
||||
*/
|
||||
struct vpe_build_bufs {
|
||||
struct vpe_buf cmd_buf; /**< Command buffer. gpu_va is optional */
|
||||
struct vpe_buf emb_buf; /**< Embedded buffer */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vpe_version.h
|
||||
* @brief This is the file containing the information and definitions for VPE versioning.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -22,6 +22,34 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/** @mainpage VPELIB
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* VPE is a hardware pipeline that does baseline video processing from DRAM to DRAM.
|
||||
* The objective of VPE is to offload the graphic workload to VPE to save power.
|
||||
* The main functionality of VPE is to read video stream from memory, process the video stream and
|
||||
* write it back to memory. VPE is meant to augment the abilities of both the graphics (GFX) and
|
||||
* multi plane overlay (MPO) and deliver more power efficient use cases.
|
||||
*
|
||||
*
|
||||
* @section main_api Main API Functions
|
||||
* @subsection create VPE Create
|
||||
* @link vpe_create @endlink
|
||||
* @subsection destroy VPE Destroy
|
||||
* @link vpe_destroy @endlink
|
||||
* @subsection check_support VPE Check Support
|
||||
* @link vpe_check_support @endlink
|
||||
* @subsection vpe_build_noops VPE Build No-Operation Commands
|
||||
* @link vpe_build_noops @endlink
|
||||
* @subsection build_commands VPE Build Commands
|
||||
* @link vpe_build_commands @endlink
|
||||
* @subsection get_optimal_num_of_taps VPE Get the Optimal Number of Taps
|
||||
* @link vpe_get_optimal_num_of_taps @endlink
|
||||
* @file vpelib.h
|
||||
* @brief This is the file containing the main API for the VPE library.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vpe_types.h"
|
||||
|
|
@ -31,7 +59,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* @brief Create the VPE lib instance.
|
||||
/** @brief Create the VPE lib instance.
|
||||
*
|
||||
* Caler provides the current asic info,
|
||||
* logging and system memory APIs.
|
||||
|
|
@ -47,7 +75,7 @@ extern "C" {
|
|||
*/
|
||||
struct vpe *vpe_create(const struct vpe_init_data *params);
|
||||
|
||||
/* @brief Destroy the VPE lib instance and resources
|
||||
/** @brief Destroy the VPE lib instance and resources
|
||||
*
|
||||
* @param[in] vpe the vpe instance created by vpe_create
|
||||
*/
|
||||
|
|
@ -106,7 +134,6 @@ enum vpe_status vpe_build_commands(
|
|||
* @param[in] vpe vpe instance created by vpe_create()
|
||||
* @param[in,out] scaling_info [in] source and destination rectangles [out] calculated taps.
|
||||
*/
|
||||
|
||||
void vpe_get_optimal_num_of_taps(struct vpe *vpe, struct vpe_scaling_info *scaling_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue