From patchwork Mon Nov 29 18:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 12693943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF2B9C433F5 for ; Mon, 29 Nov 2021 18:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dO66KzRX4ePTig9dk+UutLpvQKPwxEoO2bqEROA3ChY=; b=afZxgtcN9t5eYh UO/NzJuwZha5ZZRyvz8VfGwuG3FjX6//2SbkU4NRDGHG/jhwbYfy2ydw9/aQKENX74kvNHHFaGzuL ilj1lHwBsz/qowUD+WyLskAuEEhdQ5y9j178/WeXbsZ7DB+ddYTu5IEW6XD2t5AwdSagxLu+ZHKMw i4Ye4dnrMyEp8v0fCPe62TR11paoC84I3gA4lC5jjWhkHu4oLKiGZJsAGE/PXv28HwdZZfBe/0Iw0 TOMHXEgYpufW7ByFlBhZxhMdAnXwAscWpbSP6G8tIcAnrUzMCB0uvWNaZliAVqon5N0KSvpF1LzLy bzRnJRKolzlVdRgvjKxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrlNV-001lTN-3i; Mon, 29 Nov 2021 18:27:49 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrlMV-001l4X-4M for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 18:26:49 +0000 Received: by mail-wr1-x436.google.com with SMTP id v11so38830439wrw.10 for ; Mon, 29 Nov 2021 10:26:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a0+nTL0DN+mXlurHwon8EeRIBZDbCYqkIIB67asrkdI=; b=D9jg0iWuc1rjMrQWm7gWT/0O2pTEON1NW4/9pTdoqwKfyfG/eOpujQLPHTZvi0UWFD BeRngYZOam5f2lmLVwtMDAo2NO03+jsHYgYFmTrYlFh7gHK5+mSXzZOU9OdDKxqrjP2A Yg+gRPXi8vL3b2J9zgkFOJAnhh8FAy3YTQJoqifET/UT4OXiX8dZA8ajHApAupsPjrs8 1muu+0iGJdHC1z85ozo83O5n14AFAi00BQmdjbqGWKMAPpr3Ycj1yqOd4O/N/bmrz9b1 mi5g2pILmEdIiwdlUlPUpt7MjndDbma/75rmPqjlcSq9TwjFfPwjRAgwXo/GwME9njiY P/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a0+nTL0DN+mXlurHwon8EeRIBZDbCYqkIIB67asrkdI=; b=Cvet7bKelNPvTmDMS29Er7CZNNS8imkZztZN2pjnsLUiAx72hs6U6lSj/sSBdqvqMh rPKHjfnz+FVOJ9nfZqPop/7V8jbwPhN/5j/Np63FYeUBBJ4r3Cw8P4zwwKzu1PAVmfIH NHuKPytty1bBR3hd0GjqyMNtv1DWTX1YQObyVJ9pH5P+hOfcZ8RePuGDRTZh/nNreZiI YjfktneQI/bL6pk92l9U5GXOiNVSU4Or6l9jApEO0nGbOo+pvLTPDVtRZr5nhBhTT8rL EDv+fNF0sa0++fDgNZV5VQCbmqJUbPBzSV8QEKvadLZaApr3INogG2Tb1kxk2CtZ33cu ksZw== X-Gm-Message-State: AOAM531u1GKLz+7w7qo6l8gHtsMDzBfqe3WKnzRZ0/JLmGgXi8wx+EX8 BXpUEAgSfa3Fc1mlnza2qS4= X-Google-Smtp-Source: ABdhPJxwEk4PeOYew3lrBCgfb3LuSgZ+3uNJEjxF89OkToMSqyoueFPcPM44bzY/pA8nWtal5C+UuA== X-Received: by 2002:adf:a48e:: with SMTP id g14mr35615932wrb.474.1638210405319; Mon, 29 Nov 2021 10:26:45 -0800 (PST) Received: from kista.localdomain (cpe-86-58-29-253.static.triera.net. [86.58.29.253]) by smtp.gmail.com with ESMTPSA id o12sm85907wmq.12.2021.11.29.10.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 10:26:45 -0800 (PST) From: Jernej Skrabec To: linux-media@vger.kernel.org Cc: ezequiel@vanguardiasur.com.ar, nicolas.dufresne@collabora.com, mchehab@kernel.org, robh+dt@kernel.org, mripard@kernel.org, wens@csie.org, p.zabel@pengutronix.de, andrzej.p@collabora.com, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Jernej Skrabec Subject: [PATCH v2 5/9] media: hantro: move postproc enablement for old cores Date: Mon, 29 Nov 2021 19:26:29 +0100 Message-Id: <20211129182633.480021-6-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211129182633.480021-1-jernej.skrabec@gmail.com> References: <20211129182633.480021-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211129_102647_251306_8D823442 X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Older G2 cores, like that in Allwinner H6, seem to have issue with latching postproc register values if this is first thing done in job. Moving that to the end solves the issue. Signed-off-by: Jernej Skrabec Reviewed-by: Andrzej Pietrasiewicz Reviewed-by: Ezequiel Garcia --- drivers/staging/media/hantro/hantro.h | 2 ++ drivers/staging/media/hantro/hantro_drv.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 83ed25d9657b..06d0f3597694 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -75,6 +75,7 @@ struct hantro_irq { * @num_regs: number of register range names in the array * @double_buffer: core needs double buffering * @legacy_regs: core uses legacy register set + * @late_postproc: postproc must be set up at the end of the job */ struct hantro_variant { unsigned int enc_offset; @@ -98,6 +99,7 @@ struct hantro_variant { int num_regs; unsigned int double_buffer : 1; unsigned int legacy_regs : 1; + unsigned int late_postproc : 1; }; /** diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index 770f4ce71d29..33bf78be145b 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx) v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, &ctx->ctrl_handler); - if (!ctx->is_encoder) { + if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) { if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) hantro_postproc_enable(ctx); else @@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx) { struct vb2_v4l2_buffer *src_buf; + if (!ctx->is_encoder && ctx->dev->variant->late_postproc) { + if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) + hantro_postproc_enable(ctx); + else + hantro_postproc_disable(ctx); + } + src_buf = hantro_get_src_buf(ctx); v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, &ctx->ctrl_handler);