From patchwork Wed Jul 1 21:56:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11637375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 326BC14B7 for ; Wed, 1 Jul 2020 21:56:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 089A42077D for ; Wed, 1 Jul 2020 21:56:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t3qkihA+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="Mw7RrWX0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 089A42077D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kwiboo.se Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:References:In-Reply-To:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xfLrbf7Tpp0WCGwTAIWZQyzeJOuGlI/M0dhQc8K49ug=; b=t3qkihA+C+sGHkICd51MeJSkO6 AwRFdx9xzbu4Hdm5xg0fcNaPJAJkyjjfFKAVZP2WFQF+aY8eUViIlgsIwjk7zvTsH8zo9Nx15pCTm dIvPz4UdTr5iNMPgN4qoA9naupD1QvehM1b4c5TVqcclKv0NbifgT3JM3A8iNZw0IPEqd/rLEiU6R EcA3jXPP0JtzDPO+zi4YxcUQLNv+4AxbDXeadJj52p896Ckt7Hy5HtzZ6PuG3qR04/20l9hxhc5cN KB51jdlg6FcwdGD2SH5wCr4pO2TsW0+Ol5eTKj1WGkhLZ4r4JdBr70j7S2TxmTcK60SXc8rCkOGUC A6ILLPhA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqkiX-00086B-Ra; Wed, 01 Jul 2020 21:56:33 +0000 Received: from o1.b.az.sendgrid.net ([208.117.55.133]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqkiO-00080k-MK for linux-rockchip@lists.infradead.org; Wed, 01 Jul 2020 21:56:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:to:cc:content-type: content-transfer-encoding; s=001; bh=xxBcOYWt9uzoWsnklEsOL7RvonYUzi+J+0wqGYzLRTw=; b=Mw7RrWX0ZzLNqhzpSj0DlF01JA8dDQdPDLDKqgJwZUi4Umu4Fbsn+h1NojdMRLTvYg2t wbvscc5bLknO1zPep+RnYqS0TaB89bExoP9RLqBCmuNj0SmebvrdpgaptHex9KTl2Cu1Zf iGzsoyLwoX8K0FXqkukJyThYge6WuyO9g= Received: by filterdrecv-p3iad2-5b55dcd864-xnspw with SMTP id filterdrecv-p3iad2-5b55dcd864-xnspw-17-5EFD0688-6 2020-07-01 21:56:24.205538858 +0000 UTC m=+449220.630116891 Received: from bionic.localdomain (unknown) by ismtpd0001p1lon1.sendgrid.net (SG) with ESMTP id 9_xgV5kdRsyJnw_SpztECA Wed, 01 Jul 2020 21:56:23.947 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 8/9] media: rkvdec: Add validate_fmt ops for pixelformat validation Date: Wed, 01 Jul 2020 21:56:24 +0000 (UTC) Message-Id: <20200701215616.30874-9-jonas@kwiboo.se> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701215616.30874-1-jonas@kwiboo.se> References: <20200701215616.30874-1-jonas@kwiboo.se> X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h+lXJzeJhqDHpvcg8AJotR+LFDFZT1dM6SQR+PgjpaKMikyyPoncZva0UczSXisuYUKmaKw2JKm4vH5YXbIqJHMK3OMtHNiDgvnEo6Eaj0RuG9FD+++ZirLHj7MfiqpXdYY+gKGitKi4J1wej6k+ILQSpXJbdHuOoGGKJeoDw7WorWGoV2QhCabT39ljn0R0Xw== To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_175624_805020_48AFD7AD X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [208.117.55.133 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [208.117.55.133 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Courbot , Jonas Karlman , Tomasz Figa , Hans Verkuil , Nicolas Dufresne , Ezequiel Garcia MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Add an optional validate_fmt operation that is used to validate the pixelformat of CAPTURE buffers. This is used in next patch to ensure correct pixelformat is used for 10-bit and 4:2:2 content. Signed-off-by: Jonas Karlman --- drivers/staging/media/rkvdec/rkvdec.c | 8 ++++++++ drivers/staging/media/rkvdec/rkvdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c index b1de55aa6535..465444c58f13 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -239,6 +239,14 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, if (WARN_ON(!coded_desc)) return -EINVAL; + if (coded_desc->ops->validate_fmt) { + int ret; + + ret = coded_desc->ops->validate_fmt(ctx, pix_mp->pixelformat); + if (ret) + return ret; + } + for (i = 0; i < coded_desc->num_decoded_fmts; i++) { if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat) break; diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h index 2fc9f46b6910..be4fc3645cde 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -64,6 +64,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf) struct rkvdec_coded_fmt_ops { int (*adjust_fmt)(struct rkvdec_ctx *ctx, struct v4l2_format *f); + int (*validate_fmt)(struct rkvdec_ctx *ctx, u32 pixelformat); int (*start)(struct rkvdec_ctx *ctx); void (*stop)(struct rkvdec_ctx *ctx); int (*run)(struct rkvdec_ctx *ctx);