Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756216AbcKKLoN (ORCPT ); Fri, 11 Nov 2016 06:44:13 -0500 Received: from lb1-smtp-cloud2.xs4all.net ([194.109.24.21]:38692 "EHLO lb1-smtp-cloud2.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755240AbcKKLnp (ORCPT ); Fri, 11 Nov 2016 06:43:45 -0500 Subject: Re: [PATCH v3 5/9] media: venus: venc: add video encoder files To: Stanimir Varbanov , Mauro Carvalho Chehab References: <1478540043-24558-1-git-send-email-stanimir.varbanov@linaro.org> <1478540043-24558-6-git-send-email-stanimir.varbanov@linaro.org> Cc: Andy Gross , Bjorn Andersson , Stephen Boyd , Srinivas Kandagatla , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org From: Hans Verkuil Message-ID: <5e918c07-c3fb-262a-5c9e-11014cdb0eb0@xs4all.nl> Date: Fri, 11 Nov 2016 12:43:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1478540043-24558-6-git-send-email-stanimir.varbanov@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1837 Lines: 65 The comments I made before about start_streaming and the use of struct venus_ctrl apply here as well and I won't repeat them. On 11/07/2016 06:33 PM, Stanimir Varbanov wrote: > This adds encoder part of the driver plus encoder controls. > > Signed-off-by: Stanimir Varbanov > --- > drivers/media/platform/qcom/venus/venc.c | 1212 ++++++++++++++++++++++++ > drivers/media/platform/qcom/venus/venc.h | 32 + > drivers/media/platform/qcom/venus/venc_ctrls.c | 396 ++++++++ > 3 files changed, 1640 insertions(+) > create mode 100644 drivers/media/platform/qcom/venus/venc.c > create mode 100644 drivers/media/platform/qcom/venus/venc.h > create mode 100644 drivers/media/platform/qcom/venus/venc_ctrls.c > > diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c > new file mode 100644 > index 000000000000..35572eaffb9e > --- /dev/null > +++ b/drivers/media/platform/qcom/venus/venc.c > +static int > +venc_s_selection(struct file *file, void *fh, struct v4l2_selection *s) > +{ > + struct venus_inst *inst = to_inst(file); > + > + if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) > + return -EINVAL; > + > + switch (s->target) { > + case V4L2_SEL_TGT_CROP: > + if (s->r.width != inst->out_width || > + s->r.height != inst->out_height || > + s->r.top != 0 || s->r.left != 0) > + return -EINVAL; > + break; > + default: > + return -EINVAL; > + } > + > + return 0; > +} Why implement s_selection if I can't change the selection? > + > +static int > +venc_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *b) > +{ > + struct vb2_queue *queue = to_vb2q(file, b->type); > + > + if (!queue) > + return -EINVAL; > + > + return vb2_reqbufs(queue, b); > +} Use the m2m helpers if at all possible. Regards, Hans