Browse Source

video: driver: modify crop offsets property

modify crop offsets property to match the
hfi header file.

Change-Id: Id4cd1e6f68a811e7d3dfbaeb80b20bff98eaf35c
Signed-off-by: Darshana Patil <[email protected]>
Darshana Patil 4 năm trước cách đây
mục cha
commit
b8996ba008

+ 1 - 1
driver/vidc/inc/msm_vidc_internal.h

@@ -588,7 +588,7 @@ struct msm_vidc_rectangle {
 
 struct msm_vidc_subscription_params {
 	u32                    bitstream_resolution;
-	u64                    crop_offsets;
+	u32                    crop_offsets[2];
 	u32                    bit_depth;
 	u32                    coded_frames;
 	u32                    fw_min_count;

+ 17 - 12
driver/vidc/src/msm_vdec.c

@@ -129,7 +129,7 @@ static int msm_vdec_set_crop_offsets(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 	u32 left_offset, top_offset, right_offset, bottom_offset;
-	u64 payload;
+	u32 payload[2] = {0};
 
 	if (inst->fmts[INPUT_PORT].fmt.pix_mp.width <
 		inst->crop.width)
@@ -146,12 +146,13 @@ static int msm_vdec_set_crop_offsets(struct msm_vidc_inst *inst,
 	bottom_offset = (inst->fmts[INPUT_PORT].fmt.pix_mp.height -
 		inst->crop.height);
 
-	payload = (u64)right_offset << 48 | (u64)bottom_offset << 32 |
-		(u64)left_offset << 16 | top_offset;
+	payload[0] = left_offset << 16 | top_offset;
+	payload[1] = right_offset << 16 | bottom_offset;
 	i_vpr_h(inst, "%s: left_offset: %d top_offset: %d "
 		"right_offset: %d bottom_offset: %d", __func__,
 		left_offset, top_offset, right_offset, bottom_offset);
-	inst->subcr_params[port].crop_offsets = payload;
+	inst->subcr_params[port].crop_offsets[0] = payload[0];
+	inst->subcr_params[port].crop_offsets[1] = payload[1];
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_CROP_OFFSETS,
 			HFI_HOST_FLAGS_NONE,
@@ -1235,12 +1236,12 @@ static int msm_vdec_update_properties(struct msm_vidc_inst *inst)
 
 	inst->buffers.output.min_count = subsc_params.fw_min_count;
 
-	inst->crop.top = subsc_params.crop_offsets & 0xFFFF;
-	inst->crop.left = (subsc_params.crop_offsets >> 16) & 0xFFFF;
+	inst->crop.top = subsc_params.crop_offsets[0] & 0xFFFF;
+	inst->crop.left = (subsc_params.crop_offsets[0] >> 16) & 0xFFFF;
 	inst->crop.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height -
-		((subsc_params.crop_offsets >> 32) & 0xFFFF);
+		(subsc_params.crop_offsets[1] & 0xFFFF);
 	inst->crop.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width -
-		((subsc_params.crop_offsets >> 48) & 0xFFFF);
+		((subsc_params.crop_offsets[1] >> 16) & 0xFFFF);
 
 	inst->capabilities->cap[PROFILE].value = subsc_params.profile;
 	inst->capabilities->cap[LEVEL].value = subsc_params.level;
@@ -1450,8 +1451,8 @@ static int msm_vdec_subscribe_output_port_settings_change(struct msm_vidc_inst *
 			payload_type = HFI_PAYLOAD_U32;
 			break;
 		case HFI_PROP_CROP_OFFSETS:
-			payload[0] = subsc_params.crop_offsets >> 32;
-			payload[1] = subsc_params.crop_offsets;
+			payload[0] = subsc_params.crop_offsets[0];
+			payload[1] = subsc_params.crop_offsets[1];
 			payload_size = sizeof(u64);
 			payload_type = HFI_PAYLOAD_64_PACKED;
 			break;
@@ -1667,6 +1668,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	int rc = 0;
 	struct msm_vidc_core *core;
 	struct v4l2_format *fmt;
+	u32 codec_align;
 
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
@@ -1687,8 +1689,11 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 		}
 		fmt = &inst->fmts[INPUT_PORT];
 		fmt->type = INPUT_MPLANE;
-		fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 16);
-		fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 16);
+
+		codec_align = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat ==
+			V4L2_PIX_FMT_HEVC ? 32 : 16;
+		fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align);
+		fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align);
 		fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
 		fmt->fmt.pix_mp.num_planes = 1;
 		fmt->fmt.pix_mp.plane_fmt[0].bytesperline = 0;

+ 3 - 3
driver/vidc/src/msm_venc.c

@@ -206,7 +206,7 @@ static int msm_venc_set_crop_offsets(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 	u32 left_offset, top_offset, right_offset, bottom_offset;
-	u64 crop;
+	u32 crop[2] = {0};
 
 	if (port != OUTPUT_PORT) {
 		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
@@ -220,8 +220,8 @@ static int msm_venc_set_crop_offsets(struct msm_vidc_inst *inst,
 	bottom_offset = (inst->fmts[port].fmt.pix_mp.height -
 		inst->crop.height);
 
-	crop = (u64)right_offset << 48 | (u64)bottom_offset << 32 |
-		(u64)left_offset << 16 | top_offset;
+	crop[0] = left_offset << 16 | top_offset;
+	crop[1] = right_offset << 16 | bottom_offset;
 	i_vpr_h(inst, "%s: left_offset: %d top_offset: %d "
 		"right_offset: %d bottom_offset: %d", __func__,
 		left_offset, top_offset, right_offset, bottom_offset);

+ 5 - 4
driver/vidc/src/venus_hfi_response.c

@@ -26,9 +26,10 @@ void print_psc_properties(u32 tag, const char *str, struct msm_vidc_inst *inst,
 		return;
 
 	dprintk(tag, inst->sid,
-		"%s: resolution %#x, crop offsets %#llx, bit depth %d, coded frames %d "
+		"%s: resolution %#x, crop offsets[0] %#x, crop offsets[1] %#x, bit depth %d, coded frames %d "
 		"fw min count %d, poc %d, color info %d, profile %d, level %d, tier %d ",
-		str, subsc_params.bitstream_resolution, subsc_params.crop_offsets,
+		str, subsc_params.bitstream_resolution,
+		subsc_params.crop_offsets[0], subsc_params.crop_offsets[1],
 		subsc_params.bit_depth, subsc_params.coded_frames,
 		subsc_params.fw_min_count, subsc_params.pic_order_cnt,
 		subsc_params.color_info, subsc_params.profile, subsc_params.level,
@@ -1059,8 +1060,8 @@ static int handle_session_property(struct msm_vidc_inst *inst,
 		inst->subcr_params[port].bitstream_resolution = payload_ptr[0];
 		break;
 	case HFI_PROP_CROP_OFFSETS:
-		inst->subcr_params[port].crop_offsets =
-			(u64)payload_ptr[0] << 32 | payload_ptr[1];
+		inst->subcr_params[port].crop_offsets[0] = payload_ptr[0];
+		inst->subcr_params[port].crop_offsets[1] = payload_ptr[1];
 		break;
 	case HFI_PROP_LUMA_CHROMA_BIT_DEPTH:
 		inst->subcr_params[port].bit_depth = payload_ptr[0];