Przeglądaj źródła

Merge "video: driver: update decoder load calculation"

qctecmdr 3 lat temu
rodzic
commit
07ede771b0

+ 8 - 8
driver/vidc/src/msm_vdec.c

@@ -191,14 +191,6 @@ static int msm_vdec_set_crop_offsets(struct msm_vidc_inst *inst,
 	u32 left_offset, top_offset, right_offset, bottom_offset;
 	u32 payload[2] = {0};
 
-	if (inst->fmts[INPUT_PORT].fmt.pix_mp.width <
-		inst->crop.width)
-		return -EINVAL;
-
-	if (inst->fmts[INPUT_PORT].fmt.pix_mp.height <
-		inst->crop.height)
-		return -EINVAL;
-
 	left_offset = inst->crop.left;
 	top_offset = inst->crop.top;
 	right_offset = (inst->fmts[INPUT_PORT].fmt.pix_mp.width -
@@ -2396,6 +2388,14 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 			fmt->fmt.pix_mp.plane_fmt[0].sizeimage;
 		pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
 		msm_vidc_update_cap_value(inst, PIX_FMTS, pix_fmt, __func__);
+
+		/* update crop while input port is not streaming */
+		if (!inst->vb2q[INPUT_PORT].streaming) {
+			inst->crop.top = 0;
+			inst->crop.left = 0;
+			inst->crop.width = f->fmt.pix_mp.width;
+			inst->crop.height = f->fmt.pix_mp.height;
+		}
 		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),

+ 5 - 2
driver/vidc/src/msm_vidc_driver.c

@@ -1959,8 +1959,8 @@ int msm_vidc_get_mbs_per_frame(struct msm_vidc_inst *inst)
 
 	if (is_decode_session(inst)) {
 		inp_f = &inst->fmts[INPUT_PORT];
-		width = inp_f->fmt.pix_mp.width;
-		height = inp_f->fmt.pix_mp.height;
+		width = max(inp_f->fmt.pix_mp.width, inst->crop.width);
+		height = max(inp_f->fmt.pix_mp.height, inst->crop.height);
 	} else if (is_encode_session(inst)) {
 		width = inst->crop.width;
 		height = inst->crop.height;
@@ -5275,6 +5275,9 @@ int msm_vidc_check_core_mbps(struct msm_vidc_inst *inst)
 		i_vpr_e(inst, "%s: Hardware overloaded. needed %u, max %u", __func__,
 			mbps, core->capabilities[MAX_MBPS].value);
 		return rc;
+	} else {
+		i_vpr_h(inst, "%s: HW load needed %u is within max %u", __func__,
+			mbps, core->capabilities[MAX_MBPS].value);
 	}
 
 	return 0;

+ 1 - 1
driver/vidc/src/msm_vidc_vb2.c

@@ -261,7 +261,7 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count)
 	return rc;
 
 error:
-	i_vpr_h(inst, "Streamon: %s failed\n", v4l2_type_name(q->type));
+	i_vpr_e(inst, "Streamon: %s failed\n", v4l2_type_name(q->type));
 	return -EINVAL;
 }