msm: vidc: Align HFI profile with HAL profile
Make sure HAL profile level enums are same as that of HFI
values so that there is no conversion needed.
CRs-Fixed: 2086655
Change-Id: Ibded92d45930e0514c298af40db4465465bed9af
Signed-off-by: Vaibhav Deshu Venkatesh <vdeshuve@codeaurora.org>
diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.c b/drivers/media/platform/msm/vidc/hfi_packetization.c
index 4512409..b6c0d57 100644
--- a/drivers/media/platform/msm/vidc/hfi_packetization.c
+++ b/drivers/media/platform/msm/vidc/hfi_packetization.c
@@ -21,15 +21,6 @@
* space. So before indexing them, we apply log2 to use a more
* sensible index.
*/
-static int profile_table[] = {
- [ilog2(HAL_H264_PROFILE_BASELINE)] = HFI_H264_PROFILE_BASELINE,
- [ilog2(HAL_H264_PROFILE_MAIN)] = HFI_H264_PROFILE_MAIN,
- [ilog2(HAL_H264_PROFILE_HIGH)] = HFI_H264_PROFILE_HIGH,
- [ilog2(HAL_H264_PROFILE_CONSTRAINED_BASE)] =
- HFI_H264_PROFILE_CONSTRAINED_BASE,
- [ilog2(HAL_H264_PROFILE_CONSTRAINED_HIGH)] =
- HFI_H264_PROFILE_CONSTRAINED_HIGH,
-};
static int entropy_mode[] = {
[ilog2(HAL_H264_ENTROPY_CAVLC)] = HFI_H264_ENTROPY_CAVLC,
@@ -95,9 +86,6 @@
hal_type = ilog2(hal_type);
switch (property) {
- case HAL_PARAM_PROFILE_LEVEL_CURRENT:
- return (hal_type >= ARRAY_SIZE(profile_table)) ?
- -ENOTSUPP : profile_table[hal_type];
case HAL_PARAM_VENC_H264_ENTROPY_CONTROL:
return (hal_type >= ARRAY_SIZE(entropy_mode)) ?
-ENOTSUPP : entropy_mode[hal_type];
@@ -1194,8 +1182,7 @@
* HFI level
*/
hfi->level = prop->level;
- hfi->profile = hal_to_hfi_type(HAL_PARAM_PROFILE_LEVEL_CURRENT,
- prop->profile);
+ hfi->profile = prop->profile;
if (hfi->profile <= 0) {
hfi->profile = HFI_H264_PROFILE_HIGH;
dprintk(VIDC_WARN,
diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c
index 03b4e4d..0eb6d39 100644
--- a/drivers/media/platform/msm/vidc/msm_venc.c
+++ b/drivers/media/platform/msm/vidc/msm_venc.c
@@ -1374,7 +1374,7 @@
break;
case V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL:
property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT;
- profile_level.profile = HAL_VPX_PROFILE_MAIN;
+ profile_level.profile = HAL_VP8_PROFILE_MAIN;
profile_level.level = msm_comm_v4l2_to_hal(
V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL,
ctrl->val);
diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c
index ac53d83..f9972c1 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc_common.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c
@@ -152,16 +152,14 @@
V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE;
case HAL_H264_PROFILE_MAIN:
return V4L2_MPEG_VIDEO_H264_PROFILE_MAIN;
- case HAL_H264_PROFILE_EXTENDED:
- return V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED;
case HAL_H264_PROFILE_HIGH:
return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH;
- case HAL_H264_PROFILE_HIGH10:
- return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10;
- case HAL_H264_PROFILE_HIGH422:
- return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422;
- case HAL_H264_PROFILE_HIGH444:
- return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE;
+ case HAL_H264_PROFILE_STEREO_HIGH:
+ return V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH;
+ case HAL_H264_PROFILE_MULTIVIEW_HIGH:
+ return V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH;
+ case HAL_H264_PROFILE_CONSTRAINED_HIGH:
+ return V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH;
default:
goto unknown_value;
}
@@ -286,29 +284,40 @@
}
case V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL:
switch (value) {
- case HAL_VPX_LEVEL_VERSION_0:
+ case HAL_VP8_LEVEL_VERSION_0:
return V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0;
- case HAL_VPX_LEVEL_VERSION_1:
+ case HAL_VP8_LEVEL_VERSION_1:
return V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_1;
- case HAL_VPX_LEVEL_VERSION_2:
+ case HAL_VP8_LEVEL_VERSION_2:
return V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_2;
- case HAL_VPX_LEVEL_VERSION_3:
+ case HAL_VP8_LEVEL_VERSION_3:
return V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_3;
- case HAL_VPX_LEVEL_UNUSED:
+ case HAL_VP8_LEVEL_UNUSED:
return V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED;
default:
goto unknown_value;
}
case V4L2_CID_MPEG_VIDC_VIDEO_MPEG2_PROFILE:
+ switch (value) {
+ case HAL_MPEG2_PROFILE_SIMPLE:
+ return V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SIMPLE;
+ case HAL_MPEG2_PROFILE_MAIN:
+ return V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_MAIN;
+ default:
+ goto unknown_value;
+ }
case V4L2_CID_MPEG_VIDC_VIDEO_MPEG2_LEVEL:
- /*
- * Extremely dirty hack: we haven't implemented g_ctrl of
- * any of these controls and have no intention of doing
- * so in the near future. So just return 0 so that we
- * don't see the annoying "Unknown control" errors at the
- * bottom of this function.
- */
- return 0;
+ /* This mapping is not defined properly in V4L2 */
+ switch (value) {
+ case HAL_MPEG2_LEVEL_LL:
+ return V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_0;
+ case HAL_MPEG2_LEVEL_ML:
+ return V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_1;
+ case HAL_MPEG2_LEVEL_HL:
+ return V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_2;
+ default:
+ goto unknown_value;
+ }
}
unknown_value:
@@ -328,16 +337,12 @@
return HAL_H264_PROFILE_CONSTRAINED_BASE;
case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN:
return HAL_H264_PROFILE_MAIN;
- case V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED:
- return HAL_H264_PROFILE_EXTENDED;
case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH:
return HAL_H264_PROFILE_HIGH;
- case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10:
- return HAL_H264_PROFILE_HIGH10;
- case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422:
- return HAL_H264_PROFILE_HIGH422;
- case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE:
- return HAL_H264_PROFILE_HIGH444;
+ case V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH:
+ return HAL_H264_PROFILE_STEREO_HIGH;
+ case V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH:
+ return HAL_H264_PROFILE_MULTIVIEW_HIGH;
case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH:
return HAL_H264_PROFILE_CONSTRAINED_HIGH;
default:
@@ -407,15 +412,15 @@
case V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL:
switch (value) {
case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0:
- return HAL_VPX_LEVEL_VERSION_0;
+ return HAL_VP8_LEVEL_VERSION_0;
case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_1:
- return HAL_VPX_LEVEL_VERSION_1;
+ return HAL_VP8_LEVEL_VERSION_1;
case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_2:
- return HAL_VPX_LEVEL_VERSION_2;
+ return HAL_VP8_LEVEL_VERSION_2;
case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_3:
- return HAL_VPX_LEVEL_VERSION_3;
+ return HAL_VP8_LEVEL_VERSION_3;
case V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED:
- return HAL_VPX_LEVEL_UNUSED;
+ return HAL_VP8_LEVEL_UNUSED;
default:
goto unknown_value;
}
diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_api.h b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
index f350f25..d2a59dc 100644
--- a/drivers/media/platform/msm/vidc/vidc_hfi_api.h
+++ b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
@@ -279,34 +279,27 @@
};
enum hal_mpeg2_profile {
+ HAL_UNUSED_MPEG2_PROFILE = 0x00000000,
HAL_MPEG2_PROFILE_SIMPLE = 0x00000001,
HAL_MPEG2_PROFILE_MAIN = 0x00000002,
- HAL_MPEG2_PROFILE_422 = 0x00000004,
- HAL_MPEG2_PROFILE_SNR = 0x00000008,
- HAL_MPEG2_PROFILE_SPATIAL = 0x00000010,
- HAL_MPEG2_PROFILE_HIGH = 0x00000020,
- HAL_UNUSED_MPEG2_PROFILE = 0x10000000,
};
enum hal_mpeg2_level {
+ HAL_UNUSED_MEPG2_LEVEL = 0x00000000,
HAL_MPEG2_LEVEL_LL = 0x00000001,
HAL_MPEG2_LEVEL_ML = 0x00000002,
- HAL_MPEG2_LEVEL_H14 = 0x00000004,
- HAL_MPEG2_LEVEL_HL = 0x00000008,
- HAL_UNUSED_MEPG2_LEVEL = 0x10000000,
+ HAL_MPEG2_LEVEL_HL = 0x00000004,
};
enum hal_h264_profile {
+ HAL_UNUSED_H264_PROFILE = 0x00000000,
HAL_H264_PROFILE_BASELINE = 0x00000001,
HAL_H264_PROFILE_MAIN = 0x00000002,
HAL_H264_PROFILE_HIGH = 0x00000004,
- HAL_H264_PROFILE_EXTENDED = 0x00000008,
- HAL_H264_PROFILE_HIGH10 = 0x00000010,
- HAL_H264_PROFILE_HIGH422 = 0x00000020,
- HAL_H264_PROFILE_HIGH444 = 0x00000040,
- HAL_H264_PROFILE_CONSTRAINED_BASE = 0x00000080,
- HAL_H264_PROFILE_CONSTRAINED_HIGH = 0x00000100,
- HAL_UNUSED_H264_PROFILE = 0x10000000,
+ HAL_H264_PROFILE_STEREO_HIGH = 0x00000008,
+ HAL_H264_PROFILE_MULTIVIEW_HIGH = 0x00000010,
+ HAL_H264_PROFILE_CONSTRAINED_BASE = 0x00000020,
+ HAL_H264_PROFILE_CONSTRAINED_HIGH = 0x00000040,
};
enum hal_h264_level {
@@ -331,10 +324,10 @@
};
enum hal_hevc_profile {
+ HAL_UNUSED_HEVC_PROFILE = 0x00000000,
HAL_HEVC_PROFILE_MAIN = 0x00000001,
HAL_HEVC_PROFILE_MAIN10 = 0x00000002,
HAL_HEVC_PROFILE_MAIN_STILL_PIC = 0x00000004,
- HAL_UNUSED_HEVC_PROFILE = 0x10000000,
};
enum hal_hevc_level {
@@ -373,17 +366,17 @@
HAL_UNUSED_HEVC_TIER = 0x10000000,
};
-enum hal_vpx_profile {
- HAL_VPX_PROFILE_MAIN = 0x00000001,
- HAL_VPX_PROFILE_UNUSED = 0x10000000,
+enum hal_vp8_profile {
+ HAL_VP8_PROFILE_UNUSED = 0x00000000,
+ HAL_VP8_PROFILE_MAIN = 0x00000001,
};
-enum hal_vpx_level {
- HAL_VPX_LEVEL_UNUSED = 0x00000000,
- HAL_VPX_LEVEL_VERSION_0 = 0x00000001,
- HAL_VPX_LEVEL_VERSION_1 = 0x00000002,
- HAL_VPX_LEVEL_VERSION_2 = 0x00000004,
- HAL_VPX_LEVEL_VERSION_3 = 0x00000008,
+enum hal_vp8_level {
+ HAL_VP8_LEVEL_UNUSED = 0x00000000,
+ HAL_VP8_LEVEL_VERSION_0 = 0x00000001,
+ HAL_VP8_LEVEL_VERSION_1 = 0x00000002,
+ HAL_VP8_LEVEL_VERSION_2 = 0x00000004,
+ HAL_VP8_LEVEL_VERSION_3 = 0x00000008,
};
enum hal_tme_profile {
diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_helper.h b/drivers/media/platform/msm/vidc/vidc_hfi_helper.h
index 6a239b3..fec1517 100644
--- a/drivers/media/platform/msm/vidc/vidc_hfi_helper.h
+++ b/drivers/media/platform/msm/vidc/vidc_hfi_helper.h
@@ -83,14 +83,16 @@
#define HFI_VIDEO_CODEC_VP9 0x00004000
#define HFI_VIDEO_CODEC_TME 0x00008000
-#define HFI_PROFILE_UNKNOWN 0x00000000
+#define HFI_PROFILE_UNKNOWN 0x00000000
+#define HFI_LEVEL_UNKNOWN 0x00000000
+
#define HFI_H264_PROFILE_BASELINE 0x00000001
#define HFI_H264_PROFILE_MAIN 0x00000002
#define HFI_H264_PROFILE_HIGH 0x00000004
-#define HFI_H264_PROFILE_STEREO_HIGH 0x00000008
+#define HFI_H264_PROFILE_STEREO_HIGH 0x00000008
#define HFI_H264_PROFILE_MULTIVIEW_HIGH 0x00000010
-#define HFI_H264_PROFILE_CONSTRAINED_BASE 0x00000020
-#define HFI_H264_PROFILE_CONSTRAINED_HIGH 0x00000040
+#define HFI_H264_PROFILE_CONSTRAINED_BASE 0x00000020
+#define HFI_H264_PROFILE_CONSTRAINED_HIGH 0x00000040
#define HFI_LEVEL_UNKNOWN 0x00000000
#define HFI_H264_LEVEL_1 0x00000001
@@ -113,22 +115,17 @@
#define HFI_MPEG2_PROFILE_SIMPLE 0x00000001
#define HFI_MPEG2_PROFILE_MAIN 0x00000002
-#define HFI_MPEG2_PROFILE_422 0x00000004
-#define HFI_MPEG2_PROFILE_SNR 0x00000008
-#define HFI_MPEG2_PROFILE_SPATIAL 0x00000010
-#define HFI_MPEG2_PROFILE_HIGH 0x00000020
#define HFI_MPEG2_LEVEL_LL 0x00000001
#define HFI_MPEG2_LEVEL_ML 0x00000002
-#define HFI_MPEG2_LEVEL_H14 0x00000004
-#define HFI_MPEG2_LEVEL_HL 0x00000008
+#define HFI_MPEG2_LEVEL_HL 0x00000004
-#define HFI_VPX_PROFILE_MAIN 0x00000001
+#define HFI_VP8_PROFILE_MAIN 0x00000001
-#define HFI_VPX_LEVEL_VERSION_0 0x00000001
-#define HFI_VPX_LEVEL_VERSION_1 0x00000002
-#define HFI_VPX_LEVEL_VERSION_2 0x00000004
-#define HFI_VPX_LEVEL_VERSION_3 0x00000008
+#define HFI_VP8_LEVEL_VERSION_0 0x00000001
+#define HFI_VP8_LEVEL_VERSION_1 0x00000002
+#define HFI_VP8_LEVEL_VERSION_2 0x00000004
+#define HFI_VP8_LEVEL_VERSION_3 0x00000008
#define HFI_HEVC_PROFILE_MAIN 0x00000001
#define HFI_HEVC_PROFILE_MAIN10 0x00000002