Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp138332pxv; Wed, 14 Jul 2021 00:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbTPpX0HcOzgm1+HfZWIBhKFLuNz61WFYAN3IHpddN770sT4Amr6q86jfFcvPIKoV4Qn4S X-Received: by 2002:a05:6402:7cc:: with SMTP id u12mr11548825edy.156.1626246369124; Wed, 14 Jul 2021 00:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626246369; cv=none; d=google.com; s=arc-20160816; b=K2m3z+I+qQOM3piQWFfC7h/Jn8LeuWTJyvoOj6bhLecWzw10dAQRLWwqeEJXPnQDTA 2ApQ9d/0mBtK2YgZBCFk4aag3HY9aUHVgCAqbF3d+/1LwF0ke7EN7L/gq7nQDJ0G1O0P 3G4mZ+wVtEPoVQMerpwFQNoiG/izExoWwRwsn7b6h6y74LVJVeHs/8jjnf66/bqLREQK qLYj2JNbICY/7WJAB/md2LL+0K66C62o7CCS53qUX4GYZqZjfrl9Y9IiYkIMakgiul1A 1OyUFgCALUDlV2zOs9MIDiIjVctfXWP27lz+pIqfun1tM24LZXeDm0QeJtq1X2SSGTuM zdOg== 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=QndgXRkG7RfM5/gSRc1n3fD7uUckaUhQGku+wwSvVCM=; b=ZSaZl1p6Xh/WhFOnVxzYS5UT8DCqboKWbIopeNEuafCTfOd8sOxlx7JKD9MyhLossW C5QItB1euDOs9875bWy+AV2NegVcGQ0u+BwnYRDxWACbKTcnyE8z5QUv9ZsEiqQbheXu XyzIMHu2nE6ylqUCU/xWMQKNMBoiQWVnmKtR7bEEq7v4fg2jYrOz69vQQig55GZC9REr xhVtOBBtAil+JqyqCcuuLDgPPBXmNczDAfQNvdvPjo5I6kP0L+Ubstsgem9Z1Fzd14vY rkA/GvLsroHZzVuzC+bW3NMztMpIyuTwg9O5FnWoUBb2eBMMb5WtmkyrHrX/jn7DLWYb lIhw== 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 m1si1938493ejj.616.2021.07.14.00.05.45; Wed, 14 Jul 2021 00:06:09 -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 S238298AbhGNHEt (ORCPT + 99 others); Wed, 14 Jul 2021 03:04:49 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:49325 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238222AbhGNHEi (ORCPT ); Wed, 14 Jul 2021 03:04:38 -0400 Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 14 Jul 2021 00:01:47 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 14 Jul 2021 00:01:46 -0700 X-QCInternal: smtphost Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg01-blr.qualcomm.com with ESMTP; 14 Jul 2021 12:31:33 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id A405421B6B; Wed, 14 Jul 2021 12:31:32 +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 v3 6/7] media: venus: helpers: update NUM_MBS macro calculation Date: Wed, 14 Jul 2021 12:31:07 +0530 Message-Id: <1626246068-21023-7-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1626246068-21023-1-git-send-email-dikshita@codeaurora.org> References: <1626246068-21023-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 2223f55..ccf188a 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,16 +1099,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