Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp414927pxf; Wed, 24 Mar 2021 07:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1BcW7MN2ww0zSBmRrdnOb1ubg84g4NK4E5a29x6bE0mkgOVlJ6EsycybSHYe0z9/0r7R+ X-Received: by 2002:a17:906:d8d3:: with SMTP id re19mr4159353ejb.440.1616597269530; Wed, 24 Mar 2021 07:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616597269; cv=none; d=google.com; s=arc-20160816; b=z05PKBbNAGYWHzJjSRs/cgZYBxQ6RRMVJSYHHxI7p3e0+JnOjCtXzH21OhgP7IncR1 YUl4dOd4w7WhSfO7M0qpcQ5lLeia5V/PABgqdkhSAfDZVVP22y0YWYLVdvHMLadntSQ5 rLhJQVFOgPewfh3tRuUIpCjmmn/Jw6Jtgd2AIf29Va5+fLkpJFlxg2sw8UiZJvEnYTb+ dyY90UWFTsUopqPqWfvnRVCU1Ryk4naCI01SFUCbz/de/9t3FzxI5CDtRXd+S8MgCh7L X/Bo0zlQ1TiO5Z9s7FuXpDrrjTsA54qoM69dIs5DtMzPIM+Qa6l3JgS0hdbnT1oghyIG lOtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=hw1eLcINJXJ7kBu9TNdDZUsBVYHNAqV2qgHC5PFjVRA=; b=VuXWziuFHRU94TGX2iZOrrhlmQMXnXEChr82D9kDy/9+ovJ6HwU/dxqjZLsPcx5D7e iPLY00D5o4w8pJ8xhr6dIhjbgm1GZIwk6hM99Zb9pFSO8rS8IYtazLV5vNMx0EzbyFoE l1+aGwYciIAqsdGukDax928IAb46yX2rSzOSuS5Mac0aypC2abJn8JBqaGnNxSCd2Uzn pXptNiIk5xf6o9IkLDjq4NfSjoOrhjXd1fhkSB0VvSTCXwjv/np3aH00F8aUwn0mqOoL fUIyj6RfCginz/XWO6cQLJKgYdYCEDdDQpiANNx25jk6GKKFqcaLPkbrinHs4zuXBZfg 1W3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FBHHyyBA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si1985918ejp.450.2021.03.24.07.47.25; Wed, 24 Mar 2021 07:47:49 -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; dkim=pass header.i=@linaro.org header.s=google header.b=FBHHyyBA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236266AbhCXOpr (ORCPT + 99 others); Wed, 24 Mar 2021 10:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbhCXOpN (ORCPT ); Wed, 24 Mar 2021 10:45:13 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE564C0613DF for ; Wed, 24 Mar 2021 07:45:12 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id l4so33296648ejc.10 for ; Wed, 24 Mar 2021 07:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hw1eLcINJXJ7kBu9TNdDZUsBVYHNAqV2qgHC5PFjVRA=; b=FBHHyyBA9USwL9FdcXdH+9SxVdnTbS6u6k2Ufu/4jq1Ow62XmPhd3n2RBhom7FzaQE 6ci1yOhnA3cFJgwdtoo18EkFRkEG1fOeXrKc/y19A/OtOd5r6Lj/MGWXipDdtAS+2m91 rye5ubDqJ5PgpfVOekXC9l+ppk/tWOQoD62WNmxvUvJqr2HJ4R/IN9j852BNoaNIKnsJ m0eQsIs+ULjirzksoPHr2mS5EjVeffD9USpVa+M69eLrCrF51OSWAvFqJ/Xv2Y1i1eeu eMPTnx9SQXhwanin3j0zbGZSOz+Ahm0QhFxAKIZyZSmKcrDWTqF/zEgBR1L1U45yDyPn xI7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hw1eLcINJXJ7kBu9TNdDZUsBVYHNAqV2qgHC5PFjVRA=; b=mrQkm/HrlKIFKrR7GjIiUdQkrUZwvh96DOX2MS539sIfw/7+O9tLq2WOlbosdkMpa1 jBj0PO279cMJpD5Y8pNFLfxNCE31Sk/56PlE8JB9isMo36paxZFGg26af4U48Opz8tEl ovc3MEHAsHUG5cIQ2HmbJT1dzyUVrsLhyCJtPBbplZwAyzmO7JDMibIRZaeIBbvvRuiB t1uxIqEi4UuDYgdqhxwerNHyiYUz65Q1CBjOlKL7GVXpfg4yTwF1GsZOLG9a3pNKonrd WJX+UMR4wU1g5njDsRG1PVKpUG2YxT04KSc0VNkof9JA+h5LUlksf4C7w2IlpSuTMAYf 3QMA== X-Gm-Message-State: AOAM532FvruFrjP4IvE567LewhC5lse5CEkg0cHBgOdX+59aPWHNgdMl DRrDxPkXUxA+tfPhwGskG0M9iQ== X-Received: by 2002:a17:906:4dce:: with SMTP id f14mr4004853ejw.349.1616597111367; Wed, 24 Mar 2021 07:45:11 -0700 (PDT) Received: from [192.168.1.54] (hst-221-122.medicom.bg. [84.238.221.122]) by smtp.googlemail.com with ESMTPSA id f21sm1022723ejw.124.2021.03.24.07.45.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 07:45:11 -0700 (PDT) Subject: Re: [PATCH] media: venus: Fix internal buffer size calculations for v6. To: Dikshita Agarwal , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org References: <1615970128-25668-1-git-send-email-dikshita@codeaurora.org> From: Stanimir Varbanov Message-ID: <4716b318-08f4-0129-5021-b1b6dec3f174@linaro.org> Date: Wed, 24 Mar 2021 16:45:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1615970128-25668-1-git-send-email-dikshita@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/17/21 10:35 AM, Dikshita Agarwal wrote: > - Update persist buffer size for encoder to 204800. > - Update persist buffer size calculation for h264 decoder. > - h264d level 6 support needs update in internal buffer size. > update below buffers size > - h264 decoder colocated motion vector buffer. > - h264 decoder VPP command buffer. > - h265 decoder VPP command buffer. > - Update VP9_NUM_FRAME_INFO_BUF to 32. > > Signed-off-by: Dikshita Agarwal > --- > .../media/platform/qcom/venus/hfi_plat_bufs_v6.c | 27 ++++++++++++++-------- > 1 file changed, 18 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > index d43d1a5..a41ad63 100644 > --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > @@ -40,7 +40,8 @@ > > #define MAX_TILE_COLUMNS 32 /* 8K/256 */ > > -#define NUM_HW_PIC_BUF 10 > +#define VPP_CMD_MAX_SIZE BIT(20) This macro represents size, so I think it would be better to use SZ_1M. > +#define NUM_HW_PIC_BUF 32 > #define BIN_BUFFER_THRESHOLD (1280 * 736) > #define H264D_MAX_SLICE 1800 > /* sizeof(h264d_buftab_t) aligned to 256 */ > @@ -90,6 +91,7 @@ > #define SIZE_SLIST_BUF_H264 512 > #define LCU_MAX_SIZE_PELS 64 > #define LCU_MIN_SIZE_PELS 16 > +#define SIZE_SEI_USERDATA 4096 > > #define H265D_MAX_SLICE 600 > #define SIZE_H265D_HW_PIC_T SIZE_H264D_HW_PIC_T > @@ -199,7 +201,7 @@ static inline u32 size_vpxd_lb_se_left_ctrl(u32 width, u32 height) > #define VPX_DECODER_FRAME_BIN_RES_BUDGET_RATIO_DEN 2 > > #define VP8_NUM_FRAME_INFO_BUF (5 + 1) > -#define VP9_NUM_FRAME_INFO_BUF (8 + 2 + 1 + 8) > +#define VP9_NUM_FRAME_INFO_BUF 32 > #define VP8_NUM_PROBABILITY_TABLE_BUF VP8_NUM_FRAME_INFO_BUF > #define VP9_NUM_PROBABILITY_TABLE_BUF (VP9_NUM_FRAME_INFO_BUF + 4) > #define VP8_PROB_TABLE_SIZE 3840 > @@ -211,7 +213,7 @@ static inline u32 size_vpxd_lb_se_left_ctrl(u32 width, u32 height) > > #define QMATRIX_SIZE (sizeof(u32) * 128 + 256) > #define MP2D_QPDUMP_SIZE 115200 > -#define HFI_IRIS2_ENC_PERSIST_SIZE 102400 > +#define HFI_IRIS2_ENC_PERSIST_SIZE 204800 > #define HFI_MAX_COL_FRAME 6 > #define HFI_VENUS_VENC_TRE_WB_BUFF_SIZE (65 << 4) /* in Bytes */ > #define HFI_VENUS_VENC_DB_LINE_BUFF_PER_MB 512 > @@ -467,7 +469,7 @@ static u32 hfi_iris2_h264d_comv_size(u32 width, u32 height, > { > u32 frame_width_in_mbs = ((width + 15) >> 4); > u32 frame_height_in_mbs = ((height + 15) >> 4); > - u32 col_mv_aligned_width = (frame_width_in_mbs << 6); > + u32 col_mv_aligned_width = (frame_width_in_mbs << 7); So we start align on 256 instead of 128? > u32 col_zero_aligned_width = (frame_width_in_mbs << 2); > u32 col_zero_size = 0, size_colloc = 0, comv_size = 0; > > @@ -499,10 +501,14 @@ static u32 size_h264d_bse_cmd_buf(u32 height) > > static u32 size_h264d_vpp_cmd_buf(u32 height) > { > + u32 size = 0; > u32 aligned_height = ALIGN(height, 32); Add blank line here. > + size = min_t(u32, (((aligned_height + 15) >> 4) * 3 * 4), H264D_MAX_SLICE) * > + SIZE_H264D_VPP_CMD_PER_BUF; > + if (size > VPP_CMD_MAX_SIZE) > + size = VPP_CMD_MAX_SIZE; > > - return min_t(u32, (((aligned_height + 15) >> 4) * 3 * 4), > - H264D_MAX_SLICE) * SIZE_H264D_VPP_CMD_PER_BUF; > + return size; > } > > static u32 hfi_iris2_h264d_non_comv_size(u32 width, u32 height, > @@ -559,8 +565,11 @@ static u32 size_h265d_vpp_cmd_buf(u32 width, u32 height) > size = min_t(u32, size, H265D_MAX_SLICE + 1); > size = ALIGN(size, 4); > size = 2 * size * SIZE_H265D_VPP_CMD_PER_BUF; > + size = ALIGN(size, HFI_DMA_ALIGNMENT); > + if (size > VPP_CMD_MAX_SIZE) > + size = VPP_CMD_MAX_SIZE; > > - return ALIGN(size, HFI_DMA_ALIGNMENT); > + return size; > } > > static u32 hfi_iris2_h265d_comv_size(u32 width, u32 height, > @@ -1004,8 +1013,8 @@ static u32 enc_persist_size(void) > > static u32 h264d_persist1_size(void) > { > - return ALIGN((SIZE_SLIST_BUF_H264 * NUM_SLIST_BUF_H264), > - HFI_DMA_ALIGNMENT); > + return ALIGN((SIZE_SLIST_BUF_H264 * NUM_SLIST_BUF_H264 > + + NUM_HW_PIC_BUF * SIZE_SEI_USERDATA), HFI_DMA_ALIGNMENT); > } > > static u32 h265d_persist1_size(void) > -- regards, Stan