Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 077f836f authored by Praneeth Paladugu's avatar Praneeth Paladugu
Browse files

msm: vidc: Fix multistream issues



This change is to fix issues reported when OUTPUT and OUTPUT2
ports enabled in Venus. In this case following are the rules
    - s_fmt on OUTPUT port updates OUTPUT port dimensions.
    - s_fmt on CAPTURE port updates CAPTURE port dimensions.
    - reconfig dimensions are always updated on OUTPUT port.
    - All clocks scaling, bus scaling uses max of both ports.
    - DCVS is based on reconfig, CAPTURE and OUTPUT port dims.

CRs-Fixed: 1044772
Change-Id: Ib45424c70f995d856ad27107ae3ea24a59ca4e74
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: default avatarAbdulla Anam <abdullahanam@codeaurora.org>
parent 995bb603
Loading
Loading
Loading
Loading
+12 −50
Original line number Diff line number Diff line
@@ -1090,23 +1090,8 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	f->fmt.pix_mp.pixelformat = fmt->fourcc;
	f->fmt.pix_mp.num_planes = fmt->num_planes;
	if (inst->in_reconfig) {
		bool ds_enabled = msm_comm_g_ctrl_for_id(inst,
			V4L2_CID_MPEG_VIDC_VIDEO_KEEP_ASPECT_RATIO);

		/*
		 * Do not update height and width on capture port, if
		 * downscalar is explicitly enabled from v4l2 client.
		 */
		if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_SECONDARY && ds_enabled) {
		inst->prop.height[OUTPUT_PORT] = inst->reconfig_height;
		inst->prop.width[OUTPUT_PORT] = inst->reconfig_width;
		} else {
			inst->prop.height[CAPTURE_PORT] = inst->reconfig_height;
			inst->prop.width[CAPTURE_PORT] = inst->reconfig_width;
			inst->prop.height[OUTPUT_PORT] = inst->reconfig_height;
			inst->prop.width[OUTPUT_PORT] = inst->reconfig_width;
		}

		rc = msm_vidc_check_session_supported(inst);
		if (rc) {
@@ -1133,6 +1118,12 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
				f->fmt.pix_mp.plane_fmt[i].sizeimage =
					plane_sizes[i];
		}
		f->fmt.pix_mp.height = inst->prop.height[OUTPUT_PORT];
		f->fmt.pix_mp.width = inst->prop.width[OUTPUT_PORT];
		f->fmt.pix_mp.plane_fmt[0].bytesperline =
			(__u16)inst->prop.width[OUTPUT_PORT];
		f->fmt.pix_mp.plane_fmt[0].reserved[0] =
			(__u16)inst->prop.height[OUTPUT_PORT];
	} else {
		switch (fmt->fourcc) {
		case V4L2_PIX_FMT_NV12:
@@ -1170,34 +1161,15 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		for (i = 0; i < fmt->num_planes; ++i)
			inst->bufq[CAPTURE_PORT].vb2_bufq.plane_sizes[i] =
				f->fmt.pix_mp.plane_fmt[i].sizeimage;
	}

	if (stride && scanlines) {
		f->fmt.pix_mp.height = inst->prop.height[CAPTURE_PORT];
		f->fmt.pix_mp.width = inst->prop.width[CAPTURE_PORT];
		f->fmt.pix_mp.plane_fmt[0].bytesperline =
			(__u16)stride;
		f->fmt.pix_mp.plane_fmt[0].reserved[0] =
			(__u16)scanlines;
	} else {
		f->fmt.pix_mp.plane_fmt[0].bytesperline =
			(__u16)inst->prop.width[CAPTURE_PORT];
		f->fmt.pix_mp.plane_fmt[0].reserved[0] =
			(__u16)inst->prop.height[CAPTURE_PORT];
	}

	if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_SECONDARY) {
		if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
			f->fmt.pix_mp.height = inst->prop.height[CAPTURE_PORT];
			f->fmt.pix_mp.width = inst->prop.width[CAPTURE_PORT];
		} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
			f->fmt.pix_mp.height = inst->prop.height[OUTPUT_PORT];
			f->fmt.pix_mp.width = inst->prop.width[OUTPUT_PORT];
			f->fmt.pix_mp.plane_fmt[0].bytesperline =
				(__u16)inst->prop.width[OUTPUT_PORT];
			f->fmt.pix_mp.plane_fmt[0].reserved[0] =
				(__u16)inst->prop.height[OUTPUT_PORT];
		}
	}
exit:
	return rc;
}
@@ -1263,13 +1235,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)

		inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width;
		inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height;
		if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_PRIMARY) {
			inst->prop.width[OUTPUT_PORT] = f->fmt.pix_mp.width;
			inst->prop.height[OUTPUT_PORT] = f->fmt.pix_mp.height;
		msm_comm_set_color_format(inst, HAL_BUFFER_OUTPUT,
			f->fmt.pix_mp.pixelformat);
		}

		inst->fmts[fmt->type] = fmt;
		if (msm_comm_get_stream_output_mode(inst) ==
@@ -1311,11 +1278,6 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
		inst->prop.width[OUTPUT_PORT] = f->fmt.pix_mp.width;
		inst->prop.height[OUTPUT_PORT] = f->fmt.pix_mp.height;
		if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_PRIMARY) {
			inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width;
			inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height;
		}

		fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats,
				ARRAY_SIZE(vdec_formats),
+12 −10
Original line number Diff line number Diff line
@@ -284,8 +284,12 @@ static int msm_comm_get_mbs_per_sec(struct msm_vidc_inst *inst)
	u32 fps;
	struct v4l2_control ctrl;

	output_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[OUTPUT_PORT],
	output_port_mbs = inst->in_reconfig ?
			NUM_MBS_PER_FRAME(inst->reconfig_width,
				inst->reconfig_height) :
			NUM_MBS_PER_FRAME(inst->prop.width[OUTPUT_PORT],
				inst->prop.height[OUTPUT_PORT]);

	capture_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[CAPTURE_PORT],
		inst->prop.height[CAPTURE_PORT]);

@@ -1231,8 +1235,6 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
			"event_notify->height = %d event_notify->width = %d\n",
			event_notify->height,
			event_notify->width);
			inst->prop.height[CAPTURE_PORT] = event_notify->height;
			inst->prop.width[CAPTURE_PORT] = event_notify->width;
		inst->prop.height[OUTPUT_PORT] = event_notify->height;
		inst->prop.width[OUTPUT_PORT] = event_notify->width;
	}