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

Commit 9f3087f5 authored by Deva Ramasubramanian's avatar Deva Ramasubramanian Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Query the core on VIDIOC_G_FMT



Previously we only queried the core for buffer requirements in
VIDIOC_REQBUFS, and relied on that information in _G_FMT.  However,
there's no expectation that the client calls _REQBUFS before _G_FMT,
which leads to stale information being returned as part of _G_FMT.

As such, always retreive fresh info from the core for either ioctl.

Change-Id: Ife94343f4bd4f62da7f2bef4266076ceed409bca
Signed-off-by: default avatarDeva Ramasubramanian <dramasub@codeaurora.org>
parent 01f3b4c6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -922,11 +922,20 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	int rc = 0;
	int i;
	struct hal_buffer_requirements *buff_req_buffer;

	if (!inst || !f || !inst->core || !inst->core->device) {
		dprintk(VIDC_ERR,
			"Invalid input, inst = %p, format = %p\n", inst, f);
		return -EINVAL;
	}

	rc = msm_comm_try_get_bufreqs(inst);
	if (rc) {
		dprintk(VIDC_ERR, "Getting buffer requirements failed: %d\n",
				rc);
		return rc;
	}

	hdev = inst->core->device;
	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
		fmt = inst->fmts[CAPTURE_PORT];
+8 −0
Original line number Diff line number Diff line
@@ -2757,6 +2757,14 @@ int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			"Invalid input, inst = %p, format = %p\n", inst, f);
		return -EINVAL;
	}

	rc = msm_comm_try_get_bufreqs(inst);
	if (rc) {
		dprintk(VIDC_WARN, "Getting buffer requirements failed: %d\n",
				rc);
		return rc;
	}

	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
		fmt = inst->fmts[CAPTURE_PORT];
		height = inst->prop.height[CAPTURE_PORT];