• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2023 HiHope Open Source Organization .
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /*
17  * @file        Rockchip_OSAL_OHOS.h
18  * @brief
19  * @author      csy(csy@rock-chips.com)
20  * @version     1.0.0
21  * @history
22  *   2013.11.26 : Create
23  */
24 #ifndef Rockchip_OSAL_OHOS
25 #define Rockchip_OSAL_OHOS
26 
27 #include "OMX_Types.h"
28 #include "OMX_Core.h"
29 #include "OMX_Index.h"
30 #include "IndexExt.h"
31 #ifdef OHOS_BUFFER_HANDLE
32 #include <buffer_handle.h>
33 #endif
34 typedef unsigned int uint32_t;
35 typedef signed int int32_t;
36 
37 typedef struct _ROCKCHIP_OMX_SHARED_BUFFER {
38     OMX_S32 BufferFd;
39     OMX_S32 BufferFd1;
40     OMX_S32 BufferFd2;
41     unsigned long *pIonHandle;
42     unsigned long *pIonHandle1;
43     unsigned long *pIonHandle2;
44     OMX_U32 cnt;
45 } ROCKCHIP_OMX_SHARED_BUFFER;
46 
47 typedef struct _ROCKCHIP_OMX_REF_HANDLE {
48     OMX_HANDLETYPE hMutex;
49     ROCKCHIP_OMX_SHARED_BUFFER SharedBuffer[MAX_BUFFER_REF];
50 } ROCKCHIP_OMX_REF_HANDLE;
51 
52 enum _ROCKCHIP_OMX_DEPTH {
53     OMX_DEPTH_BIT_8,
54     OMX_DEPTH_BIT_10,
55     // add more
56 };
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 OMX_ERRORTYPE Rockchip_OSAL_GetInfoFromMetaData(OMX_IN OMX_BYTE pBuffer,
63                                                 OMX_OUT OMX_PTR *pOutBuffer);
64 OMX_ERRORTYPE Rockchip_OSAL_GetInfoRkWfdMetaData(OMX_IN OMX_BOOL bRkWFD,
65                                                  OMX_IN OMX_BYTE pBuffer,
66                                                  OMX_OUT OMX_PTR *ppBuf);
67 
68 OMX_ERRORTYPE Rockchip_OSAL_CheckANB(OMX_IN ROCKCHIP_OMX_DATA *pBuffer,
69                                      OMX_OUT OMX_BOOL *bIsANBEnabled);
70 
71 OMX_ERRORTYPE Rockchip_OSAL_SetPrependSPSPPSToIDR(OMX_PTR pComponentParameterStructure,
72                                                   OMX_PTR pbPrependSpsPpsToIdr);
73 
74 OMX_ERRORTYPE Rockchip_OSAL_CheckBuffType(OMX_U32 type);
75 
76 #ifdef OHOS_BUFFER_HANDLE
77 OMX_COLOR_FORMATTYPE Rockchip_OSAL_GetBufferHandleColorFormat(BufferHandle* bufferHandle);
78 OMX_U32 Rockchip_OSAL_OmxColorFormat2CodecFormat(OMX_COLOR_FORMATTYPE omxColorFormat);
79 OMX_COLOR_FORMATTYPE Rochip_OSAL_CodecFormat2OmxColorFormat(OMX_U32 codecFormat);
80 #endif
81 
82 OMX_COLOR_FORMATTYPE Rockchip_OSAL_Hal2OMXPixelFormat(unsigned int hal_format);
83 
84 unsigned int Rockchip_OSAL_OMX2HalPixelFormat(OMX_COLOR_FORMATTYPE omx_format);
85 
86 OMX_ERRORTYPE Rockchip_OSAL_Fd2VpumemPool(ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent,
87                                           OMX_BUFFERHEADERTYPE* bufferHeader);
88 
89 OMX_ERRORTYPE Rockchip_OSAL_CommitBuffer(ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent,
90                                          OMX_U32 index);
91 
92 OMX_BUFFERHEADERTYPE *Rockchip_OSAL_Fd2OmxBufferHeader(ROCKCHIP_OMX_BASEPORT *pRockchipPort,
93                                                        OMX_IN OMX_S32 fd, OMX_IN OMX_PTR pVpumem);
94 OMX_ERRORTYPE  Rockchip_OSAL_FreeVpumem(OMX_IN OMX_PTR pVpumem);
95 
96 OMX_ERRORTYPE  Rockchip_OSAL_Openvpumempool(OMX_IN ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent, OMX_U32 portIndex);
97 
98 OMX_ERRORTYPE  Rockchip_OSAL_Closevpumempool(OMX_IN ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent);
99 
100 OMX_ERRORTYPE Rockchip_OSAL_resetVpumemPool(OMX_IN ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent);
101 
102 OMX_BOOL Rockchip_OSAL_Check_Use_FBCMode(OMX_VIDEO_CODINGTYPE codecId, int32_t depth, ROCKCHIP_OMX_BASEPORT *pPort);
103 
104 OMX_COLOR_FORMATTYPE Rockchip_OSAL_CheckFormat(ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent,
105                                                OMX_IN OMX_PTR pVpuframe);
106 
107 OMX_U32 Get_Video_HorAlign(OMX_VIDEO_CODINGTYPE codecId, OMX_U32 width, OMX_U32 height, OMX_U32 codecprofile);
108 OMX_U32 Get_Video_VerAlign(OMX_VIDEO_CODINGTYPE codecId, OMX_U32 height, OMX_U32 codecprofile);
109 OMX_ERRORTYPE Rockchip_OSAL_PowerControl(ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent,
110                                          int32_t width,
111                                          int32_t height,
112                                          int32_t mHevc,
113                                          int32_t frameRate,
114                                          OMX_BOOL mFlag,
115                                          int bitDepth);
116 OMX_U32 GetDataSize(OMX_U32 width, OMX_U32 height, OMX_COLOR_FORMATTYPE);
117 OMX_ERRORTYPE Rkvpu_ComputeDecBufferCount(OMX_HANDLETYPE hComponent);
118 OMX_U32 Rockchip_OSAL_CalculateTotalRefFrames(OMX_VIDEO_CODINGTYPE codecId, OMX_U32 width,
119                                               OMX_U32 height, OMX_BOOL isSecure);
120 
121 #ifdef AVS80
122 #endif
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif