Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1728494pxj; Wed, 19 May 2021 12:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4axmDS3pJJmhiKipD87Lm8yED1stras+speraHS+R3tvPMb70DPrvcbbkq9e5DSgbanf0 X-Received: by 2002:a17:906:e09:: with SMTP id l9mr735222eji.528.1621452499128; Wed, 19 May 2021 12:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452499; cv=none; d=google.com; s=arc-20160816; b=N+zRJPNP9RTE7uDEtjZ2nhO/TrbmPGfde4M5CfyyvJbGa4AZeBtJlObnRncZqxQqH4 /k6bdL77zxqlBk5fL+gzRBwW67wJyTxw6sSVPJ2E7QCr2u117HMHikB51wazwNVL1/3r +ea7pEm9HMk6ccuYhUSz9jeT5fLDofg/Ue4KO45fUProJGoKrtbGDyxnroLF8Jpl4k/O rrK4ER1qXGBeyc8oYa3YbwwEiZrgR4XgThmUcSq8LgzdcIXJlt1Myrogx9auM7kHDmff RERHpdasIW36UGTnMw+aYM5iRKed8a6idpnZc5mLG2DJttK5xIs3NHgdvCpv4LmLgiV/ ls2Q== 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=kCk6zrHohMd7yDF1EXh5lalxgtR8CLEN/hMaA+GGYSM=; b=GuqRE0lCuF8Hm0/dno/wHggGwTwPT1wfcoLh2d9kWDrsdgqw+hI80HweqeZ4KvZ7Us m9basj5T0rVoDcxspSMuKcf+Vl7FikiFyQ88LTrk/uMXfF+sPI/kTuyeGVM0+0I3UMEu eoyqFmQHfqJptTumX/1XvAHm9svWeQ84ovj4x4Uqc3u/zHK+4irZ56xSUXt0hja95DXv d6g7AfITyCQnyA+IEw9gv1AtbrGjBdVaeiUYzkqj4D4QC522QNtHiadvZ/WU4V1jhB0M 6znFIqKXThH9qy13mCx8GudZrZNg47+YMHjN4WZJtDjIE8n0nYkdisLEf74Sk4egKubJ uVKg== 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 8si585358ejx.637.2021.05.19.12.27.55; Wed, 19 May 2021 12:28:19 -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 S1345836AbhESJjK (ORCPT + 99 others); Wed, 19 May 2021 05:39:10 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:42311 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345847AbhESJjE (ORCPT ); Wed, 19 May 2021 05:39:04 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 19 May 2021 02:37:45 -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; 19 May 2021 02:37:44 -0700 X-QCInternal: smtphost Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg02-blr.qualcomm.com with ESMTP; 19 May 2021 15:07:43 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id B26DE219EB; Wed, 19 May 2021 15:07:42 +0530 (IST) From: Dikshita Agarwal To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH 6/7] media: venus: helpers: update NUM_MBS macro calculation Date: Wed, 19 May 2021 15:06:47 +0530 Message-Id: <1621417008-6117-7-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621417008-6117-1-git-send-email-dikshita@codeaurora.org> References: <1621417008-6117-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 | 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)) { + 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; -- 2.7.4