Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3092601imw; Mon, 18 Jul 2022 01:51:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s3pKJL7pRAFI9JA3+mTC5u5mvtLCcXtr0GGJr+bpI1vUIKVP7WdMfnnAN0mSiQAI+ZoUTd X-Received: by 2002:a05:6402:110b:b0:43a:e0b7:1788 with SMTP id u11-20020a056402110b00b0043ae0b71788mr36034937edv.109.1658134271212; Mon, 18 Jul 2022 01:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658134271; cv=none; d=google.com; s=arc-20160816; b=cqTGEeNhJsDCukipAAyIZvMWqconh9IoZJ8f5neFLb+n03Ji2hE0KPFHLoXOn9diz9 pU5qif2WDJRwgp3kD8x2ZXyoE4wQ4rbvvYv/5NmZkmxppnl49tV/RxH8BmFbRCLo7yNF mtHNc9eUX0hMWtyXXViHdCtkqcfZgMrGXi1ScOFxrSJ+gJ5QzsRfcXXlbZnlUzN693+c abrXF+waZFAv/gO6BDBlMLjW6hITAP2u5XY9gtGNx2CSX2CusAY6x8flSGR4pQVxgWt4 /T+Sj+rppFem93BmssVh5KTwPfyO++qdAEedPol+0PWfzUFmHosPJSqRxJH0kIei3Jyr 0QpQ== 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 :dkim-signature; bh=6BIg71pFXFYMlTGxt0V8BPL303jdcy7NtiYmFgbUnds=; b=OrXvxv0Tug3ps5Vx+6zVnVJBV/FTGhSq/xbgzkWhmuq2IluQg1frSfsK89ZUsEIUZ3 qCIcFXVunlEvIOPMwpWRq5AKxgvBfWkt9EitpsLplv0/fHXKLIiGd+o5pU1Ff9Hw1EAy xH7j1G5NeKuP427TsY6lHY1l0l6/GpsYEgVrWm6OMfQ24G4tW5iCGLVDHAJ/Ue42Eymi Ik/0lv2B85T0XDTiUoTnHObGTdHbj6ySMA28Z9SyH7SKj1dwr+JPiFTzmdJTIeLIg+f0 SYbLmdjZudKYkxiEBTgZCvHU7yDXcPnXnQdTmWpC5cyvGlL/gCiPvTlmKlRLVSwOqi8+ fYfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WrJiN1Cm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a0564021f8600b0043a7f8ba394si15572138edc.43.2022.07.18.01.50.46; Mon, 18 Jul 2022 01:51:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WrJiN1Cm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233955AbiGRIkH (ORCPT + 99 others); Mon, 18 Jul 2022 04:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233900AbiGRIj5 (ORCPT ); Mon, 18 Jul 2022 04:39:57 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7928CBC92; Mon, 18 Jul 2022 01:39:56 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:4754:89ee:32c6:e620]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id AE0266601A2E; Mon, 18 Jul 2022 09:39:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1658133595; bh=aAX2fIh0E/jx2jwVuosd8v5FOJr/5j+dV3YioIr80rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WrJiN1Cm4Wa0LYa4FCz+FGHrVrWvTDOfElmkh8S6OI/JEcd0LyhxmhXwUwu4hBATx iK4R8mxeRgYc64pUvA8SQYe7VB7th9p4mN6nKfFAHo4J/Lm45E7nqyUDh6vSy21vMo KJKc5VklJCNKmgjp+E0lUsDR+rabYpt78F/+udczXMdmnp51E20zpAFTKZqBYcsWV7 Ngn5DW/M+ZOsxpcS8jjakmJKsw+fAypmi/3BBEKZOw6plORkUacG5h9YvDpHoOeb37 S2Slbo/FlXImqGUFNfZOPkAgF8j0g6KV/FxPNBijsE42eiwx21BjeMsQOKoqJHItmx SWvYtZOz+YRtQ== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, nicolas.dufresne@collabora.com, andrzej.p@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v2 2/7] media: hantro: HEVC: Fix auxilary buffer size calculation Date: Mon, 18 Jul 2022 10:39:40 +0200 Message-Id: <20220718083945.200845-3-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220718083945.200845-1-benjamin.gaignard@collabora.com> References: <20220718083945.200845-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SAO and FILTER buffers size depend of the bit depth. Make sure we have enough space for 10bit bitstreams. Signed-off-by: Benjamin Gaignard Reviewed-by: Ezequiel Garcia --- drivers/staging/media/hantro/hantro_hevc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/media/hantro/hantro_hevc.c index dcb5c8703b6e..e06837108a09 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -104,7 +104,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx) hevc_dec->tile_bsd.cpu = NULL; } - size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1); + size = (VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8; hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size, &hevc_dec->tile_filter.dma, GFP_KERNEL); @@ -112,7 +112,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx) goto err_free_tile_buffers; hevc_dec->tile_filter.size = size; - size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1); + size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8; hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size, &hevc_dec->tile_sao.dma, GFP_KERNEL); -- 2.32.0