Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6141195ybv; Tue, 18 Feb 2020 10:43:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwJgeii6Sx3TB3WGDL4mWAQmLvJlJBawpUdwnG/S+gXWGPw0sXpPU5oIZXKE5DOgcgDf9YC X-Received: by 2002:a05:6830:11:: with SMTP id c17mr16544119otp.360.1582051389490; Tue, 18 Feb 2020 10:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582051389; cv=none; d=google.com; s=arc-20160816; b=aJ5QOExhmdKpJIEuT5EwHAy+NxdypJEKN8oxcBqwuTZNKKQmoIccTzJ04fijuA6bqm uKGXZSrL58bANEAadU75GPfXvcpU4b/eeL11+SZrL+cnbo0YuysOx+MsbJ0pOnzNbtjb McBM2mePxj2j/NKVkLpu35gDGh2CayVcSH9Cxz7p2/TxR//Y6BiBjDynRN7kBIO6BL/0 63xwiBe5/RDrlUV/+XV9U04tUZ1do68cvfL+J2NUcvvPgqTJZ8+eHpcmGIvzu6/i5ads 19WyAbrNICt5IgvxR1ZmwBy+O1G1pn+D/lZMpv7VPDh8Vco1fh00JY9jnNITFU/aACD2 8ljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=d2wRJbkLFbnX5h47+/KLKTC9EOu1JUk/eVuafQjYbHQ=; b=mk9O/ggAZj7iMaRFLH2PHNUz8zhrVNApVwcHctNhJMSxKoSbCcn6tNM+DEDG7xtaeQ YUdI2MwiqcKLMDj+QBZzBbO3w/w7KWfGn7n4RDA7yVqQw9QBMj/qArCZQV3atW+qbNDn HRztzNchs56eg1a7FPnP1eJaDbl+1Y8H21BFi/5hOr59TIYyXPDvQ6jLKViEFzxj6M3N t+Y1USuVjW4CMjQKgZjV7rP4PamZwmgt4SXTW7R8t081fEfip3dWjWEmXtFCDlJ8GPL6 qhWO6dQLPASBxN3yDLphQ2OXzFOoz7aNM2Acr6q2dvTZTlAz6xudG5j9UAhzAN3UeDlw X0Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oI+QH8Md; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si8281971oic.57.2020.02.18.10.42.57; Tue, 18 Feb 2020 10:43:09 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=oI+QH8Md; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbgBRSmb (ORCPT + 99 others); Tue, 18 Feb 2020 13:42:31 -0500 Received: from mail-pl1-f201.google.com ([209.85.214.201]:45948 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgBRSma (ORCPT ); Tue, 18 Feb 2020 13:42:30 -0500 Received: by mail-pl1-f201.google.com with SMTP id 36so10649782plc.12 for ; Tue, 18 Feb 2020 10:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=d2wRJbkLFbnX5h47+/KLKTC9EOu1JUk/eVuafQjYbHQ=; b=oI+QH8Mdb2jaFfP3q7AupqB0QhhC5C1B/q18uf5tlCkfj0fGYsfGN3WEhSgn8ktTye UiMgo+VvnJG1h3Bgz5YmaO1VlLK93iihg4L36/gRFJNb2Qd3D5Efu0r8r3znpxP83uCe JHZIezRmf7eCcLSzet3tsvEgcms82qlBc2J8accp8ALlkwXpz+nhXOQ15ndG0JuS9C+j b+vSHiWUr6dM8sbKQEbaEITysRx+/3XJNjx+f35KRLF7cucVH/OoTLPRV0xXAJgaawi1 Kbsyhl9TtefwGkKkozcsvWIJnfYrtV9lmiao7Oz6XkOxa83P5/iqajKbDe+n0dWBB0jV 2mUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=d2wRJbkLFbnX5h47+/KLKTC9EOu1JUk/eVuafQjYbHQ=; b=PuNJQS/hgoRFwRnGrncXMX/01jnTB7JCRFTjZbuZq2DNn0dfn+1261Muh5C+jClooy kCmQmPpexYMTHXvoxqsyNUTerbsumrtKWWyQf6D8y+5ZUYUt8NtpyMc6BTh0slN7z/kg yyrD5bwgWJLW8pzgU6GIFwUBCmCuvFmHeDwP7b1L574Jih7X1ZY+5lfrJTyR7lnyzg9K QONqWR6LdOGdwklU1iRUarD9Gq8cvIHKzJx8dMxzYgfHIgkZVr9+gs2Xdk1GE4pm/k8Z thmAWJ0P18aQneooRKXpNbd2O5uzqMC1AkGb8CRi4lr2V0/K8gnP9T2QPiV+8SOP7gqW yf3Q== X-Gm-Message-State: APjAAAXI6P8ToePGW+jNMWWE0hH5Mh+oiCELlRn63o+BSNY94iGim4Tf W9oG44h1pIJkb+U/huhQpIlwL65jGwK9IMw= X-Received: by 2002:a63:455c:: with SMTP id u28mr24914926pgk.163.1582051348672; Tue, 18 Feb 2020 10:42:28 -0800 (PST) Date: Tue, 18 Feb 2020 10:42:16 -0800 Message-Id: <20200218184220.139656-1-jkardatzke@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog Subject: [PATCH v3] media: venus: add support for selection rectangles From: Jeffrey Kardatzke To: linux-media@vger.kernel.org Cc: Stanimir Varbanov , Andy Gross , Mauro Carvalho Chehab , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Malathi Gottam , Jeffrey Kardatzke Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Malathi Gottam <> Handles target type crop by setting the new active rectangle to hardware. The new rectangle should be within YUV size. This was taken from: https://lkml.org/lkml/2018/11/9/899 Signed-off-by: Malathi Gottam Signed-off-by: Jeffrey Kardatzke --- drivers/media/platform/qcom/venus/venc.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 453edf966d4f..73b3181eed9a 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -479,10 +479,26 @@ venc_s_selection(struct file *file, void *fh, struct v4l2_selection *s) 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; -- 2.25.0.265.gbab2e86ba0-goog