All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: cedrus: Fix SUNXI tile size calculation
@ 2021-08-19 14:00 ` Nicolas Dufresne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2021-08-19 14:00 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, Jernej Skrabec, linux-media, linux-staging,
	linux-arm-kernel, linux-sunxi, linux-kernel

Tiled formats requires full rows being allocated (even for Chroma
planes). When the number of Luma tiles is odd, we need to round up
to twice the tile width in order to roundup the number of Chroma
tiles.

This was notice with a crash running BA1_FT_C compliance test using
sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
Luma, but only 4.5 rows for Chroma, causing userspace to crash.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 32c13ecb22d8..a8168ac2fbd0 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -135,7 +135,7 @@ void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
 		sizeimage = bytesperline * height;
 
 		/* Chroma plane size. */
-		sizeimage += bytesperline * height / 2;
+		sizeimage += bytesperline * ALIGN(height, 64) / 2;
 
 		break;
 
-- 
2.31.1


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

* [PATCH] media: cedrus: Fix SUNXI tile size calculation
@ 2021-08-19 14:00 ` Nicolas Dufresne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2021-08-19 14:00 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, Jernej Skrabec, linux-media, linux-staging,
	linux-arm-kernel, linux-sunxi, linux-kernel

Tiled formats requires full rows being allocated (even for Chroma
planes). When the number of Luma tiles is odd, we need to round up
to twice the tile width in order to roundup the number of Chroma
tiles.

This was notice with a crash running BA1_FT_C compliance test using
sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
Luma, but only 4.5 rows for Chroma, causing userspace to crash.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 32c13ecb22d8..a8168ac2fbd0 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -135,7 +135,7 @@ void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
 		sizeimage = bytesperline * height;
 
 		/* Chroma plane size. */
-		sizeimage += bytesperline * height / 2;
+		sizeimage += bytesperline * ALIGN(height, 64) / 2;
 
 		break;
 
-- 
2.31.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] 7+ messages in thread

* Re: [PATCH] media: cedrus: Fix SUNXI tile size calculation
  2021-08-19 14:00 ` Nicolas Dufresne
@ 2021-08-19 16:30   ` Jernej Škrabec
  -1 siblings, 0 replies; 7+ messages in thread
From: Jernej Škrabec @ 2021-08-19 16:30 UTC (permalink / raw)
  To: Maxime Ripard, Nicolas Dufresne
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, linux-media, linux-staging, linux-arm-kernel,
	linux-sunxi, linux-kernel

Hi Nicolas!

Dne četrtek, 19. avgust 2021 ob 16:00:09 CEST je Nicolas Dufresne napisal(a):
> Tiled formats requires full rows being allocated (even for Chroma
> planes). When the number of Luma tiles is odd, we need to round up
> to twice the tile width in order to roundup the number of Chroma
> tiles.
> 
> This was notice with a crash running BA1_FT_C compliance test using
> sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
> Luma, but only 4.5 rows for Chroma, causing userspace to crash.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Fixes tag would be nice so it would be picked up for stable branches. 
Otherwise it looks good. It also aligns logic with libvdpau-sunxi.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



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

* Re: [PATCH] media: cedrus: Fix SUNXI tile size calculation
@ 2021-08-19 16:30   ` Jernej Škrabec
  0 siblings, 0 replies; 7+ messages in thread
From: Jernej Škrabec @ 2021-08-19 16:30 UTC (permalink / raw)
  To: Maxime Ripard, Nicolas Dufresne
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, linux-media, linux-staging, linux-arm-kernel,
	linux-sunxi, linux-kernel

Hi Nicolas!

Dne četrtek, 19. avgust 2021 ob 16:00:09 CEST je Nicolas Dufresne napisal(a):
> Tiled formats requires full rows being allocated (even for Chroma
> planes). When the number of Luma tiles is odd, we need to round up
> to twice the tile width in order to roundup the number of Chroma
> tiles.
> 
> This was notice with a crash running BA1_FT_C compliance test using
> sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
> Luma, but only 4.5 rows for Chroma, causing userspace to crash.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Fixes tag would be nice so it would be picked up for stable branches. 
Otherwise it looks good. It also aligns logic with libvdpau-sunxi.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



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

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

* Re: [PATCH] media: cedrus: Fix SUNXI tile size calculation
  2021-08-19 16:30   ` Jernej Škrabec
  (?)
@ 2021-08-19 17:54     ` Nicolas Dufresne
  -1 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2021-08-19 17:54 UTC (permalink / raw)
  To: Jernej Škrabec, Maxime Ripard
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, linux-media, linux-staging, linux-arm-kernel,
	linux-sunxi, linux-kernel

Le jeudi 19 août 2021 à 18:30 +0200, Jernej Škrabec a écrit :
> Hi Nicolas!
> 
> Dne četrtek, 19. avgust 2021 ob 16:00:09 CEST je Nicolas Dufresne napisal(a):
> > Tiled formats requires full rows being allocated (even for Chroma
> > planes). When the number of Luma tiles is odd, we need to round up
> > to twice the tile width in order to roundup the number of Chroma
> > tiles.
> > 
> > This was notice with a crash running BA1_FT_C compliance test using
> > sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
> > Luma, but only 4.5 rows for Chroma, causing userspace to crash.
> > 
> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Fixes tag would be nice so it would be picked up for stable branches. 
> Otherwise it looks good. It also aligns logic with libvdpau-sunxi.

Sure, I'd say can be merged adding (it was broken since when cedrus was added):

Fixes: 50e761516f2b8 ("media: platform: Add Cedrus VPU decoder driver")

> 
> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> 
> Best regards,
> Jernej
> 
> 



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

* Re: [PATCH] media: cedrus: Fix SUNXI tile size calculation
@ 2021-08-19 17:54     ` Nicolas Dufresne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2021-08-19 17:54 UTC (permalink / raw)
  To: Jernej Škrabec, Maxime Ripard
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, linux-media, linux-staging, linux-arm-kernel,
	linux-sunxi, linux-kernel

Le jeudi 19 août 2021 à 18:30 +0200, Jernej Škrabec a écrit :
> Hi Nicolas!
> 
> Dne četrtek, 19. avgust 2021 ob 16:00:09 CEST je Nicolas Dufresne napisal(a):
> > Tiled formats requires full rows being allocated (even for Chroma
> > planes). When the number of Luma tiles is odd, we need to round up
> > to twice the tile width in order to roundup the number of Chroma
> > tiles.
> > 
> > This was notice with a crash running BA1_FT_C compliance test using
> > sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
> > Luma, but only 4.5 rows for Chroma, causing userspace to crash.
> > 
> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Fixes tag would be nice so it would be picked up for stable branches. 
> Otherwise it looks good. It also aligns logic with libvdpau-sunxi.

Sure, I'd say can be merged adding (it was broken since when cedrus was added):

Fixes: 50e761516f2b8 ("media: platform: Add Cedrus VPU decoder driver")

> 
> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> 
> Best regards,
> Jernej
> 
> 



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

* Re: [PATCH] media: cedrus: Fix SUNXI tile size calculation
@ 2021-08-19 17:54     ` Nicolas Dufresne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2021-08-19 17:54 UTC (permalink / raw)
  To: Jernej Škrabec, Maxime Ripard
  Cc: Paul Kocialkowski, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Chen-Yu Tsai, linux-media, linux-staging, linux-arm-kernel,
	linux-sunxi, linux-kernel

Le jeudi 19 août 2021 à 18:30 +0200, Jernej Škrabec a écrit :
> Hi Nicolas!
> 
> Dne četrtek, 19. avgust 2021 ob 16:00:09 CEST je Nicolas Dufresne napisal(a):
> > Tiled formats requires full rows being allocated (even for Chroma
> > planes). When the number of Luma tiles is odd, we need to round up
> > to twice the tile width in order to roundup the number of Chroma
> > tiles.
> > 
> > This was notice with a crash running BA1_FT_C compliance test using
> > sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
> > Luma, but only 4.5 rows for Chroma, causing userspace to crash.
> > 
> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Fixes tag would be nice so it would be picked up for stable branches. 
> Otherwise it looks good. It also aligns logic with libvdpau-sunxi.

Sure, I'd say can be merged adding (it was broken since when cedrus was added):

Fixes: 50e761516f2b8 ("media: platform: Add Cedrus VPU decoder driver")

> 
> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> 
> Best regards,
> Jernej
> 
> 



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

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

end of thread, other threads:[~2021-08-19 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 14:00 [PATCH] media: cedrus: Fix SUNXI tile size calculation Nicolas Dufresne
2021-08-19 14:00 ` Nicolas Dufresne
2021-08-19 16:30 ` Jernej Škrabec
2021-08-19 16:30   ` Jernej Škrabec
2021-08-19 17:54   ` Nicolas Dufresne
2021-08-19 17:54     ` Nicolas Dufresne
2021-08-19 17:54     ` Nicolas Dufresne

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.