diff --git a/osal/inc/mpp_platform.h b/osal/inc/mpp_platform.h index 6e383174..46b466e7 100644 --- a/osal/inc/mpp_platform.h +++ b/osal/inc/mpp_platform.h @@ -22,6 +22,11 @@ /* * Platform flag detection is for rockchip hardware platform detection */ +typedef enum MppIoctlVersion_e { + IOCTL_VCODEC_SERVICE, + IOCTL_MPP_SERVICE_V1, + IOCTL_VERSION_BUTT, +} MppIoctlVersion; /* * Platform video codec hardware feature @@ -45,27 +50,27 @@ typedef enum { } VPU_CLIENT2_TYPE; /* RK combined codec */ -#define HAVE_VDPU1 (1 << VPU_CLIENT_VDPU1) /* 0x00000001 */ -#define HAVE_VDPU2 (1 << VPU_CLIENT_VDPU2) /* 0x00000002 */ -#define HAVE_VDPU1_PP (1 << VPU_CLIENT_VDPU1_PP) /* 0x00000004 */ -#define HAVE_VDPU2_PP (1 << VPU_CLIENT_VDPU2_PP) /* 0x00000008 */ +#define HAVE_VDPU1 (1 << VPU_CLIENT_VDPU1) /* 0x00000001 */ +#define HAVE_VDPU2 (1 << VPU_CLIENT_VDPU2) /* 0x00000002 */ +#define HAVE_VDPU1_PP (1 << VPU_CLIENT_VDPU1_PP) /* 0x00000004 */ +#define HAVE_VDPU2_PP (1 << VPU_CLIENT_VDPU2_PP) /* 0x00000008 */ /* RK standalone decoder */ -#define HAVE_HEVC_DEC (1 << VPU_CLIENT_HEVC_DEC) /* 0x00000100 */ -#define HAVE_RKVDEC (1 << VPU_CLIENT_RKVDEC) /* 0x00000200 */ -#define HAVE_AVSDEC (1 << VPU_CLIENT_AVSPLUS_DEC) /* 0x00001000 */ +#define HAVE_HEVC_DEC (1 << VPU_CLIENT_HEVC_DEC) /* 0x00000100 */ +#define HAVE_RKVDEC (1 << VPU_CLIENT_RKVDEC) /* 0x00000200 */ +#define HAVE_AVSDEC (1 << VPU_CLIENT_AVSPLUS_DEC) /* 0x00001000 */ /* RK standalone encoder */ -#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_LITE (1 << VPU_CLIENT_VEPU2_LITE) /* 0x00080000 */ +#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_LITE (1 << VPU_CLIENT_VEPU2_LITE) /* 0x00080000 */ /* External encoder */ -#define HAVE_VEPU22 (1 << VPU_CLIENT_VEPU22) /* 0x01000000 */ +#define HAVE_VEPU22 (1 << VPU_CLIENT_VEPU22) /* 0x01000000 */ /* Platform image process hardware feature */ -#define HAVE_IPP (0x00000001) -#define HAVE_RGA (0x00000002) -#define HAVE_RGA2 (0x00000004) -#define HAVE_IEP (0x00000008) +#define HAVE_IPP (0x00000001) +#define HAVE_RGA (0x00000002) +#define HAVE_RGA2 (0x00000004) +#define HAVE_IEP (0x00000008) /* Hal device id */ typedef enum MppDeviceId_e { @@ -80,10 +85,10 @@ typedef enum MppDeviceId_e { extern "C" { #endif +MppIoctlVersion mpp_get_ioctl_version(void); const char *mpp_get_soc_name(void); RK_U32 mpp_get_vcodec_type(void); RK_U32 mpp_get_2d_hw_flag(void); -RK_U32 mpp_get_ioctl_version(void); RK_U32 mpp_refresh_vcodec_type(RK_U32 vcodec_type); const char *mpp_get_platform_dev_name(MppCtxType type, MppCodingType coding, RK_U32 platform); const char *mpp_get_vcodec_dev_name(MppCtxType type, MppCodingType coding); diff --git a/osal/mpp_platform.cpp b/osal/mpp_platform.cpp index 36bde2fc..696b79c3 100644 --- a/osal/mpp_platform.cpp +++ b/osal/mpp_platform.cpp @@ -149,6 +149,7 @@ private: MppPlatformService(const MppPlatformService &); MppPlatformService &operator=(const MppPlatformService &); + MppIoctlVersion ioctl_version; char *soc_name; RockchipSocType soc_type; RK_U32 vcodec_type; @@ -160,15 +161,17 @@ public: return &instance; } + MppIoctlVersion get_ioctl_version(void) { return ioctl_version; }; const char *get_soc_name() { return soc_name; }; RockchipSocType get_soc_type() { return soc_type; }; RK_U32 get_vcodec_type() { return vcodec_type; }; - void refresh_vcodec_type(RK_U32 val) { vcodec_type = val; }; + void set_vcodec_type(RK_U32 val) { vcodec_type = val; }; RK_U32 get_vcodec_capability() { return vcodec_capability; }; }; MppPlatformService::MppPlatformService() - : soc_name(NULL), + : ioctl_version(IOCTL_VCODEC_SERVICE), + soc_name(NULL), vcodec_type(0), vcodec_capability(0) { @@ -222,6 +225,7 @@ MppPlatformService::MppPlatformService() /* if /dev/mpp_service not double check */ if (mpp_find_device(mpp_service_dev)) { + ioctl_version = IOCTL_MPP_SERVICE_V1; mpp_dbg(MPP_DBG_PLATFORM, "/dev/mpp_service not double check device\n"); goto __return; } @@ -280,6 +284,11 @@ MppPlatformService::~MppPlatformService() MPP_FREE(soc_name); } +MppIoctlVersion mpp_get_ioctl_version(void) +{ + return MppPlatformService::get_instance()->get_ioctl_version(); +} + const char *mpp_get_soc_name(void) { static const char *soc_name = NULL; @@ -314,27 +323,17 @@ RK_U32 mpp_get_2d_hw_flag(void) return flag; } -RK_U32 mpp_get_ioctl_version(void) -{ - RK_U32 flag = 0; - - flag = mpp_find_device(mpp_service_dev) ? 1 : 0; - - return flag; -} - RK_U32 mpp_refresh_vcodec_type(RK_U32 vcodec_type) { - MppPlatformService::get_instance()->refresh_vcodec_type(vcodec_type); + MppPlatformService::get_instance()->set_vcodec_type(vcodec_type); return 0; } const char *mpp_get_platform_dev_name(MppCtxType type, MppCodingType coding, RK_U32 platform) { - const char *dev = NULL; - - if ((dev = mpp_find_device(mpp_service_dev)) != NULL) { + const char *dev = mpp_find_device(mpp_service_dev); + if (dev) { mpp_log("got the %s\n", dev); } else if ((platform & HAVE_RKVDEC) && (type == MPP_CTX_DEC) && (coding == MPP_VIDEO_CodingAVC ||