You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
470 lines
13 KiB
470 lines
13 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2019. All rights reserved.
|
|
* Description: gfx2d interface
|
|
* Create: 2019-11-19
|
|
*/
|
|
|
|
#ifndef __UAPI_GFX2D_H__
|
|
#define __UAPI_GFX2D_H__
|
|
|
|
#include "td_type.h"
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#endif
|
|
|
|
#define UAPI_GFX2D_COMPONENT 3
|
|
#define UAPI_GFX2D_MAX_ALPHASUM 17
|
|
#define UAPI_GFX2D_MAX_HOLES_NUM 4
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_DEV_ID_0 = 0x0,
|
|
UAPI_GFX2D_DEV_ID_1,
|
|
UAPI_GFX2D_DEV_ID_MAX
|
|
} uapi_gfx2d_dev_id;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_FMT_RGB565 = 0,
|
|
UAPI_GFX2D_FMT_BGR565,
|
|
UAPI_GFX2D_FMT_RGB888,
|
|
UAPI_GFX2D_FMT_BGR888,
|
|
|
|
UAPI_GFX2D_FMT_ARGB4444 = 0x10,
|
|
UAPI_GFX2D_FMT_ABGR4444,
|
|
UAPI_GFX2D_FMT_RGBA4444,
|
|
UAPI_GFX2D_FMT_BGRA4444,
|
|
UAPI_GFX2D_FMT_ARGB1555,
|
|
UAPI_GFX2D_FMT_ABGR1555,
|
|
UAPI_GFX2D_FMT_RGBA5551,
|
|
UAPI_GFX2D_FMT_BGRA5551,
|
|
|
|
UAPI_GFX2D_FMT_ARGB8888 = 0x20,
|
|
UAPI_GFX2D_FMT_ABGR8888,
|
|
UAPI_GFX2D_FMT_RGBA8888,
|
|
UAPI_GFX2D_FMT_BGRA8888,
|
|
UAPI_GFX2D_FMT_XRGB8888,
|
|
UAPI_GFX2D_FMT_XBGR8888,
|
|
UAPI_GFX2D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_GFX2D_FMT_MAX
|
|
} uapi_gfx2d_color_fmt;
|
|
|
|
typedef struct {
|
|
td_s32 x;
|
|
td_s32 y;
|
|
td_u32 width;
|
|
td_u32 height;
|
|
} uapi_gfx2d_rect;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_ROP_BLACK = 0x0,
|
|
UAPI_GFX2D_ROP_NOTMERGEPEN,
|
|
UAPI_GFX2D_ROP_MASKNOTPEN,
|
|
UAPI_GFX2D_ROP_NOTCOPYPEN,
|
|
UAPI_GFX2D_ROP_MASKPENNOT,
|
|
UAPI_GFX2D_ROP_NOT,
|
|
UAPI_GFX2D_ROP_XORPEN,
|
|
UAPI_GFX2D_ROP_NOTMASKPEN,
|
|
UAPI_GFX2D_ROP_MASKPEN,
|
|
UAPI_GFX2D_ROP_NOTXORPEN,
|
|
UAPI_GFX2D_ROP_NOP,
|
|
UAPI_GFX2D_ROP_MERGENOTPEN,
|
|
UAPI_GFX2D_ROP_COPYPEN,
|
|
UAPI_GFX2D_ROP_MERGEPENNOT,
|
|
UAPI_GFX2D_ROP_MERGEPEN,
|
|
UAPI_GFX2D_ROP_WHITE,
|
|
UAPI_GFX2D_ROP_MAX
|
|
} uapi_gfx2d_rop_mode;
|
|
|
|
typedef struct {
|
|
td_bool rop_enable;
|
|
uapi_gfx2d_rop_mode alpha_rop_mode;
|
|
uapi_gfx2d_rop_mode color_rop_mode;
|
|
} uapi_gfx2d_rop_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_MIRROR_NONE = 0,
|
|
UAPI_GFX2D_MIRROR_HORIZONTAL,
|
|
UAPI_GFX2D_MIRROR_VERTICAL,
|
|
UAPI_GFX2D_MIRROR_BOTH,
|
|
UAPI_GFX2D_MIRROR_MAX
|
|
} uapi_gfx2d_mirror_mode;
|
|
|
|
typedef struct {
|
|
td_bool mirror_en;
|
|
uapi_gfx2d_mirror_mode mirror_mode;
|
|
} uapi_gfx2d_mirror_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_CLIP_NONE = 0x0,
|
|
UAPI_GFX2D_CLIP_INSIDE,
|
|
UAPI_GFX2D_CLIP_OUTSIDE,
|
|
UAPI_GFX2D_CLIP_MAX
|
|
} uapi_gfx2d_clip_mode;
|
|
|
|
typedef struct {
|
|
td_bool clip_en;
|
|
uapi_gfx2d_clip_mode clip_mode;
|
|
uapi_gfx2d_rect clip_rect;
|
|
} uapi_gfx2d_clip_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_COLORKEY_NONE = 0,
|
|
UAPI_GFX2D_COLORKEY_FOREGROUND,
|
|
UAPI_GFX2D_COLORKEY_BACKGROUND,
|
|
UAPI_GFX2D_COLORKEY_MAX
|
|
} uapi_gfx2d_colorkey_mode;
|
|
|
|
typedef struct {
|
|
td_u16 component_min;
|
|
td_u16 component_max;
|
|
td_bool is_component_out;
|
|
td_bool is_component_ignore;
|
|
td_u16 component_mask;
|
|
} uapi_gfx2d_colorkey_component;
|
|
|
|
typedef union {
|
|
struct {
|
|
uapi_gfx2d_colorkey_component alpha;
|
|
uapi_gfx2d_colorkey_component red;
|
|
uapi_gfx2d_colorkey_component green;
|
|
uapi_gfx2d_colorkey_component blue;
|
|
} colorkey_argb;
|
|
|
|
struct {
|
|
uapi_gfx2d_colorkey_component alpha;
|
|
uapi_gfx2d_colorkey_component y;
|
|
uapi_gfx2d_colorkey_component cb;
|
|
uapi_gfx2d_colorkey_component cr;
|
|
} colorkey_ycbcr;
|
|
|
|
struct {
|
|
uapi_gfx2d_colorkey_component alpha;
|
|
uapi_gfx2d_colorkey_component clut;
|
|
} colorkey_clut;
|
|
} uapi_gfx2d_colorkey_value;
|
|
|
|
typedef struct {
|
|
td_bool colorkey_enable;
|
|
uapi_gfx2d_colorkey_mode colorkey_mode;
|
|
uapi_gfx2d_colorkey_value colorkey_value;
|
|
} uapi_gfx2d_colorkey_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_FILTER_COLOR = 0,
|
|
UAPI_GFX2D_FILTER_ALPHA,
|
|
UAPI_GFX2D_FILTER_BOTH,
|
|
UAPI_GFX2D_FILTER_NONE,
|
|
UAPI_GFX2D_FILTER_MAX
|
|
} uapi_gfx2d_filter_mode;
|
|
|
|
typedef struct {
|
|
td_bool filter_enable;
|
|
uapi_gfx2d_filter_mode filter_mode;
|
|
} uapi_gfx2d_filter_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_DEFLICKER_NONE = 0,
|
|
UAPI_GFX2D_DEFLICKER_RGB,
|
|
UAPI_GFX2D_DEFLICKER_BOTH,
|
|
UAPI_GFX2D_DEFLICKER_MAX
|
|
} uapi_gfx2d_deflicker_mode;
|
|
|
|
typedef struct {
|
|
td_bool deflicker_enable;
|
|
uapi_gfx2d_deflicker_mode deflicker_mode;
|
|
} uapi_gfx2d_deflicker_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_BLEND_ZERO = 0x0,
|
|
UAPI_GFX2D_BLEND_ONE,
|
|
UAPI_GFX2D_BLEND_SRC2COLOR,
|
|
UAPI_GFX2D_BLEND_INVSRC2COLOR,
|
|
UAPI_GFX2D_BLEND_SRC2ALPHA,
|
|
UAPI_GFX2D_BLEND_INVSRC2ALPHA,
|
|
UAPI_GFX2D_BLEND_SRC1COLOR,
|
|
UAPI_GFX2D_BLEND_INVSRC1COLOR,
|
|
UAPI_GFX2D_BLEND_SRC1ALPHA,
|
|
UAPI_GFX2D_BLEND_INVSRC1ALPHA,
|
|
UAPI_GFX2D_BLEND_SRC2ALPHASAT,
|
|
UAPI_GFX2D_BLEND_MAX
|
|
} uapi_gfx2d_blend_mode;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_BLENDCMD_NONE = 0x0,
|
|
UAPI_GFX2D_BLENDCMD_CLEAR,
|
|
UAPI_GFX2D_BLENDCMD_SRC,
|
|
UAPI_GFX2D_BLENDCMD_SRCOVER,
|
|
UAPI_GFX2D_BLENDCMD_DSTOVER,
|
|
UAPI_GFX2D_BLENDCMD_SRCIN,
|
|
UAPI_GFX2D_BLENDCMD_DSTIN,
|
|
UAPI_GFX2D_BLENDCMD_SRCOUT,
|
|
UAPI_GFX2D_BLENDCMD_DSTOUT,
|
|
UAPI_GFX2D_BLENDCMD_SRCATOP,
|
|
UAPI_GFX2D_BLENDCMD_DSTATOP,
|
|
UAPI_GFX2D_BLENDCMD_ADD,
|
|
UAPI_GFX2D_BLENDCMD_XOR,
|
|
UAPI_GFX2D_BLENDCMD_DST,
|
|
UAPI_GFX2D_BLENDCMD_CONFIG,
|
|
UAPI_GFX2D_BLENDCMD_MAX
|
|
} uapi_gfx2d_blend_cmd;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_OUTALPHA_FROM_NORM = 0,
|
|
UAPI_GFX2D_OUTALPHA_FROM_BACKGROUND,
|
|
UAPI_GFX2D_OUTALPHA_FROM_FOREGROUND,
|
|
UAPI_GFX2D_OUTALPHA_FROM_GLOBALALPHA,
|
|
UAPI_GFX2D_OUTALPHA_FROM_MAX
|
|
} uapi_gfx2d_out_alpha_mode;
|
|
|
|
typedef struct {
|
|
/* only for blitter */
|
|
td_bool blend_enable;
|
|
uapi_gfx2d_blend_cmd blend_cmd;
|
|
uapi_gfx2d_blend_mode blend_mode;
|
|
uapi_gfx2d_out_alpha_mode out_alpha_mode;
|
|
|
|
/* only for composer */
|
|
td_bool cov_blend;
|
|
|
|
td_bool global_alpha_en;
|
|
td_u8 global_alpha;
|
|
td_bool pixel_alpha_en;
|
|
} uapi_gfx2d_blend_attr;
|
|
|
|
typedef struct {
|
|
td_bool in_csc_user_en;
|
|
td_bool is_in_csc_param_reload;
|
|
td_bool out_csc_user_en;
|
|
td_bool is_out_csc_param_reload;
|
|
td_mem_handle in_csc_param_mem_handle;
|
|
td_u32 in_csc_param_buf_size;
|
|
td_mem_handle out_csc_param_mem_handle;
|
|
td_u32 out_csc_param_buf_size;
|
|
} uapi_gfx2d_csc_attr;
|
|
|
|
typedef struct {
|
|
td_bool colorize_enable;
|
|
td_u32 colorrize_value;
|
|
} uapi_gfx2d_colorize_attr;
|
|
|
|
typedef struct {
|
|
td_bool clut_reload;
|
|
} uapi_gfx2d_clut_attr;
|
|
|
|
typedef struct {
|
|
td_bool resize_enable;
|
|
} uapi_gfx2d_resize_attr;
|
|
|
|
typedef struct {
|
|
td_bool holes_enable;
|
|
td_u32 holes_cnt;
|
|
uapi_gfx2d_rect rect[UAPI_GFX2D_MAX_HOLES_NUM];
|
|
td_u8 a[UAPI_GFX2D_MAX_HOLES_NUM];
|
|
td_u32 rgb[UAPI_GFX2D_MAX_HOLES_NUM];
|
|
} uapi_gfx2d_holes_attr;
|
|
|
|
typedef struct {
|
|
uapi_gfx2d_resize_attr resize_attr;
|
|
uapi_gfx2d_filter_attr filter_attr;
|
|
uapi_gfx2d_rop_attr rop_attr;
|
|
uapi_gfx2d_colorkey_attr colorkey_attr;
|
|
uapi_gfx2d_clip_attr clip_attr;
|
|
uapi_gfx2d_deflicker_attr deflicker_attr;
|
|
uapi_gfx2d_mirror_attr mirror_attr;
|
|
uapi_gfx2d_blend_attr blend_attr;
|
|
uapi_gfx2d_csc_attr csc_attr;
|
|
uapi_gfx2d_colorize_attr color_rize_attr;
|
|
uapi_gfx2d_clut_attr clut_attr;
|
|
uapi_gfx2d_holes_attr holes_attr;
|
|
} uapi_gfx2d_attr;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_COMPRESS_NONE = 0x0,
|
|
UAPI_GFX2D_COMPRESS_HFBC,
|
|
UAPI_GFX2D_COMPRESS_AFBC,
|
|
UAPI_GFX2D_COMPRESS_MAX
|
|
} uapi_gfx2d_compress_mode;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_HDR_SDR,
|
|
UAPI_GFX2D_HDR_HDR10,
|
|
UAPI_GFX2D_HDR_HLG,
|
|
UAPI_GFX2D_HDR_MAX
|
|
} uapi_gfx2d_xdr_mode;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_COLOR_SPACE_BT709,
|
|
UAPI_GFX2D_COLOR_SPACE_BT2020,
|
|
UAPI_GFX2D_COLOR_SPACE_MAX
|
|
} uapi_gfx2d_color_space;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_SURFACE_TYPE_MEM = 0x0,
|
|
UAPI_GFX2D_SURFACE_TYPE_COLOR,
|
|
UAPI_GFX2D_SURFACE_TYPE_MAX
|
|
} uapi_gfx2d_surface_type;
|
|
|
|
typedef struct {
|
|
td_bool alpha_ext_enable;
|
|
td_u8 alpha0;
|
|
td_u8 alpha1;
|
|
} uapi_gfx2d_alpha_ext;
|
|
|
|
typedef struct {
|
|
td_u32 alpha_sum[UAPI_GFX2D_MAX_ALPHASUM];
|
|
} uapi_gfx2d_compose_ext_info;
|
|
|
|
typedef struct {
|
|
td_bool is_secure;
|
|
td_u32 width;
|
|
td_u32 height;
|
|
td_u32 stride[UAPI_GFX2D_COMPONENT];
|
|
td_u32 size[UAPI_GFX2D_COMPONENT];
|
|
td_mem_handle mem_handle[UAPI_GFX2D_COMPONENT];
|
|
|
|
uapi_gfx2d_color_fmt format;
|
|
uapi_gfx2d_xdr_mode xdr_mode;
|
|
uapi_gfx2d_color_space color_space;
|
|
uapi_gfx2d_compress_mode compress_mode;
|
|
|
|
td_u32 background_color;
|
|
uapi_gfx2d_surface_type surface_type;
|
|
|
|
td_bool is_ycbcr_clut;
|
|
td_u32 palette_phy_addr_size;
|
|
td_mem_handle palette_mem_handle;
|
|
|
|
td_u32 stogram_phy_addr_size;
|
|
td_mem_handle stogram_mem_handle;
|
|
|
|
td_bool premulti_en;
|
|
td_bool is_alpha_max_255;
|
|
td_bool is_alpha_ext_1555;
|
|
uapi_gfx2d_alpha_ext alpha_ext;
|
|
|
|
uapi_gfx2d_rect in_rect;
|
|
uapi_gfx2d_rect out_rect;
|
|
uapi_gfx2d_attr *attr;
|
|
|
|
td_s32 acquire_fence_fd;
|
|
td_s32 release_fence_fd;
|
|
|
|
uapi_gfx2d_compose_ext_info ext_info;
|
|
} uapi_gfx2d_surface;
|
|
|
|
typedef enum {
|
|
UAPI_GFX2D_OPS_NONE = 0,
|
|
UAPI_GFX2D_OPS_QUICK_COPY,
|
|
UAPI_GFX2D_OPS_QUICK_FILL,
|
|
UAPI_GFX2D_OPS_QUICK_RESIZE,
|
|
UAPI_GFX2D_OPS_QUICK_DEFLICKER,
|
|
UAPI_GFX2D_OPS_BIT_BLIT,
|
|
UAPI_GFX2D_OPS_SOLID_DRAW,
|
|
UAPI_GFX2D_OPS_ROTATE,
|
|
UAPI_GFX2D_OPS_PATTERN_FILL,
|
|
UAPI_GFX2D_OPS_MAX
|
|
} uapi_gfx2d_ops_mode;
|
|
|
|
typedef struct {
|
|
td_u32 src_surface_cnt;
|
|
uapi_gfx2d_surface *src_surfaces;
|
|
uapi_gfx2d_surface *dst_surface;
|
|
uapi_gfx2d_ops_mode ops_mode;
|
|
} uapi_gfx2d_list;
|
|
|
|
typedef struct {
|
|
td_u8 total_layer_num; /* Total number of support input layers */ /* CNcomment: 支持的输入层个数 */
|
|
td_u8 max_graphic_layer_num; /* Max graphic layer */ /* CNcomment: 最大图形层个数 */
|
|
td_u8 max_video_layer_num; /* Max video layer */ /* CNcomment: 最大视频层个数 */
|
|
td_bool input_support_fmt[UAPI_GFX2D_FMT_MAX]; /* input support fmt */
|
|
td_bool output_support_fmt[UAPI_GFX2D_FMT_MAX]; /* output support fmt */
|
|
td_u32 min_stride; /* min stride */
|
|
td_u32 max_stride; /* max stride */
|
|
td_u8 stride_align; /* stride align */
|
|
td_u32 min_width; /* min width */
|
|
td_u32 max_width; /* max width */
|
|
td_u32 min_height; /* min height */
|
|
td_u32 max_height; /* max height */
|
|
td_u32 min_video_layer_width; /* min width of video layer */ /* CNcomment: 视频层最小宽度 */
|
|
td_u32 min_video_layer_height; /* min height of video layer */ /* 视频层最小高度 */
|
|
td_u32 max_horizontal_zme_ratio; /* maximum horizontal reduction factor */ /* CNcomment: 水平最大缩小倍数 */
|
|
td_u32 max_vertical_zme_ratio; /* vertical maximum reduction factor */ /* CNcomment: 垂直最大缩小倍数 */
|
|
td_u8 width_align; /* width alignment requirements */ /* CNcomment: 宽度对齐要求 */
|
|
td_bool compress_support_fmt[UAPI_GFX2D_FMT_MAX]; /* CNcomment: 压缩支持的格式 */
|
|
td_bool clip_support; /* Does Support clip */ /* CNcomment: 是否支持clip */
|
|
td_u8 graphic_layer_zme_num; /* Max zme support layers */
|
|
td_u8 video_layer_zme_num; /* Max zme support layers */
|
|
td_u32 max_frm_rate; /* 1080p max frame rate */
|
|
} uapi_gfx2d_capability;
|
|
|
|
td_s32 uapi_gfx2d_open(uapi_gfx2d_dev_id dev_id);
|
|
|
|
td_s32 uapi_gfx2d_close(uapi_gfx2d_dev_id dev_id);
|
|
|
|
td_handle uapi_gfx2d_create(uapi_gfx2d_dev_id dev_id);
|
|
|
|
td_s32 uapi_gfx2d_bitblit(td_handle handle, uapi_gfx2d_list *surface_list);
|
|
|
|
td_s32 uapi_gfx2d_compose(td_handle handle, uapi_gfx2d_list *surface_list, td_bool is_sync);
|
|
|
|
td_s32 uapi_gfx2d_submit(td_handle handle, td_bool is_sync, td_u32 time_out);
|
|
|
|
td_s32 uapi_gfx2d_cancel(td_handle handle);
|
|
|
|
td_s32 uapi_gfx2d_get_status(td_handle handle);
|
|
|
|
td_s32 uapi_gfx2d_get_hw_status(uapi_gfx2d_dev_id dev_id);
|
|
|
|
td_s32 uapi_gfx2d_destroy(td_handle handle);
|
|
|
|
td_s32 uapi_gfx2d_get_capability(uapi_gfx2d_capability *capability); /* gfx2d support capability */
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#endif /* __UAPI_GFX2D_H__ */
|