Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp440152imu; Thu, 8 Nov 2018 23:40:28 -0800 (PST) X-Google-Smtp-Source: AJdET5dQek9u1lmtzEJIvR0zt85vBBSNk8e15PIBu5K9erZx1cFoTmyKDwXNcUxPnHseuVU+VlI/ X-Received: by 2002:a63:6ec4:: with SMTP id j187-v6mr6704577pgc.3.1541749228425; Thu, 08 Nov 2018 23:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541749228; cv=none; d=google.com; s=arc-20160816; b=ike23aDvc5FRZHQKaQ/Qqt8A2pxomaLRY2Z/AKpkK0ywtTagru8XOANZRsKbu4G0Yc lAz77gaNbPV4Zpwu++2Ux8ytjUkFP3YZdb7u5Mhlx1juEKcc9/UySnEltxaJqSo5tNof 95L3vPCkTdUPM2V5U60/O92iuu9Z/yGadmyY0OL578KkfvVIUYO6VmADrYk29mAI39ha bYZb2CV4HGjdGoXTSGPI5Q2njjVNzUOp3U+QqdTJ0kGarBRTuSr/Nkw8WlpPSaKOtHfy IbyF7FWsPPyfDdi3TNcmGNj+pZ+vvwgFzu3d2lMN5xM3/QCGSW2UkqaP0hBtq9KWBw1w 28sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=AgCAwIvu62bzEW27ggLuS2BZ8odlAgFCMaX70qigdZw=; b=uCmaEJQlFgQTSNV6Z8y5FDZufTvO4i49xQvR3trp+r94Tt6xlytjaL42eXzMZPYGK0 RGWLo/46CL2tfPegVtYU1mH/MsB9jSox2GPzEebi9/ykQww2Sr5ogvh/E37l1R10KamX VVjCtBsJxrS6IiPmQ9n7S0/7HbYlQbJi9XcSCh/8nw1t6McHB6OKrtb9mCFWHM487Ufx LOypNHUoRNEpj88L/vTNgj+u4kvddSD6KiPf3DBbl03/t7EwhswalQ5jjeP6UasBFTix vKPoEVdoijyMqkrAKXuOiNDc6PnmoQYXU7HEpBJOOicztKE++K+c1hd5uPL2xgbJf4Vu S97g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h33-v6si2091603plh.390.2018.11.08.23.40.12; Thu, 08 Nov 2018 23:40:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728311AbeKIRSi (ORCPT + 99 others); Fri, 9 Nov 2018 12:18:38 -0500 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:27279 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbeKIRSi (ORCPT ); Fri, 9 Nov 2018 12:18:38 -0500 X-IronPort-AV: E=Sophos;i="5.54,482,1534789800"; d="scan'208";a="280333" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 09 Nov 2018 13:09:05 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9071"; a="1984371" Received: from mgottam-linux.qualcomm.com ([10.204.65.20]) by ironmsg03-blr.qualcomm.com with ESMTP; 09 Nov 2018 13:09:05 +0530 Received: by mgottam-linux.qualcomm.com (Postfix, from userid 2305155) id D11F430E6; Fri, 9 Nov 2018 13:09:03 +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 v2] media: venus: add support for selection rectangles Date: Fri, 9 Nov 2018 13:09:01 +0530 Message-Id: <1541749141-6989-1-git-send-email-mgottam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index ce85962..d26c129 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -478,16 +478,34 @@ 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 || - s->r.top != 0 || s->r.left != 0) - return -EINVAL; + if (s->r.left != 0) { + s->r.width += s->r.left; + s->r.left = 0; + } + + if (s->r.top != 0) { + s->r.height += s->r.top; + s->r.top = 0; + } + + if (s->r.width > inst->width) + s->r.width = inst->width; + else + inst->width = s->r.width; + + if (s->r.height > inst->height) + s->r.height = inst->height; + else + inst->height = s->r.height; + break; default: return -EINVAL; -- 1.9.1