vimc: debayer: Add support for ARGB format
Subsystems (2)
PATCH 1/1 vimc: debayer: Add support for ARGB format
Running qcam for pixelformat 0x34324142 showed that vimc debayer does not support it. Hence, add the support for Alpha (255).
--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/media/test-drivers/vimc/vimc-debayer.c +18 -9
@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {
@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
Signature · 1 line
2.17.1
Hi,
Thanks for the patch
I don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Quoted 2 lines · Kaaira Gupta
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).
I would change the commit log to:
Add support for V4L2_PIX_FMT_RGB24 format in the debayer and set the alpha channel to constant 255.
Thanks,
Dafna
Quoted 52 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
PATCH 1/1 vimc: debayer: Add support for ARGB format
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 64 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Thanks,
DafnaQuoted 50 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
Quoted 7 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Quoted 7 lines
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
At the hardware level, the de-bayering block usually produces RGB with 8 or more bits per colour components (so 3xn, 24 bits for 8-bit depths). The conversion to 32-bit ARGB usually happens at the DMA engine level, in the formatter right in front of the DMA engine. Ideally the vimc pipeline should expose the same.
From a performance point of view, it makes little sense to process the image in vimc through multiple steps. I think it would be best to generate the final image directly at the output of the pipeline.
Quoted 57 lines
Quoted 57 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 22 lines · Laurent Pinchart
Quoted 7 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Quoted 7 lines
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
At the hardware level, the de-bayering block usually produces RGB with 8 or more bits per colour components (so 3xn, 24 bits for 8-bit depths). The conversion to 32-bit ARGB usually happens at the DMA engine level, in the formatter right in front of the DMA engine. Ideally the vimc pipeline should expose the same.
Quoted 3 lines
From a performance point of view, it makes little sense to process the image in vimc through multiple steps. I think it would be best to generate the final image directly at the output of the pipeline.
[+ Lucas Magalhães]
Lucas was working on a patch for that, he sent an RFC[1] some time ago.
[1] https://patchwork.linuxtv.org/patch/60445/
It would be nice to have this indeed.
Regards,
Helen
Quoted 59 lines
Quoted 58 lines
Quoted 58 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
Hope t was helpful,
Dafna
Quoted 69 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 64 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Thanks,
DafnaQuoted 50 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = {MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ,MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA ,MEDIA_BUS_FMT_RGB888_1X32_PADHI , +MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb,unsigned int i, index; vpix =vimc_pix_map_by_code (vdeb->src_code); - index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); -for (i =0 ; i <3 ; i++) { -switch (vpix->pixelformat) { -case V4L2_PIX_FMT_RGB24 : - vdeb->src_frame[index + i] = rgb[i]; -break ; -case V4L2_PIX_FMT_BGR24 : - vdeb->src_frame[index + i] = rgb[2 - i]; -break ; + +if (vpix->pixelformat ==V4L2_PIX_FMT_ARGB32 ) { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,4 ); + vdeb->src_frame[index] =255 ; +for (i =0 ; i <3 ; i++) + vdeb->src_frame[index + i +1 ] = rgb[i]; + }else { + index =VIMC_FRAME_INDEX (lin, col, vdeb->sink_fmt.width,3 ); +for (i =0 ; i <3 ; i++) { +switch (vpix->pixelformat) { +case V4L2_PIX_FMT_RGB24 : + vdeb->src_frame[index + i] = rgb[i]; +break ; +case V4L2_PIX_FMT_BGR24 : + vdeb->src_frame[index + i] = rgb[2 - i]; +break ; + } } } }
Quoted 14 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
This is also my understanding.
You should have an -EPIPE error when start streaming though, it shouldn't fail silently.
Regards,
Helen
Quoted 73 lines
Hope t was helpful,
DafnaQuoted 69 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 64 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Thanks,
DafnaQuoted 50 lines
Signed-off-by Kaaira Gupta <[email protected]>---
.../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++-------1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Kieran Bingham
reviewerHi Helen, Dafna,
Quoted 26 lines · Helen Koike
Quoted 13 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
Quoted 3 lines
This is also my understanding.
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.
Yes, we had -EPIPE, and that is what I think we were trying to resolve.
How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?
--
Regards
Kieran
Quoted 76 lines
Regards,
HelenQuoted 73 lines
Hope t was helpful,
DafnaQuoted 69 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 64 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Thanks,
DafnaQuoted 50 lines
Signed-off-by Kaaira Gupta <[email protected]>---
.../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++-------1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Signature · 3 lines
Regards -- Kieran
Hello,
Quoted 31 lines · Kieran Bingham
Hi Helen, Dafna,
Quoted 28 lines · Helen Koike
Quoted 13 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.This is also my understanding.
Quoted 7 lines
Quoted 1 line
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.Yes, we had
-EPIPE, and that is what I think we were trying to resolve.How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
This is a good question, I don't recall v4l2 API defining this.
It would be a bit hard to implement in Vimc, specially when we have configfs for custom topology, since the capture would need to query all the pipeline. But could be implemented.
Quoted 4 lines
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
At the moment yes.
Quoted 7 lines
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
With the configfs feature, you could build a topology with sensor->capture, and ARGB would be supported.
Quoted 6 lines
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?
I know it is very limited atm, but I would like to increase the range, I'm just with a limited bandwitdh to work on it.
Thanks,
Helen
Quoted 85 lines
--
RegardsKieran
Quoted 76 lines
Regards,
HelenQuoted 73 lines
Hope t was helpful,
DafnaQuoted 69 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 64 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Thanks,
DafnaQuoted 50 lines
Signed-off-by Kaaira Gupta <[email protected]>---
.../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++-------1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Hello,
Quoted 15 lines · Helen Koike
Quoted 14 lines · Kieran Bingham
Quoted 13 lines · Helen Koike
Quoted 12 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
Is here a valid configuration for the vimc pipeline that produces BA24 ? I agree that not all pipeline configurations need to support every format, but we shouldn't report a format that can't be produced at all.
This being said, and as discussed before, the de-bayering subdev should just produce MEDIA_BUS_FMT_RGB888_1X24, and the video node should then implement the RGB pixel formats. BA24 should likely be one of the supported formats (or maybe BX24 ?).
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
This is also my understanding.
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.
Quoted 7 lines
Quoted 5 lines
Yes, we had
-EPIPE, and that is what I think we were trying to resolve.How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
This is a good question, I don't recall v4l2 API defining this.
A recent extension to VIDIOC_ENUMFMT allows enumerating pixel formats for a given media bus code, I think that's the way forward.
Quoted 91 lines
It would be a bit hard to implement in Vimc, specially when we have configfs for custom topology, since the capture would need to query all the pipeline. But could be implemented.
Quoted 3 lines
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
At the moment yes.
Quoted 6 lines
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
With the configfs feature, you could build a topology with
sensor->capture, and ARGB would be supported.Quoted 5 lines
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?I know it is very limited atm, but I would like to increase the range, I'm just with a limited bandwitdh to work on it.
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 57 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>---
.../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++-------1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 29 lines · Laurent Pinchart
Hello,
Quoted 15 lines · Helen Koike
Quoted 14 lines · Kieran Bingham
Quoted 13 lines · Helen Koike
Quoted 12 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
Quoted 1 line
Is here a valid configuration for the vimc pipeline that produces BA24 ?
It should work when using the other capture nodes that doesn't contain the debayer in the pipeline.
Quoted 2 lines
I agree that not all pipeline configurations need to support every format, but we shouldn't report a format that can't be produced at all.
ok, this requires major changes in Vimc, unless we implement all the conversions in the capture.
Quoted 5 lines
This being said, and as discussed before, the de-bayering subdev should just produce
MEDIA_BUS_FMT_RGB888_1X24, and the video node should then implement the RGB pixel formats. BA24 should likely be one of the supported formats (or maybe BX24 ?).
We can implement the conversion in the capture node, we just need to distinguish when the pipeline generates it and when it requires conversion, but shouldn't be a problem.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
This is also my understanding.
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.Yes, we had
-EPIPE, and that is what I think we were trying to resolve.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
This is a good question, I don't recall v4l2 API defining this.
A recent extension to
VIDIOC_ENUMFMTallows enumerating pixel formats for a given media bus code, I think that's the way forward.
Nice, I'm not familiar with this extension, I'll take a look, thanks for the pointer.
Thanks
Helen
Quoted 93 lines
Quoted 92 lines
It would be a bit hard to implement in Vimc, specially when we have configfs for custom topology, since the capture would need to query all the pipeline. But could be implemented.
Quoted 3 lines
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
At the moment yes.
Quoted 6 lines
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
With the configfs feature, you could build a topology with
sensor->capture, and ARGB would be supported.Quoted 5 lines
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?I know it is very limited atm, but I would like to increase the range, I'm just with a limited bandwitdh to work on it.
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 57 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>---
.../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++-------1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Quoted 29 lines · Laurent Pinchart
Hello,
Quoted 15 lines · Helen Koike
Quoted 14 lines · Kieran Bingham
Quoted 13 lines · Helen Koike
Quoted 12 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.
Quoted 1 line
Is here a valid configuration for the vimc pipeline that produces BA24 ?
I think there isn't
Quoted 7 lines
I agree that not all pipeline configurations need to support every format, but we shouldn't report a format that can't be produced at all.
This being said, and as discussed before, the de-bayering subdev should just produce
MEDIA_BUS_FMT_RGB888_1X24, and the video node should then implement the RGB pixel formats. BA24 should likely be one of the supported formats (or maybe BX24 ?).
So you mean that the video node should support it so when it receive RGB format in the source pad it converts it to BA24 or BX24 ?
It makes sense. I guess both BA24 and BX24 can be added, I see in the pixfmt-rgb.html doc that probably the control V4L2_CID_ALPHA_COMPONENT should then be added.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
This is also my understanding.
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.Yes, we had
-EPIPE, and that is what I think we were trying to resolve.
Quoted 16 lines
Quoted 5 lines
Quoted 3 lines
How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
This is a good question, I don't recall v4l2 API defining this.
A recent extension to
VIDIOC_ENUMFMTallows enumerating pixel formats for a given media bus code, I think that's the way forward.Quoted 7 lines
It would be a bit hard to implement in Vimc, specially when we have configfs for custom topology, since the capture would need to query all the pipeline. But could be implemented.
Quoted 3 lines
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
Yes, there is a doc file that explains that it should be done in a "bottom-up" way ,that is, starting with configuring the sensor, then adjusting the debayer to the sensor output, then adjusting the scaler to the debayer outout and then adjusting the video node output to the scaler output. One should also use the 'try' version of the setting at the stage of adjusting the final configuration. The detailed explanation is in Documentation/output/userspace-api/media/v4l/dev-subdev.html
Thanks,
Dafna
Quoted 85 lines
Quoted 84 lines
At the moment yes.
Quoted 6 lines
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
With the configfs feature, you could build a topology with
sensor->capture, and ARGB would be supported.Quoted 5 lines
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?I know it is very limited atm, but I would like to increase the range, I'm just with a limited bandwitdh to work on it.
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 57 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Hi Dafna,
Quoted 35 lines · Dafna Hirschfeld
Quoted 27 lines · Laurent Pinchart
Quoted 15 lines · Helen Koike
Quoted 14 lines · Kieran Bingham
Quoted 13 lines · Helen Koike
Quoted 12 lines · Dafna Hirschfeld
Quoted 10 lines · Kaaira Gupta
Quoted 5 lines · Dafna Hirschfeld
Hi,
Thanks for the patchI don't know how real devices handle ARGB formats, I wonder if it should be the part of the debayer.
Hi! qcam tries to support BA24 as it is one of the formats that vimc lists as its supported formats wih --list-formats. Shouldn't BA24 be possible to capture with vimc?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Hi,
Just to clarify, when listing the supported formats of a video node, the node lists the formats that the video node as an independent media entity support.
It does not mean that the 'camera' as a whole (that is, the media topology graph) supports all the formats that the video node lists. When interacting with a video node or a subdevice node, one interacts only with that specific entity.
In the case of vimc, the RGB video node as an independent entity supports BA24 so the format appears in the list of the its supported formats. But since the Debayer does not support it, the format can not be generated by the entire vimc topology.
This is not a bug.Quoted 1 line
Is here a valid configuration for the vimc pipeline that produces BA24 ?
I think there isn't
Quoted 3 lines
I agree that not all pipeline configurations need to support every format, but we shouldn't report a format that can't be produced at all.
Quoted 7 lines
Quoted 4 lines
This being said, and as discussed before, the de-bayering subdev should just produce
MEDIA_BUS_FMT_RGB888_1X24, and the video node should then implement the RGB pixel formats. BA24 should likely be one of the supported formats (or maybe BX24 ?).So you mean that the video node should support it so when it receive RGB format in the source pad it converts it to BA24 or BX24 ?
Yes. If you think about an equivalent hardware pipeline, the device would carry 24-bit RGB between the processing blocks, and only when the data reaches the output formatter (usually bundled with the DMA engine) would it be converted to one of the multiple RGB pixel formats. I think vimc should mimic that behaviour when it comes to pipeline configuration.
When it comes to generating data (or processing it, I believe vimc supports, or aims to support, memory-to-memory processing), we have two options:
- In the general case, data generated by the TPG would be processed by the individual blocks in the pipeline until it reaches the capture video node. To support processing steps that may generate more, less or an equal amount of data as they consume, we would need to allocate buffers between all the processing blocks. Those buffers don't need to be full frame buffers though, they can be a few lines only, generating the test pattern and processing it a few lines at a time.
This architecture would also support memory-to-memory processing.
- When using the TPG, we could optimize the implementation by generating data in the capture buffer directly, in the format configured on the video node, without processing the data in every block. The drawback is that processing artifacts (such as the artifacts due to colour interpolation or scaling) wouldn't be generated, the captured image would be cleaner than in a real hardware implementation. Whether that is an issue or not is for us to decide.
If vimc doesn't need to support memory-to-memory processing, we could implement the optimized behaviour only.
Quoted 3 lines
It makes sense. I guess both BA24 and BX24 can be added, I see in the pixfmt-rgb.html doc that probably the control
V4L2_CID_ALPHA_COMPONENTshould then be added.
Yes, V4L2_CID_ALPHA_COMPONENT would need to be added (on the video node) to produce BA24, otherwise the alpha component would have a fixed value.
Quoted 24 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
This is also my understanding.
You should have an
-EPIPEerror when start streaming though, it shouldn't fail silently.Yes, we had
-EPIPE, and that is what I think we were trying to resolve.Quoted 16 lines
Quoted 5 lines
Quoted 3 lines
How would userspace be expected to detect what formats to use ? Should the available formats on the capture node depend on the current linking of the media graph?
This is a good question, I don't recall v4l2 API defining this.
A recent extension to
VIDIOC_ENUMFMTallows enumerating pixel formats for a given media bus code, I think that's the way forward.Quoted 7 lines
It would be a bit hard to implement in Vimc, specially when we have configfs for custom topology, since the capture would need to query all the pipeline. But could be implemented.
Quoted 3 lines
Otherwise, to know what formats are supported - userspace must first 'get a list of formats' then try to 'set' the formats to know what is possible?
Quoted 6 lines
Yes, there is a doc file that explains that it should be done in a "bottom-up" way ,that is, starting with configuring the sensor, then adjusting the debayer to the sensor output, then adjusting the scaler to the debayer outout and then adjusting the video node output to the scaler output. One should also use the 'try' version of the setting at the stage of adjusting the final configuration. The detailed explanation is in
Documentation/output/userspace-api/media/v4l/dev-subdev.html
That won't help though. The video node will happily accept a VIDIOC_S_FMT call that sets a pixel format not compatible with the media bus format at the input of the video node. The error will only be raised at stream on time. The VIDIOC_ENUMFMT extension that allows enumerating pixel formats supported for a given media bus code is the only working option.
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
At the moment yes.
Quoted 6 lines
Or should (given VIMC is quite specialist anyway) userspace 'just know' what is capable all the same?
That's possibly fine, as we can simply remove support for the ARGB formats from the libcamera pipeline handler if it is never expected to be supported.
With the configfs feature, you could build a topology with
sensor->capture, and ARGB would be supported.Quoted 5 lines
But then as a further question - what formats will we expect VIMC to support? VIVID has a (very) wide range of formats.
Would we ever expect VIMC to be as configurable?
Or is the scope limited to what we have today?I know it is very limited atm, but I would like to increase the range, I'm just with a limited bandwitdh to work on it.
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
Quoted 62 lines
If yes, which entity should support it, if not debayer? Should there be a separate conversion entity, or should we keep the support in debayer itself for efficiency issues?
Quoted 57 lines · Kaaira Gupta
Quoted 2 lines
Running qcam for pixelformat
0x34324142showed that vimc debayer does not support it. Hence, add the support for Alpha (255).I would change the commit log to:
Add support for
V4L2_PIX_FMT_RGB24format in the debayer and set the alpha channel to constant 255.Quoted 48 lines
Signed-off-by Kaaira Gupta <[email protected]>--- .../media/test-drivers/vimc/vimc-debayer.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)drivers/media/test-drivers/vimc/vimc-debayer.c +18
-9@@ -62,6 +62,7 @@ static const u32 vimc_deb_src_mbus_codes[] = { MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, MEDIA_BUS_FMT_RGB888_1X32_PADHI, + MEDIA_BUS_FMT_ARGB8888_1X32 }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = {@@ -322,15 +323,23 @@ static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, unsigned int i, index; vpix = vimc_pix_map_by_code(vdeb->src_code); - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); - for (i = 0; i < 3; i++) { - switch (vpix->pixelformat) { - case V4L2_PIX_FMT_RGB24: - vdeb->src_frame[index + i] = rgb[i]; - break; - case V4L2_PIX_FMT_BGR24: - vdeb->src_frame[index + i] = rgb[2 - i]; - break; + + if (vpix->pixelformat == V4L2_PIX_FMT_ARGB32) { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 4); + vdeb->src_frame[index] = 255; + for (i = 0; i < 3; i++) + vdeb->src_frame[index + i + 1] = rgb[i]; + } else { + index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); + for (i = 0; i < 3; i++) { + switch (vpix->pixelformat) { + case V4L2_PIX_FMT_RGB24: + vdeb->src_frame[index + i] = rgb[i]; + break; + case V4L2_PIX_FMT_BGR24: + vdeb->src_frame[index + i] = rgb[2 - i]; + break; + } } } }
Signature · 3 lines
Regards, Laurent Pinchart