[mpp_hal]: Remove hal header dependency

1. Remove dependency between mpp_hal.h and mpp_enc_hal.h.
2. Remove unused work_mode.

Change-Id: I1d8e8163e3c2de00636665d7aff38652309820ba
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2020-10-22 09:24:55 +08:00
parent a79544d7cf
commit d29cb91c22
10 changed files with 38 additions and 49 deletions

View File

@@ -1315,7 +1315,6 @@ MPP_RET mpp_dec_init(MppDec *dec, MppDecCfg *cfg)
MppHalCfg hal_cfg = {
MPP_CTX_DEC,
coding,
HAL_MODE_LIBVPU,
DEV_RKVDEC,
frame_slots,
packet_slots,

View File

@@ -1379,7 +1379,6 @@ MPP_RET mpp_enc_init_v2(MppEnc *enc, MppEncInitCfg *cfg)
// create hal first
enc_hal_cfg.coding = coding;
enc_hal_cfg.cfg = &p->cfg;
enc_hal_cfg.work_mode = HAL_MODE_LIBVPU;
enc_hal_cfg.device_id = DEV_VEPU;
ctrl_cfg.coding = coding;

View File

@@ -17,7 +17,8 @@
#ifndef __MPP_ENC_HAL_H__
#define __MPP_ENC_HAL_H__
#include "mpp_hal.h"
#include "hal_task.h"
#include "mpp_enc_cfg.h"
typedef struct MppEncHalCfg_t {
// input for encoder
@@ -25,7 +26,6 @@ typedef struct MppEncHalCfg_t {
MppEncCfgSet *cfg;
// output for enc_impl
HalWorkMode work_mode;
MppDeviceId device_id;
} MppEncHalCfg;

View File

@@ -25,28 +25,19 @@
#include "hal_task.h"
#include "mpp_enc_cfg.h"
typedef enum MppHalType_e {
HAL_MODE_LIBVPU,
HAL_MODE_V4L2,
HAL_MODE_BUTT,
} HalWorkMode;
typedef enum vpu_hard_mode_e {
typedef enum VpuHwMode_e {
MODE_NULL = 0,
RKVDEC_MODE = 0x01,
VDPU1_MODE = 0x02,
VDPU2_MODE = 0x04,
RKVENC_MODE = 0x05,
MODE_BUTT,
} VpuHardMode;
typedef void* MppHalCtx;
} VpuHwMode;
typedef struct MppHalCfg_t {
// input
MppCtxType type;
MppCodingType coding;
HalWorkMode work_mode;
MppDeviceId device_id;
MppBufSlots frame_slots;
MppBufSlots packet_slots;

View File

@@ -84,8 +84,8 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
MppHalApi *p_api = NULL;
MPP_RET ret = MPP_ERR_UNKNOW;
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
VpuHardMode hard_mode = MODE_NULL;
RK_U32 hard_platform = 0;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_plat = 0;
INP_CHECK(ret, NULL == p_hal);
memset(p_hal, 0, sizeof(H264dHalCtx_t));
@@ -103,19 +103,19 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
vcodec_type = mpp_get_vcodec_type();
mpp_assert(vcodec_type & (HAVE_RKVDEC | HAVE_VDPU1 | HAVE_VDPU2));
if ((mode <= RKVDEC_MODE) && (vcodec_type & HAVE_RKVDEC)) {
hard_mode = RKVDEC_MODE;
hard_platform = HAVE_RKVDEC;
hw_mode = RKVDEC_MODE;
hw_plat = HAVE_RKVDEC;
} else if (vcodec_type & HAVE_VDPU1) {
hard_mode = VDPU1_MODE;
hard_platform = HAVE_VDPU1;
hw_mode = VDPU1_MODE;
hw_plat = HAVE_VDPU1;
} else if (vcodec_type & HAVE_VDPU2) {
hard_mode = VDPU2_MODE;
hard_platform = HAVE_VDPU2;
hw_mode = VDPU2_MODE;
hw_plat = HAVE_VDPU2;
}
H264D_DBG(H264D_DBG_HARD_MODE, "set_mode=%d, hw_spt=%08x, use_mode=%d\n",
mode, vcodec_type, hard_mode);
mode, vcodec_type, hw_mode);
}
switch (hard_mode) {
switch (hw_mode) {
case RKVDEC_MODE:
p_api->init = rkv_h264d_init;
p_api->deinit = rkv_h264d_deinit;
@@ -150,7 +150,7 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
cfg->device_id = DEV_VDPU;
break;
default:
mpp_err_f("hard mode error, value=%d\n", hard_mode);
mpp_err_f("hard mode error, value=%d\n", hw_mode);
mpp_assert(0);
break;
}
@@ -163,7 +163,7 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
MppDevCfg dev_cfg = {
.type = MPP_CTX_DEC, /* type */
.coding = MPP_VIDEO_CodingAVC, /* coding */
.platform = hard_platform, /* platform */
.platform = hw_plat, /* platform */
.pp_enable = 0, /* pp_enable */
};

View File

@@ -82,7 +82,7 @@ static MPP_RET hal_h263d_init(void *hal, MppHalCfg *cfg)
{
MppHalApi *p_api = NULL;
hal_h263_ctx *p_hal = (hal_h263_ctx *)hal;
VpuHardMode hard_mode = MODE_NULL;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_flag = 0;
mpp_env_get_u32("h263d_hal_debug", &h263d_hal_debug, 0);
@@ -95,11 +95,11 @@ static MPP_RET hal_h263d_init(void *hal, MppHalCfg *cfg)
hw_flag = mpp_get_vcodec_type();
if (hw_flag & HAVE_VDPU2)
hard_mode = VDPU2_MODE;
hw_mode = VDPU2_MODE;
if (hw_flag & HAVE_VDPU1)
hard_mode = VDPU1_MODE;
hw_mode = VDPU1_MODE;
switch (hard_mode) {
switch (hw_mode) {
case VDPU2_MODE : {
mpp_log("the VDPU2_MODE is used currently!\n");
p_api->init = hal_vpu2_h263d_init;
@@ -123,7 +123,7 @@ static MPP_RET hal_h263d_init(void *hal, MppHalCfg *cfg)
p_api->control = hal_vpu1_h263d_control;
} break;
default : {
mpp_err("unknow vpu type:%d.", hard_mode);
mpp_err("unknow vpu type:%d.", hw_mode);
return MPP_ERR_INIT;
} break;
}

View File

@@ -71,7 +71,7 @@ static MPP_RET hal_jpegd_init (void *hal, MppHalCfg *cfg)
{
JpegdHalCtx *self = (JpegdHalCtx *)hal;
MppHalApi *p_api = NULL;
VpuHardMode hard_mode = MODE_NULL;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_flag = 0;
if (NULL == self)
@@ -82,11 +82,11 @@ static MPP_RET hal_jpegd_init (void *hal, MppHalCfg *cfg)
hw_flag = mpp_get_vcodec_type();
if (hw_flag & HAVE_VDPU2)
hard_mode = VDPU2_MODE;
hw_mode = VDPU2_MODE;
if (hw_flag & HAVE_VDPU1)
hard_mode = VDPU1_MODE;
hw_mode = VDPU1_MODE;
switch (hard_mode) {
switch (hw_mode) {
case VDPU2_MODE:
p_api->init = hal_jpegd_vdpu2_init;
p_api->deinit = hal_jpegd_vdpu2_deinit;

View File

@@ -74,7 +74,7 @@ static MPP_RET hal_m2vd_init (void *hal, MppHalCfg *cfg)
{
M2vdHalCtx *self = (M2vdHalCtx *)hal;
MppHalApi *p_api = NULL;
VpuHardMode hard_mode = MODE_NULL;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_flag = 0;
if (self == NULL)
@@ -87,11 +87,11 @@ static MPP_RET hal_m2vd_init (void *hal, MppHalCfg *cfg)
hw_flag = mpp_get_vcodec_type();
if (hw_flag & HAVE_VDPU1)
hard_mode = VDPU1_MODE;
hw_mode = VDPU1_MODE;
if (hw_flag & HAVE_VDPU2)
hard_mode = VDPU2_MODE;
hw_mode = VDPU2_MODE;
switch (hard_mode) {
switch (hw_mode) {
case VDPU2_MODE:
p_api->init = hal_m2vd_vdpu2_init;
p_api->deinit = hal_m2vd_vdpu2_deinit;
@@ -113,7 +113,7 @@ static MPP_RET hal_m2vd_init (void *hal, MppHalCfg *cfg)
p_api->control = hal_m2vd_vdpu1_control;
break;
default:
mpp_err("unknow vpu mode %d.", hard_mode);
mpp_err("unknow vpu mode %d.", hw_mode);
return MPP_ERR_INIT;
}

View File

@@ -48,7 +48,7 @@ MPP_RET hal_vpu_mpg4d_init(void *hal, MppHalCfg *cfg)
{
hal_mpg4_ctx *p_hal = (hal_mpg4_ctx *)hal;
MppHalApi *p_api = NULL;
VpuHardMode hard_mode = MODE_NULL;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_flag = 0;
if (NULL == p_hal)
@@ -61,11 +61,11 @@ MPP_RET hal_vpu_mpg4d_init(void *hal, MppHalCfg *cfg)
mpp_assert(hw_flag & (HAVE_VDPU2 | HAVE_VDPU1));
if (hw_flag & HAVE_VDPU2)
hard_mode = VDPU2_MODE;
hw_mode = VDPU2_MODE;
if (hw_flag & HAVE_VDPU1)
hard_mode = VDPU1_MODE;
hw_mode = VDPU1_MODE;
switch (hard_mode) {
switch (hw_mode) {
case VDPU2_MODE:
p_api->init = vdpu2_mpg4d_init;
p_api->deinit = vdpu2_mpg4d_deinit;

View File

@@ -98,7 +98,7 @@ static MPP_RET hal_vp8d_init (void *hal, MppHalCfg *cfg)
{
VP8DHalContext_t *self = (VP8DHalContext_t *)hal;
MppHalApi *p_api = NULL;
VpuHardMode hard_mode = MODE_NULL;
VpuHwMode hw_mode = MODE_NULL;
RK_U32 hw_flag = 0;
if (NULL == self)
@@ -109,11 +109,11 @@ static MPP_RET hal_vp8d_init (void *hal, MppHalCfg *cfg)
hw_flag = mpp_get_vcodec_type();
if (hw_flag & HAVE_VDPU1)
hard_mode = VDPU1_MODE;
hw_mode = VDPU1_MODE;
if (hw_flag & HAVE_VDPU2)
hard_mode = VDPU2_MODE;
hw_mode = VDPU2_MODE;
switch (hard_mode) {
switch (hw_mode) {
case VDPU2_MODE:
p_api->init = hal_vp8d_vdpu2_init;
p_api->deinit = hal_vp8d_vdpu2_deinit;