From patchwork Wed Nov 2 18:07:59 2022 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: 13028740 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 EAC14C433FE for ; Wed, 2 Nov 2022 18:11:39 +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: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:In-Reply-To:References: List-Owner; bh=+0ZY0DiResvplTlsLfarRBmnHjvfl+u4K7fgRbdHQSk=; b=jqSUuIxMaHMmZj uQ3AJLvppYY2y6ACad0TN39XcgkqvnqsrI50JJP9z/pRqQlRJ2N9Uvkbjni1blO3i20zFhl0/gTDI w9P4rW1lKK1AflUSMvviaZGldtyq5GK17uaEcIWaDuUKtFpjVIqYKeUC09wG/CNeMkpmtF03a7EjP aQocmkwKyIxxtaG+HSZ8+8Gsf94EFfnxtDsSsXvda8kDITdQRDzxIvOQB8GNDk9ZJVeA927DcsdaH 0hvuaW6FblDy39PPMoPWjOIw6uJGDuWxprJ+hcRTQvHVugKz7x7vEfnERbfSOytTQQj9vDhUpRhHq 1y73swXb6nlhu0Kn/M+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqIC4-00CqBM-AK; Wed, 02 Nov 2022 18:10:28 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqIA0-00CodH-MM for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 18:08:22 +0000 Received: by mail-ej1-x630.google.com with SMTP id b2so47504309eja.6 for ; Wed, 02 Nov 2022 11:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=94rmcDkdjrCGxv2Cn/WpEypZpF2kxP75q7QoZpGWNew=; b=ekX5hSaEueliIxmzaE5dgNJ3EX4kjNF5VY2hGEdzwx6d3+r2oOn96JfuAKDyci+QLq XQ+XJ2MTFjJE/IQAUbqjWsBYD7F/V8ZPEDEtiKxIohY26Ow0vpAWBSaPe0rYb2nSFXkP T8uyQenowxqzR2CP7+JD0AdVaxorzLxwxdaKkJdQrkK0V3nOTj85AhlV8eDaeESDIiga Hn1JXPIPI7UxsSSOV7SSaR0INEXUiDRrF0UrIfWbn8/bw78MfYxLB2b3+ZezMyEAYmXK TElTQNvengSph89HBmZT+iFMCKQcQkOr5N0lxAorn3nyzFhrv+oBkZ+21JMUBC2jYxMw YZ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=94rmcDkdjrCGxv2Cn/WpEypZpF2kxP75q7QoZpGWNew=; b=U4eXVcastNex35ejL4r05ZQFz3iqmEoCJaw2VZeLy7j+520A//CUBU65WhNHKDlhgh ayNq0k80FvA3Tm2lI+RrJnCvhSDJzMwxJRcMw4M/DtZtNA2B6MdMehIouFn1YfQXEhEx NmQJ3H9y5TDNpTYuqqNqmbCc3BGJ5lZ9bo4p60ce6/wgZE4UECZy6z+kSffuvREvZhUd jjnwkj7My5ETN0nkmBMpIDJm6q9FGncR4g6gDcWiUFKx1RUohyyLhz96dIIkM6p/y4sv mcaDHcUZysdWhUg1Evy24GUGsBxM/r7y1JZzYx8E7vDLulcdhWZlD3Bt9zB8PTyW9Sm8 I4zA== X-Gm-Message-State: ACrzQf25PT5KOcBPQWLafXsKa1GyTU2fnM4eFW7GwS01oyx5C8nBi5js 4R6CBu2QJgNt/6TBMxY6mzU= X-Google-Smtp-Source: AMsMyM45xz8lKz2n6ZZKU3vArbgM/LEaLIXdVBWy0aGRkor1nOrSj43LK1IZVOfAkUEFrv2qMYLIQg== X-Received: by 2002:a17:906:2353:b0:7ad:daae:6edd with SMTP id m19-20020a170906235300b007addaae6eddmr15139513eja.40.1667412497517; Wed, 02 Nov 2022 11:08:17 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id gy8-20020a170906f24800b007317f017e64sm5677460ejb.134.2022.11.02.11.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 11:08:16 -0700 (PDT) From: Jernej Skrabec To: mripard@kernel.org, paul.kocialkowski@bootlin.com Cc: mchehab@kernel.org, gregkh@linuxfoundation.org, wens@csie.org, samuel@sholland.org, hverkuil-cisco@xs4all.nl, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH v2 00/11] media: cedrus: Format handling improvements and 10-bit HEVC support Date: Wed, 2 Nov 2022 19:07:59 +0100 Message-Id: <20221102180810.267252-1-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_110820_767143_D28D12A4 X-CRM114-Status: GOOD ( 12.39 ) 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 While my first intention was to just add 10-bit HEVC handling, I noticed a few format handling issues and a bit of redundancy in some cases. Final result is that driver now sticks to stateless decoder rules better. Format handling improvements: 1. Default format selection is now based on HW capabilities. Before, MPEG2 was hardcoded but some Cedrus variants don't actually support it. 2. Controls are registered only if related codec is supported by HW. 3. Untiled output format is preferred, if supported, over tiled one. All display engine cores support untiled format, but only first generation supports tiled one. I hope this makes Cedrus eligible for destaging. Best regards, Jernej Changes from v1: - collected acks, except for patch 5, which was changed - use cedrus_is_capable() for cedrus_find_format() too (patch 4) - tightly pack control pointers in ctx->ctrls[] (patch 5) Jernej Skrabec (11): media: cedrus: remove superfluous call media: cedrus: Add format reset helpers media: cedrus: use helper to set default formats media: cedrus: Add helper for checking capabilities media: cedrus: Filter controls based on capability media: cedrus: set codec ops immediately media: cedrus: Remove cedrus_codec enum media: cedrus: prefer untiled capture format media: cedrus: initialize controls a bit later media: cedrus: Adjust buffer size based on control values media: cedrus: h265: Support decoding 10-bit frames drivers/staging/media/sunxi/cedrus/cedrus.c | 102 +++++---- drivers/staging/media/sunxi/cedrus/cedrus.h | 22 +- .../staging/media/sunxi/cedrus/cedrus_dec.c | 4 +- .../staging/media/sunxi/cedrus/cedrus_h264.c | 2 +- .../staging/media/sunxi/cedrus/cedrus_h265.c | 37 +++- .../staging/media/sunxi/cedrus/cedrus_hw.c | 18 +- .../staging/media/sunxi/cedrus/cedrus_hw.h | 2 +- .../staging/media/sunxi/cedrus/cedrus_mpeg2.c | 2 +- .../staging/media/sunxi/cedrus/cedrus_regs.h | 16 ++ .../staging/media/sunxi/cedrus/cedrus_video.c | 200 ++++++++++-------- .../staging/media/sunxi/cedrus/cedrus_video.h | 2 + .../staging/media/sunxi/cedrus/cedrus_vp8.c | 2 +- 12 files changed, 244 insertions(+), 165 deletions(-) --- 2.38.1