diff --git a/mpp/hal/vpu/jpege/hal_jpege_api_v2.c b/mpp/hal/vpu/jpege/hal_jpege_api_v2.c index d6545b79..74cf71d4 100644 --- a/mpp/hal/vpu/jpege/hal_jpege_api_v2.c +++ b/mpp/hal/vpu/jpege/hal_jpege_api_v2.c @@ -48,7 +48,7 @@ static MPP_RET hal_jpege_init(void *hal, MppEncHalCfg *cfg) mpp_env_get_u32("hal_jpege_debug", &hal_jpege_debug, 0); - if (vcodec_type & HAVE_VEPU2) { + if (vcodec_type & (HAVE_VEPU2 | HAVE_VEPU2_JPEG)) { api = &hal_jpege_vepu2; } else if (vcodec_type & HAVE_VEPU1) { api = &hal_jpege_vepu1; diff --git a/mpp/hal/vpu/jpege/hal_jpege_vepu2_v2.c b/mpp/hal/vpu/jpege/hal_jpege_vepu2_v2.c index d8d97a5b..4d24e814 100644 --- a/mpp/hal/vpu/jpege/hal_jpege_vepu2_v2.c +++ b/mpp/hal/vpu/jpege/hal_jpege_vepu2_v2.c @@ -43,12 +43,15 @@ MPP_RET hal_jpege_vepu2_init(void *hal, MppEncHalCfg *cfg) { MPP_RET ret = MPP_OK; HalJpegeCtx *ctx = (HalJpegeCtx *)hal; + RK_U32 vcodec_type = mpp_get_vcodec_type(); mpp_env_get_u32("hal_jpege_debug", &hal_jpege_debug, 0); hal_jpege_dbg_func("enter hal %p cfg %p\n", hal, cfg); /* update output to MppEnc */ - cfg->type = VPU_CLIENT_VEPU2; + cfg->type = (vcodec_type & VPU_CLIENT_VEPU2_JPEG) ? + VPU_CLIENT_VEPU2_JPEG : VPU_CLIENT_VEPU2; + ret = mpp_dev_init(&cfg->dev, cfg->type); if (ret) { mpp_err_f("mpp_dev_init failed. ret: %d\n", ret); diff --git a/osal/inc/mpp_dev_defs.h b/osal/inc/mpp_dev_defs.h index 2c275b33..3a486218 100644 --- a/osal/inc/mpp_dev_defs.h +++ b/osal/inc/mpp_dev_defs.h @@ -37,7 +37,7 @@ typedef enum MppClientType_e { VPU_CLIENT_RKVENC = 16, /* 0x00010000 */ VPU_CLIENT_VEPU1 = 17, /* 0x00020000 */ VPU_CLIENT_VEPU2 = 18, /* 0x00040000 */ - VPU_CLIENT_VEPU2_LITE = 19, /* 0x00080000 */ + VPU_CLIENT_VEPU2_JPEG = 19, /* 0x00080000 */ VPU_CLIENT_VEPU22 = 24, /* 0x01000000 */ IEP_CLIENT_TYPE = 28, /* 0x10000000 */ @@ -60,6 +60,7 @@ typedef enum MppClientType_e { #define HAVE_RKVENC (1 << VPU_CLIENT_RKVENC) /* 0x00010000 */ #define HAVE_VEPU1 (1 << VPU_CLIENT_VEPU1) /* 0x00020000 */ #define HAVE_VEPU2 (1 << VPU_CLIENT_VEPU2) /* 0x00040000 */ +#define HAVE_VEPU2_JPEG (1 << VPU_CLIENT_VEPU2_JPEG) /* 0x00080000 */ /* External encoder */ #define HAVE_VEPU22 (1 << VPU_CLIENT_VEPU22) /* 0x01000000 */ /* RK Image Enhance Processor for deinterlacing */ diff --git a/osal/inc/mpp_platform.h b/osal/inc/mpp_platform.h index cdf7dfc2..65c65ec2 100644 --- a/osal/inc/mpp_platform.h +++ b/osal/inc/mpp_platform.h @@ -45,6 +45,7 @@ MppIoctlVersion mpp_get_ioctl_version(void); MppKernelVersion mpp_get_kernel_version(void); RK_U32 mpp_get_2d_hw_flag(void); RK_U32 mpp_get_client_hw_id(RK_S32 client_type); +RK_U32 mpp_get_vcodec_type(void); #ifdef __cplusplus } diff --git a/osal/inc/mpp_soc.h b/osal/inc/mpp_soc.h index a841dda5..3164cc3f 100644 --- a/osal/inc/mpp_soc.h +++ b/osal/inc/mpp_soc.h @@ -92,7 +92,6 @@ extern "C" { const char *mpp_get_soc_name(void); RockchipSocType mpp_get_soc_type(void); -RK_U32 mpp_get_vcodec_type(void); const MppSocInfo *mpp_get_soc_info(void); RK_U32 mpp_check_soc_cap(MppCtxType type, MppCodingType coding); diff --git a/osal/mpp_platform.cpp b/osal/mpp_platform.cpp index 2aa29492..b15b338b 100644 --- a/osal/mpp_platform.cpp +++ b/osal/mpp_platform.cpp @@ -92,6 +92,7 @@ public: const char *get_soc_name() { return soc_name; }; MppServiceCmdCap *get_mpp_service_cmd_cap() { return &mpp_service_cmd_cap; }; RK_U32 get_hw_id(RK_S32 client_type); + RK_U32 get_vcodec_type(void) { return vcodec_type; }; }; MppPlatformService::MppPlatformService() @@ -127,7 +128,8 @@ MppPlatformService::MppPlatformService() check_mpp_service_cap(&vcodec_type, hw_ids, cap); } kernel_version = check_kernel_version(); - vcodec_type = soc_info->vcodec_type; + if (!vcodec_type) + vcodec_type = soc_info->vcodec_type; } RK_U32 MppPlatformService::get_hw_id(RK_S32 client_type) @@ -172,3 +174,13 @@ RK_U32 mpp_get_client_hw_id(RK_S32 client_type) { return MppPlatformService::get_instance()->get_hw_id(client_type); } + +RK_U32 mpp_get_vcodec_type(void) +{ + static RK_U32 vcodec_type = 0; + + if (!vcodec_type) + vcodec_type = MppPlatformService::get_instance()->get_vcodec_type(); + + return vcodec_type; +} diff --git a/osal/mpp_soc.cpp b/osal/mpp_soc.cpp index 654cf037..dd62b02e 100644 --- a/osal/mpp_soc.cpp +++ b/osal/mpp_soc.cpp @@ -352,7 +352,7 @@ static const MppEncHwCap vepu2_no_jpeg = { static const MppEncHwCap vepu2_jpeg = { .cap_coding = HAVE_MJPEG, - .type = VPU_CLIENT_VEPU2, + .type = VPU_CLIENT_VEPU2_JPEG, .cap_fbc = 0, .cap_4k = 0, .cap_8k = 0, @@ -668,7 +668,8 @@ static const MppSocInfo mpp_soc_infos[] = { */ "rk3588", ROCKCHIP_SOC_RK3588, - HAVE_VDPU2 | HAVE_VDPU2_PP | HAVE_VEPU2 | HAVE_RKVDEC | HAVE_RKVENC | HAVE_JPEG_DEC | HAVE_AV1DEC | HAVE_AVSDEC, + HAVE_VDPU2 | HAVE_VDPU2_PP | HAVE_VEPU2 | HAVE_RKVDEC | HAVE_RKVENC | + HAVE_JPEG_DEC | HAVE_AV1DEC | HAVE_AVSDEC | HAVE_VEPU2_JPEG, { &vdpu38x, &rkjpegd, &vdpu2, &vdpu2_jpeg_pp, &av1d, &avspd}, { &vepu58x, &vepu2, &vepu2_jpeg, NULL, }, }, @@ -826,16 +827,6 @@ RockchipSocType mpp_get_soc_type(void) return soc_type; } -RK_U32 mpp_get_vcodec_type(void) -{ - static RK_U32 vcodec_type = 0; - - if (!vcodec_type) - vcodec_type = MppSocService::get()->get_soc_info()->vcodec_type; - - return vcodec_type; -} - static RK_U32 is_valid_cap_coding(RK_U32 cap, MppCodingType coding) { RK_S32 index = CODING_TO_IDX(coding); diff --git a/osal/osal_2str.c b/osal/osal_2str.c index 1129ee1b..ff7406b9 100644 --- a/osal/osal_2str.c +++ b/osal/osal_2str.c @@ -25,7 +25,7 @@ const char *strof_client_type(MppClientType type) /* VPU_CLIENT_VDPU1_PP */ "vdpu1_pp", /* VPU_CLIENT_VDPU2_PP */ "vdpu2_pp", /* 4 ~ 7 */ - /* VPU_CLIENT_BUTT */ NULL, + /* VPU_CLIENT_AV1DEC */ "av1dec", /* VPU_CLIENT_BUTT */ NULL, /* VPU_CLIENT_BUTT */ NULL, /* VPU_CLIENT_BUTT */ NULL, @@ -43,7 +43,7 @@ const char *strof_client_type(MppClientType type) /* VPU_CLIENT_RKVENC */ "rkvenc", /* VPU_CLIENT_VEPU1 */ "vepu1", /* VPU_CLIENT_VEPU2 */ "vepu2", - /* VPU_CLIENT_VEPU2_LITE */ "vepu2_lite", + /* VPU_CLIENT_VEPU2_JPEG */ "vepu2_jpeg", /* 20 ~ 23 */ /* VPU_CLIENT_BUTT */ NULL, /* VPU_CLIENT_BUTT */ NULL,