From patchwork Tue Feb 26 17:04:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 10830595 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 0DBC91575 for ; Tue, 26 Feb 2019 17:05:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E67F92D223 for ; Tue, 26 Feb 2019 17:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAE052D243; Tue, 26 Feb 2019 17:05:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 719FE2D223 for ; Tue, 26 Feb 2019 17:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728316AbfBZRFg (ORCPT ); Tue, 26 Feb 2019 12:05:36 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44138 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727981AbfBZRFg (ORCPT ); Tue, 26 Feb 2019 12:05:36 -0500 Received: by mail-wr1-f65.google.com with SMTP id w2so14767047wrt.11 for ; Tue, 26 Feb 2019 09:05:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zKajMQ8qbbs/vF9eB7W61cC95ASl/yiwMSYyCZNuyJA=; b=YttJkepALoskf+R1rx0ptw+C8NUogmAXMbLJ5HRs3b2wX/9UD1233PaOwh1WmYgnw9 sn7/AfSzwmVB/VQgQHqJ1oTTllGYZ+A590Igym1m/K7CNVlmHO039u3vGWI8AEd3uURl 96xv4J8eKT/LaZKSI+ei/bqWR83JVcjIHXQoUTMSTyQRe19lHPzz7VgKycEJuHFW5gFC 04w00g/VS0paYJ0CWON7mQzwQMJMOZQIV0q69BdMzlQ30IRntGclSfYU0F65RPGHsQ0n f1039P/MuNl1TvyOEvbDqvf/ZXcus+JfSLrKtFo2RX+QFIB8WSncnkAEyWUw6s1FYfWZ 398g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zKajMQ8qbbs/vF9eB7W61cC95ASl/yiwMSYyCZNuyJA=; b=DSQfG4YKXYRFIzXpyIr2kKa1C1TADAS6YdneO7D+Hl5jR/jtjIhMZBPg8PJ7B/rRe2 /L5w0c2rG9FS8ZwML/OrrM/2BNH+fdJn6JUJYoIn8OkixV1GpoHCRtH6EMMUoShADtWF t9FvtUDz2zN4QzTdgltJToING6ArOR2VNxKKJmJJ5zluSh9kNuliJGa1Pvknn6XB55ez GE08KUheHW/Wnep5C16IbnBEOAmwrb51V0QMFzdYk+QBDPFTk84hNM/yw2msMMAVDYPi ImSfgaoTET8JWPJGWJCoAbdEemCqgjgGG0dNyzk69FOuSDD8AmI1vgoB6xXL2BAMzvwk 38+A== X-Gm-Message-State: AHQUAuZ8DOxhxt/p5zfBeUUrwpR408sgNv7lKypEpB42zrKJWJDsE4eU iyEa9iPzJADc6sDJ/KHUVjXvFPiK0AE= X-Google-Smtp-Source: AHgI3IZGmK1cowJHNHIPzQIQRNmJvFmrTRlMkdvT9x7lAcwxBFOe+JOWnBwCumjqJZERDVrSHVrd+A== X-Received: by 2002:adf:ecc6:: with SMTP id s6mr17520871wro.144.1551200734663; Tue, 26 Feb 2019 09:05:34 -0800 (PST) Received: from ubuntu.home ([77.127.107.32]) by smtp.gmail.com with ESMTPSA id w4sm21024486wrk.85.2019.02.26.09.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 09:05:34 -0800 (PST) From: Dafna Hirschfeld To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, helen.koike@collabora.com, Dafna Hirschfeld Subject: [PATCH v5 04/21] media: vicodec: selection api should only check single buffer types Date: Tue, 26 Feb 2019 09:04:57 -0800 Message-Id: <20190226170514.86127-5-dafna3@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190226170514.86127-1-dafna3@gmail.com> References: <20190226170514.86127-1-dafna3@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The selection api should check only single buffer types because multiplanar types are converted to single in drivers/media/v4l2-core/v4l2-ioctl.c Signed-off-by: Dafna Hirschfeld --- drivers/media/platform/vicodec/vicodec-core.c | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index d7636fe9e174..b92a91e06e18 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -945,16 +945,6 @@ static int vidioc_g_selection(struct file *file, void *priv, { struct vicodec_ctx *ctx = file2ctx(file); struct vicodec_q_data *q_data; - enum v4l2_buf_type valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - enum v4l2_buf_type valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - - if (multiplanar) { - valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - } - - if (s->type != valid_cap_type && s->type != valid_out_type) - return -EINVAL; q_data = get_q_data(ctx, s->type); if (!q_data) @@ -963,8 +953,8 @@ static int vidioc_g_selection(struct file *file, void *priv, * encoder supports only cropping on the OUTPUT buffer * decoder supports only composing on the CAPTURE buffer */ - if ((ctx->is_enc && s->type == valid_out_type) || - (!ctx->is_enc && s->type == valid_cap_type)) { + if ((ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) || + (!ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)) { switch (s->target) { case V4L2_SEL_TGT_COMPOSE: case V4L2_SEL_TGT_CROP: @@ -992,12 +982,8 @@ static int vidioc_s_selection(struct file *file, void *priv, { struct vicodec_ctx *ctx = file2ctx(file); struct vicodec_q_data *q_data; - enum v4l2_buf_type out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - - if (multiplanar) - out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - if (s->type != out_type) + if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) return -EINVAL; q_data = get_q_data(ctx, s->type);