Message ID | 1628588875-23790-7-git-send-email-dikshita@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: venus: Enable venus support on sc7280 | expand |
Hi, On 8/10/21 12:47 PM, Dikshita Agarwal wrote: > Consider alignment while calculating NUM_MBS. > > Co-developed-by: Mansur Alisha Shaik <mansur@codeaurora.org> > Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org> > --- > 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; Could you help me understand what is the difference between both calculations? IMO this patch should only change NUM_MBS_720P and NUM_MBS_4K macros. > 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) This change just makes indentation wrong and also it is not related to the patch subject. > 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) ditto > mode = VIDC_WORK_MODE_1; > } > >
Hi Stan, On 2021-10-02 03:01, Stanimir Varbanov wrote: > Hi, > > On 8/10/21 12:47 PM, Dikshita Agarwal wrote: >> Consider alignment while calculating NUM_MBS. >> >> Co-developed-by: Mansur Alisha Shaik <mansur@codeaurora.org> >> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org> >> --- >> 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; > > Could you help me understand what is the difference between both > calculations? IMO this patch should only change NUM_MBS_720P and > NUM_MBS_4K macros. > We are updating the calculation here to match with the calculation used in Macro. AFAIK, we were seeing a size mismatch for a resolution with the old calculation. >> 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) > > This change just makes indentation wrong and also it is not related to > the patch subject. I think it can be dropped. > >> 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) > > ditto Same here. > >> mode = VIDC_WORK_MODE_1; >> } >> >>
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; }
Consider alignment while calculating NUM_MBS. Co-developed-by: Mansur Alisha Shaik <mansur@codeaurora.org> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org> --- drivers/media/platform/qcom/venus/helpers.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)