All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] media: mtk-vcodec: Align width and height to 64
@ 2021-10-29  9:45 ` Yunfei Dong
  0 siblings, 0 replies; 5+ messages in thread
From: Yunfei Dong @ 2021-10-29  9:45 UTC (permalink / raw)
  To: Yunfei Dong, Alexandre Courbot, Hans Verkuil, Tzung-Bi Shih,
	Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa
  Cc: Hsin-Yi Wang, Fritz Koenig, Dafna Hirschfeld, Benjamin Gaignard,
	Daniel Vetter, dri-devel, Irui Wang, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, srv_heupstream, linux-mediatek,
	Project_Global_Chrome_Upstream_Group

User get width and height are 64 align when set format. Need to make
sure all is 64 align when use width and height to calculate buffer size.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
index 946c23088308..28c17204f9a1 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
@@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst,
 {
 	struct mtk_vcodec_ctx *ctx = inst->ctx;
 
-	ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0;
-	ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0;
+	ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
+	ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
 	ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx->picinfo.buf_h;
 	ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1;
 	inst->vsi_ctx.dec.cap_num_planes =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1] media: mtk-vcodec: Align width and height to 64
@ 2021-10-29  9:45 ` Yunfei Dong
  0 siblings, 0 replies; 5+ messages in thread
From: Yunfei Dong @ 2021-10-29  9:45 UTC (permalink / raw)
  To: Yunfei Dong, Alexandre Courbot, Hans Verkuil, Tzung-Bi Shih,
	Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa
  Cc: Hsin-Yi Wang, Fritz Koenig, Dafna Hirschfeld, Benjamin Gaignard,
	Daniel Vetter, dri-devel, Irui Wang, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, srv_heupstream, linux-mediatek,
	Project_Global_Chrome_Upstream_Group

User get width and height are 64 align when set format. Need to make
sure all is 64 align when use width and height to calculate buffer size.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
index 946c23088308..28c17204f9a1 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
@@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst,
 {
 	struct mtk_vcodec_ctx *ctx = inst->ctx;
 
-	ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0;
-	ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0;
+	ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
+	ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
 	ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx->picinfo.buf_h;
 	ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1;
 	inst->vsi_ctx.dec.cap_num_planes =
-- 
2.25.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1] media: mtk-vcodec: Align width and height to 64
@ 2021-10-29  9:45 ` Yunfei Dong
  0 siblings, 0 replies; 5+ messages in thread
From: Yunfei Dong @ 2021-10-29  9:45 UTC (permalink / raw)
  To: Yunfei Dong, Alexandre Courbot, Hans Verkuil, Tzung-Bi Shih,
	Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa
  Cc: Hsin-Yi Wang, Fritz Koenig, Dafna Hirschfeld, Benjamin Gaignard,
	Daniel Vetter, dri-devel, Irui Wang, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, srv_heupstream, linux-mediatek,
	Project_Global_Chrome_Upstream_Group

User get width and height are 64 align when set format. Need to make
sure all is 64 align when use width and height to calculate buffer size.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
index 946c23088308..28c17204f9a1 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
@@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst,
 {
 	struct mtk_vcodec_ctx *ctx = inst->ctx;
 
-	ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0;
-	ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0;
+	ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
+	ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
 	ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx->picinfo.buf_h;
 	ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1;
 	inst->vsi_ctx.dec.cap_num_planes =
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] media: mtk-vcodec: Align width and height to 64
  2021-10-29  9:45 ` Yunfei Dong
  (?)
  (?)
@ 2021-11-02 16:43 ` Steve Cho
  2021-11-03  3:36   ` yunfei.dong
  -1 siblings, 1 reply; 5+ messages in thread
From: Steve Cho @ 2021-11-02 16:43 UTC (permalink / raw)
  To: Yunfei Dong
  Cc: Andrew-CT Chen, Dafna Hirschfeld, dri-devel, Irui Wang,
	Mauro Carvalho Chehab, Benjamin Gaignard,
	Project_Global_Chrome_Upstream_Group, Fritz Koenig, linux-media,
	devicetree, Tzung-Bi Shih, Tomasz Figa, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Matthias Brugger, Tiffany Lin,
	linux-arm-kernel, Alexandre Courbot, srv_heupstream,
	linux-kernel, Hans Verkuil

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

Thank you Yunfei for following up with this change.

This change is the last missing piece to enable VD on Kukui with Chromium.
This patch fixed the corruption we were seeing on Kukui with certain tests.

One comment from me is just to use defined macro or variable instead of
hard coding 64.

"User get width and height are 64 align when set format."

This sentence might need to be reworded. It is not clear to me.

Maybe something like "Width and height need to be 64 bytes aligned when
setting the format."

Thanks,
Steve

On Fri, Oct 29, 2021 at 2:45 AM Yunfei Dong <yunfei.dong@mediatek.com>
wrote:

> User get width and height are 64 align when set format. Need to make
> sure all is 64 align when use width and height to calculate buffer size.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
>  drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> index 946c23088308..28c17204f9a1 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> @@ -562,8 +562,8 @@ static void get_pic_info(struct vdec_h264_slice_inst
> *inst,
>  {
>         struct mtk_vcodec_ctx *ctx = inst->ctx;
>
> -       ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0;
> -       ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0;
> +       ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
> +       ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
>         ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx->picinfo.buf_h;
>         ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1;
>         inst->vsi_ctx.dec.cap_num_planes =
> --
> 2.25.1
>
>

[-- Attachment #2: Type: text/html, Size: 2691 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] media: mtk-vcodec: Align width and height to 64
  2021-11-02 16:43 ` Steve Cho
@ 2021-11-03  3:36   ` yunfei.dong
  0 siblings, 0 replies; 5+ messages in thread
From: yunfei.dong @ 2021-11-03  3:36 UTC (permalink / raw)
  To: Steve Cho
  Cc: Andrew-CT Chen, Dafna Hirschfeld, dri-devel, Irui Wang,
	Mauro Carvalho Chehab, Benjamin Gaignard,
	Project_Global_Chrome_Upstream_Group, Fritz Koenig, linux-media,
	devicetree, Tzung-Bi Shih, Tomasz Figa, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Matthias Brugger, Tiffany Lin,
	linux-arm-kernel, Alexandre Courbot, srv_heupstream,
	linux-kernel, Hans Verkuil

[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]

Hi steve,
Thanks for your suggestion.On Tue, 2021-11-02 at 09:43 -0700, Steve Cho
wrote:
> Thank you Yunfei for following up with this change. 
> This change is the last missing piece to enable VD on Kukui with
> Chromium. 
> This patch fixed the corruption we were seeing on Kukui with certain
> tests.
> 
> One comment from me is just to use defined macro or variable instead
> of hard coding 64. 
> 
> "User get width and height are 64 align when set format."
> 
> This sentence might need to be reworded. It is not clear to me. 
> 
> Maybe something like "Width and height need to be 64 bytes aligned
> when setting the format."
> 
> Thanks,Steve
Fix it and send patch v2.
Thanks,Yunfei Dong
> On Fri, Oct 29, 2021 at 2:45 AM Yunfei Dong <yunfei.dong@mediatek.com
> > wrote:
> > User get width and height are 64 align when set format. Need to
> > make
> > 
> > sure all is 64 align when use width and height to calculate buffer
> > size.
> > 
> > 
> > 
> > Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> > 
> > ---
> > 
> >  drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c | 4 ++--
> > 
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > 
> > 
> > diff --git a/drivers/media/platform/mtk-
> > vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mtk-
> > vcodec/vdec/vdec_h264_req_if.c
> > 
> > index 946c23088308..28c17204f9a1 100644
> > 
> > --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> > 
> > +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c
> > 
> > @@ -562,8 +562,8 @@ static void get_pic_info(struct
> > vdec_h264_slice_inst *inst,
> > 
> >  {
> > 
> >         struct mtk_vcodec_ctx *ctx = inst->ctx;
> > 
> > 
> > 
> > -       ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) &
> > 0xFFFFFFF0;
> > 
> > -       ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) &
> > 0xFFFFFFE0;
> > 
> > +       ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
> > 
> > +       ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
> > 
> >         ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx-
> > >picinfo.buf_h;
> > 
> >         ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1;
> > 
> >         inst->vsi_ctx.dec.cap_num_planes =
> > 

[-- Attachment #2: Type: text/html, Size: 3420 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-03  3:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29  9:45 [PATCH v1] media: mtk-vcodec: Align width and height to 64 Yunfei Dong
2021-10-29  9:45 ` Yunfei Dong
2021-10-29  9:45 ` Yunfei Dong
2021-11-02 16:43 ` Steve Cho
2021-11-03  3:36   ` yunfei.dong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.