From patchwork Tue Oct 9 07:53:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malathi Gottam X-Patchwork-Id: 10632107 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F570112B for ; Tue, 9 Oct 2018 07:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C2128B5F for ; Tue, 9 Oct 2018 07:59:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86CB028B61; Tue, 9 Oct 2018 07:59:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ABCF28B5F for ; Tue, 9 Oct 2018 07:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbeJIPP2 (ORCPT ); Tue, 9 Oct 2018 11:15:28 -0400 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:33323 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbeJIPP1 (ORCPT ); Tue, 9 Oct 2018 11:15:27 -0400 X-IronPort-AV: E=Sophos;i="5.54,359,1534789800"; d="scan'208";a="240332" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 09 Oct 2018 13:23:28 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9040"; a="1605184" Received: from mgottam-linux.qualcomm.com ([10.204.66.66]) by ironmsg03-blr.qualcomm.com with ESMTP; 09 Oct 2018 13:23:26 +0530 Received: by mgottam-linux.qualcomm.com (Postfix, from userid 2305155) id E12202E3B; Tue, 9 Oct 2018 13:23:25 +0530 (IST) From: Malathi Gottam To: stanimir.varbanov@linaro.org, hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org, mgottam@codeaurora.org Subject: [PATCH] media: venus: add support for selection rectangles Date: Tue, 9 Oct 2018 13:23:23 +0530 Message-Id: <1539071603-1588-1-git-send-email-mgottam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Handles target type crop by setting the new active rectangle to hardware. The new rectangle should be within YUV size. Signed-off-by: Malathi Gottam --- drivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 3f50cd0..754c19a 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -478,16 +478,31 @@ static int venc_g_fmt(struct file *file, void *fh, struct v4l2_format *f) venc_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { struct venus_inst *inst = to_inst(file); + int ret; + u32 buftype; 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 || + if (s->r.width > inst->out_width || + s->r.height > inst->out_height || s->r.top != 0 || s->r.left != 0) return -EINVAL; + if (s->r.width != inst->width || + s->r.height != inst->height) { + buftype = HFI_BUFFER_OUTPUT; + ret = venus_helper_set_output_resolution(inst, + s->r.width, + s->r.height, + buftype); + if (ret) + return ret; + + inst->width = s->r.width; + inst->height = s->r.height; + } break; default: return -EINVAL;