video: driver: Revise encoder port configs

1. Revise to config encoder RAW port with buffer actual
aligned width and height in pixels to firmware;
2. Client also needs to config aligned input port
width and height to driver;
3. Driver must config encoder RAW port crops;
4. Client also needs to config encoder input port crops;

Change-Id: Idb85036df9a72e50239ddb46039ef1995b7f0689
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
此提交包含在:
Zhongbo Shi
2022-11-16 10:19:41 +08:00
提交者 Shi Zhongbo
父節點 faf2b173fe
當前提交 e65a251443

查看文件

@@ -21,6 +21,7 @@
static const u32 msm_venc_input_set_prop[] = {
HFI_PROP_COLOR_FORMAT,
HFI_PROP_RAW_RESOLUTION,
HFI_PROP_CROP_OFFSETS,
HFI_PROP_LINEAR_STRIDE_SCANLINE,
HFI_PROP_SIGNAL_COLOR_INFO,
};
@@ -213,9 +214,10 @@ static int msm_venc_set_raw_resolution(struct msm_vidc_inst *inst,
return -EINVAL;
}
resolution = inst->crop.width << 16 | inst->crop.height;
resolution = (inst->fmts[port].fmt.pix_mp.width << 16) |
inst->fmts[port].fmt.pix_mp.height;
i_vpr_h(inst, "%s: width: %d height: %d\n", __func__,
inst->crop.width, inst->crop.height);
inst->fmts[port].fmt.pix_mp.width, inst->fmts[port].fmt.pix_mp.height);
rc = venus_hfi_session_property(inst,
HFI_PROP_RAW_RESOLUTION,
HFI_HOST_FLAGS_NONE,
@@ -264,19 +266,25 @@ static int msm_venc_set_crop_offsets(struct msm_vidc_inst *inst,
u32 crop[2] = {0};
u32 width, height;
if (port != OUTPUT_PORT) {
if (port != OUTPUT_PORT && port != INPUT_PORT) {
i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
return -EINVAL;
}
left_offset = inst->compose.left;
top_offset = inst->compose.top;
width = inst->compose.width;
height = inst->compose.height;
if (is_rotation_90_or_270(inst)) {
width = inst->compose.height;
height = inst->compose.width;
if (port == INPUT_PORT) {
left_offset = inst->crop.left;
top_offset = inst->crop.top;
width = inst->crop.width;
height = inst->crop.height;
} else {
left_offset = inst->compose.left;
top_offset = inst->compose.top;
width = inst->compose.width;
height = inst->compose.height;
if (is_rotation_90_or_270(inst)) {
width = inst->compose.height;
height = inst->compose.width;
}
}
right_offset = (inst->fmts[port].fmt.pix_mp.width - width);
@@ -449,6 +457,7 @@ static int msm_venc_set_input_properties(struct msm_vidc_inst *inst)
static const struct msm_venc_prop_type_handle prop_type_handle_arr[] = {
{HFI_PROP_COLOR_FORMAT, msm_venc_set_colorformat },
{HFI_PROP_RAW_RESOLUTION, msm_venc_set_raw_resolution },
{HFI_PROP_CROP_OFFSETS, msm_venc_set_crop_offsets },
{HFI_PROP_LINEAR_STRIDE_SCANLINE, msm_venc_set_stride_scanline },
{HFI_PROP_SIGNAL_COLOR_INFO, msm_venc_set_colorspace },
};