[jpege]: add new client type for vepu2 jpeg only

Add VPU_CLIENT_VEPU2_JPEG to distinguish vepu2 jpege only device.
And check whether kernel support the client type or not.

rk3588 has 4 jpeg encoder core and we will use VPU_CLIENT_VEPU2_JPEG as
its client type in kernel.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib1c45781ac9c8f504ba7b46f2f0c7aad5d16fa68
This commit is contained in:
Yandong Lin
2022-06-14 16:09:46 +08:00
committed by Herman Chen
parent 8ce07dbfba
commit def09cb3c2
8 changed files with 26 additions and 19 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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,