1 /* 2 * Copyright 2015 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __RK_MPI_CMD_H__ 18 #define __RK_MPI_CMD_H__ 19 20 /* 21 * Command id bit usage is defined as follows: 22 * bit 20 - 23 - module id 23 * bit 16 - 19 - contex id 24 * bit 0 - 15 - command id 25 */ 26 #define CMD_MODULE_ID_MASK (0x00F00000) 27 #define CMD_MODULE_OSAL (0x00100000) 28 #define CMD_MODULE_MPP (0x00200000) 29 #define CMD_MODULE_CODEC (0x00300000) 30 #define CMD_MODULE_HAL (0x00400000) 31 32 #define CMD_CTX_ID_MASK (0x000F0000) 33 #define CMD_CTX_ID_DEC (0x00010000) 34 #define CMD_CTX_ID_ENC (0x00020000) 35 #define CMD_CTX_ID_ISP (0x00030000) 36 37 /* separate encoder / decoder control command to different segment */ 38 #define CMD_CFG_ID_MASK (0x0000FF00) 39 40 /* mpp status control command */ 41 #define CMD_STATE_OPS (0x00000100) 42 43 /* decoder control command */ 44 #define CMD_DEC_CFG_ALL (0x00000000) 45 #define CMD_DEC_QUERY (0x00000100) 46 #define CMD_DEC_CFG (0x00000200) 47 48 /* encoder control command */ 49 #define CMD_ENC_CFG_ALL (0x00000000) 50 #define CMD_ENC_QUERY (0x00000100) 51 #define CMD_ENC_CFG_RC_API (0x00000200) 52 53 #define CMD_ENC_CFG_MISC (0x00008000) 54 #define CMD_ENC_CFG_SPLIT (0x00008100) 55 #define CMD_ENC_CFG_REF (0x00008200) 56 #define CMD_ENC_CFG_ROI (0x00008300) 57 #define CMD_ENC_CFG_OSD (0x00008400) 58 #define CMD_ENC_CFG_USERDATA (0x00008500) 59 60 typedef enum { 61 MPP_OSAL_CMD_BASE = CMD_MODULE_OSAL, 62 MPP_OSAL_CMD_END, 63 64 MPP_CMD_BASE = CMD_MODULE_MPP, 65 MPP_ENABLE_DEINTERLACE, 66 MPP_SET_INPUT_BLOCK, /* deprecated */ 67 MPP_SET_INTPUT_BLOCK_TIMEOUT, /* deprecated */ 68 MPP_SET_OUTPUT_BLOCK, /* deprecated */ 69 MPP_SET_OUTPUT_BLOCK_TIMEOUT, /* deprecated */ 70 /* 71 * timeout setup, refer to MPP_TIMEOUT_XXX 72 * zero - non block 73 * negative - block with no timeout 74 * positive - timeout in milisecond 75 */ 76 MPP_SET_INPUT_TIMEOUT, /* parameter type RK_S64 */ 77 MPP_SET_OUTPUT_TIMEOUT, /* parameter type RK_S64 */ 78 MPP_SET_DISABLE_THREAD, /* MPP no thread mode and use external thread to decode */ 79 MPP_SET_SELECT_TIMEOUT, /* kmpp path select operation timeout */ 80 MPP_SET_VENC_INIT_KCFG, /* kmpp path venc init cfg set */ 81 82 MPP_STATE_CMD_BASE = CMD_MODULE_MPP | CMD_STATE_OPS, 83 MPP_START, 84 MPP_STOP, 85 MPP_PAUSE, 86 MPP_RESUME, 87 88 MPP_CMD_END, 89 90 MPP_CODEC_CMD_BASE = CMD_MODULE_CODEC, 91 MPP_CODEC_GET_FRAME_INFO, 92 MPP_CODEC_CMD_END, 93 94 MPP_DEC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_DEC, 95 MPP_DEC_SET_FRAME_INFO, /* vpu api legacy control for buffer slot dimension init */ 96 MPP_DEC_SET_EXT_BUF_GROUP, /* IMPORTANT: set external buffer group to mpp decoder */ 97 MPP_DEC_SET_INFO_CHANGE_READY, 98 MPP_DEC_SET_PRESENT_TIME_ORDER, /* use input time order for output */ 99 MPP_DEC_SET_PARSER_SPLIT_MODE, /* Need to setup before init */ 100 MPP_DEC_SET_PARSER_FAST_MODE, /* Need to setup before init */ 101 MPP_DEC_GET_STREAM_COUNT, 102 MPP_DEC_GET_VPUMEM_USED_COUNT, 103 MPP_DEC_SET_VC1_EXTRA_DATA, 104 MPP_DEC_SET_OUTPUT_FORMAT, 105 MPP_DEC_SET_DISABLE_ERROR, /* When set it will disable sw/hw error (H.264 / H.265) */ 106 MPP_DEC_SET_IMMEDIATE_OUT, 107 MPP_DEC_SET_ENABLE_DEINTERLACE, /* MPP enable deinterlace by default. Vpuapi can disable it */ 108 MPP_DEC_SET_ENABLE_FAST_PLAY, /* enable idr output immediately */ 109 MPP_DEC_SET_DISABLE_THREAD, /* MPP no thread mode and use external thread to decode */ 110 MPP_DEC_SET_MAX_USE_BUFFER_SIZE, 111 MPP_DEC_SET_ENABLE_MVC, /* enable MVC decoding*/ 112 MPP_DEC_GET_THUMBNAIL_FRAME_INFO, /* update thumbnail frame info to user, for MPP_FRAME_THUMBNAIL_ONLY mode */ 113 MPP_DEC_SET_DISABLE_DPB_CHECK, /* disable dpb discontinuous check */ 114 MPP_DEC_SET_CODEC_MODE, /* select codec mode */ 115 MPP_DEC_SET_DIS_ERR_CLR_MARK, 116 117 MPP_DEC_CMD_QUERY = CMD_MODULE_CODEC | CMD_CTX_ID_DEC | CMD_DEC_QUERY, 118 /* query decoder runtime information for decode stage */ 119 MPP_DEC_QUERY, /* set and get MppDecQueryCfg structure */ 120 121 CMD_DEC_CMD_CFG = CMD_MODULE_CODEC | CMD_CTX_ID_DEC | CMD_DEC_CFG, 122 MPP_DEC_SET_CFG, /* set MppDecCfg structure */ 123 MPP_DEC_GET_CFG, /* get MppDecCfg structure */ 124 125 MPP_DEC_CMD_END, 126 127 MPP_ENC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ENC, 128 /* basic encoder setup control */ 129 MPP_ENC_SET_CFG, /* set MppEncCfg structure */ 130 MPP_ENC_GET_CFG, /* get MppEncCfg structure */ 131 MPP_ENC_SET_PREP_CFG, /* deprecated set MppEncPrepCfg structure, use MPP_ENC_SET_CFG instead */ 132 MPP_ENC_GET_PREP_CFG, /* deprecated get MppEncPrepCfg structure, use MPP_ENC_GET_CFG instead */ 133 MPP_ENC_SET_RC_CFG, /* deprecated set MppEncRcCfg structure, use MPP_ENC_SET_CFG instead */ 134 MPP_ENC_GET_RC_CFG, /* deprecated get MppEncRcCfg structure, use MPP_ENC_GET_CFG instead */ 135 MPP_ENC_SET_CODEC_CFG, /* deprecated set MppEncCodecCfg structure, use MPP_ENC_SET_CFG instead */ 136 MPP_ENC_GET_CODEC_CFG, /* deprecated get MppEncCodecCfg structure, use MPP_ENC_GET_CFG instead */ 137 /* runtime encoder setup control */ 138 MPP_ENC_SET_IDR_FRAME, /* next frame will be encoded as intra frame */ 139 MPP_ENC_SET_OSD_LEGACY_0, /* deprecated */ 140 MPP_ENC_SET_OSD_LEGACY_1, /* deprecated */ 141 MPP_ENC_SET_OSD_LEGACY_2, /* deprecated */ 142 MPP_ENC_GET_HDR_SYNC, /* get vps / sps / pps which has better sync behavior parameter is MppPacket */ 143 MPP_ENC_GET_EXTRA_INFO, /* deprecated */ 144 MPP_ENC_SET_SEI_CFG, /* SEI: Supplement Enhancemant Information, parameter is MppSeiMode */ 145 MPP_ENC_GET_SEI_DATA, /* SEI: Supplement Enhancemant Information, parameter is MppPacket */ 146 MPP_ENC_PRE_ALLOC_BUFF, /* deprecated */ 147 MPP_ENC_SET_QP_RANGE, /* used for adjusting qp range, the parameter can be 1 or 2 */ 148 MPP_ENC_SET_ROI_CFG, /* set MppEncROICfg structure */ 149 MPP_ENC_SET_CTU_QP, /* for H265 Encoder,set CTU's size and QP */ 150 MPP_ENC_GET_ROI_CFG, /* get MppEncROICfg structure */ 151 MPP_ENC_SET_JPEG_ROI_CFG, /* set MppJpegROICfg structure */ 152 MPP_ENC_GET_JPEG_ROI_CFG, /* get MppJpegROICfg structure */ 153 154 MPP_ENC_CMD_QUERY = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_QUERY, 155 /* query encoder runtime information for encode stage */ 156 MPP_ENC_QUERY, /* set and get MppEncQueryCfg structure */ 157 158 /* User define rate control stategy API control */ 159 MPP_ENC_CFG_RC_API = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_RC_API, 160 /* 161 * Get RcApiQueryAll structure 162 * Get all available rate control stategy string and count 163 */ 164 MPP_ENC_GET_RC_API_ALL = MPP_ENC_CFG_RC_API + 1, 165 /* 166 * Get RcApiQueryType structure 167 * Get available rate control stategy string with certain type 168 */ 169 MPP_ENC_GET_RC_API_BY_TYPE = MPP_ENC_CFG_RC_API + 2, 170 /* 171 * Set RcImplApi structure 172 * Add new or update rate control stategy function pointers 173 */ 174 MPP_ENC_SET_RC_API_CFG = MPP_ENC_CFG_RC_API + 3, 175 /* 176 * Get RcApiBrief structure 177 * Get current used rate control stategy brief information (type and name) 178 */ 179 MPP_ENC_GET_RC_API_CURRENT = MPP_ENC_CFG_RC_API + 4, 180 /* 181 * Set RcApiBrief structure 182 * Set current used rate control stategy brief information (type and name) 183 */ 184 MPP_ENC_SET_RC_API_CURRENT = MPP_ENC_CFG_RC_API + 5, 185 186 MPP_ENC_CFG_MISC = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_MISC, 187 MPP_ENC_SET_HEADER_MODE, /* set MppEncHeaderMode */ 188 MPP_ENC_GET_HEADER_MODE, /* get MppEncHeaderMode */ 189 190 MPP_ENC_CFG_SPLIT = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_SPLIT, 191 MPP_ENC_SET_SPLIT, /* set MppEncSliceSplit structure */ 192 MPP_ENC_GET_SPLIT, /* get MppEncSliceSplit structure */ 193 194 MPP_ENC_CFG_REF = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_REF, 195 MPP_ENC_SET_REF_CFG, /* set MppEncRefCfg structure */ 196 MPP_ENC_GET_REF_CFG, 197 198 MPP_ENC_CFG_OSD = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_OSD, 199 MPP_ENC_SET_OSD_PLT_CFG, /* set OSD palette, parameter should be pointer to MppEncOSDPltCfg */ 200 MPP_ENC_GET_OSD_PLT_CFG, /* get OSD palette, parameter should be pointer to MppEncOSDPltCfg */ 201 MPP_ENC_SET_OSD_DATA_CFG, /* set OSD data with at most 8 regions, parameter should be pointer to MppEncOSDData */ 202 203 MPP_ENC_CFG_USERDATA = CMD_MODULE_CODEC | CMD_CTX_ID_ENC | CMD_ENC_CFG_USERDATA, 204 MPP_ENC_SET_USERDATA, 205 MPP_ENC_GET_USERDATA, 206 MPP_ENC_CMD_END, 207 208 MPP_ISP_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ISP, 209 MPP_ISP_CMD_END, 210 211 MPP_HAL_CMD_BASE = CMD_MODULE_HAL, 212 MPP_HAL_CMD_END, 213 214 MPI_CMD_BUTT, 215 } MpiCmd; 216 217 #include "rk_vdec_cmd.h" 218 #include "rk_vdec_cfg.h" 219 #include "rk_venc_cmd.h" 220 #include "rk_venc_cfg.h" 221 #include "rk_venc_ref.h" 222 223 #endif /*__RK_MPI_CMD_H__*/ 224