Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3543341pxt; Tue, 10 Aug 2021 06:11:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7nZdrYocR6MpOvD7KcuvpBtNbSlzAFNl2Ajo7mQjMpTcqpEZhSS+jp6PCyixqeSzeZVGz X-Received: by 2002:a17:906:4dd5:: with SMTP id f21mr10485418ejw.284.1628601100503; Tue, 10 Aug 2021 06:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628601100; cv=none; d=google.com; s=arc-20160816; b=0mutAwuGLkht/APhdN8JrZtNxTGnn0jkgXInqJH57X9asOdgvdkoreuwsZNaRnw3Hh TRv4apbuDV/fPxbDnfrr3EDe0ZrakpAMw7Jdyr5sB6fo8yZcyfx+7N3BhBhJ87HyWX8l vD+4CcCX6JJwNazrSx9IR/zkqbaDBTetZSNEnTyA8/fIYOn7KjNPD5Qw98/2qKZamIRc yCxtzmedcRsgnyFAb0rA2Hx6lY8Lhcqc15jWMpnROjgxrrKhvCdqXRN30VfVQBDriQ/I aXo0M/xvYhLT6QY1iT+sCY8M/BzSkqFDhVNaYGyadzIA174n+i7M6TwvO//qFyq9V6cU zktA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=SHQ6VslaIKwRco2eIPRbJTWkTCX5HYqjomsJeFDA8OU=; b=fcWa88XP+6sosHD9mb4c76MIWri5Goi8xHOUWmJo54/RBUMr14SmCmPijWA3wVnIdZ 8qJERQfssfD0/8UfiBkj2QXEaKOzcnEyoaVk5Z3qvbF64thI2PCGufIlqFyT+/OCHs1h i28JOJu+dD4pqc8+gim20poP8tPSsJl7MJk3O5u5TxVf87J+Xvl1QddmQFnR/g/Hpskw CD7rOXxFMZhoJ2RrWJU0hkBNm5Dn+nT0qabBaSD9bThvusoZyz398QXX/j5oYT9CGxmp fItl3WmkT5XbH4rnMBBVR6GnBKXk1Ei+AL2Z4uxlRKoLexLR/hL26mtYAIUPwjVRbx7V rHCw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq21si11043863ejc.226.2021.08.10.06.11.13; Tue, 10 Aug 2021 06:11:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239401AbhHJJuD (ORCPT + 99 others); Tue, 10 Aug 2021 05:50:03 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:61815 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238838AbhHJJsw (ORCPT ); Tue, 10 Aug 2021 05:48:52 -0400 Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 10 Aug 2021 02:48:30 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 10 Aug 2021 02:48:29 -0700 X-QCInternal: smtphost Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg02-blr.qualcomm.com with ESMTP; 10 Aug 2021 15:18:15 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id F2B5D21CA3; Tue, 10 Aug 2021 15:18:14 +0530 (IST) From: Dikshita Agarwal To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH v4 6/7] media: venus: helpers: update NUM_MBS macro calculation Date: Tue, 10 Aug 2021 15:17:54 +0530 Message-Id: <1628588875-23790-7-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1628588875-23790-1-git-send-email-dikshita@codeaurora.org> References: <1628588875-23790-1-git-send-email-dikshita@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Consider alignment while calculating NUM_MBS. Co-developed-by: Mansur Alisha Shaik Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/helpers.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 60a2775..2db33ba 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; @@ -1098,16 +1098,17 @@ 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; + 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) + 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) + num_mbs <= NUM_MBS_4K) mode = VIDC_WORK_MODE_1; } -- 2.7.4