Merge "video: driver: add all intra encoding support"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
b1c38f2133
@@ -70,6 +70,7 @@ static struct msm_platform_core_capability core_data_waipio[] = {
|
|||||||
{MAX_MBPS_HQ, 489600}, /* ((1920x1088)/256)@60fps */
|
{MAX_MBPS_HQ, 489600}, /* ((1920x1088)/256)@60fps */
|
||||||
{MAX_MBPF_B_FRAME, 32640}, /* 3840x2176/256 */
|
{MAX_MBPF_B_FRAME, 32640}, /* 3840x2176/256 */
|
||||||
{MAX_MBPS_B_FRAME, 1958400}, /* 3840x2176/256 MBs@60fps */
|
{MAX_MBPS_B_FRAME, 1958400}, /* 3840x2176/256 MBs@60fps */
|
||||||
|
{MAX_MBPS_ALL_INTRA, 1958400}, /* 3840x2176/256 MBs@60fps */
|
||||||
{MAX_ENH_LAYER_COUNT, 5},
|
{MAX_ENH_LAYER_COUNT, 5},
|
||||||
{NUM_VPP_PIPE, 4},
|
{NUM_VPP_PIPE, 4},
|
||||||
{SW_PC, 1},
|
{SW_PC, 1},
|
||||||
@@ -441,7 +442,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
||||||
CAP_FLAG_DYNAMIC_ALLOWED,
|
CAP_FLAG_DYNAMIC_ALLOWED,
|
||||||
{ENH_LAYER_COUNT},
|
{ENH_LAYER_COUNT},
|
||||||
{0},
|
{ALL_INTRA},
|
||||||
msm_vidc_adjust_gop_size, msm_vidc_set_gop_size},
|
msm_vidc_adjust_gop_size, msm_vidc_set_gop_size},
|
||||||
|
|
||||||
{GOP_CLOSURE, ENC, H264|HEVC,
|
{GOP_CLOSURE, ENC, H264|HEVC,
|
||||||
@@ -456,7 +457,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
HFI_PROP_MAX_B_FRAMES,
|
HFI_PROP_MAX_B_FRAMES,
|
||||||
CAP_FLAG_OUTPUT_PORT,
|
CAP_FLAG_OUTPUT_PORT,
|
||||||
{ENH_LAYER_COUNT},
|
{ENH_LAYER_COUNT},
|
||||||
{0},
|
{ALL_INTRA},
|
||||||
msm_vidc_adjust_b_frame, msm_vidc_set_u32},
|
msm_vidc_adjust_b_frame, msm_vidc_set_u32},
|
||||||
|
|
||||||
{BLUR_TYPES, ENC, CODECS_ALL,
|
{BLUR_TYPES, ENC, CODECS_ALL,
|
||||||
@@ -526,7 +527,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
V4L2_CID_MPEG_VIDEO_LTR_COUNT,
|
V4L2_CID_MPEG_VIDEO_LTR_COUNT,
|
||||||
HFI_PROP_LTR_COUNT,
|
HFI_PROP_LTR_COUNT,
|
||||||
CAP_FLAG_OUTPUT_PORT,
|
CAP_FLAG_OUTPUT_PORT,
|
||||||
{BITRATE_MODE}, {0},
|
{BITRATE_MODE, ALL_INTRA}, {0},
|
||||||
msm_vidc_adjust_ltr_count, msm_vidc_set_u32},
|
msm_vidc_adjust_ltr_count, msm_vidc_set_u32},
|
||||||
|
|
||||||
{USE_LTR, ENC, H264|HEVC,
|
{USE_LTR, ENC, H264|HEVC,
|
||||||
@@ -560,7 +561,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
V4L2_CID_MPEG_VIDC_INTRA_REFRESH_PERIOD,
|
V4L2_CID_MPEG_VIDC_INTRA_REFRESH_PERIOD,
|
||||||
HFI_PROP_IR_RANDOM_PERIOD,
|
HFI_PROP_IR_RANDOM_PERIOD,
|
||||||
CAP_FLAG_OUTPUT_PORT,
|
CAP_FLAG_OUTPUT_PORT,
|
||||||
{BITRATE_MODE}, {0},
|
{BITRATE_MODE, ALL_INTRA}, {0},
|
||||||
msm_vidc_adjust_ir_random, msm_vidc_set_u32},
|
msm_vidc_adjust_ir_random, msm_vidc_set_u32},
|
||||||
|
|
||||||
{AU_DELIMITER, ENC, H264|HEVC,
|
{AU_DELIMITER, ENC, H264|HEVC,
|
||||||
@@ -1229,7 +1230,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE,
|
V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE,
|
||||||
0,
|
0,
|
||||||
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU,
|
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU,
|
||||||
{BITRATE_MODE}, {0},
|
{BITRATE_MODE, ALL_INTRA}, {0},
|
||||||
msm_vidc_adjust_slice_count, msm_vidc_set_slice_count},
|
msm_vidc_adjust_slice_count, msm_vidc_set_slice_count},
|
||||||
|
|
||||||
{SLICE_MAX_BYTES, ENC, H264|HEVC|HEIC,
|
{SLICE_MAX_BYTES, ENC, H264|HEVC|HEIC,
|
||||||
@@ -1401,6 +1402,16 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
{0}, {0},
|
{0}, {0},
|
||||||
NULL, NULL},
|
NULL, NULL},
|
||||||
|
|
||||||
|
{ALL_INTRA, ENC, H264|HEVC,
|
||||||
|
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
||||||
|
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
CAP_FLAG_OUTPUT_PORT,
|
||||||
|
{GOP_SIZE, B_FRAME},
|
||||||
|
{LTR_COUNT, IR_RANDOM, SLICE_MODE},
|
||||||
|
msm_vidc_adjust_all_intra, NULL},
|
||||||
|
|
||||||
{META_LTR_MARK_USE, ENC, H264|HEVC,
|
{META_LTR_MARK_USE, ENC, H264|HEVC,
|
||||||
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
||||||
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
||||||
|
@@ -45,6 +45,7 @@ int msm_vidc_adjust_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl);
|
|||||||
int msm_vidc_adjust_v4l2_properties(struct msm_vidc_inst *inst);
|
int msm_vidc_adjust_v4l2_properties(struct msm_vidc_inst *inst);
|
||||||
int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl);
|
int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl);
|
int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
|
int msm_vidc_adjust_all_intra(void *instance, struct v4l2_ctrl *ctrl);
|
||||||
|
|
||||||
int msm_vidc_set_header_mode(void *instance,
|
int msm_vidc_set_header_mode(void *instance,
|
||||||
enum msm_vidc_inst_capability_type cap_id);
|
enum msm_vidc_inst_capability_type cap_id);
|
||||||
|
@@ -319,6 +319,7 @@ enum msm_vidc_core_capability_type {
|
|||||||
MAX_MBPS_HQ,
|
MAX_MBPS_HQ,
|
||||||
MAX_MBPF_B_FRAME,
|
MAX_MBPF_B_FRAME,
|
||||||
MAX_MBPS_B_FRAME,
|
MAX_MBPS_B_FRAME,
|
||||||
|
MAX_MBPS_ALL_INTRA,
|
||||||
MAX_ENH_LAYER_COUNT,
|
MAX_ENH_LAYER_COUNT,
|
||||||
NUM_VPP_PIPE,
|
NUM_VPP_PIPE,
|
||||||
SW_PC,
|
SW_PC,
|
||||||
@@ -460,6 +461,7 @@ enum msm_vidc_inst_capability_type {
|
|||||||
PRIORITY,
|
PRIORITY,
|
||||||
ENC_IP_CR,
|
ENC_IP_CR,
|
||||||
DPB_LIST,
|
DPB_LIST,
|
||||||
|
ALL_INTRA,
|
||||||
META_LTR_MARK_USE,
|
META_LTR_MARK_USE,
|
||||||
META_DPB_MISR,
|
META_DPB_MISR,
|
||||||
META_OPB_MISR,
|
META_OPB_MISR,
|
||||||
|
@@ -1026,7 +1026,7 @@ int msm_vidc_adjust_ltr_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
struct msm_vidc_inst_capability *capability;
|
struct msm_vidc_inst_capability *capability;
|
||||||
s32 adjusted_value;
|
s32 adjusted_value;
|
||||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||||
s32 rc_type = -1;
|
s32 rc_type = -1, all_intra = 0;
|
||||||
|
|
||||||
if (!inst || !inst->capabilities) {
|
if (!inst || !inst->capabilities) {
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
@@ -1037,13 +1037,20 @@ int msm_vidc_adjust_ltr_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
adjusted_value = ctrl ? ctrl->val : capability->cap[LTR_COUNT].value;
|
adjusted_value = ctrl ? ctrl->val : capability->cap[LTR_COUNT].value;
|
||||||
|
|
||||||
if (msm_vidc_get_parent_value(inst, LTR_COUNT, BITRATE_MODE,
|
if (msm_vidc_get_parent_value(inst, LTR_COUNT, BITRATE_MODE,
|
||||||
&rc_type, __func__))
|
&rc_type, __func__) ||
|
||||||
|
msm_vidc_get_parent_value(inst, LTR_COUNT, ALL_INTRA,
|
||||||
|
&all_intra, __func__))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (rc_type != HFI_RC_OFF &&
|
if ((rc_type != HFI_RC_OFF &&
|
||||||
rc_type != HFI_RC_CBR_CFR &&
|
rc_type != HFI_RC_CBR_CFR &&
|
||||||
rc_type != HFI_RC_CBR_VFR)
|
rc_type != HFI_RC_CBR_VFR) ||
|
||||||
|
all_intra) {
|
||||||
adjusted_value = 0;
|
adjusted_value = 0;
|
||||||
|
i_vpr_h(inst,
|
||||||
|
"%s: ltr count unsupported, rc_type: %#x, all_intra %d\n",
|
||||||
|
__func__,rc_type, all_intra);
|
||||||
|
}
|
||||||
|
|
||||||
msm_vidc_update_cap_value(inst, LTR_COUNT,
|
msm_vidc_update_cap_value(inst, LTR_COUNT,
|
||||||
adjusted_value, __func__);
|
adjusted_value, __func__);
|
||||||
@@ -1134,7 +1141,7 @@ int msm_vidc_adjust_mark_ltr(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
int msm_vidc_adjust_ir_random(void *instance, struct v4l2_ctrl *ctrl)
|
int msm_vidc_adjust_ir_random(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
struct msm_vidc_inst_capability *capability;
|
struct msm_vidc_inst_capability *capability;
|
||||||
s32 adjusted_value;
|
s32 adjusted_value, all_intra = 0;
|
||||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||||
|
|
||||||
if (!inst || !inst->capabilities) {
|
if (!inst || !inst->capabilities) {
|
||||||
@@ -1145,6 +1152,17 @@ int msm_vidc_adjust_ir_random(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
|
|
||||||
adjusted_value = ctrl ? ctrl->val : capability->cap[IR_RANDOM].value;
|
adjusted_value = ctrl ? ctrl->val : capability->cap[IR_RANDOM].value;
|
||||||
|
|
||||||
|
if (msm_vidc_get_parent_value(inst, IR_RANDOM, ALL_INTRA,
|
||||||
|
&all_intra, __func__))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (all_intra) {
|
||||||
|
adjusted_value = 0;
|
||||||
|
i_vpr_h(inst, "%s: IR unsupported, all intra: %d\n",
|
||||||
|
__func__, all_intra);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BITRATE_MODE dependency is NOT common across all chipsets.
|
* BITRATE_MODE dependency is NOT common across all chipsets.
|
||||||
* Hence, do not return error if not specified as one of the parent.
|
* Hence, do not return error if not specified as one of the parent.
|
||||||
@@ -1154,6 +1172,7 @@ int msm_vidc_adjust_ir_random(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
inst->hfi_rc_type != HFI_RC_CBR_VFR)
|
inst->hfi_rc_type != HFI_RC_CBR_VFR)
|
||||||
adjusted_value = 0;
|
adjusted_value = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
msm_vidc_update_cap_value(inst, IR_RANDOM,
|
msm_vidc_update_cap_value(inst, IR_RANDOM,
|
||||||
adjusted_value, __func__);
|
adjusted_value, __func__);
|
||||||
|
|
||||||
@@ -1257,7 +1276,7 @@ int msm_vidc_adjust_slice_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||||
struct msm_vidc_inst_capability *capability;
|
struct msm_vidc_inst_capability *capability;
|
||||||
struct v4l2_format *output_fmt;
|
struct v4l2_format *output_fmt;
|
||||||
s32 adjusted_value, rc_type = -1, slice_mode;
|
s32 adjusted_value, rc_type = -1, slice_mode, all_intra = 0;
|
||||||
u32 slice_val, mbpf = 0, mbps = 0, max_mbpf = 0, max_mbps = 0;
|
u32 slice_val, mbpf = 0, mbps = 0, max_mbpf = 0, max_mbps = 0;
|
||||||
u32 update_cap, max_avg_slicesize, output_width, output_height;
|
u32 update_cap, max_avg_slicesize, output_width, output_height;
|
||||||
u32 min_width, min_height, max_width, max_height, fps;
|
u32 min_width, min_height, max_width, max_height, fps;
|
||||||
@@ -1272,7 +1291,9 @@ int msm_vidc_adjust_slice_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
capability->cap[SLICE_MODE].value;
|
capability->cap[SLICE_MODE].value;
|
||||||
|
|
||||||
if (msm_vidc_get_parent_value(inst, SLICE_MODE,
|
if (msm_vidc_get_parent_value(inst, SLICE_MODE,
|
||||||
BITRATE_MODE, &rc_type, __func__))
|
BITRATE_MODE, &rc_type, __func__) ||
|
||||||
|
msm_vidc_get_parent_value(inst, SLICE_MODE,
|
||||||
|
ALL_INTRA, &all_intra, __func__))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE)
|
if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE)
|
||||||
@@ -1282,12 +1303,13 @@ int msm_vidc_adjust_slice_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
if (fps > MAX_SLICES_FRAME_RATE ||
|
if (fps > MAX_SLICES_FRAME_RATE ||
|
||||||
(rc_type != HFI_RC_OFF &&
|
(rc_type != HFI_RC_OFF &&
|
||||||
rc_type != HFI_RC_CBR_CFR &&
|
rc_type != HFI_RC_CBR_CFR &&
|
||||||
rc_type != HFI_RC_CBR_VFR)) {
|
rc_type != HFI_RC_CBR_VFR) ||
|
||||||
|
all_intra) {
|
||||||
adjusted_value = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE;
|
adjusted_value = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE;
|
||||||
update_cap = SLICE_MODE;
|
update_cap = SLICE_MODE;
|
||||||
i_vpr_h(inst,
|
i_vpr_h(inst,
|
||||||
"%s: slice unsupported, fps: %u, rc_type: %#x\n",
|
"%s: slice unsupported, fps: %u, rc_type: %#x, all_intra %d\n",
|
||||||
__func__, fps, rc_type);
|
__func__, fps, rc_type, all_intra);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1968,6 +1990,53 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msm_vidc_adjust_all_intra(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst_capability *capability;
|
||||||
|
s32 adjusted_value;
|
||||||
|
struct msm_vidc_core *core;
|
||||||
|
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||||
|
s32 gop_size = -1, bframe = -1;
|
||||||
|
u32 width, height, fps, mbps, max_mbps;
|
||||||
|
|
||||||
|
if (!inst || !inst->capabilities || !inst->core) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
|
adjusted_value = capability->cap[ALL_INTRA].value;
|
||||||
|
|
||||||
|
if (msm_vidc_get_parent_value(inst, ALL_INTRA, GOP_SIZE,
|
||||||
|
&gop_size, __func__) ||
|
||||||
|
msm_vidc_get_parent_value(inst, ALL_INTRA, B_FRAME,
|
||||||
|
&bframe, __func__))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
width = inst->crop.width;
|
||||||
|
height = inst->crop.height;
|
||||||
|
fps = msm_vidc_get_fps(inst);
|
||||||
|
mbps = NUM_MBS_PER_SEC(height, width, fps);
|
||||||
|
core = inst->core;
|
||||||
|
max_mbps = core->capabilities[MAX_MBPS_ALL_INTRA].value;
|
||||||
|
|
||||||
|
if (mbps > max_mbps) {
|
||||||
|
adjusted_value = 0;
|
||||||
|
i_vpr_h(inst, "%s: mbps %d exceeds max supported mbps %d\n",
|
||||||
|
__func__, mbps, max_mbps);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gop_size && !bframe)
|
||||||
|
adjusted_value = 1;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
msm_vidc_update_cap_value(inst, ALL_INTRA,
|
||||||
|
adjusted_value, __func__);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl)
|
int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
struct msm_vidc_inst_capability *capability;
|
struct msm_vidc_inst_capability *capability;
|
||||||
|
@@ -164,6 +164,7 @@ static const struct msm_vidc_cap_name cap_name_arr[] = {
|
|||||||
{PRIORITY, "PRIORITY" },
|
{PRIORITY, "PRIORITY" },
|
||||||
{ENC_IP_CR, "ENC_IP_CR" },
|
{ENC_IP_CR, "ENC_IP_CR" },
|
||||||
{DPB_LIST, "DPB_LIST" },
|
{DPB_LIST, "DPB_LIST" },
|
||||||
|
{ALL_INTRA, "ALL_INTRA" },
|
||||||
{META_LTR_MARK_USE, "META_LTR_MARK_USE" },
|
{META_LTR_MARK_USE, "META_LTR_MARK_USE" },
|
||||||
{META_DPB_MISR, "META_DPB_MISR" },
|
{META_DPB_MISR, "META_DPB_MISR" },
|
||||||
{META_OPB_MISR, "META_OPB_MISR" },
|
{META_OPB_MISR, "META_OPB_MISR" },
|
||||||
|
Reference in New Issue
Block a user