Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp431974pxv; Thu, 1 Jul 2021 01:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6lAj1ay00hKv4TwVjr2jU78QnE+ctzduUgGde5MjKAE74Li4pKY0BNqFkH0/ZnWNciZw7 X-Received: by 2002:a05:6402:40c2:: with SMTP id z2mr28888016edb.134.1625127089484; Thu, 01 Jul 2021 01:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625127089; cv=none; d=google.com; s=arc-20160816; b=mlsCWRkPR4l04IGkRR/ZU61LDdOViABk9zWZRst4PKSz6zPAUbijRa9A16AtnWAlaw j/SNDrS6UGfO4VTswdT11VYb8T/AzpPfrtfDh0fyjEPw2j4ci5/MxS4aRumFeVqmQPrC RMJyqs1HDo+PM10buS3ExQfMecdbUfl/IiUbUZTiFm28QFIyC5V82xWqXW1rK6ECoUPq 34jCulJdd9PR7L8zqqmG5jGitKy5fTwuYPLaAx2nlYn2RzMiRbMICPBNzdLGPYk4m1cW Ec2xjTnjlf3H+p0p7ciKQuLk6wqvCWOCJ9ZaoKEiVUKH9afGnPO6nXyC1LFhNmEKIiqp NX/w== 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=sljBJLSkrPYH+DhuCp/fFwJYO5ZJFIWyl3wtkA+YZO48LDz0mmQJVSkWemc/eoixnB vyO7ogr5y5Jw4qLkvL8Zu87Kw+7m5hzQlltvefK7z56idnGrObh0w5iXeshcFbtFFO9j kJb76XxMacpZM9MNqoT4IMj14OWSmEtOkfyolcanPlLtV+h/QX3LZqJE0EyXYH6hc+xB jKJIY8A1ScCYLA3BKx/x13pHlUqHUIz6rC+sWRDMKJfHzWVCmRSQz5GAa+2uhgZZ6TjY 8Hvk2vQcOWTBLAxM9MnrvUGT0itEJBKnQtk0rR58r7M7aAst89nubXzVXGjQamLqLTBs 6RSQ== 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 ec4si24704795ejb.244.2021.07.01.01.11.06; Thu, 01 Jul 2021 01:11:29 -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 S235336AbhGAIIq (ORCPT + 99 others); Thu, 1 Jul 2021 04:08:46 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:13117 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbhGAIIm (ORCPT ); Thu, 1 Jul 2021 04:08:42 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 01 Jul 2021 01:06:12 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 01 Jul 2021 01:06:10 -0700 X-QCInternal: smtphost Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg02-blr.qualcomm.com with ESMTP; 01 Jul 2021 13:36:09 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id C4FF321A36; Thu, 1 Jul 2021 13:36:08 +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 v2 6/7] media: venus: helpers: update NUM_MBS macro calculation Date: Thu, 1 Jul 2021 13:35:35 +0530 Message-Id: <1625126736-16266-7-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1625126736-16266-1-git-send-email-dikshita@codeaurora.org> References: <1625126736-16266-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