[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1621417008-6117-7-git-send-email-dikshita@codeaurora.org>
Date: Wed, 19 May 2021 15:06:47 +0530
From: Dikshita Agarwal <dikshita@...eaurora.org>
To: linux-media@...r.kernel.org, stanimir.varbanov@...aro.org
Cc: linux-kernel@...r.kernel.org, vgarodia@...eaurora.org,
Dikshita Agarwal <dikshita@...eaurora.org>
Subject: [PATCH 6/7] media: venus: helpers: update NUM_MBS macro calculation
Consider alignment while calculating NUM_MBS.
Co-developed-by: Mansur Alisha Shaik <mansur@...eaurora.org>
Signed-off-by: Dikshita Agarwal <dikshita@...eaurora.org>
---
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
Powered by blists - more mailing lists