diff --git a/driver/platform/common/inc/msm_vidc_platform.h b/driver/platform/common/inc/msm_vidc_platform.h index b94fc757f9..1e89136dc3 100644 --- a/driver/platform/common/inc/msm_vidc_platform.h +++ b/driver/platform/common/inc/msm_vidc_platform.h @@ -41,6 +41,33 @@ extern u32 vpe_csc_custom_matrix_coeff[MAX_MATRIX_COEFFS]; extern u32 vpe_csc_custom_bias_coeff[MAX_BIAS_COEFFS]; extern u32 vpe_csc_custom_limit_coeff[MAX_LIMIT_COEFFS]; +struct codec_info { + u32 v4l2_codec; + enum msm_vidc_codec_type vidc_codec; + const char *pixfmt_name; +}; + +struct color_format_info { + u32 v4l2_color_format; + enum msm_vidc_colorformat_type vidc_color_format; + const char *pixfmt_name; +}; + +struct color_primaries_info { + u32 v4l2_color_primaries; + enum msm_vidc_color_primaries vidc_color_primaries; +}; + +struct transfer_char_info { + u32 v4l2_transfer_char; + enum msm_vidc_transfer_characteristics vidc_transfer_char; +}; + +struct matrix_coeff_info { + u32 v4l2_matrix_coeff; + enum msm_vidc_matrix_coefficients vidc_matrix_coeff; +}; + struct msm_platform_core_capability { enum msm_vidc_core_capability_type type; u32 value; @@ -95,6 +122,19 @@ struct msm_vidc_ubwc_config_data { u32 bank_spreading; }; +struct msm_vidc_format_capability { + struct codec_info *codec_info; + u32 codec_info_size; + struct color_format_info *color_format_info; + u32 color_format_info_size; + struct color_primaries_info *color_prim_info; + u32 color_prim_info_size; + struct transfer_char_info *transfer_char_info; + u32 transfer_char_info_size; + struct matrix_coeff_info *matrix_coeff_info; + u32 matrix_coeff_info_size; +}; + struct msm_vidc_platform_data { struct msm_platform_core_capability *core_data; u32 core_data_size; @@ -107,6 +147,7 @@ struct msm_vidc_platform_data { struct msm_vidc_efuse_data *efuse_data; unsigned int efuse_data_size; unsigned int sku_version; + struct msm_vidc_format_capability *format_data; }; struct msm_vidc_platform { diff --git a/driver/platform/kalama/src/kalama.c b/driver/platform/kalama/src/kalama.c index 90c1db98b1..bfaae7e36c 100644 --- a/driver/platform/kalama/src/kalama.c +++ b/driver/platform/kalama/src/kalama.c @@ -9,7 +9,6 @@ #include "msm_vidc_kalama.h" #include "msm_vidc_platform.h" #include "msm_vidc_debug.h" -#include "msm_vidc_internal.h" #include "hfi_property.h" #include "msm_vidc_iris3.h" #include "hfi_command.h" @@ -41,6 +40,135 @@ #define CODECS_ALL (H264 | HEVC | VP9 | HEIC | AV1) #define MAXIMUM_OVERRIDE_VP9_FPS 180 +static struct codec_info codec_data_kalama[] = { + { + .v4l2_codec = V4L2_PIX_FMT_H264, + .vidc_codec = MSM_VIDC_H264, + .pixfmt_name = "AVC", + }, + { + .v4l2_codec = V4L2_PIX_FMT_HEVC, + .vidc_codec = MSM_VIDC_HEVC, + .pixfmt_name = "HEVC", + }, + { + .v4l2_codec = V4L2_PIX_FMT_VP9, + .vidc_codec = MSM_VIDC_VP9, + .pixfmt_name = "VP9", + }, +}; + +static struct color_format_info color_format_data_kalama[] = { + { + .v4l2_color_format = V4L2_PIX_FMT_NV12, + .vidc_color_format = MSM_VIDC_FMT_NV12, + .pixfmt_name = "NV12", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_NV21, + .vidc_color_format = MSM_VIDC_FMT_NV21, + .pixfmt_name = "NV21", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_RGBA32, + .vidc_color_format = MSM_VIDC_FMT_RGBA8888, + .pixfmt_name = "RGBA", + }, +}; + +static struct color_primaries_info color_primaries_data_kalama[] = { + { + .v4l2_color_primaries = V4L2_COLORSPACE_DEFAULT, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_REC709, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT709, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_470_SYSTEM_M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_M, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_470_SYSTEM_BG, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_SMPTE170M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT601_525, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_SMPTE240M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_ST240M, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_BT2020, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT2020, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_DCI_P3, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_RP431_2, + }, +}; + +static struct transfer_char_info transfer_char_data_kalama[] = { + { + .v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT, + .vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_709, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT709, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE240M, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST240M, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SRGB, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SRGB_SYCC, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE2084, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ, + }, +}; + +static struct matrix_coeff_info matrix_coeff_data_kalama[] = { + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_709, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV709, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV601, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_601, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_SMPTE240M, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SMPTE_ST240, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020_CONST_LUM, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT, + }, +}; + static struct msm_platform_core_capability core_data_kalama[] = { /* {type, value} */ {ENC_CODECS, H264|HEVC|HEIC}, @@ -253,18 +381,14 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 0}, {HFLIP, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_HFLIP, HFI_PROP_FLIP, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, {VFLIP, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_VFLIP, HFI_PROP_FLIP, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT | @@ -297,22 +421,17 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {PREPEND_SPSPPS_TO_IDR, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR}, {WITHOUT_STARTCODE, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE, HFI_PROP_NAL_LENGTH_FIELD, CAP_FLAG_OUTPUT_PORT}, {WITHOUT_STARTCODE, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_DISABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE, HFI_PROP_NAL_LENGTH_FIELD, CAP_FLAG_INPUT_PORT}, @@ -389,8 +508,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 70000000, 1, 70000000}, {LOSSLESS, ENC, HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU}, {FRAME_SKIP_MODE, ENC, H264|HEVC|HEIC, @@ -405,8 +523,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {FRAME_RC_ENABLE, ENC, H264|HEVC|HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE}, {CONSTANT_QUALITY, ENC, HEVC, @@ -438,8 +555,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, {GOP_CLOSURE, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_GOP_CLOSURE, 0}, @@ -450,37 +566,32 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {B_FRAME, ENC, HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_B_FRAMES, HFI_PROP_MAX_B_FRAMES, CAP_FLAG_OUTPUT_PORT}, {BLUR_TYPES, ENC, H264|HEVC, - VIDC_BLUR_NONE, VIDC_BLUR_EXTERNAL, - BIT(VIDC_BLUR_NONE) | BIT(VIDC_BLUR_EXTERNAL), - VIDC_BLUR_NONE, + MSM_VIDC_BLUR_NONE, MSM_VIDC_BLUR_EXTERNAL, + BIT(MSM_VIDC_BLUR_NONE) | BIT(MSM_VIDC_BLUR_EXTERNAL), + MSM_VIDC_BLUR_NONE, 0, HFI_PROP_BLUR_TYPES, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {CSC, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_CSC}, {LOWLATENCY_MODE, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, 0, CAP_FLAG_NONE}, {LOWLATENCY_MODE, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_SEQ_CHANGE_AT_SYNC_FRAME, CAP_FLAG_INPUT_PORT}, @@ -514,16 +625,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {AU_DELIMITER, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_AU_DELIMITER, HFI_PROP_AUD, CAP_FLAG_OUTPUT_PORT}, {CONTENT_ADAPTIVE_CODING, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_CONTENT_ADAPTIVE_CODING, CAP_FLAG_OUTPUT_PORT}, @@ -692,15 +800,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {LAYER_ENABLE, ENC, H264, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING, HFI_PROP_LAYER_ENCODING_TYPE, CAP_FLAG_OUTPUT_PORT}, {LAYER_ENABLE, ENC, HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, 0, CAP_FLAG_OUTPUT_PORT}, @@ -1067,15 +1173,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {MB_RC, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE, 0, CAP_FLAG_OUTPUT_PORT}, {TRANSFORM_8X8, ENC, H264, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, HFI_PROP_8X8_TRANSFORM, CAP_FLAG_OUTPUT_PORT}, @@ -1088,8 +1192,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {DISPLAY_DELAY_ENABLE, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE, HFI_PROP_DECODE_ORDER_OUTPUT, CAP_FLAG_INPUT_PORT}, @@ -1101,8 +1204,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT}, {OUTPUT_ORDER, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DECODE_ORDER_OUTPUT, CAP_FLAG_INPUT_PORT}, @@ -1174,28 +1276,24 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 0}, {THUMBNAIL_MODE, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_THUMBNAIL_MODE, CAP_FLAG_INPUT_PORT}, {DEFAULT_HEADER, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DEC_DEFAULT_HEADER}, {RAP_FRAME, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_DEC_START_FROM_RAP_FRAME, CAP_FLAG_INPUT_PORT}, {SEQ_CHANGE_AT_SYNC_FRAME, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_SEQ_CHANGE_AT_SYNC_FRAME, CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, @@ -1204,21 +1302,18 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 1, 1, 1, 1}, {DPB_LIST, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DPB_LIST, CAP_FLAG_OUTPUT_PORT}, {FILM_GRAIN, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_AV1_FILM_GRAIN_PRESENT}, {SUPER_BLOCK, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_AV1_SUPER_BLOCK_ENABLED}, @@ -1229,15 +1324,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT}, {ALL_INTRA, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, 0, CAP_FLAG_OUTPUT_PORT}, {GRID, ENC, HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_HEIC_GRID_ENABLE, CAP_FLAG_OUTPUT_PORT}, @@ -1799,6 +1892,19 @@ static struct msm_vidc_ubwc_config_data ubwc_config_kalama[] = { UBWC_CONFIG(8, 32, 16, 0, 1, 1, 1), }; +static struct msm_vidc_format_capability format_data_kalama = { + .codec_info = codec_data_kalama, + .codec_info_size = ARRAY_SIZE(codec_data_kalama), + .color_format_info = color_format_data_kalama, + .color_format_info_size = ARRAY_SIZE(color_format_data_kalama), + .color_prim_info = color_primaries_data_kalama, + .color_prim_info_size = ARRAY_SIZE(color_primaries_data_kalama), + .transfer_char_info = transfer_char_data_kalama, + .transfer_char_info_size = ARRAY_SIZE(transfer_char_data_kalama), + .matrix_coeff_info = matrix_coeff_data_kalama, + .matrix_coeff_info_size = ARRAY_SIZE(matrix_coeff_data_kalama), +}; + static const struct msm_vidc_platform_data kalama_data = { .core_data = core_data_kalama, .core_data_size = ARRAY_SIZE(core_data_kalama), @@ -1810,6 +1916,7 @@ static const struct msm_vidc_platform_data kalama_data = { .csc_data.vpe_csc_custom_matrix_coeff = vpe_csc_custom_matrix_coeff, .csc_data.vpe_csc_custom_limit_coeff = vpe_csc_custom_limit_coeff, .ubwc_config = ubwc_config_kalama, + .format_data = &format_data_kalama, }; int msm_vidc_kalama_check_ddr_type(void) diff --git a/driver/platform/kalama/src/msm_vidc_kalama.c b/driver/platform/kalama/src/msm_vidc_kalama.c index a0736035a9..ad83d0459e 100644 --- a/driver/platform/kalama/src/msm_vidc_kalama.c +++ b/driver/platform/kalama/src/msm_vidc_kalama.c @@ -43,6 +43,226 @@ #define CODECS_ALL (H264 | HEVC | VP9 | HEIC | AV1) #define MAXIMUM_OVERRIDE_VP9_FPS 200 +static struct codec_info codec_data_kalama[] = { + { + .v4l2_codec = V4L2_PIX_FMT_H264, + .vidc_codec = MSM_VIDC_H264, + .pixfmt_name = "AVC", + }, + { + .v4l2_codec = V4L2_PIX_FMT_HEVC, + .vidc_codec = MSM_VIDC_HEVC, + .pixfmt_name = "HEVC", + }, + { + .v4l2_codec = V4L2_PIX_FMT_VP9, + .vidc_codec = MSM_VIDC_VP9, + .pixfmt_name = "VP9", + }, + { + .v4l2_codec = V4L2_PIX_FMT_AV1, + .vidc_codec = MSM_VIDC_AV1, + .pixfmt_name = "AV1", + }, + { + .v4l2_codec = V4L2_PIX_FMT_HEIC, + .vidc_codec = MSM_VIDC_HEIC, + .pixfmt_name = "HEIC", + }, +}; + +static struct color_format_info color_format_data_kalama[] = { + { + .v4l2_color_format = V4L2_PIX_FMT_NV12, + .vidc_color_format = MSM_VIDC_FMT_NV12, + .pixfmt_name = "NV12", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_NV21, + .vidc_color_format = MSM_VIDC_FMT_NV21, + .pixfmt_name = "NV21", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_VIDC_NV12C, + .vidc_color_format = MSM_VIDC_FMT_NV12C, + .pixfmt_name = "NV12C", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_VIDC_TP10C, + .vidc_color_format = MSM_VIDC_FMT_TP10C, + .pixfmt_name = "TP10C", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_RGBA32, + .vidc_color_format = MSM_VIDC_FMT_RGBA8888, + .pixfmt_name = "RGBA", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_VIDC_ARGB32C, + .vidc_color_format = MSM_VIDC_FMT_RGBA8888C, + .pixfmt_name = "RGBAC", + }, + { + .v4l2_color_format = V4L2_PIX_FMT_VIDC_P010, + .vidc_color_format = MSM_VIDC_FMT_P010, + .pixfmt_name = "P010", + }, + { + .v4l2_color_format = V4L2_META_FMT_VIDC, + .vidc_color_format = MSM_VIDC_FMT_META, + .pixfmt_name = "META", + }, +}; + +static struct color_primaries_info color_primaries_data_kalama[] = { + { + .v4l2_color_primaries = V4L2_COLORSPACE_DEFAULT, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_REC709, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT709, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_470_SYSTEM_M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_M, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_470_SYSTEM_BG, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_SMPTE170M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT601_525, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_SMPTE240M, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_ST240M, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_VIDC_GENERIC_FILM, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_GENERIC_FILM, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_BT2020, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_BT2020, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_DCI_P3, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_RP431_2, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_VIDC_EG431, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EG431_1, + }, + { + .v4l2_color_primaries = V4L2_COLORSPACE_VIDC_EBU_TECH, + .vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EBU_TECH, + }, +}; + +static struct transfer_char_info transfer_char_data_kalama[] = { + { + .v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT, + .vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_709, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT709, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_M, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_M, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_BG, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_BG, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT601_525_OR_625, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT601_525_OR_625, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE240M, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST240M, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_LINEAR, + .vidc_transfer_char = MSM_VIDC_TRANSFER_LINEAR, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_XVYCC, + .vidc_transfer_char = MSM_VIDC_TRANSFER_XVYCC, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT1361, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT1361_0, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SRGB, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SRGB_SYCC, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT2020, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT2020_14, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE2084, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_ST428, + .vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST428_1, + }, + { + .v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_HLG, + .vidc_transfer_char = MSM_VIDC_TRANSFER_BT2100_2_HLG, + }, +}; + +static struct matrix_coeff_info matrix_coeff_data_kalama[] = { + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_VIDC_SRGB_OR_SMPTE_ST428, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SRGB_SMPTE_ST428_1, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_709, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV709, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_VIDC_FCC47_73_682, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_FCC_TITLE_47, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV601, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_601, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_SMPTE240M, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SMPTE_ST240, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT, + }, + { + .v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020_CONST_LUM, + .vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT, + }, +}; + static struct msm_platform_core_capability core_data_kalama[] = { /* {type, value} */ {ENC_CODECS, H264|HEVC|HEIC}, @@ -312,8 +532,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { V4L2_CID_MPEG_VIDC_CLIENT_ID}, {SECURE_MODE, ENC|DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_SECURE, HFI_PROP_SECURE, CAP_FLAG_NONE}, @@ -323,9 +542,9 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { * to get fence_id in input metadata buffer done. */ {META_OUTBUF_FENCE, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_OUTBUF_FENCE, HFI_PROP_FENCE, CAP_FLAG_BITMASK}, @@ -346,23 +565,18 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { V4L2_CID_MPEG_VIDC_SW_FENCE_FD}, {TS_REORDER, DEC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_TS_REORDER}, {HFLIP, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_HFLIP, HFI_PROP_FLIP, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, {VFLIP, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_VFLIP, HFI_PROP_FLIP, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT | @@ -398,9 +612,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {PREPEND_SPSPPS_TO_IDR, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR}, {VUI_TIMING_INFO, ENC, CODECS_ALL, @@ -412,16 +624,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {WITHOUT_STARTCODE, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE, HFI_PROP_NAL_LENGTH_FIELD, CAP_FLAG_OUTPUT_PORT}, {WITHOUT_STARTCODE, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_DISABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 0, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE, HFI_PROP_NAL_LENGTH_FIELD, CAP_FLAG_INPUT_PORT}, @@ -501,8 +710,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 0, INT_MAX, 1, 0}, {LOSSLESS, ENC, HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU}, {FRAME_SKIP_MODE, ENC, H264|HEVC|HEIC, @@ -517,8 +725,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {FRAME_RC_ENABLE, ENC, H264|HEVC|HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE}, {CONSTANT_QUALITY, ENC, HEVC, @@ -550,8 +757,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, {GOP_CLOSURE, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_GOP_CLOSURE, 0}, @@ -562,16 +768,15 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {B_FRAME, ENC, HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_B_FRAMES, HFI_PROP_MAX_B_FRAMES, CAP_FLAG_OUTPUT_PORT}, {BLUR_TYPES, ENC, H264|HEVC, - VIDC_BLUR_NONE, VIDC_BLUR_EXTERNAL, - BIT(VIDC_BLUR_NONE) | BIT(VIDC_BLUR_EXTERNAL), - VIDC_BLUR_NONE, + MSM_VIDC_BLUR_NONE, MSM_VIDC_BLUR_EXTERNAL, + BIT(MSM_VIDC_BLUR_NONE) | BIT(MSM_VIDC_BLUR_EXTERNAL), + MSM_VIDC_BLUR_NONE, V4L2_CID_MPEG_VIDC_VIDEO_BLUR_TYPES, HFI_PROP_BLUR_TYPES, CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, @@ -584,30 +789,24 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_DYNAMIC_ALLOWED}, {CSC, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_CSC}, {CSC_CUSTOM_MATRIX, ENC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_CUSTOM_MATRIX, HFI_PROP_CSC_MATRIX, CAP_FLAG_OUTPUT_PORT}, {LOWLATENCY_MODE, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_LOWLATENCY_REQUEST, 0, CAP_FLAG_NONE}, {LOWLATENCY_MODE, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_LOWLATENCY_REQUEST, HFI_PROP_SEQ_CHANGE_AT_SYNC_FRAME, CAP_FLAG_INPUT_PORT}, @@ -658,30 +857,25 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_DYNAMIC_ALLOWED}, {AU_DELIMITER, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_AU_DELIMITER, HFI_PROP_AUD, CAP_FLAG_OUTPUT_PORT}, {TIME_DELTA_BASED_RC, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDC_TIME_DELTA_BASED_RC, HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL, CAP_FLAG_OUTPUT_PORT}, {TIME_DELTA_BASED_RC, ENC, HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_TIME_DELTA_BASED_RC, HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL, CAP_FLAG_OUTPUT_PORT}, {CONTENT_ADAPTIVE_CODING, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDC_CONTENT_ADAPTIVE_CODING, HFI_PROP_CONTENT_ADAPTIVE_CODING, CAP_FLAG_OUTPUT_PORT}, @@ -856,15 +1050,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, {LAYER_ENABLE, ENC, H264, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING, HFI_PROP_LAYER_ENCODING_TYPE, CAP_FLAG_OUTPUT_PORT}, {LAYER_ENABLE, ENC, HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, 0, CAP_FLAG_OUTPUT_PORT}, @@ -1276,15 +1468,13 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {MB_RC, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE, 0, CAP_FLAG_OUTPUT_PORT}, {TRANSFORM_8X8, ENC, H264, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, HFI_PROP_8X8_TRANSFORM, CAP_FLAG_OUTPUT_PORT}, @@ -1297,8 +1487,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_OUTPUT_PORT}, {DISPLAY_DELAY_ENABLE, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE, HFI_PROP_DECODE_ORDER_OUTPUT, CAP_FLAG_INPUT_PORT}, @@ -1310,8 +1499,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT}, {OUTPUT_ORDER, DEC, H264|HEVC|VP9|AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DECODE_ORDER_OUTPUT, CAP_FLAG_INPUT_PORT}, @@ -1383,28 +1571,24 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { V4L2_CID_MPEG_VIDC_MIN_BITSTREAM_SIZE_OVERWRITE}, {THUMBNAIL_MODE, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_THUMBNAIL_MODE, HFI_PROP_THUMBNAIL_MODE, CAP_FLAG_INPUT_PORT}, {DEFAULT_HEADER, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DEC_DEFAULT_HEADER}, {RAP_FRAME, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_DEC_START_FROM_RAP_FRAME, CAP_FLAG_INPUT_PORT}, {SEQ_CHANGE_AT_SYNC_FRAME, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_SEQ_CHANGE_AT_SYNC_FRAME, CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, @@ -1434,21 +1618,18 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { 0, CAP_FLAG_DYNAMIC_ALLOWED}, {DPB_LIST, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_DPB_LIST, CAP_FLAG_OUTPUT_PORT}, {FILM_GRAIN, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_AV1D_FILM_GRAIN_PRESENT, HFI_PROP_AV1_FILM_GRAIN_PRESENT}, {SUPER_BLOCK, DEC, AV1, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, HFI_PROP_AV1_SUPER_BLOCK_ENABLED}, @@ -1459,31 +1640,29 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT}, {LAST_FLAG_EVENT_ENABLE, DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_LAST_FLAG_EVENT_ENABLE}, {META_BITSTREAM_RESOLUTION, DEC, AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_BITSTREAM_RESOLUTION, HFI_PROP_BITSTREAM_RESOLUTION, CAP_FLAG_BITMASK}, {META_CROP_OFFSETS, DEC, AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_CROP_OFFSETS, HFI_PROP_CROP_OFFSETS, CAP_FLAG_BITMASK}, {ALL_INTRA, ENC, H264|HEVC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, 0, 0, CAP_FLAG_OUTPUT_PORT}, @@ -1495,180 +1674,179 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED}, {INPUT_META_VIA_REQUEST, ENC|DEC, CODECS_ALL, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_DISABLE, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_INPUT_METADATA_VIA_REQUEST_ENABLE, 0, CAP_FLAG_INPUT_PORT}, {META_LTR_MARK_USE, ENC, H264|HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_LTR_MARK_USE_DETAILS, HFI_PROP_LTR_MARK_USE_DETAILS, CAP_FLAG_BITMASK}, {META_SEQ_HDR_NAL, ENC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SEQ_HEADER_NAL, HFI_PROP_METADATA_SEQ_HEADER_NAL, CAP_FLAG_BITMASK}, {META_DPB_MISR, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_DPB_LUMA_CHROMA_MISR, HFI_PROP_DPB_LUMA_CHROMA_MISR, CAP_FLAG_BITMASK}, {META_OPB_MISR, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_OPB_LUMA_CHROMA_MISR, HFI_PROP_OPB_LUMA_CHROMA_MISR, CAP_FLAG_BITMASK}, {META_INTERLACE, DEC, H264, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_INTERLACE, HFI_PROP_INTERLACE_INFO, CAP_FLAG_BITMASK}, {META_TIMESTAMP, DEC | ENC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_TIMESTAMP, HFI_PROP_TIMESTAMP, CAP_FLAG_BITMASK}, {META_CONCEALED_MB_CNT, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_CONCEALED_MB_COUNT, HFI_PROP_CONEALED_MB_COUNT, CAP_FLAG_BITMASK}, {META_HIST_INFO, DEC, HEVC|AV1|VP9, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_HISTOGRAM_INFO, HFI_PROP_HISTOGRAM_INFO, CAP_FLAG_BITMASK}, {META_TRANSCODING_STAT_INFO, DEC, HEVC|H264, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_TRANSCODE_STAT_INFO, HFI_PROP_TRANSCODING_STAT_INFO, CAP_FLAG_BITMASK}, {META_TRANSCODING_STAT_INFO, ENC, HEVC|H264, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_TRANSCODE_STAT_INFO, HFI_PROP_TRANSCODING_STAT_INFO, CAP_FLAG_BITMASK}, {META_PICTURE_TYPE, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_PICTURE_TYPE, HFI_PROP_PICTURE_TYPE, CAP_FLAG_BITMASK}, {META_SEI_MASTERING_DISP, ENC, HEVC|HEIC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SEI_MASTERING_DISPLAY_COLOUR, HFI_PROP_SEI_MASTERING_DISPLAY_COLOUR, CAP_FLAG_BITMASK}, {META_SEI_MASTERING_DISP, DEC, HEVC|HEIC|AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SEI_MASTERING_DISPLAY_COLOUR, HFI_PROP_SEI_MASTERING_DISPLAY_COLOUR, CAP_FLAG_BITMASK}, {META_SEI_CLL, ENC, HEVC|HEIC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SEI_CONTENT_LIGHT_LEVEL, HFI_PROP_SEI_CONTENT_LIGHT_LEVEL, CAP_FLAG_BITMASK}, {META_SEI_CLL, DEC, HEVC|HEIC|AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SEI_CONTENT_LIGHT_LEVEL, HFI_PROP_SEI_CONTENT_LIGHT_LEVEL, CAP_FLAG_BITMASK}, {META_HDR10PLUS, ENC, HEVC|HEIC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_HDR10PLUS, HFI_PROP_SEI_HDR10PLUS_USERDATA, CAP_FLAG_BITMASK}, {META_HDR10PLUS, DEC, HEVC|HEIC|AV1, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_HDR10PLUS, HFI_PROP_SEI_HDR10PLUS_USERDATA, CAP_FLAG_BITMASK}, {META_DOLBY_RPU, ENC, HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_DOLBY_RPU, HFI_PROP_DOLBY_RPU_METADATA, CAP_FLAG_BITMASK}, {META_DOLBY_RPU, DEC, H264|HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_DOLBY_RPU, HFI_PROP_DOLBY_RPU_METADATA, CAP_FLAG_BITMASK}, {META_EVA_STATS, ENC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_EVA_STATS, HFI_PROP_EVA_STAT_INFO, CAP_FLAG_BITMASK}, {META_BUF_TAG, ENC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_BUFFER_TAG, HFI_PROP_BUFFER_TAG, CAP_FLAG_BITMASK}, @@ -1678,74 +1856,73 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { * in input metadata buffer done. */ {META_BUF_TAG, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT | - V4L2_MPEG_VIDC_META_TX_OUTPUT | V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT | + MSM_VIDC_META_TX_OUTPUT | MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_BUFFER_TAG, HFI_PROP_BUFFER_TAG, CAP_FLAG_BITMASK}, {META_DPB_TAG_LIST, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_DPB_TAG_LIST, HFI_PROP_DPB_TAG_LIST, CAP_FLAG_BITMASK}, {META_SUBFRAME_OUTPUT, ENC, HEIC | H264 | HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SUBFRAME_OUTPUT, HFI_PROP_SUBFRAME_OUTPUT, CAP_FLAG_BITMASK}, {META_SUBFRAME_OUTPUT, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SUBFRAME_OUTPUT, HFI_PROP_SUBFRAME_OUTPUT, CAP_FLAG_BITMASK}, {META_ENC_QP_METADATA, ENC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_ENC_QP_METADATA, HFI_PROP_ENC_QP_METADATA, CAP_FLAG_BITMASK}, {META_ROI_INFO, ENC, H264|HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_ROI_INFO, HFI_PROP_ROI_INFO, CAP_FLAG_INPUT_PORT | CAP_FLAG_BITMASK}, {META_SALIENCY_INFO, ENC, H264|HEVC, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_TX_INPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_TX_INPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_SALIENCY_INFO, HFI_PROP_ROI_AS_SALIENCY_INFO, CAP_FLAG_INPUT_PORT | CAP_FLAG_BITMASK}, {META_DEC_QP_METADATA, DEC, CODECS_ALL, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_DEC_QP_METADATA, HFI_PROP_DEC_QP_METADATA, CAP_FLAG_BITMASK}, {GRID, ENC, HEIC, - V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, - 1, V4L2_MPEG_MSM_VIDC_ENABLE, + 0, 1, 1, 1, 0, HFI_PROP_HEIC_GRID_ENABLE, CAP_FLAG_OUTPUT_PORT}, @@ -1756,32 +1933,24 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = { V4L2_CID_MPEG_VIDC_VENC_COMPLEXITY}, {META_MAX_NUM_REORDER_FRAMES, DEC, HEVC | H264, - V4L2_MPEG_VIDC_META_DISABLE, - V4L2_MPEG_VIDC_META_ENABLE | V4L2_MPEG_VIDC_META_RX_OUTPUT, - 0, V4L2_MPEG_VIDC_META_DISABLE, + MSM_VIDC_META_DISABLE, + MSM_VIDC_META_ENABLE | MSM_VIDC_META_RX_OUTPUT, + 0, MSM_VIDC_META_DISABLE, V4L2_CID_MPEG_VIDC_METADATA_MAX_NUM_REORDER_FRAMES, HFI_PROP_MAX_NUM_REORDER_FRAMES, CAP_FLAG_BITMASK}, {DELIVERY_MODE, ENC, HEVC, - V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_FRAME_BASED, - V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED, - BIT(V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_FRAME_BASED) | - BIT(V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED), - V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_FRAME_BASED, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE, HFI_PROP_ENABLE_SLICE_DELIVERY, - CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, + CAP_FLAG_OUTPUT_PORT}, {DELIVERY_MODE, ENC, H264, - V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_FRAME_BASED, - V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED, - BIT(V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_FRAME_BASED) | - BIT(V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED), - V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_FRAME_BASED, + 0, 1, 1, 0, V4L2_CID_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE, HFI_PROP_ENABLE_SLICE_DELIVERY, - CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU}, + CAP_FLAG_OUTPUT_PORT}, }; static struct msm_platform_inst_cap_dependency instance_cap_dependency_data_kalama[] = { @@ -2445,6 +2614,19 @@ static struct msm_vidc_ubwc_config_data ubwc_config_kalama[] = { UBWC_CONFIG(8, 32, 16, 0, 1, 1, 1), }; +static struct msm_vidc_format_capability format_data_kalama = { + .codec_info = codec_data_kalama, + .codec_info_size = ARRAY_SIZE(codec_data_kalama), + .color_format_info = color_format_data_kalama, + .color_format_info_size = ARRAY_SIZE(color_format_data_kalama), + .color_prim_info = color_primaries_data_kalama, + .color_prim_info_size = ARRAY_SIZE(color_primaries_data_kalama), + .transfer_char_info = transfer_char_data_kalama, + .transfer_char_info_size = ARRAY_SIZE(transfer_char_data_kalama), + .matrix_coeff_info = matrix_coeff_data_kalama, + .matrix_coeff_info_size = ARRAY_SIZE(matrix_coeff_data_kalama), +}; + static const struct msm_vidc_platform_data kalama_data = { .core_data = core_data_kalama, .core_data_size = ARRAY_SIZE(core_data_kalama), @@ -2456,6 +2638,7 @@ static const struct msm_vidc_platform_data kalama_data = { .csc_data.vpe_csc_custom_matrix_coeff = vpe_csc_custom_matrix_coeff, .csc_data.vpe_csc_custom_limit_coeff = vpe_csc_custom_limit_coeff, .ubwc_config = ubwc_config_kalama, + .format_data = &format_data_kalama, }; int msm_vidc_kalama_check_ddr_type(void) diff --git a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c index 80d22934ca..bae3504453 100644 --- a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c @@ -143,7 +143,7 @@ static u32 msm_vidc_decoder_line_size_iris2(struct msm_vidc_inst *inst) } num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value; - color_fmt = v4l2_colorformat_to_driver( + color_fmt = v4l2_colorformat_to_driver(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); if (is_linear_colorformat(color_fmt)) is_opb = true; @@ -473,10 +473,10 @@ static u32 msm_vidc_encoder_vpss_size_iris2(struct msm_vidc_inst* inst) } f = &inst->fmts[INPUT_PORT]; - driver_colorfmt = v4l2_colorformat_to_driver( + driver_colorfmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); is_tenbit = is_10bit_colorformat(driver_colorfmt); - if (inst->capabilities->cap[BLUR_TYPES].value != VIDC_BLUR_NONE) + if (inst->capabilities->cap[BLUR_TYPES].value != MSM_VIDC_BLUR_NONE) blur = true; HFI_BUFFER_VPSS_ENC(size, width, height, ds_enable, blur, is_tenbit); diff --git a/driver/variant/iris2/src/msm_vidc_iris2.c b/driver/variant/iris2/src/msm_vidc_iris2.c index 9d348b264c..9661eb900c 100644 --- a/driver/variant/iris2/src/msm_vidc_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_iris2.c @@ -1097,7 +1097,7 @@ int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl) adjusted_value = ctrl ? ctrl->val : capability->cap[BLUR_TYPES].value; - if (adjusted_value == VIDC_BLUR_NONE) + if (adjusted_value == MSM_VIDC_BLUR_NONE) return 0; if (msm_vidc_get_parent_value(inst, BLUR_TYPES, BITRATE_MODE, @@ -1110,16 +1110,16 @@ int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl) &min_quality, __func__)) return -EINVAL; - if (adjusted_value == VIDC_BLUR_EXTERNAL) { + if (adjusted_value == MSM_VIDC_BLUR_EXTERNAL) { if (is_scaling_enabled(inst) || min_quality) { - adjusted_value = VIDC_BLUR_NONE; + adjusted_value = MSM_VIDC_BLUR_NONE; } - } else if (adjusted_value == VIDC_BLUR_ADAPTIVE) { + } else if (adjusted_value == MSM_VIDC_BLUR_ADAPTIVE) { if (is_scaling_enabled(inst) || min_quality || (rc_type != HFI_RC_VBR_CFR) || !cac || is_10bit_colorformat(pix_fmts)) { - adjusted_value = VIDC_BLUR_NONE; + adjusted_value = MSM_VIDC_BLUR_NONE; } } diff --git a/driver/variant/iris3/src/msm_vidc_buffer_iris3.c b/driver/variant/iris3/src/msm_vidc_buffer_iris3.c index 38ce2a15e9..6f844dbd58 100644 --- a/driver/variant/iris3/src/msm_vidc_buffer_iris3.c +++ b/driver/variant/iris3/src/msm_vidc_buffer_iris3.c @@ -173,7 +173,7 @@ static u32 msm_vidc_decoder_line_size_iris3(struct msm_vidc_inst *inst) } num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value; - color_fmt = v4l2_colorformat_to_driver( + color_fmt = v4l2_colorformat_to_driver(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); if (is_linear_colorformat(color_fmt)) is_opb = true; @@ -555,10 +555,10 @@ static u32 msm_vidc_encoder_vpss_size_iris3(struct msm_vidc_inst* inst) } f = &inst->fmts[INPUT_PORT]; - driver_colorfmt = v4l2_colorformat_to_driver( + driver_colorfmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); is_tenbit = is_10bit_colorformat(driver_colorfmt); - if (inst->capabilities->cap[BLUR_TYPES].value != VIDC_BLUR_NONE) + if (inst->capabilities->cap[BLUR_TYPES].value != MSM_VIDC_BLUR_NONE) blur = true; HFI_BUFFER_VPSS_ENC(size, width, height, ds_enable, blur, is_tenbit); @@ -573,6 +573,7 @@ static u32 msm_vidc_encoder_output_size_iris3(struct msm_vidc_inst *inst) bool is_ten_bit = false; int bitrate_mode, frame_rc; u32 hfi_rc_type = HFI_RC_VBR_CFR; + enum msm_vidc_codec_type codec; if (!inst || !inst->capabilities) { d_vpr_e("%s: invalid params\n", __func__); @@ -580,8 +581,8 @@ static u32 msm_vidc_encoder_output_size_iris3(struct msm_vidc_inst *inst) } f = &inst->fmts[OUTPUT_PORT]; - if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC) + codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); + if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC) is_ten_bit = true; bitrate_mode = inst->capabilities->cap[BITRATE_MODE].value; @@ -747,10 +748,7 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst * delivery_mode = inst->capabilities->cap[DELIVERY_MODE].value; if (slice_mode != V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB || - (inst->codec == MSM_VIDC_H264 && - delivery_mode != V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED) || - (inst->codec == MSM_VIDC_HEVC && - delivery_mode != V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED)) + (!delivery_mode)) return count; f = &inst->fmts[OUTPUT_PORT]; diff --git a/driver/vidc/inc/msm_vidc_driver.h b/driver/vidc/inc/msm_vidc_driver.h index 0e9647e31f..ffdfc3cba7 100644 --- a/driver/vidc/inc/msm_vidc_driver.h +++ b/driver/vidc/inc/msm_vidc_driver.h @@ -113,8 +113,8 @@ static inline bool is_meta_rx_inp_enabled(struct msm_vidc_inst *inst, u32 cap) { bool enabled = false; - if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE && - inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_RX_INPUT) + if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE && + inst->capabilities->cap[cap].value & MSM_VIDC_META_RX_INPUT) enabled = true; return enabled; @@ -124,8 +124,8 @@ static inline bool is_meta_rx_out_enabled(struct msm_vidc_inst *inst, u32 cap) { bool enabled = false; - if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE && - inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_RX_OUTPUT) + if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE && + inst->capabilities->cap[cap].value & MSM_VIDC_META_RX_OUTPUT) enabled = true; return enabled; @@ -135,8 +135,8 @@ static inline bool is_meta_tx_inp_enabled(struct msm_vidc_inst *inst, u32 cap) { bool enabled = false; - if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE && - inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_TX_INPUT) + if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE && + inst->capabilities->cap[cap].value & MSM_VIDC_META_TX_INPUT) enabled = true; return enabled; @@ -146,8 +146,8 @@ static inline bool is_meta_tx_out_enabled(struct msm_vidc_inst *inst, u32 cap) { bool enabled = false; - if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE && - inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_TX_OUTPUT) + if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE && + inst->capabilities->cap[cap].value & MSM_VIDC_META_TX_OUTPUT) enabled = true; return enabled; @@ -344,12 +344,7 @@ static inline bool is_enc_slice_delivery_mode(struct msm_vidc_inst *inst) return (inst->capabilities->cap[SLICE_MODE].value == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB && - ((inst->codec == MSM_VIDC_H264 && - inst->capabilities->cap[DELIVERY_MODE].value == - V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED) || - (inst->codec == MSM_VIDC_HEVC && - inst->capabilities->cap[DELIVERY_MODE].value == - V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED))); + inst->capabilities->cap[DELIVERY_MODE].value); } static inline bool is_state(struct msm_vidc_inst *inst, enum msm_vidc_state state) @@ -364,20 +359,20 @@ static inline bool is_sub_state(struct msm_vidc_inst *inst, } const char *cap_name(enum msm_vidc_inst_capability_type cap_id); -const char *v4l2_pixelfmt_name(u32 pixelfmt); +const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixelfmt); const char *v4l2_type_name(u32 port); void print_vidc_buffer(u32 tag, const char *tag_str, const char *str, struct msm_vidc_inst *inst, struct msm_vidc_buffer *vbuf); void print_vb2_buffer(const char *str, struct msm_vidc_inst *inst, struct vb2_buffer *vb2); -enum msm_vidc_codec_type v4l2_codec_to_driver(u32 v4l2_codec, - const char *func); -u32 v4l2_codec_from_driver(enum msm_vidc_codec_type codec, - const char *func); -enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(u32 colorformat, - const char *func); -u32 v4l2_colorformat_from_driver(enum msm_vidc_colorformat_type colorformat, +enum msm_vidc_codec_type v4l2_codec_to_driver(struct msm_vidc_inst *inst, + u32 v4l2_codec, const char *func); +u32 v4l2_codec_from_driver(struct msm_vidc_inst *inst, enum msm_vidc_codec_type codec, const char *func); +enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(struct msm_vidc_inst *inst, + u32 colorformat, const char *func); +u32 v4l2_colorformat_from_driver(struct msm_vidc_inst *inst, + enum msm_vidc_colorformat_type colorformat, const char *func); u32 v4l2_color_primaries_to_driver(struct msm_vidc_inst *inst, u32 v4l2_primaries, const char *func); u32 v4l2_color_primaries_from_driver(struct msm_vidc_inst *inst, diff --git a/driver/vidc/inc/msm_vidc_internal.h b/driver/vidc/inc/msm_vidc_internal.h index c4eeb7a4f0..49c17bd139 100644 --- a/driver/vidc/inc/msm_vidc_internal.h +++ b/driver/vidc/inc/msm_vidc_internal.h @@ -21,6 +21,33 @@ #include #include +/* TODO : remove once available in mainline kernel */ +#ifndef V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10_STILL_PICTURE +#define V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10_STILL_PICTURE (3) +#endif + +enum msm_vidc_blur_types { + MSM_VIDC_BLUR_NONE = 0x0, + MSM_VIDC_BLUR_EXTERNAL = 0x1, + MSM_VIDC_BLUR_ADAPTIVE = 0x2, +}; + +/* various Metadata - encoder & decoder */ +enum msm_vidc_metadata_bits { + MSM_VIDC_META_DISABLE = 0x0, + MSM_VIDC_META_ENABLE = 0x1, + MSM_VIDC_META_TX_INPUT = 0x2, + MSM_VIDC_META_TX_OUTPUT = 0x4, + MSM_VIDC_META_RX_INPUT = 0x8, + MSM_VIDC_META_RX_OUTPUT = 0x10, + MSM_VIDC_META_MAX = 0x20, +}; + +#define MSM_VIDC_METADATA_SIZE (4 * 4096) /* 16 KB */ +#define ENCODE_INPUT_METADATA_SIZE (512 * 4096) /* 2 MB */ +#define DECODE_INPUT_METADATA_SIZE MSM_VIDC_METADATA_SIZE +#define MSM_VIDC_METADATA_DOLBY_RPU_SIZE (41 * 1024) /* 41 KB */ + #define MAX_NAME_LENGTH 128 #define VENUS_VERSION_LENGTH 128 #define MAX_MATRIX_COEFFS 9 @@ -164,6 +191,7 @@ enum msm_vidc_colorformat_type { MSM_VIDC_FMT_P010 = BIT(4), MSM_VIDC_FMT_RGBA8888C = BIT(5), MSM_VIDC_FMT_RGBA8888 = BIT(6), + MSM_VIDC_FMT_META = BIT(31), }; enum msm_vidc_buffer_type { diff --git a/driver/vidc/src/msm_vdec.c b/driver/vidc/src/msm_vdec.c index 717c0ffeec..79832fd283 100644 --- a/driver/vidc/src/msm_vdec.c +++ b/driver/vidc/src/msm_vdec.c @@ -104,10 +104,10 @@ static int msm_vdec_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec) return 0; i_vpr_h(inst, "%s: codec changed from %s to %s\n", - __func__, v4l2_pixelfmt_name(inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat), - v4l2_pixelfmt_name(v4l2_codec)); + __func__, v4l2_pixelfmt_name(inst, inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat), + v4l2_pixelfmt_name(inst, v4l2_codec)); - inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__); + inst->codec = v4l2_codec_to_driver(inst, v4l2_codec, __func__); if (!inst->codec) { i_vpr_e(inst, "%s: invalid codec %#x\n", __func__, v4l2_codec); rc = -EINVAL; @@ -177,7 +177,7 @@ static int msm_vdec_set_linear_stride_scanline(struct msm_vidc_inst *inst) u32 payload[2]; enum msm_vidc_colorformat_type colorformat; - colorformat = v4l2_colorformat_to_driver( + colorformat = v4l2_colorformat_to_driver(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); if (!is_linear_yuv_colorformat(colorformat)) @@ -222,7 +222,7 @@ static int msm_vdec_set_ubwc_stride_scanline(struct msm_vidc_inst *inst) width = f->fmt.pix_mp.width; height = f->fmt.pix_mp.height; - colorformat = v4l2_colorformat_to_driver(pix_fmt, __func__); + colorformat = v4l2_colorformat_to_driver(inst, pix_fmt, __func__); if (inst->codec != MSM_VIDC_AV1 || (!is_ubwc_colorformat(colorformat))) @@ -316,7 +316,7 @@ static int msm_vdec_set_bit_depth(struct msm_vidc_inst *inst, } pix_fmt = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat; - colorformat = v4l2_colorformat_to_driver(pix_fmt, __func__); + colorformat = v4l2_colorformat_to_driver(inst, pix_fmt, __func__); if (is_10bit_colorformat(colorformat)) bitdepth = 10 << 16 | 10; @@ -705,7 +705,7 @@ static int msm_vdec_set_colorformat(struct msm_vidc_inst *inst) u32 hfi_colorformat; pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat; - colorformat = v4l2_colorformat_to_driver(pixelformat, __func__); + colorformat = v4l2_colorformat_to_driver(inst, pixelformat, __func__); hfi_colorformat = get_hfi_colorformat(inst, colorformat); i_vpr_h(inst, "%s: hfi colorformat: %d", __func__, hfi_colorformat); @@ -1277,7 +1277,7 @@ static int msm_vdec_read_input_subcr_params(struct msm_vidc_inst *inst) inst->fmts[INPUT_PORT].fmt.pix_mp.width = width; inst->fmts[INPUT_PORT].fmt.pix_mp.height = height; - output_fmt = v4l2_colorformat_to_driver( + output_fmt = v4l2_colorformat_to_driver(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); inst->fmts[OUTPUT_PORT].fmt.pix_mp.width = video_y_stride_pix( @@ -1376,8 +1376,8 @@ static int msm_vdec_read_input_subcr_params(struct msm_vidc_inst *inst) if (inst->capabilities->cap[CODED_FRAMES].value == CODED_FRAMES_INTERLACE) { msm_vidc_update_cap_value(inst, META_OUTBUF_FENCE, - V4L2_MPEG_VIDC_META_RX_INPUT | - V4L2_MPEG_VIDC_META_DISABLE, __func__); + MSM_VIDC_META_RX_INPUT | + MSM_VIDC_META_DISABLE, __func__); } return 0; @@ -2285,22 +2285,23 @@ int msm_vdec_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); if (f->type == INPUT_MPLANE) { - pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); if (!pix_fmt) { i_vpr_e(inst, "%s: unsupported codec, set current params\n", __func__); f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width; f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height; f->fmt.pix_mp.pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat; - pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); } } else if (f->type == OUTPUT_MPLANE) { - pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); if (!pix_fmt) { i_vpr_e(inst, "%s: unsupported format, set current params\n", __func__); f->fmt.pix_mp.pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat; f->fmt.pix_mp.width = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width; f->fmt.pix_mp.height = inst->fmts[OUTPUT_PORT].fmt.pix_mp.height; - pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_colorformat_to_driver(inst, + f->fmt.pix_mp.pixelformat, __func__); } if (inst->bufq[INPUT_PORT].vb2q->streaming) { f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height; @@ -2418,7 +2419,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) inst->crop.height = f->fmt.pix_mp.height; i_vpr_h(inst, "%s: type: INPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n", - __func__, v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat), + __func__, v4l2_pixelfmt_name(inst, f->fmt.pix_mp.pixelformat), f->fmt.pix_mp.width, f->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.input.min_count, @@ -2426,7 +2427,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } else if (f->type == INPUT_META_PLANE) { fmt = &inst->fmts[INPUT_META_PORT]; fmt->type = INPUT_META_PLANE; - fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + fmt->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); fmt->fmt.meta.buffersize = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_INPUT_META); inst->buffers.input_meta.min_count = @@ -2449,7 +2451,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width; } fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; - colorformat = v4l2_colorformat_to_driver(fmt->fmt.pix_mp.pixelformat, + colorformat = v4l2_colorformat_to_driver(inst, fmt->fmt.pix_mp.pixelformat, __func__); fmt->fmt.pix_mp.width = video_y_stride_pix( colorformat, f->fmt.pix_mp.width); @@ -2487,7 +2489,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } i_vpr_h(inst, "%s: type: OUTPUT, format %s width %d height %d size %u min_count %d extra_count %d\n", - __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + __func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat), fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.output.min_count, @@ -2495,7 +2497,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } else if (f->type == OUTPUT_META_PLANE) { fmt = &inst->fmts[OUTPUT_META_PORT]; fmt->type = OUTPUT_META_PLANE; - fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + fmt->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); fmt->fmt.meta.buffersize = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_OUTPUT_META); inst->buffers.output_meta.min_count = @@ -2673,7 +2676,7 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } if (!array[f->index]) return -EINVAL; - f->pixelformat = v4l2_codec_from_driver(array[f->index], + f->pixelformat = v4l2_codec_from_driver(inst, array[f->index], __func__); if (!f->pixelformat) return -EINVAL; @@ -2696,14 +2699,15 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } if (!array[f->index]) return -EINVAL; - f->pixelformat = v4l2_colorformat_from_driver(array[f->index], + f->pixelformat = v4l2_colorformat_from_driver(inst, array[f->index], __func__); if (!f->pixelformat) return -EINVAL; strlcpy(f->description, "colorformat", sizeof(f->description)); } else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) { if (!f->index) { - f->pixelformat = V4L2_META_FMT_VIDC; + f->pixelformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); strlcpy(f->description, "metadata", sizeof(f->description)); } else { return -EINVAL; @@ -2712,7 +2716,8 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) memset(f->reserved, 0, sizeof(f->reserved)); i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n", - __func__, f->index, f->description, v4l2_pixelfmt_name(f->pixelformat), f->flags); + __func__, f->index, f->description, + v4l2_pixelfmt_name(inst, f->pixelformat), f->flags); return rc; } @@ -2762,7 +2767,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[INPUT_META_PORT]; f->type = INPUT_META_PLANE; - f->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + f->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);; f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE; inst->buffers.input_meta.min_count = 0; inst->buffers.input_meta.extra_count = 0; @@ -2771,8 +2777,9 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[OUTPUT_PORT]; f->type = OUTPUT_MPLANE; - f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VIDC_NV12C; - colorformat = v4l2_colorformat_to_driver( + f->fmt.pix_mp.pixelformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_NV12C, __func__); + colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); f->fmt.pix_mp.width = video_y_stride_pix(colorformat, DEFAULT_WIDTH); f->fmt.pix_mp.height = video_y_scanlines(colorformat, DEFAULT_HEIGHT); @@ -2798,7 +2805,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[OUTPUT_META_PORT]; f->type = OUTPUT_META_PLANE; - f->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + f->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE; inst->buffers.output_meta.min_count = 0; inst->buffers.output_meta.extra_count = 0; diff --git a/driver/vidc/src/msm_venc.c b/driver/vidc/src/msm_venc.c index 88d38207b4..bb487d2119 100644 --- a/driver/vidc/src/msm_venc.c +++ b/driver/vidc/src/msm_venc.c @@ -66,10 +66,10 @@ static int msm_venc_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec) return 0; i_vpr_h(inst, "%s: codec changed from %s to %s\n", - __func__, v4l2_pixelfmt_name(inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat), - v4l2_pixelfmt_name(v4l2_codec)); + __func__, v4l2_pixelfmt_name(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat), + v4l2_pixelfmt_name(inst, v4l2_codec)); - inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__); + inst->codec = v4l2_codec_to_driver(inst, v4l2_codec, __func__); if (!inst->codec) { i_vpr_e(inst, "%s: invalid codec %#x\n", __func__, v4l2_codec); rc = -EINVAL; @@ -120,10 +120,10 @@ static int msm_venc_set_colorformat(struct msm_vidc_inst *inst, } pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat; - colorformat = v4l2_colorformat_to_driver(pixelformat, __func__); + colorformat = v4l2_colorformat_to_driver(inst, pixelformat, __func__); if (!(colorformat & inst->capabilities->cap[PIX_FMTS].step_or_mask)) { i_vpr_e(inst, "%s: invalid pixelformat %s\n", - __func__, v4l2_pixelfmt_name(pixelformat)); + __func__, v4l2_pixelfmt_name(inst, pixelformat)); return -EINVAL; } @@ -324,7 +324,7 @@ static int msm_venc_set_colorspace(struct msm_vidc_inst* inst, } input_fmt = &inst->fmts[INPUT_PORT]; - pix_fmt = v4l2_colorformat_to_driver( + pix_fmt = v4l2_colorformat_to_driver(inst, input_fmt->fmt.pix_mp.pixelformat, __func__); if (inst->fmts[port].fmt.pix_mp.colorspace != V4L2_COLORSPACE_DEFAULT || inst->fmts[port].fmt.pix_mp.ycbcr_enc != V4L2_YCBCR_ENC_DEFAULT || @@ -1039,22 +1039,23 @@ int msm_venc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); if (f->type == INPUT_MPLANE) { - pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); if (!pix_fmt) { i_vpr_e(inst, "%s: unsupported format, set current params\n", __func__); f->fmt.pix_mp.pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat; f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width; f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height; - pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_colorformat_to_driver(inst, + f->fmt.pix_mp.pixelformat, __func__); } } else if (f->type == OUTPUT_MPLANE) { - pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); if (!pix_fmt) { i_vpr_e(inst, "%s: unsupported codec, set current params\n", __func__); f->fmt.pix_mp.width = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width; f->fmt.pix_mp.height = inst->fmts[OUTPUT_PORT].fmt.pix_mp.height; f->fmt.pix_mp.pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat; - pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); } } else if (f->type == INPUT_META_PLANE) { f->fmt.meta.dataformat = inst->fmts[INPUT_META_PORT].fmt.meta.dataformat; @@ -1081,6 +1082,7 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f) struct msm_vidc_core *core; u32 codec_align; u32 width, height; + enum msm_vidc_codec_type codec; if (!inst || !inst->core || !f) { d_vpr_e("%s: invalid params\n", __func__); @@ -1097,8 +1099,10 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f) } fmt->type = OUTPUT_MPLANE; - codec_align = (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC) ? 32 : 16; + codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); + + codec_align = (codec == MSM_VIDC_HEVC || + codec == MSM_VIDC_HEIC) ? 32 : 16; /* use rotated width height if rotation is enabled */ width = inst->compose.width; height = inst->compose.height; @@ -1143,7 +1147,7 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f) i_vpr_h(inst, "%s: type: OUTPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n", - __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + __func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat), fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.output.min_count, @@ -1168,7 +1172,8 @@ static int msm_venc_s_fmt_output_meta(struct msm_vidc_inst *inst, struct v4l2_fo fmt = &inst->fmts[OUTPUT_META_PORT]; fmt->type = OUTPUT_META_PLANE; - fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + fmt->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); fmt->fmt.meta.buffersize = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_OUTPUT_META); inst->buffers.output_meta.min_count = @@ -1203,7 +1208,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format * core = inst->core; msm_venc_try_fmt(inst, f); - pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); + pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); msm_vidc_update_cap_value(inst, PIX_FMTS, pix_fmt, __func__); width = f->fmt.pix_mp.width; @@ -1283,7 +1288,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format * i_vpr_h(inst, "%s: type: INPUT, format %s width %d height %d size %u min_count %d extra_count %d\n", - __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + __func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat), fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.input.min_count, @@ -1309,7 +1314,8 @@ static int msm_venc_s_fmt_input_meta(struct msm_vidc_inst *inst, struct v4l2_for fmt = &inst->fmts[INPUT_META_PORT]; fmt->type = INPUT_META_PLANE; - fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + fmt->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); fmt->fmt.meta.buffersize = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_INPUT_META); inst->buffers.input_meta.min_count = @@ -1742,7 +1748,7 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } if (!array[f->index]) return -EINVAL; - f->pixelformat = v4l2_codec_from_driver(array[f->index], + f->pixelformat = v4l2_codec_from_driver(inst, array[f->index], __func__); if (!f->pixelformat) return -EINVAL; @@ -1762,14 +1768,15 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } if (!array[f->index]) return -EINVAL; - f->pixelformat = v4l2_colorformat_from_driver(array[f->index], + f->pixelformat = v4l2_colorformat_from_driver(inst, array[f->index], __func__); if (!f->pixelformat) return -EINVAL; strlcpy(f->description, "colorformat", sizeof(f->description)); } else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) { if (!f->index) { - f->pixelformat = V4L2_META_FMT_VIDC; + f->pixelformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); strlcpy(f->description, "metadata", sizeof(f->description)); } else { return -EINVAL; @@ -1779,7 +1786,7 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n", __func__, f->index, f->description, - v4l2_pixelfmt_name(f->pixelformat), f->flags); + v4l2_pixelfmt_name(inst, f->pixelformat), f->flags); return rc; } @@ -1834,7 +1841,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[OUTPUT_META_PORT]; f->type = OUTPUT_META_PLANE; - f->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + f->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE; inst->buffers.output_meta.min_count = 0; inst->buffers.output_meta.extra_count = 0; @@ -1843,11 +1851,12 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[INPUT_PORT]; f->type = INPUT_MPLANE; - f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VIDC_NV12C; + f->fmt.pix_mp.pixelformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_NV12C, __func__); f->fmt.pix_mp.width = DEFAULT_WIDTH; f->fmt.pix_mp.height = DEFAULT_HEIGHT; f->fmt.pix_mp.num_planes = 1; - colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, + colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); f->fmt.pix_mp.plane_fmt[0].bytesperline = video_y_stride_bytes(colorformat, DEFAULT_WIDTH); @@ -1869,7 +1878,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) f = &inst->fmts[INPUT_META_PORT]; f->type = INPUT_META_PLANE; - f->fmt.meta.dataformat = V4L2_META_FMT_VIDC; + f->fmt.meta.dataformat = + v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE; inst->buffers.input_meta.min_count = 0; inst->buffers.input_meta.extra_count = 0; diff --git a/driver/vidc/src/msm_vidc.c b/driver/vidc/src/msm_vidc.c index 08286853c9..70c2aa449a 100644 --- a/driver/vidc/src/msm_vidc.c +++ b/driver/vidc/src/msm_vidc.c @@ -287,7 +287,7 @@ int msm_vidc_g_fmt(void *instance, struct v4l2_format *f) if (f->type == INPUT_MPLANE || f->type == OUTPUT_MPLANE) i_vpr_h(inst, "%s: type %s format %s width %d height %d size %d\n", __func__, v4l2_type_name(f->type), - v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat), + v4l2_pixelfmt_name(inst, f->fmt.pix_mp.pixelformat), f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.plane_fmt[0].sizeimage); else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) @@ -684,6 +684,7 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize) struct msm_vidc_inst_capability *capability; enum msm_vidc_colorformat_type colorfmt; enum msm_vidc_codec_type codec; + u32 meta_fmt; if (!inst || !fsize) { d_vpr_e("%s: invalid params: %pK %pK\n", @@ -700,11 +701,13 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize) if (fsize->index) return -EINVAL; - if (fsize->pixel_format != V4L2_META_FMT_VIDC) { + meta_fmt = v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); + if (fsize->pixel_format != meta_fmt) { /* validate pixel format */ - codec = v4l2_codec_to_driver(fsize->pixel_format, __func__); + codec = v4l2_codec_to_driver(inst, fsize->pixel_format, __func__); if (!codec) { - colorfmt = v4l2_colorformat_to_driver(fsize->pixel_format, __func__); + colorfmt = v4l2_colorformat_to_driver(inst, fsize->pixel_format, + __func__); if (colorfmt == MSM_VIDC_FMT_NONE) { i_vpr_e(inst, "%s: unsupported pix fmt %#x\n", __func__, fsize->pixel_format); @@ -734,6 +737,7 @@ int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival) struct msm_vidc_inst_capability *capability; enum msm_vidc_colorformat_type colorfmt; u32 fps, mbpf; + u32 meta_fmt; if (!inst || !fival) { d_vpr_e("%s: invalid params: %pK %pK\n", @@ -758,9 +762,10 @@ int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival) if (fival->index) return -EINVAL; - if (fival->pixel_format != V4L2_META_FMT_VIDC) { + meta_fmt = v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__); + if (fival->pixel_format != meta_fmt) { /* validate pixel format */ - colorfmt = v4l2_colorformat_to_driver(fival->pixel_format, __func__); + colorfmt = v4l2_colorformat_to_driver(inst, fival->pixel_format, __func__); if (colorfmt == MSM_VIDC_FMT_NONE) { i_vpr_e(inst, "%s: unsupported pix fmt %#x\n", __func__, fival->pixel_format); diff --git a/driver/vidc/src/msm_vidc_buffer.c b/driver/vidc/src/msm_vidc_buffer.c index 0aac6a755e..0dad518fcc 100644 --- a/driver/vidc/src/msm_vidc_buffer.c +++ b/driver/vidc/src/msm_vidc_buffer.c @@ -207,6 +207,7 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst) u32 base_res_mbs = NUM_MBS_4k; struct v4l2_format *f; u32 bitstream_size_overwrite = 0; + enum msm_vidc_codec_type codec; if (!inst || !inst->capabilities) { d_vpr_e("%s: invalid params\n", __func__); @@ -230,13 +231,14 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst) * 4k mbs for VP8/VP9 and 4k / 2 for remaining codecs. */ f = &inst->fmts[INPUT_PORT]; + codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); num_mbs = msm_vidc_get_mbs_per_frame(inst); if (num_mbs > NUM_MBS_4k) { div_factor = 4; base_res_mbs = inst->capabilities->cap[MBPF].value; } else { base_res_mbs = NUM_MBS_4k; - if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) + if (codec == MSM_VIDC_VP9) div_factor = 1; else div_factor = 2; @@ -254,10 +256,8 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst) frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor; /* multiply by 10/8 (1.25) to get size for 10 bit case */ - if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9 || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_AV1 || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC) + if (codec == MSM_VIDC_VP9 || codec == MSM_VIDC_AV1 || + codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC) frame_size = frame_size + (frame_size >> 2); i_vpr_h(inst, "set input buffer size to %d\n", frame_size); @@ -272,7 +272,7 @@ u32 msm_vidc_decoder_output_size(struct msm_vidc_inst *inst) enum msm_vidc_colorformat_type colorformat; f = &inst->fmts[OUTPUT_PORT]; - colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, + colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); size = video_buffer_size(colorformat, f->fmt.pix_mp.width, f->fmt.pix_mp.height, true); @@ -304,7 +304,7 @@ u32 msm_vidc_encoder_input_size(struct msm_vidc_inst *inst) f = &inst->fmts[INPUT_PORT]; width = f->fmt.pix_mp.width; height = f->fmt.pix_mp.height; - colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, + colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); if (is_image_session(inst)) { width = ALIGN(width, HEIC_GRID_DIMENSION); @@ -360,6 +360,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst) u32 mbs_per_frame; u32 width, height; struct v4l2_format *f; + enum msm_vidc_codec_type codec; if (!inst || !inst->capabilities) { d_vpr_e("%s: invalid params\n", __func__); @@ -367,6 +368,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst) } f = &inst->fmts[OUTPUT_PORT]; + codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__); /* * Encoder output size calculation: 32 Align width/height * For heic session : YUVsize * 2 @@ -402,8 +404,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst) skip_calc: /* multiply by 10/8 (1.25) to get size for 10 bit case */ - if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC || - f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC) + if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC) frame_size = frame_size + (frame_size >> 2); frame_size = ALIGN(frame_size, SZ_4K); diff --git a/driver/vidc/src/msm_vidc_control.c b/driver/vidc/src/msm_vidc_control.c index 49f0363655..86ec7c7ebb 100644 --- a/driver/vidc/src/msm_vidc_control.c +++ b/driver/vidc/src/msm_vidc_control.c @@ -152,12 +152,6 @@ static const char *const mpeg_video_vidc_ir_type[] = { NULL, }; -static const char *const mpeg_vidc_delivery_modes[] = { - "Frame Based Delivery Mode", - "Slice Based Delivery Mode", - NULL, -}; - u32 msm_vidc_get_port_info(struct msm_vidc_inst *inst, enum msm_vidc_inst_capability_type cap_id) { @@ -201,10 +195,6 @@ static const char * const * msm_vidc_get_qmenu_type( return av1_tier; case V4L2_CID_MPEG_VIDEO_VIDC_INTRA_REFRESH_TYPE: return mpeg_video_vidc_ir_type; - case V4L2_CID_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE: - return mpeg_vidc_delivery_modes; - case V4L2_CID_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE: - return mpeg_vidc_delivery_modes; default: i_vpr_e(inst, "%s: No available qmenu for ctrl %#x\n", __func__, control_id); @@ -468,7 +458,7 @@ int msm_vidc_update_cap_value(struct msm_vidc_inst *inst, u32 cap_id, * cumulative control value if client set same metadata * control multiple times. */ - if (adjusted_val & V4L2_MPEG_VIDC_META_ENABLE) { + if (adjusted_val & MSM_VIDC_META_ENABLE) { /* enable metadata */ inst->capabilities->cap[cap_id].value |= adjusted_val; } else { @@ -1621,7 +1611,7 @@ int msm_vidc_adjust_transform_8x8(void *instance, struct v4l2_ctrl *ctrl) if (profile != V4L2_MPEG_VIDEO_H264_PROFILE_HIGH && profile != V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH) - adjusted_value = V4L2_MPEG_MSM_VIDC_DISABLE; + adjusted_value = 0; msm_vidc_update_cap_value(inst, TRANSFORM_8X8, adjusted_value, __func__); @@ -2350,7 +2340,7 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl) adjusted_value = ctrl ? ctrl->val : capability->cap[BLUR_TYPES].value; - if (adjusted_value == VIDC_BLUR_NONE) + if (adjusted_value == MSM_VIDC_BLUR_NONE) return 0; if (msm_vidc_get_parent_value(inst, BLUR_TYPES, BITRATE_MODE, @@ -2363,17 +2353,17 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl) &roi_enable, __func__)) return -EINVAL; - if (adjusted_value == VIDC_BLUR_EXTERNAL) { + if (adjusted_value == MSM_VIDC_BLUR_EXTERNAL) { if (is_scaling_enabled(inst) || min_quality) { - adjusted_value = VIDC_BLUR_NONE; + adjusted_value = MSM_VIDC_BLUR_NONE; } - } else if (adjusted_value == VIDC_BLUR_ADAPTIVE) { + } else if (adjusted_value == MSM_VIDC_BLUR_ADAPTIVE) { if (is_scaling_enabled(inst) || min_quality || (rc_type != HFI_RC_VBR_CFR && rc_type != HFI_RC_CBR_CFR && rc_type != HFI_RC_CBR_VFR) || is_10bit_colorformat(pix_fmts) || roi_enable) { - adjusted_value = VIDC_BLUR_NONE; + adjusted_value = MSM_VIDC_BLUR_NONE; } } @@ -2450,7 +2440,7 @@ int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl) &blur_type, __func__)) return -EINVAL; - if (blur_type != VIDC_BLUR_EXTERNAL) + if (blur_type != MSM_VIDC_BLUR_EXTERNAL) return 0; msm_vidc_update_cap_value(inst, BLUR_RESOLUTION, @@ -2725,7 +2715,7 @@ int msm_vidc_adjust_preprocess(void *instance, struct v4l2_ctrl *ctrl) * BRS enabled and upto 4k @ 60 fps */ if (!is_meta_tx_inp_enabled(inst, META_EVA_STATS) && - brs == V4L2_MPEG_MSM_VIDC_ENABLE && + brs == 1 && res_is_less_than_or_equal_to(width, height, 3840, 2160) && max_fps <= 60) adjusted_value = 1; @@ -2774,7 +2764,7 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl) struct msm_vidc_inst_capability *capability; s32 adjusted_value; struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance; - s32 outbuf_fence = V4L2_MPEG_VIDC_META_DISABLE; + s32 outbuf_fence = MSM_VIDC_META_DISABLE; if (!inst || !inst->capabilities) { d_vpr_e("%s: invalid params\n", __func__); @@ -2790,8 +2780,8 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl) return -EINVAL; /* enable lowlatency if outbuf fence is enabled */ - if (outbuf_fence & V4L2_MPEG_VIDC_META_ENABLE && - outbuf_fence & V4L2_MPEG_VIDC_META_RX_INPUT) + if (outbuf_fence & MSM_VIDC_META_ENABLE && + outbuf_fence & MSM_VIDC_META_RX_INPUT) adjusted_value = 1; msm_vidc_update_cap_value(inst, LOWLATENCY_MODE, @@ -2893,10 +2883,10 @@ int msm_vidc_adjust_dec_outbuf_fence(void *instance, struct v4l2_ctrl *ctrl) &picture_order, __func__)) return -EINVAL; - if (picture_order == V4L2_MPEG_MSM_VIDC_DISABLE) { + if (picture_order == 0) { /* disable outbuf fence */ - adjusted_value = V4L2_MPEG_VIDC_META_DISABLE | - V4L2_MPEG_VIDC_META_RX_INPUT; + adjusted_value = MSM_VIDC_META_DISABLE | + MSM_VIDC_META_RX_INPUT; } msm_vidc_update_cap_value(inst, META_OUTBUF_FENCE, @@ -3982,7 +3972,7 @@ int msm_vidc_set_blur_resolution(void *instance, BLUR_TYPES, &blur_type, __func__)) return -EINVAL; - if (blur_type != VIDC_BLUR_EXTERNAL) + if (blur_type != MSM_VIDC_BLUR_EXTERNAL) return 0; hfi_value = inst->capabilities->cap[cap_id].value; @@ -4336,33 +4326,6 @@ int msm_vidc_v4l2_menu_to_hfi(struct msm_vidc_inst *inst, goto set_default; } return 0; - case DELIVERY_MODE: - if (inst->codec == MSM_VIDC_H264) { - switch (capability->cap[cap_id].value) { - case V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_FRAME_BASED: - *value = 0; - break; - case V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED: - *value = 1; - break; - default: - *value = 0; - goto set_default; - } - } else if (inst->codec == MSM_VIDC_HEVC) { - switch (capability->cap[cap_id].value) { - case V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_FRAME_BASED: - *value = 0; - break; - case V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED: - *value = 1; - break; - default: - *value = 0; - goto set_default; - } - } - return 0; default: i_vpr_e(inst, "%s: mapping not specified for ctrl_id: %#x\n", diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index c03c007bd5..164d10e636 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -400,27 +400,40 @@ const char *v4l2_type_name(u32 port) return "UNKNOWN"; } -const char *v4l2_pixelfmt_name(u32 pixfmt) +const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixfmt) { - switch (pixfmt) { - /* raw port: color format */ - case V4L2_PIX_FMT_NV12: return "NV12"; - case V4L2_PIX_FMT_NV21: return "NV21"; - case V4L2_PIX_FMT_VIDC_NV12C: return "NV12C"; - case V4L2_PIX_FMT_VIDC_P010: return "P010"; - case V4L2_PIX_FMT_VIDC_TP10C: return "TP10C"; - case V4L2_PIX_FMT_RGBA32: return "RGBA"; - case V4L2_PIX_FMT_VIDC_ARGB32C: return "RGBAC"; - /* bitstream port: codec type */ - case V4L2_PIX_FMT_H264: return "AVC"; - case V4L2_PIX_FMT_HEVC: return "HEVC"; - case V4L2_PIX_FMT_HEIC: return "HEIC"; - case V4L2_PIX_FMT_VP9: return "VP9"; - case V4L2_PIX_FMT_AV1: return "AV1"; - /* meta port */ - case V4L2_META_FMT_VIDC: return "META"; + struct msm_vidc_core *core; + const struct codec_info *codec_info; + const struct color_format_info *color_format_info; + u32 i, size; + + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + goto exit; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + goto exit; + } + codec_info = core->platform->data.format_data->codec_info; + size = core->platform->data.format_data->codec_info_size; + + for (i = 0; i < size; i++) { + if (codec_info[i].v4l2_codec == pixfmt) + return codec_info[i].pixfmt_name; + } + + color_format_info = core->platform->data.format_data->color_format_info; + size = core->platform->data.format_data->color_format_info_size; + + for (i = 0; i < size; i++) { + if (color_format_info[i].v4l2_color_format == pixfmt) + return color_format_info[i].pixfmt_name; + } + +exit: return "UNKNOWN"; } @@ -696,423 +709,317 @@ u32 v4l2_type_from_driver(enum msm_vidc_buffer_type buffer_type, return type; } -enum msm_vidc_codec_type v4l2_codec_to_driver(u32 v4l2_codec, const char *func) +enum msm_vidc_codec_type v4l2_codec_to_driver(struct msm_vidc_inst *inst, + u32 v4l2_codec, const char *func) { + struct msm_vidc_core *core; + const struct codec_info *codec_info; + u32 i, size; enum msm_vidc_codec_type codec = 0; - switch (v4l2_codec) { - case V4L2_PIX_FMT_H264: - codec = MSM_VIDC_H264; - break; - case V4L2_PIX_FMT_HEVC: - codec = MSM_VIDC_HEVC; - break; - case V4L2_PIX_FMT_VP9: - codec = MSM_VIDC_VP9; - break; - case V4L2_PIX_FMT_AV1: - codec = MSM_VIDC_AV1; - break; - case V4L2_PIX_FMT_HEIC: - codec = MSM_VIDC_HEIC; - break; - default: - d_vpr_h("%s: invalid v4l2 codec %#x\n", func, v4l2_codec); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + codec_info = core->platform->data.format_data->codec_info; + size = core->platform->data.format_data->codec_info_size; + + for (i = 0; i < size; i++) { + if (codec_info[i].v4l2_codec == v4l2_codec) + return codec_info[i].vidc_codec; + } + + d_vpr_h("%s: invalid v4l2 codec %#x\n", func, v4l2_codec); return codec; } -u32 v4l2_codec_from_driver(enum msm_vidc_codec_type codec, const char *func) +u32 v4l2_codec_from_driver(struct msm_vidc_inst *inst, + enum msm_vidc_codec_type codec, const char *func) { + struct msm_vidc_core *core; + const struct codec_info *codec_info; + u32 i, size; u32 v4l2_codec = 0; - switch (codec) { - case MSM_VIDC_H264: - v4l2_codec = V4L2_PIX_FMT_H264; - break; - case MSM_VIDC_HEVC: - v4l2_codec = V4L2_PIX_FMT_HEVC; - break; - case MSM_VIDC_VP9: - v4l2_codec = V4L2_PIX_FMT_VP9; - break; - case MSM_VIDC_AV1: - v4l2_codec = V4L2_PIX_FMT_AV1; - break; - case MSM_VIDC_HEIC: - v4l2_codec = V4L2_PIX_FMT_HEIC; - break; - default: - d_vpr_e("%s: invalid driver codec %#x\n", func, codec); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + codec_info = core->platform->data.format_data->codec_info; + size = core->platform->data.format_data->codec_info_size; + + for (i = 0; i < size; i++) { + if (codec_info[i].vidc_codec == codec) + return codec_info[i].v4l2_codec; + } + + d_vpr_e("%s: invalid driver codec %#x\n", func, codec); return v4l2_codec; } -enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(u32 v4l2_colorformat, - const char *func) +enum msm_vidc_colorformat_type v4l2_colorformat_to_driver( + struct msm_vidc_inst *inst, + u32 v4l2_colorformat, const char *func) { + struct msm_vidc_core *core; + const struct color_format_info *color_format_info; + u32 i, size; enum msm_vidc_colorformat_type colorformat = 0; - switch (v4l2_colorformat) { - case V4L2_PIX_FMT_NV12: - colorformat = MSM_VIDC_FMT_NV12; - break; - case V4L2_PIX_FMT_NV21: - colorformat = MSM_VIDC_FMT_NV21; - break; - case V4L2_PIX_FMT_VIDC_NV12C: - colorformat = MSM_VIDC_FMT_NV12C; - break; - case V4L2_PIX_FMT_VIDC_TP10C: - colorformat = MSM_VIDC_FMT_TP10C; - break; - case V4L2_PIX_FMT_RGBA32: - colorformat = MSM_VIDC_FMT_RGBA8888; - break; - case V4L2_PIX_FMT_VIDC_ARGB32C: - colorformat = MSM_VIDC_FMT_RGBA8888C; - break; - case V4L2_PIX_FMT_VIDC_P010: - colorformat = MSM_VIDC_FMT_P010; - break; - default: - d_vpr_e("%s: invalid v4l2 color format %#x\n", - func, v4l2_colorformat); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + color_format_info = core->platform->data.format_data->color_format_info; + size = core->platform->data.format_data->color_format_info_size; + + for (i = 0; i < size; i++) { + if (color_format_info[i].v4l2_color_format == v4l2_colorformat) + return color_format_info[i].vidc_color_format; + } + + d_vpr_e("%s: invalid v4l2 color format %#x\n", func, v4l2_colorformat); return colorformat; } -u32 v4l2_colorformat_from_driver(enum msm_vidc_colorformat_type colorformat, +u32 v4l2_colorformat_from_driver(struct msm_vidc_inst *inst, + enum msm_vidc_colorformat_type colorformat, const char *func) { + struct msm_vidc_core *core; + const struct color_format_info *color_format_info; + u32 i, size; u32 v4l2_colorformat = 0; - switch (colorformat) { - case MSM_VIDC_FMT_NV12: - v4l2_colorformat = V4L2_PIX_FMT_NV12; - break; - case MSM_VIDC_FMT_NV21: - v4l2_colorformat = V4L2_PIX_FMT_NV21; - break; - case MSM_VIDC_FMT_NV12C: - v4l2_colorformat = V4L2_PIX_FMT_VIDC_NV12C; - break; - case MSM_VIDC_FMT_TP10C: - v4l2_colorformat = V4L2_PIX_FMT_VIDC_TP10C; - break; - case MSM_VIDC_FMT_RGBA8888: - v4l2_colorformat = V4L2_PIX_FMT_RGBA32; - break; - case MSM_VIDC_FMT_RGBA8888C: - v4l2_colorformat = V4L2_PIX_FMT_VIDC_ARGB32C; - break; - case MSM_VIDC_FMT_P010: - v4l2_colorformat = V4L2_PIX_FMT_VIDC_P010; - break; - default: - d_vpr_e("%s: invalid driver color format %#x\n", - func, colorformat); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + color_format_info = core->platform->data.format_data->color_format_info; + size = core->platform->data.format_data->color_format_info_size; + + for (i = 0; i < size; i++) { + if (color_format_info[i].vidc_color_format == colorformat) + return color_format_info[i].v4l2_color_format; + } + + d_vpr_e("%s: invalid driver color format %#x\n", func, colorformat); return v4l2_colorformat; } u32 v4l2_color_primaries_to_driver(struct msm_vidc_inst *inst, u32 v4l2_primaries, const char *func) { + struct msm_vidc_core *core; + const struct color_primaries_info *color_prim_info; + u32 i, size; u32 vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED; - switch(v4l2_primaries) { - case V4L2_COLORSPACE_DEFAULT: - vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED; - break; - case V4L2_COLORSPACE_REC709: - vidc_color_primaries = MSM_VIDC_PRIMARIES_BT709; - break; - case V4L2_COLORSPACE_470_SYSTEM_M: - vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_M; - break; - case V4L2_COLORSPACE_470_SYSTEM_BG: - vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG; - break; - case V4L2_COLORSPACE_SMPTE170M: - vidc_color_primaries = MSM_VIDC_PRIMARIES_BT601_525; - break; - case V4L2_COLORSPACE_SMPTE240M: - vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_ST240M; - break; - case V4L2_COLORSPACE_VIDC_GENERIC_FILM: - vidc_color_primaries = MSM_VIDC_PRIMARIES_GENERIC_FILM; - break; - case V4L2_COLORSPACE_BT2020: - vidc_color_primaries = MSM_VIDC_PRIMARIES_BT2020; - break; - case V4L2_COLORSPACE_DCI_P3: - vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_RP431_2; - break; - case V4L2_COLORSPACE_VIDC_EG431: - vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EG431_1; - break; - case V4L2_COLORSPACE_VIDC_EBU_TECH: - vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EBU_TECH; - break; - default: - i_vpr_e(inst, "%s: invalid v4l2 color primaries %d\n", - func, v4l2_primaries); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + color_prim_info = core->platform->data.format_data->color_prim_info; + size = core->platform->data.format_data->color_prim_info_size; + + for (i = 0; i < size; i++) { + if (color_prim_info[i].v4l2_color_primaries == v4l2_primaries) + return color_prim_info[i].vidc_color_primaries; + } + + i_vpr_e(inst, "%s: invalid v4l2 color primaries %d\n", + func, v4l2_primaries); + return vidc_color_primaries; } u32 v4l2_color_primaries_from_driver(struct msm_vidc_inst *inst, u32 vidc_color_primaries, const char *func) { + struct msm_vidc_core *core; + const struct color_primaries_info *color_prim_info; + u32 i, size; u32 v4l2_primaries = V4L2_COLORSPACE_DEFAULT; - switch(vidc_color_primaries) { - case MSM_VIDC_PRIMARIES_UNSPECIFIED: - v4l2_primaries = V4L2_COLORSPACE_DEFAULT; - break; - case MSM_VIDC_PRIMARIES_BT709: - v4l2_primaries = V4L2_COLORSPACE_REC709; - break; - case MSM_VIDC_PRIMARIES_BT470_SYSTEM_M: - v4l2_primaries = V4L2_COLORSPACE_470_SYSTEM_M; - break; - case MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG: - v4l2_primaries = V4L2_COLORSPACE_470_SYSTEM_BG; - break; - case MSM_VIDC_PRIMARIES_BT601_525: - v4l2_primaries = V4L2_COLORSPACE_SMPTE170M; - break; - case MSM_VIDC_PRIMARIES_SMPTE_ST240M: - v4l2_primaries = V4L2_COLORSPACE_SMPTE240M; - break; - case MSM_VIDC_PRIMARIES_GENERIC_FILM: - v4l2_primaries = V4L2_COLORSPACE_VIDC_GENERIC_FILM; - break; - case MSM_VIDC_PRIMARIES_BT2020: - v4l2_primaries = V4L2_COLORSPACE_BT2020; - break; - case MSM_VIDC_PRIMARIES_SMPTE_RP431_2: - v4l2_primaries = V4L2_COLORSPACE_DCI_P3; - break; - case MSM_VIDC_PRIMARIES_SMPTE_EG431_1: - v4l2_primaries = V4L2_COLORSPACE_VIDC_EG431; - break; - case MSM_VIDC_PRIMARIES_SMPTE_EBU_TECH: - v4l2_primaries = V4L2_COLORSPACE_VIDC_EBU_TECH; - break; - default: - i_vpr_e(inst, "%s: invalid hfi color primaries %d\n", - func, vidc_color_primaries); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + color_prim_info = core->platform->data.format_data->color_prim_info; + size = core->platform->data.format_data->color_prim_info_size; + + for (i = 0; i < size; i++) { + if (color_prim_info[i].vidc_color_primaries == vidc_color_primaries) + return color_prim_info[i].v4l2_color_primaries; + } + + i_vpr_e(inst, "%s: invalid hfi color primaries %d\n", + func, vidc_color_primaries); + return v4l2_primaries; } u32 v4l2_transfer_char_to_driver(struct msm_vidc_inst *inst, u32 v4l2_transfer_char, const char *func) { + struct msm_vidc_core *core; + const struct transfer_char_info *transfer_char_info; + u32 i, size; u32 vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED; - switch(v4l2_transfer_char) { - case V4L2_XFER_FUNC_DEFAULT: - vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED; - break; - case V4L2_XFER_FUNC_709: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT709; - break; - case V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_M: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_M; - break; - case V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_BG: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_BG; - break; - case V4L2_XFER_FUNC_VIDC_BT601_525_OR_625: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT601_525_OR_625; - break; - case V4L2_XFER_FUNC_SMPTE240M: - vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST240M; - break; - case V4L2_XFER_FUNC_VIDC_LINEAR: - vidc_transfer_char = MSM_VIDC_TRANSFER_LINEAR; - break; - case V4L2_XFER_FUNC_VIDC_XVYCC: - vidc_transfer_char = MSM_VIDC_TRANSFER_XVYCC; - break; - case V4L2_XFER_FUNC_VIDC_BT1361: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT1361_0; - break; - case V4L2_XFER_FUNC_SRGB: - vidc_transfer_char = MSM_VIDC_TRANSFER_SRGB_SYCC; - break; - case V4L2_XFER_FUNC_VIDC_BT2020: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT2020_14; - break; - case V4L2_XFER_FUNC_SMPTE2084: - vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ; - break; - case V4L2_XFER_FUNC_VIDC_ST428: - vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST428_1; - break; - case V4L2_XFER_FUNC_VIDC_HLG: - vidc_transfer_char = MSM_VIDC_TRANSFER_BT2100_2_HLG; - break; - default: - i_vpr_e(inst, "%s: invalid v4l2 transfer char %d\n", - func, v4l2_transfer_char); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + transfer_char_info = core->platform->data.format_data->transfer_char_info; + size = core->platform->data.format_data->transfer_char_info_size; + + for (i = 0; i < size; i++) { + if (transfer_char_info[i].v4l2_transfer_char == v4l2_transfer_char) + return transfer_char_info[i].vidc_transfer_char; + } + + i_vpr_e(inst, "%s: invalid v4l2 transfer char %d\n", + func, v4l2_transfer_char); + return vidc_transfer_char; } u32 v4l2_transfer_char_from_driver(struct msm_vidc_inst *inst, u32 vidc_transfer_char, const char *func) { + struct msm_vidc_core *core; + const struct transfer_char_info *transfer_char_info; + u32 i, size; u32 v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT; - switch(vidc_transfer_char) { - case MSM_VIDC_TRANSFER_UNSPECIFIED: - v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT; - break; - case MSM_VIDC_TRANSFER_BT709: - v4l2_transfer_char = V4L2_XFER_FUNC_709; - break; - case MSM_VIDC_TRANSFER_BT470_SYSTEM_M: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_M; - break; - case MSM_VIDC_TRANSFER_BT470_SYSTEM_BG: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_BG; - break; - case MSM_VIDC_TRANSFER_BT601_525_OR_625: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT601_525_OR_625; - break; - case MSM_VIDC_TRANSFER_SMPTE_ST240M: - v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE240M; - break; - case MSM_VIDC_TRANSFER_LINEAR: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_LINEAR; - break; - case MSM_VIDC_TRANSFER_XVYCC: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_XVYCC; - break; - case MSM_VIDC_TRANSFER_BT1361_0: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT1361; - break; - case MSM_VIDC_TRANSFER_SRGB_SYCC: - v4l2_transfer_char = V4L2_XFER_FUNC_SRGB; - break; - case MSM_VIDC_TRANSFER_BT2020_14: - case MSM_VIDC_TRANSFER_BT2020_15: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT2020; - break; - case MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ: - v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE2084; - break; - case MSM_VIDC_TRANSFER_SMPTE_ST428_1: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_ST428; - break; - case MSM_VIDC_TRANSFER_BT2100_2_HLG: - v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_HLG; - break; - default: - i_vpr_e(inst, "%s: invalid hfi transfer char %d\n", - func, vidc_transfer_char); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + transfer_char_info = core->platform->data.format_data->transfer_char_info; + size = core->platform->data.format_data->transfer_char_info_size; + + for (i = 0; i < size; i++) { + if (transfer_char_info[i].vidc_transfer_char == vidc_transfer_char) + return transfer_char_info[i].v4l2_transfer_char; + } + + i_vpr_e(inst, "%s: invalid hfi transfer char %d\n", + func, vidc_transfer_char); + return v4l2_transfer_char; } u32 v4l2_matrix_coeff_to_driver(struct msm_vidc_inst *inst, u32 v4l2_matrix_coeff, const char *func) { + struct msm_vidc_core *core; + const struct matrix_coeff_info *matrix_coeff_info; + u32 i, size; u32 vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED; - switch(v4l2_matrix_coeff) { - case V4L2_YCBCR_ENC_DEFAULT: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED; - break; - case V4L2_YCBCR_VIDC_SRGB_OR_SMPTE_ST428: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SRGB_SMPTE_ST428_1; - break; - case V4L2_YCBCR_ENC_709: - case V4L2_YCBCR_ENC_XV709: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709; - break; - case V4L2_YCBCR_VIDC_FCC47_73_682: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_FCC_TITLE_47; - break; - case V4L2_YCBCR_ENC_XV601: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625; - break; - case V4L2_YCBCR_ENC_601: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625; - break; - case V4L2_YCBCR_ENC_SMPTE240M: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SMPTE_ST240; - break; - case V4L2_YCBCR_ENC_BT2020: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT; - break; - case V4L2_YCBCR_ENC_BT2020_CONST_LUM: - vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT; - break; - default: - i_vpr_e(inst, "%s: invalid v4l2 matrix coeff %d\n", - func, v4l2_matrix_coeff); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info; + size = core->platform->data.format_data->matrix_coeff_info_size; + + for (i = 0; i < size; i++) { + if (matrix_coeff_info[i].v4l2_matrix_coeff == v4l2_matrix_coeff) + return matrix_coeff_info[i].vidc_matrix_coeff; + } + + i_vpr_e(inst, "%s: invalid v4l2 matrix coeff %d\n", + func, v4l2_matrix_coeff); + return vidc_matrix_coeff; } u32 v4l2_matrix_coeff_from_driver(struct msm_vidc_inst *inst, u32 vidc_matrix_coeff, const char *func) { + struct msm_vidc_core *core; + const struct matrix_coeff_info *matrix_coeff_info; + u32 i, size; u32 v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT; - switch(vidc_matrix_coeff) { - case MSM_VIDC_MATRIX_COEFF_SRGB_SMPTE_ST428_1: - v4l2_matrix_coeff = V4L2_YCBCR_VIDC_SRGB_OR_SMPTE_ST428; - break; - case MSM_VIDC_MATRIX_COEFF_BT709: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_709; - break; - case MSM_VIDC_MATRIX_COEFF_UNSPECIFIED: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT; - break; - case MSM_VIDC_MATRIX_COEFF_FCC_TITLE_47: - v4l2_matrix_coeff = V4L2_YCBCR_VIDC_FCC47_73_682; - break; - case MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV601; - break; - case MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_601; - break; - case MSM_VIDC_MATRIX_COEFF_SMPTE_ST240: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_SMPTE240M; - break; - case MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020; - break; - case MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT: - v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020_CONST_LUM; - break; - default: - i_vpr_e(inst, "%s: invalid hfi matrix coeff %d\n", - func, vidc_matrix_coeff); - break; + if (!inst || !inst->core) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; } + core = inst->core; + if (!core->platform || !core->platform->data.format_data) { + d_vpr_e("%s: invalid core platform\n", __func__); + return -EINVAL; + } + matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info; + size = core->platform->data.format_data->matrix_coeff_info_size; + + for (i = 0; i < size; i++) { + if (matrix_coeff_info[i].v4l2_matrix_coeff == v4l2_matrix_coeff) + return matrix_coeff_info[i].vidc_matrix_coeff; + } + + i_vpr_e(inst, "%s: invalid hfi matrix coeff %d\n", + func, vidc_matrix_coeff); + return v4l2_matrix_coeff; } diff --git a/driver/vidc/src/msm_vidc_power.c b/driver/vidc/src/msm_vidc_power.c index f9ee45f540..9ed55d4e7b 100644 --- a/driver/vidc/src/msm_vidc_power.c +++ b/driver/vidc/src/msm_vidc_power.c @@ -250,7 +250,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst) vote_data->bitrate = (vote_data->bitrate / frame_rate) * operating_rate; vote_data->num_formats = 1; - vote_data->color_formats[0] = v4l2_colorformat_to_driver( + vote_data->color_formats[0] = v4l2_colorformat_to_driver(inst, inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat, __func__); vote_data->vpss_preprocessing_enabled = inst->capabilities->cap[REQUEST_PREPROCESS].value; @@ -259,7 +259,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst) vote_data->domain = MSM_VIDC_DECODER; vote_data->bitrate = inst->max_input_data_size * vote_data->fps * 8; - color_format = v4l2_colorformat_to_driver( + color_format = v4l2_colorformat_to_driver(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); if (is_linear_colorformat(color_format)) { vote_data->num_formats = 2;