From patchwork Sun Oct 29 18:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13439845 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 245A0C4332F for ; Sun, 29 Oct 2023 18:35:06 +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=oYJQXNsuXYszZPjZOtAV9yd/qVXJQtm2bOMKNoUbMqo=; b=RgsROpNeQjuyQf LzQKYSJrHnVTvkS9nbsajlK5eQmFrEeSZELrXvlXxesoSznJYY0vTQdXnXxgP2qH/7lS0LrsXaRTN HIiddg1Jr4XQfEeKhfTzkfG496AHIXJRo1d75bnblkzzFPqAxIMa4DF6HvfoYb5tfW7aM6LxqoS8r GMWhYE5MS9drzTF5Ud8fX+lBH3fUAWY9Gt8brHbS2w8jbFOpoaBoJ/RZu/Z18Y5xx3pMG55K+JLwU zKnZBlerG4bVtAfRCcAwevGfw4fWfKAwT7+MpW/Gl1fDcM6EpI2EX+KEtdn4NDRjviesqt7TcZiWS MVEbikDkaug8UDm+i0JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxAck-0020Rd-0p; Sun, 29 Oct 2023 18:34:58 +0000 Received: from smtp.forwardemail.net ([149.28.215.223]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxAce-0020PI-1S for linux-rockchip@lists.infradead.org; Sun, 29 Oct 2023 18:34:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1698604485; bh=TjALA8+JUykYZHDpAwjPY9nVwije8ffpqMNBtSLkpsI=; b=GLqK5fpOOGkVJuoKgzr2RTjhuMY7zcU6z/MA2FtUL2CggbwROrGmuwfU1CXk9jbfy5Y7I65Y3 J9x/MKbjfA+Hxa18NQVN6ymwmaMsePe5aF7i9JRoLVyeWozWLSdAZR9XVyu1iu7ykh5oJu0NzFP xTFDGjrlx1T6cvD919m1pmC7o31TFEEi9jYqVBIqLfUBSsFCvlrSW6CMGVeJ13UWjszhA1Oy6Yu Py4XLYOzC3jx1vb4uKOi39j/CQyCK6TCEyAGQoc6USLP/32YrUHQoGp+cHuqUxUzBBpNPqeRtGT zUpPvctOId6oPi36knRBGe9acLWGUrn1CM5pQKcb/F3g== From: Jonas Karlman To: Ezequiel Garcia , Mauro Carvalho Chehab , "Greg Kroah-Hartman" Cc: Alex Bee , Nicolas Dufresne , Benjamin Gaignard , Sebastian Fricke , Christopher Obbard , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v3 03/10] media: rkvdec: h264: Use bytesperline and buffer height as virstride Date: Sun, 29 Oct 2023 18:34:10 +0000 Message-ID: <20231029183427.1781554-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029183427.1781554-1-jonas@kwiboo.se> References: <20231029183427.1781554-1-jonas@kwiboo.se> MIME-Version: 1.0 X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-ForwardEmail-ID: 653ea5c58fe0ffca230b0f2f X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231029_113452_529009_097E0359 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Use bytesperline and buffer height to calculate the strides configured. This does not really change anything other than ensuring the bytesperline that is signaled to userspace matches what is configured in HW. Signed-off-by: Jonas Karlman --- v3: - Remove unnecessary yuv_virstride += drivers/staging/media/rkvdec/rkvdec-h264.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c index 4fc167b42cf0..7a1e76d423df 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c @@ -896,9 +896,9 @@ static void config_registers(struct rkvdec_ctx *ctx, dma_addr_t rlc_addr; dma_addr_t refer_addr; u32 rlc_len; - u32 hor_virstride = 0; - u32 ver_virstride = 0; - u32 y_virstride = 0; + u32 hor_virstride; + u32 ver_virstride; + u32 y_virstride; u32 yuv_virstride = 0; u32 offset; dma_addr_t dst_addr; @@ -909,16 +909,16 @@ static void config_registers(struct rkvdec_ctx *ctx, f = &ctx->decoded_fmt; dst_fmt = &f->fmt.pix_mp; - hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8; - ver_virstride = round_up(dst_fmt->height, 16); + hor_virstride = dst_fmt->plane_fmt[0].bytesperline; + ver_virstride = dst_fmt->height; y_virstride = hor_virstride * ver_virstride; if (sps->chroma_format_idc == 0) yuv_virstride = y_virstride; else if (sps->chroma_format_idc == 1) - yuv_virstride += y_virstride + y_virstride / 2; + yuv_virstride = y_virstride + y_virstride / 2; else if (sps->chroma_format_idc == 2) - yuv_virstride += 2 * y_virstride; + yuv_virstride = 2 * y_virstride; reg = RKVDEC_Y_HOR_VIRSTRIDE(hor_virstride / 16) | RKVDEC_UV_HOR_VIRSTRIDE(hor_virstride / 16) |