Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp343076pxf; Thu, 18 Mar 2021 01:23:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYkbKAbUojM1oc8i1ZPikq1ju0hW8KjMlBLToIcH0R5GqSep0tozpXkPUX1vVs7Lb6KASj X-Received: by 2002:a05:6402:1115:: with SMTP id u21mr2134027edv.383.1616055813503; Thu, 18 Mar 2021 01:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616055813; cv=none; d=google.com; s=arc-20160816; b=YjV5WuUojVxbdp8GdPkFJsRa77jIuVG7KinpVKXN6jz1cKx5EK8dPUaWWLjmR4IIIx IUwfwW3jtuQbdTiz5KDOetgtOMUpDV4IVGlobDLCfc524EqkURA8zCP4cNdE5sopAYBF J8nz6yhxVTv9KgDxmayYJFusNXNNdnTBA7hU5TPAcSMZOJyOmOla5GxyAWvTYlMOS6Mg AVZ8FcsLSzO6QyF7btjcf6vKVJibY4nko+Lu07qvfwrSDbGjAj/K8f2GuzZaHIABqn1q kyQ8tTbI9Ns0rAXORvnAZrToIurVQWiOO5Shx/uNRsuKk3YWjmfec8eBss4yVGUPpZjh F6sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8gBmfCEKeUESoqhDLWTMo/VPwKRYoCrFkfCzq6hQbDA=; b=t/75Pg/XssDPWFsidX53L28xjRdGlFoU1ICz7812LIFzcS6lXwxmfziRN/hjDaoGu8 kXNbYkewXPHIy5P4tkUNJClQKgDYayuny5O9TDTOwP/3aqf7eVdX7RV4YBy2z456euJA 3RmyGBF0FPVK1bSCGaT2kTo3/Eth4S1UKtRhQdP/D0kHTVY3BLGurbSJBLVe4blMA3Bd /9fBqBy927NWGkIn1HHEN9dCE8mK1gl3lbAmLMhxZSTSO8LdvM1C0nj/HLQ157KaSVRD WoZXF0B29jxEwszi1ur7zWWXrS1bZXiU8fXUzG7fDZduy0RZbWXx4OqkYmmplcfRB2b5 hQ6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si1085575ejf.292.2021.03.18.01.23.10; Thu, 18 Mar 2021 01:23:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbhCRIVq (ORCPT + 99 others); Thu, 18 Mar 2021 04:21:46 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38782 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbhCRIVM (ORCPT ); Thu, 18 Mar 2021 04:21:12 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: benjamin.gaignard) with ESMTPSA id BDAD21F456D3 From: Benjamin Gaignard To: ezequiel@collabora.com, p.zabel@pengutronix.de, mchehab@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, lee.jones@linaro.org, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@siol.net, hverkuil-cisco@xs4all.nl, emil.l.velikov@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v6 08/13] media: hantro: Only use postproc when post processed formats are defined Date: Thu, 18 Mar 2021 09:20:41 +0100 Message-Id: <20210318082046.51546-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210318082046.51546-1-benjamin.gaignard@collabora.com> References: <20210318082046.51546-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the variant doesn't offert postprocessed formats make sure it will be ok. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/hantro/hantro.h | 8 ++------ drivers/staging/media/hantro/hantro_postproc.c | 14 ++++++++++++++ drivers/staging/media/hantro/hantro_v4l2.c | 4 +++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 4ae2071b3bfe..83299e8d3a6c 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -413,12 +413,8 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); } -static inline bool -hantro_needs_postproc(const struct hantro_ctx *ctx, - const struct hantro_fmt *fmt) -{ - return !ctx->is_encoder && fmt->fourcc != V4L2_PIX_FMT_NV12; -} +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt); static inline dma_addr_t hantro_get_dec_buf_addr(struct hantro_ctx *ctx, struct vb2_buffer *vb) diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c index 6d2a8f2a8f0b..ed8916c950a4 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -50,6 +50,20 @@ const struct hantro_postproc_regs hantro_g1_postproc_regs = { .display_width = {G1_REG_PP_DISPLAY_WIDTH, 0, 0xfff}, }; +bool hantro_needs_postproc(const struct hantro_ctx *ctx, + const struct hantro_fmt *fmt) +{ + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder) + return false; + + if (!vpu->variant->postproc_fmts) + return false; + + return fmt->fourcc != V4L2_PIX_FMT_NV12; +} + void hantro_postproc_enable(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 1bc118e375a1..77d7fe62ce81 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -55,7 +55,9 @@ static const struct hantro_fmt * hantro_get_postproc_formats(const struct hantro_ctx *ctx, unsigned int *num_fmts) { - if (ctx->is_encoder) { + struct hantro_dev *vpu = ctx->dev; + + if (ctx->is_encoder || !vpu->variant->postproc_fmts) { *num_fmts = 0; return NULL; } -- 2.25.1