xref: /OK3568_Linux_fs/external/rockit/mpi/sdk/include/rk_comm_tde.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */
2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */
3 
4 #ifndef SRC_RT_MPI_INCLUDE_RK_COMM_TDE_H_
5 #define SRC_RT_MPI_INCLUDE_RK_COMM_TDE_H_
6 
7 #include "rk_type.h"
8 #include "rk_common.h"
9 #include "rk_comm_mb.h"
10 #include "rk_errno.h"
11 #include "rk_comm_video.h"
12 
13 #ifdef __cplusplus
14 #if __cplusplus
15 extern "C" {
16 #endif
17 #endif /* End of #ifdef __cplusplus */
18 
19 // error code
20 enum {
21     RK_ERR_NOT_ALIGNED = RK_ERR_BUTT - 1,  /* <  aligned error for position, stride, width */
22     RK_ERR_MINIFICATION,                   /* <  invalid minification */
23     RK_ERR_CLIP_AREA,                      /* <  clip area and operation area have no intersection */
24     RK_ERR_JOB_TIMEOUT,                    /* <  blocked job wait timeout */
25     RK_ERR_UNSUPPORTED_OPERATION,          /* <  unsupported operation */
26     RK_ERR_QUERY_TIMEOUT,                  /* <  query time out */
27     RK_ERR_INTERRUPT                       /* blocked job was interrupted */
28 };
29 
30 #define RK_ERR_TDE_DEV_NOT_OPEN           RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_UNEXIST)
31 #define RK_ERR_TDE_DEV_OPEN_FAILED        RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_BUSY)
32 #define RK_ERR_TDE_NULL_PTR               RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_NULL_PTR)
33 #define RK_ERR_TDE_NO_MEM                 RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_NOMEM)
34 #define RK_ERR_TDE_INVALID_HANDLE         RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_DEVID)
35 #define RK_ERR_TDE_INVALID_PARA           RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_ILLEGAL_PARAM)
36 #define RK_ERR_TDE_NOT_ALIGNED            RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_ALIGNED)
37 #define RK_ERR_TDE_MINIFICATION           RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_MINIFICATION)
38 #define RK_ERR_TDE_CLIP_AREA              RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_CLIP_AREA)
39 #define RK_ERR_TDE_JOB_TIMEOUT            RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_JOB_TIMEOUT)
40 #define RK_ERR_TDE_UNSUPPORTED_OPERATION  RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_UNSUPPORTED_OPERATION)
41 #define RK_ERR_TDE_QUERY_TIMEOUT          RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_QUERY_TIMEOUT)
42 #define RK_ERR_TDE_INTERRUPT              RK_DEF_ERR(RK_ID_TDE, RK_ERR_LEVEL_ERROR, RK_ERR_INTERRUPT)
43 
44 /* Definition of the TDE handle */
45 typedef RK_S32 TDE_HANDLE;
46 
47 typedef enum rkTDE_ALUCMD_E {
48     TDE_OSD_COVER = 0x100,      /* not blend */
49     TDE_OSD_DST_ALPHA = 0x105,  /* blend:src data alpha premultipy */
50     TDE_OSD_ALL_ALPHA = 0x405   /* blend:src data not alpha premultipy */
51 } TDE_ALUCMD_E;
52 
53 /* Structure of the bitmap information set by customers */
54 typedef struct rkTDE_SURFACE_S {
55     MB_BLK pMbBlk;/* <Header address of a bitmap or the Y component */
56     PIXEL_FORMAT_E enColorFmt; /* <Color format */
57     RK_U32 u32Height; /* <Bitmap height */
58     RK_U32 u32Width; /* <Bitmap width */
59     COMPRESS_MODE_E enComprocessMode; /* compress type */
60     RK_BOOL bAlphaExt1555;  /* <Whether to enable the alpha extension of an ARGB1555 bitmap. */
61     RK_U8 u8Alpha0;  /* <Values of alpha0 and alpha1, used as the ARGB1555 format */
62     RK_U8 u8Alpha1;  /* <Values of alpha0 and alpha1, used as the ARGB1555 format */
63 } TDE_SURFACE_S;
64 
65 /* Definition of the TDE rectangle */
66 typedef struct rkTDE_RECT_S {
67     RK_S32 s32Xpos;   /* <Horizontal coordinate */
68     RK_S32 s32Ypos;   /* <Vertical coordinate */
69     RK_U32 u32Width;  /* <Width */
70     RK_U32 u32Height; /* <Height */
71 } TDE_RECT_S;
72 
73 /* Definition of colorkey modes */
74 typedef enum rkTDE_COLORKEY_MODE_E {
75     TDE_COLORKEY_MODE_NONE = 0,   /* <No colorkey */
76      /*
77       * <When performing the colorkey operation on the foreground bitmap,
78       * you need to perform this operation before the CLUT for color extension and perform this operation
79       * after the CLUT for color correction.
80       */
81     TDE_COLORKEY_MODE_FOREGROUND,
82     TDE_COLORKEY_MODE_BACKGROUND, /* <Perform the colorkey operation on the background bitmap */
83     TDE_COLORKEY_MODE_BUTT
84 } TDE_COLORKEY_MODE_E;
85 
86 /* Definition of blit operation options */
87 typedef struct rkTDE_OPT_S {
88     TDE_COLORKEY_MODE_E enColorKeyMode;  /* <Colorkey mode */
89     RK_U32              unColorKeyValue; /* <Colorkey value */
90     MIRROR_E            enMirror;        /* <Mirror type */
91     TDE_RECT_S          stClipRect;      /* <Definition of the clipping area */
92     RK_U32              u32GlobalAlpha;   /* <Global alpha value */
93 } TDE_OPT_S;
94 
95 #ifdef __cplusplus
96 #if __cplusplus
97 }
98 #endif
99 #endif /* __cplusplus */
100 
101 #endif /* SRC_RT_MPI_INCLUDE_RK_COMM_TDE_H_ */
102