Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2518931pxj; Mon, 31 May 2021 04:23:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHHNFTx8E5BXGe5Pr8c2BEFl/e3aLKynSHKl0Satur0jNNTXghg++NgEVzdUBmhsMMCJ9P X-Received: by 2002:a05:6638:33a2:: with SMTP id h34mr4738558jav.60.1622460226112; Mon, 31 May 2021 04:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622460226; cv=none; d=google.com; s=arc-20160816; b=IvdvzML1dBO8OjBbODaywJkkI/1ziKxRBmiwFi71xDtZTzWyzcKgbiFJV+LzVw5PnE ybuzTEqckyj+O56BYGuWKOgarNNa+BZj3TcfoaE01QfjlRDJZ2kKVeBEZ05tyuK3/XTu lnevmUSZiLVNfQSfkgV4NbUH7YKWJryovUdHs4CXfpmWFbBlboYZsdFG76TikcdConwe LpP4KxDXReadyT5uMfAc8/zbhqmE9Q7C0yNMsY8Yllu9AF6z/d9IehGInDWFrmRRkyoB KuIVyJ/FpLob1Lk6tHayDW8DEqdp2m3rOTkZ+Axc/bSCQBHVtV0XIC4Fri7AFWZYVm7V vxVg== 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=FdUWrypFboll3s6XGR9/NH8Gi70rzyMBTmGkIlVn5fQ=; b=UTVheAyuUPTGVdNUpdXThzJdoZk0bHiTZQwIrirox9m0qvk8N7pyqqK2irE7MFxd+m V6s0yV5vd+s/qsp0Do+IuPUrKb5lbjRucfu8bnGtlUfjJ1ljGHzrglAcYOPE7Q7uKCER zcUYjny7MGCQ5akTS/5AT2leRFIY+abyg++OckMuYeCTMtcz1Ptcpq0AhL0Oiw4rdEAq +Vs5AGTe7xcNvaVVXTHfrxiLgv0E8Hr6WIkWediYNBbZHZXao0CMYcoHVoKEMC/SpkWE VypmaEAXUbpTMN+pKwfAXjUVD0o/vQgF1rUGb1/6q5SG7oUrAYLhZdjagEic3iMekJ/5 4PLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nN1/gv2a"; 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 t10si15215394ilf.139.2021.05.31.04.23.31; Mon, 31 May 2021 04:23:46 -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="nN1/gv2a"; 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 S231360AbhEaLXa (ORCPT + 99 others); Mon, 31 May 2021 07:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbhEaLX0 (ORCPT ); Mon, 31 May 2021 07:23:26 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B750DC06174A for ; Mon, 31 May 2021 04:21:46 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id b17so13136374ede.0 for ; Mon, 31 May 2021 04:21:46 -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=FdUWrypFboll3s6XGR9/NH8Gi70rzyMBTmGkIlVn5fQ=; b=nN1/gv2aRK2Ka4CUIRbUDq9drpxmUdjaRVH6FquQHWKZvgADex2vktzLgxtsGS6jRd teh/1yI+GhGPDTFshNTMOCKHGwnHoiOGljQHuewaUXo18F3l1EHZ4YfrOfmnuWmwQx8A GHp7kpSkSJAKvc98aWO1MeptFtovu2dXIFCvcVIVEQBxkNH2eedm0TLGXeD5Xeck02Pf UTmeCdTnLNMaNQc4yGpYMRy59v42YEv8qMMj5RfZMAyS8tKeoQbkP4PtsW3oFlYUxKUV UE9bBET/TqpxoC4b3abv1Ut7dmZwszopG5IF2KLSUIXl1j/FfA5/a9frn0V4hhZp6pYl SJiw== 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=FdUWrypFboll3s6XGR9/NH8Gi70rzyMBTmGkIlVn5fQ=; b=VQktvfCnVwtoTY29F6TsC2H0UTm52dmZJ1NEiaqGgHRil/x3xzxZiIzVoFi9/Vr4p9 dZ9F1D1Xp/L1phVXhi34EgsfDSfxYziCUGnmI+T0VSSK3/Sz3QyxDuXqY85edFTM+79b Tcl4ZGlg72PkE7VJ2VtYI6UxNeGKW0WzvSSU89eyds9elyL7PLe78/TTc5Pbak0tXxVe eRYvAQR7c54MutewfXeSV3pl/f4glWNIH0Cw26ULj4F86+X9nUTD/GRKDET5ohojMzYN +ASeA7IwC9Ltfz+OUkWypGd016yiy/m0TEaA/S2QFEd9Bwlvo+ihAmWjNOUf/JxBF3xl Oo1w== X-Gm-Message-State: AOAM530emO2jyqbqJuWK2/NOVECLMYhYmKYEnOjdc2jzbfVfbZipFY7z F806WS2ANER8wRtjXJdfcIpKWg== X-Received: by 2002:aa7:c450:: with SMTP id n16mr516801edr.386.1622460105389; Mon, 31 May 2021 04:21:45 -0700 (PDT) Received: from [192.168.1.28] (hst-221-6.medicom.bg. [84.238.221.6]) by smtp.googlemail.com with ESMTPSA id dh21sm6784486edb.28.2021.05.31.04.21.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 May 2021 04:21:45 -0700 (PDT) Subject: Re: [PATCH 6/7] media: venus: helpers: update NUM_MBS macro calculation To: Dikshita Agarwal , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, vgarodia@codeaurora.org References: <1621417008-6117-1-git-send-email-dikshita@codeaurora.org> <1621417008-6117-7-git-send-email-dikshita@codeaurora.org> From: Stanimir Varbanov Message-ID: Date: Mon, 31 May 2021 14:21:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1621417008-6117-7-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 5/19/21 12:36 PM, Dikshita Agarwal wrote: > Consider alignment while calculating NUM_MBS. > > Co-developed-by: Mansur Alisha Shaik > Signed-off-by: Dikshita Agarwal > --- > drivers/media/platform/qcom/venus/helpers.c | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c > index 2223f55..cbe653f 100644 > --- a/drivers/media/platform/qcom/venus/helpers.c > +++ b/drivers/media/platform/qcom/venus/helpers.c > @@ -18,8 +18,8 @@ > #include "hfi_platform.h" > #include "hfi_parser.h" > > -#define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4)) > -#define NUM_MBS_4K (((4096 + 15) >> 4) * ((2304 + 15) >> 4)) > +#define NUM_MBS_720P (((ALIGN(1280, 16)) >> 4) * ((ALIGN(736, 16)) >> 4)) > +#define NUM_MBS_4K (((ALIGN(4096, 16)) >> 4) * ((ALIGN(2304, 16)) >> 4)) > > struct intbuf { > struct list_head list; > @@ -1099,17 +1099,19 @@ static u32 venus_helper_get_work_mode(struct venus_inst *inst) > u32 num_mbs; > > mode = VIDC_WORK_MODE_2; > - if (inst->session_type == VIDC_SESSION_TYPE_DEC) { > - num_mbs = (ALIGN(inst->height, 16) * ALIGN(inst->width, 16)) / 256; > - if (inst->hfi_codec == HFI_VIDEO_CODEC_MPEG2 || > - inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE || > - num_mbs <= NUM_MBS_720P) > - mode = VIDC_WORK_MODE_1; > - } else { > - num_mbs = (ALIGN(inst->out_height, 16) * ALIGN(inst->out_width, 16)) / 256; > - if (inst->hfi_codec == HFI_VIDEO_CODEC_VP8 && > - num_mbs <= NUM_MBS_4K) > - mode = VIDC_WORK_MODE_1; > + if (IS_V6(inst->core)) { IS_V6() is not needed - we already have this check in venus_helper_set_work_mode() > + if (inst->session_type == VIDC_SESSION_TYPE_DEC) { > + num_mbs = ((ALIGN(inst->height, 16))/16 * (ALIGN(inst->width, 16)))/16; > + if (inst->hfi_codec == HFI_VIDEO_CODEC_MPEG2 || > + inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE || > + num_mbs <= NUM_MBS_720P) > + mode = VIDC_WORK_MODE_1; > + } else { > + num_mbs = (ALIGN(inst->out_height, 16) * ALIGN(inst->out_width, 16)) / 256; > + if (inst->hfi_codec == HFI_VIDEO_CODEC_VP8 && > + num_mbs <= NUM_MBS_4K) > + mode = VIDC_WORK_MODE_1; > + } > } > > return mode; > -- regards, Stan