public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hantro: Fix JPEG encoder ENUM_FRAMESIZE on RK3399
@ 2022-12-23 14:16 Nicolas Dufresne
  2022-12-23 16:28 ` Ezequiel Garcia
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dufresne @ 2022-12-23 14:16 UTC (permalink / raw)
  To: Ezequiel Garcia, Philipp Zabel, Mauro Carvalho Chehab,
	Heiko Stuebner, Hans Verkuil
  Cc: kernel, Nicolas Dufresne, Robert Mader, Mauro Carvalho Chehab,
	linux-media, linux-rockchip, linux-arm-kernel, linux-kernel

The frmsize structure was left initialize to 0, as side effect, the driver was
reporting an invalid frmsize.

  Size: Stepwise 0x0 - 0x0 with step 0/0

Fix this by replicating the constraints in the raw formats too. This fixes
taking picture in Gnome Cheese Software, or any software using GSteamer
encodebin feature.

Fixes: 775fec69008d30 ("media: add Rockchip VPU JPEG encoder driver")
Reported-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 .../platform/verisilicon/rockchip_vpu_hw.c    | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 8de6fd2e8eefa..7e65b5c3aa03c 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -21,40 +21,46 @@
  * Supported formats.
  */
 
+#define ROCKCHIP_VPU_JPEG_ENC_FRMSIZE {\
+                        .min_width = 96, \
+                        .max_width = 8192,\
+                        .step_width = MB_DIM, \
+                        .min_height = 32, \
+                        .max_height = 8192,\
+                        .step_height = MB_DIM, \
+		     }
+
 static const struct hantro_fmt rockchip_vpu_enc_fmts[] = {
 	{
 		.fourcc = V4L2_PIX_FMT_YUV420M,
 		.codec_mode = HANTRO_MODE_NONE,
 		.enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P,
+		.frmsize = ROCKCHIP_VPU_JPEG_ENC_FRMSIZE,
 	},
 	{
 		.fourcc = V4L2_PIX_FMT_NV12M,
 		.codec_mode = HANTRO_MODE_NONE,
 		.enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP,
+		.frmsize = ROCKCHIP_VPU_JPEG_ENC_FRMSIZE,
 	},
 	{
 		.fourcc = V4L2_PIX_FMT_YUYV,
 		.codec_mode = HANTRO_MODE_NONE,
 		.enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422,
+		.frmsize = ROCKCHIP_VPU_JPEG_ENC_FRMSIZE,
 	},
 	{
 		.fourcc = V4L2_PIX_FMT_UYVY,
 		.codec_mode = HANTRO_MODE_NONE,
 		.enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422,
+		.frmsize = ROCKCHIP_VPU_JPEG_ENC_FRMSIZE,
 	},
 	{
 		.fourcc = V4L2_PIX_FMT_JPEG,
 		.codec_mode = HANTRO_MODE_JPEG_ENC,
 		.max_depth = 2,
 		.header_size = JPEG_HEADER_SIZE,
-		.frmsize = {
-			.min_width = 96,
-			.max_width = 8192,
-			.step_width = MB_DIM,
-			.min_height = 32,
-			.max_height = 8192,
-			.step_height = MB_DIM,
-		},
+		.frmsize = ROCKCHIP_VPU_JPEG_ENC_FRMSIZE,
 	},
 };
 
-- 
2.38.1


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

end of thread, other threads:[~2023-01-25 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-23 14:16 [PATCH] hantro: Fix JPEG encoder ENUM_FRAMESIZE on RK3399 Nicolas Dufresne
2022-12-23 16:28 ` Ezequiel Garcia
2022-12-23 17:05   ` Nicolas Dufresne
2023-01-24 22:38     ` Michael Grzeschik
2023-01-25 14:27       ` Nicolas Dufresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox