Skip to contentSkip to conversation

media: v4l2-common: Add BGR666 to v4l2_format_info

PATCH In review Dafna Hirschfeld 2 participants 7 messages Mar 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: v4l2-common: Add BGR666 to v4l2_format_info

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

 drivers/media/v4l2-core/v4l2-common.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/v4l2-core/v4l2-common.c +1 -0
index d0e5ebc736f9..d7f82b2aa22f 100644
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
 		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
 		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
 		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
 
 		/* YUV packed formats */
 		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
Signature · 1 line
2.17.1
#1 lore raw

Hi Dafna,

Thank you for the patch.

Quoted 17 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

 drivers/media/v4l2-core/v4l2-common.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/v4l2-core/v4l2-common.c +0 -0
index d0e5ebc736f9..d7f82b2aa22f 100644

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 4 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
 		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
 		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
 		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Quoted 3 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
 		/* YUV packed formats */
 		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi,

Quoted 17 lines · Laurent Pinchart

Hi Dafna,

Thank you for the patch.

Quoted 12 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

  drivers/media/v4l2-core/v4l2-common.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 9 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
index d0e5ebc736f9..d7f82b2aa22f 100644
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
  		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
  		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
  		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Hi, I also discussed it with Helen. From the documentation we understood that it uses 4 bytes and the last one is empty.
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-rgb.html

Dafna

Quoted 5 lines
Quoted 4 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
  		/* YUV packed formats */
  		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
#3 lore raw

Hi Dafna,

Quoted 26 lines · Dafna Hirschfeld
Quoted 13 lines · Laurent Pinchart
Quoted 12 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

  drivers/media/v4l2-core/v4l2-common.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 9 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
index d0e5ebc736f9..d7f82b2aa22f 100644
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
  		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
  		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
  		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Quoted 3 lines

Hi, I also discussed it with Helen. From the documentation we understood that it uses 4 bytes and the last one is empty.
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-rgb.html

Would you then also understand V4L2_PIX_FMT_RGB565 to use 4 bytes with the last 2 bytes empty ? :-)

I agree that the documentation is somehow ambiguous and should be fixed. Patches are welcome ;-)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
  		/* YUV packed formats */
  		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw
Quoted 29 lines · Laurent Pinchart

Hi Dafna,

Quoted 26 lines · Dafna Hirschfeld
Quoted 24 lines · Laurent Pinchart
Quoted 17 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

   drivers/media/v4l2-core/v4l2-common.c | 1 +
   1 file changed, 1 insertion(+)
drivers/media/v4l2-core/v4l2-common.c +0 -0
index d0e5ebc736f9..d7f82b2aa22f 100644

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 4 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
   		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
   		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
   		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Quoted 6 lines
Quoted 3 lines

Hi, I also discussed it with Helen. From the documentation we understood that it uses 4 bytes and the last one is empty.
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-rgb.html

Would you then also understand V4L2_PIX_FMT_RGB565 to use 4 bytes with the last 2 bytes empty ? :-)

hmm, the formats between BGR24 and XRGB32 in the docs table have vertical lines crossing all 4 bytes so we understood that they are all 4 bytes. Isn't it? Format RGB565 doesn't have does vertical lines on the last two bytes which means it uses 2. At least that is what we understood.

Dafna

Quoted 8 lines

I agree that the documentation is somehow ambiguous and should be fixed. Patches are welcome ;-)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
   		/* YUV packed formats */
   		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
Reviewed-by
#5 lore raw

Hi Dafna,

Quoted 32 lines · Dafna Hirschfeld
Quoted 31 lines · Laurent Pinchart
Quoted 29 lines · Dafna Hirschfeld
Quoted 13 lines · Laurent Pinchart
Quoted 12 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

   drivers/media/v4l2-core/v4l2-common.c | 1 +
   1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 9 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
index d0e5ebc736f9..d7f82b2aa22f 100644
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
   		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
   		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
   		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Hi, I also discussed it with Helen. From the documentation we understood that it uses 4 bytes and the last one is empty.
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-rgb.html

Quoted 5 lines
Quoted 2 lines

Would you then also understand V4L2_PIX_FMT_RGB565 to use 4 bytes with the last 2 bytes empty ? :-)

hmm, the formats between BGR24 and XRGB32 in the docs table have vertical lines crossing all 4 bytes so we understood that they are all 4 bytes. Isn't it? Format RGB565 doesn't have does vertical lines on the last two bytes which means it uses 2. At least that is what we understood.

I stand corrected, looking at the drivers implementing V4L2_PIX_FMT_BGR666, they all handle it as a 32bpp format.

Quoted 2 lines
Quoted 2 lines

I agree that the documentation is somehow ambiguous and should be fixed. Patches are welcome ;-)

I think adding explicit '-' or 'x' in the cells that contain "don't care" bits would help avoiding confusion.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
   		/* YUV packed formats */
   		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },
Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw
Quoted 44 lines · Laurent Pinchart

Hi Dafna,

Quoted 32 lines · Dafna Hirschfeld
Quoted 31 lines · Laurent Pinchart
Quoted 29 lines · Dafna Hirschfeld
Quoted 13 lines · Laurent Pinchart
Quoted 12 lines · Dafna Hirschfeld

Add V4L2_PIX_FMT_BGR666 to the format table.

---
Hi,
BGR66 is needed for the rkisp1 driver.
Currently it crashes since the call to
v4l2_format_info returns NULL.

    drivers/media/v4l2-core/v4l2-common.c | 1 +
    1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/media/v4l2-core/v4l2-common.c const struct v4l2_format_info *v4l2_format_info(u32 format) · line 256

Quoted 9 lines
drivers/media/v4l2-core/v4l2-common.c +1 -0
index d0e5ebc736f9..d7f82b2aa22f 100644
@@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
    		{ .format = V4L2_PIX_FMT_GREY,    .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
    		{ .format = V4L2_PIX_FMT_RGB565,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
    		{ .format = V4L2_PIX_FMT_RGB555,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+		{ .format = V4L2_PIX_FMT_BGR666,  .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

Isn't BGR666 stored in 3 bytes per pixel ?

Hi, I also discussed it with Helen. From the documentation we understood that it uses 4 bytes and the last one is empty.
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-rgb.html

Quoted 5 lines
Quoted 2 lines

Would you then also understand V4L2_PIX_FMT_RGB565 to use 4 bytes with the last 2 bytes empty ? :-)

hmm, the formats between BGR24 and XRGB32 in the docs table have vertical lines crossing all 4 bytes so we understood that they are all 4 bytes. Isn't it? Format RGB565 doesn't have does vertical lines on the last two bytes which means it uses 2. At least that is what we understood.

I stand corrected, looking at the drivers implementing V4L2_PIX_FMT_BGR666, they all handle it as a 32bpp format.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

I agree that the documentation is somehow ambiguous and should be fixed. Patches are welcome ;-)

I think adding explicit '-' or 'x' in the cells that contain "don't care" bits would help avoiding confusion.

sure, I'll do that

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/media/v4l2-core/v4l2-common.c +0 -0
    		/* YUV packed formats */
    		{ .format = V4L2_PIX_FMT_YUYV,    .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 },