staging: media: starfive: Add multiple resolution support
Subsystems (2)
PATCH 1/1 staging: media: starfive: Add multiple resolution support
Add multiple resolution support for video "capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.
--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/starfive/camss/stf-capture.c +4 -1
@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix; + val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );
@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {
--
2.25.1
Hi, Hans
Quoted 3 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.
Can you help to review this patch, Thanks for your times.
Regards,
Changhuang
Quoted 38 lines
Fixes e080f339c80a ("media: staging: media: starfive: camss: Add capturedriver")
Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +4
-1@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix; + val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val);} else if (
cap->type==STF_CAPTURE_YUV) {
--
2.25.1
Quoted 7 lines · Changhuang Liang
Hi, Hans
Quoted 3 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Can you help to review this patch, Thanks for your times.
Patch looks OK, it will be part of my next 'various fixes' Pull Request.
Regards,
Hans
Quoted 42 lines
Regards,
ChanghuangQuoted 38 lines
Fixes e080f339c80a ("media: staging: media: starfive: camss: Add capturedriver")
Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +4
-1@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix; + val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val);} else if (
cap->type==STF_CAPTURE_YUV) {
--
2.25.1
Hi Changhuang,
Thank you for the patch.
Quoted 15 lines · Changhuang Liang
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Add capture driver")Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +0
-0
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 180
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;
This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;
And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 10 lines
drivers/staging/media/starfive/camss/stf-capture.c +2
-1+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );
Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Laurent
Thanks for your comments.
Quoted 44 lines
Hi Changhuang,
Thank you for the patch.
Quoted 17 lines · Changhuang Liang
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Addcapture driver")
Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +0
-0drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video · line 180
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video*video)
Quoted 9 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-1val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
Ragards,
Changhuang
Quoted 8 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 202
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {--
Regards,Laurent Pinchart
Quoted 56 lines · Changhuang Liang
Hi, Laurent
Thanks for your comments.
Quoted 45 lines
Hi Changhuang,
Thank you for the patch.
Quoted 17 lines · Changhuang Liang
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Addcapture driver")
Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +0
-0drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video · line 180
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;Quoted 7 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 );Quoted 6 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-1val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Laurent
Quoted 62 lines · Changhuang Liang
Quoted 42 lines
Hi, Laurent
Thanks for your comments.
Quoted 38 lines
Hi Changhuang,
Thank you for the patch.
Quoted 20 lines · Changhuang Liang
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Addcapture driver")
Signed-off-by: Changhuang Liang
<[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video
*video) {drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 180
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
Quoted 7 lines
Quoted 7 lines
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct
stfcamss_video*video)Quoted 8 lines
Quoted 8 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-1val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than
expected ?
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
VSYNC time = (width + h_blank) * height;
Regards,
Changhuang
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 202
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {--
Regards,Laurent Pinchart
Hi Changhuang,
Quoted 59 lines · Changhuang Liang
Quoted 51 lines · Changhuang Liang
Quoted 50 lines
Quoted 49 lines · Changhuang Liang
Quoted 20 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Addcapture driver")
Signed-off-by: Changhuang Liang
<[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/starfive/camss/stf-capture.c +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video
*video) {drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 180
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 10 lines
drivers/staging/media/starfive/camss/stf-capture.c +2
-1+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Quoted 7 lines
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
Quoted 5 lines
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
VSYNC time = (width +
h_blank) * height;
What I'm trying to understand is what happens if the ISP is configured for 1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines limit to avoid buffer overflows ?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0stf_syscon_reg_write (stfcamss,VIN_INRT_PIX_CFG , val); }else if (cap->type ==STF_CAPTURE_YUV ) {
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Laurent
Quoted 71 lines
Hi Changhuang,
Quoted 4 lines · Changhuang Liang
Quoted 4 lines · Changhuang Liang
Quoted 3 lines
Quoted 3 lines · Changhuang Liang
Quoted 2 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not1920.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 19 lines
Fixes e080f339c80a ("media: staging: media: starfive: camss:Add capture driver")
Signed-off-by: Changhuang Liang
<[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644drivers/staging/media/starfive/camss/stf-capture.c +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video
*video) {drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 180
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 184
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
const struct
v4l2_pix_format*pix =&video->active_fmt.fmt.pix;Quoted 2 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0+ val = stf_syscon_reg_read(stfcamss,
VIN_CHANNEL_SEL_EN);Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct
stfcamss_video*video)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-1val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than
expected ?
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
The hardware can confirm the image height by using the VSYNC signal.
Quoted 9 lines
Quoted 3 lines
Image will transfer when VSYNC is high.
VSYNC time = (width +
h_blank) * height;What I'm trying to understand is what happens if the ISP is configured for 1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines limit to avoid buffer overflows ?
If is "capture_raw" video device, no image height can be configured. If is "capture_yuv" video device, it will be set by stf_isp_config_crop.
Regards,
Changhuang
Quoted 66 lines · Changhuang Liang
Quoted 66 lines · Changhuang Liang
Quoted 65 lines
Quoted 53 lines · Changhuang Liang
Quoted 52 lines
Quoted 51 lines · Changhuang Liang
Quoted 21 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss:Add capture driver")
Signed-off-by: Changhuang Liang
<[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644drivers/staging/media/starfive/camss/stf-capture.c +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video
*video) {drivers/staging/media/starfive/camss/stf-capture.c
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct
v4l2_pix_format*pix =&video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 10 lines
drivers/staging/media/starfive/camss/stf-capture.c +2
-1+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does
the driver prevent buffer overflows if the sensor sends more data than expected ?Quoted 7 lines
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
VSYNC time = (width +
h_blank) * height;What I'm trying to understand is what happens if the ISP is configured for 1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines limit to avoid buffer overflows ?
If is "
capture_raw" video device, no image height can be configured.
In that case what happens if the camera sensor sends more lines than expected ? Will the raw video device write past the end of the buffer ? If so, is there a way to guard against that ?
Quoted 1 line
If is "
capture_yuv" video device, it will be set bystf_isp_config_crop.
Thank you, that's the information I was looking for.
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Lanrent
Quoted 81 lines · Changhuang Liang
Quoted 3 lines
Quoted 3 lines · Changhuang Liang
Quoted 2 lines
Quoted 2 lines · Changhuang Liang
Quoted 1 line
Quoted 1 line
On Fri, Apr 19, 2024 at 01:19:55AM -0700, Changhuang Liang
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not1920.
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 20 lines
Fixes e080f339c80a ("media: staging: media: starfive: camss:Add capture driver")
Signed-off-by: Changhuang Liang
<[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644drivers/staging/media/starfive/camss/stf-capture.c +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video
*video) {drivers/staging/media/starfive/camss/stf-capture.c
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
const struct
v4l2_pix_format*pix =&video->active_fmt.fmt.pix;Quoted 2 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0+ val = stf_syscon_reg_read(stfcamss,
VIN_CHANNEL_SEL_EN);Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +0
-0val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct
stfcamss_video*video)Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct · line 199
Quoted 5 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-1val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more
data than expected ?
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 3 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
VSYNC time = (width +
h_blank) * height;What I'm trying to understand is what happens if the ISP is configured for
1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines limit to avoid buffer
Quoted 6 lines
overflows ?
Quoted 2 lines
If is "
capture_raw" video device, no image height can be configured.In that case what happens if the camera sensor sends more lines than expected ? Will the raw video device write past the end of the buffer ?
Yes, the buffer will overflows, so we will use the software restrictions. Implement .link_validate hooks for the CSI2RX subdev and "capture_raw" video device.
Quoted 6 lines
If so, is there a way to guard against that ?
Quoted 1 line
If is "
capture_yuv" video device, it will be set bystf_isp_config_crop.Thank you, that's the information I was looking for.
Regards,
Changhuang
Quoted 70 lines · Changhuang Liang
Quoted 70 lines · Changhuang Liang
Quoted 69 lines
Quoted 68 lines · Changhuang Liang
Quoted 57 lines
Quoted 49 lines · Changhuang Liang
Quoted 48 lines
Quoted 47 lines · Changhuang Liang
Quoted 17 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Add capture driver")Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) { · line 179
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) { · line 183
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 10 lines
drivers/staging/media/starfive/camss/stf-capture.c +2
-1+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Quoted 7 lines
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
Quoted 5 lines
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
VSYNC time = (width +
h_blank) * height;What I'm trying to understand is what happens if the ISP is configured for 1080 lines, but the camera sensor sends more than 1080 lines (the
VSYNC signal is active for more than 1080 lines). Where in the
driver is the hardware configure with the 1080 lines limit to avoid buffer overflows ?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
If is "
capture_raw" video device, no image height can be configured.In that case what happens if the camera sensor sends more lines than expected ? Will the raw video device write past the end of the buffer ?
Yes, the buffer will overflows, so we will use the software restrictions. Implement .link_validate hooks for the CSI2RX subdev and "
capture_raw" video device.
Is there an IOMMU in the system that could help preventing buffer overflows to reach system memory ?
Quoted 5 lines
Quoted 5 lines
If so, is there a way to guard against that ?
Quoted 1 line
If is "
capture_yuv" video device, it will be set bystf_isp_config_crop.Thank you, that's the information I was looking for.
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Laurent
Quoted 95 lines · Changhuang Liang
Quoted 2 lines
Quoted 2 lines · Changhuang Liang
Quoted 1 line
Quoted 1 line
On Mon, Aug 12, 2024 at 09:43:47AM +0000, Changhuang Liang
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Fri, Aug 09, 2024 at 12:12:01PM +0000, Changhuang Liang
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Fri, Apr 19, 2024 at 01:19:55AM -0700, Changhuang Liang
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Add multiple resolution support for video "
capture_raw"device.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Otherwise it will capture the wrong image data if the width is
not 1920.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Fixes e080f339c80a ("media: staging: media: starfive:camss: Add capture driver")
Signed-off-by: Changhuang Liang <[email protected]>
---
drivers/staging/media/starfive/camss/stf-capture.c|
5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review static void stf_channel_set(struct
Quoted 9 lines
diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644
---a/drivers/staging/media/starfive/camss/stf-capture.c+++ b/drivers/staging/media/starfive/camss/stf-capture +++ .c(quoted diff) +0
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct
stfcamss_video*video) {Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Review static void stf_channel_set(struct · line 179
Quoted 3 lines
(quoted diff) +1
-0struct stf_capture *cap = to_stf_capture(video); struct stfcamss *stfcamss = cap->video.stfcamss; + struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
Review static void stf_channel_set(struct · line 183
Quoted 4 lines
(quoted diff) +1
-0u32 val; if (cap->type == STF_CAPTURE_RAW) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
const struct
v4l2_pix_format*pix =&video->active_fmt.fmt.pix;Quoted 2 lines
(quoted diff) +1
-0+ val = stf_syscon_reg_read(stfcamss,
VIN_CHANNEL_SEL_EN);Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review static void stf_channel_set(struct
Quoted 3 lines
(quoted diff) +0
-0val &= ~U0_VIN_CHANNEL_SEL_MASK; val |= CHANNEL(0);@@ -193,7 +196,7 @@ static void stf_channel_set(struct
stfcamss_video*video)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Review static void stf_channel_set(struct · line 199
Quoted 5 lines
(quoted diff) +1
-1val |= PIXEL_HEIGH_BIT_SEL(0); val &= ~U0_VIN_PIX_CNT_END_MASK; - val |= PIX_CNT_END(IMAGE_MAX_WIDTH / 4 - 1); + val |= PIX_CNT_END(pix->width / 4 - 1);Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
What happens if the system expects, for instance, a 1920x1080
RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?The hardware can confirm the image height by using the VSYNC
signal.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Image will transfer when VSYNC is high.
VSYNC time = (width +
h_blank) * height;What I'm trying to understand is what happens if the ISP is configured for
1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines limit to avoidbuffer overflows ?
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
If is "
capture_raw" video device, no image height can be configured.In that case what happens if the camera sensor sends more lines than expected ? Will the raw video device write past the end of the buffer ?
Quoted 7 lines
Quoted 2 lines
Yes, the buffer will overflows, so we will use the software restrictions. Implement .link_validate hooks for the CSI2RX subdev and "
capture_raw"video device.
Is there an IOMMU in the system that could help preventing buffer overflows to reach system memory ?
JH7110 SoC has no IOMMU.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
If so, is there a way to guard against that ?
Quoted 1 line
If is "
capture_yuv" video device, it will be set bystf_isp_config_crop.Thank you, that's the information I was looking for.
--
Regards,
Changhuang
Quoted 77 lines · Changhuang Liang
Quoted 77 lines · Changhuang Liang
Quoted 76 lines
Quoted 75 lines · Changhuang Liang
Quoted 64 lines
Quoted 64 lines · Changhuang Liang
Quoted 62 lines
Quoted 49 lines · Changhuang Liang
Quoted 48 lines
Quoted 47 lines · Changhuang Liang
Quoted 17 lines
Add multiple resolution support for video "
capture_raw" device. Otherwise it will capture the wrong image data if the width is not 1920.Fixes e080f339c80a ("media: staging: media: starfive: camss: Add capture driver")Signed-off-by Changhuang Liang <[email protected]>--- drivers/staging/media/starfive/camss/stf-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)diff --git
a/drivers/staging/media/starfive/camss/stf-capture.cb/drivers/staging/media/starfive/camss/stf-capture.cindexec5169e7b391..9e853ff2596a100644drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) { · line 179
Quoted 3 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0@@ -177,9 +177,12 @@ static void stf_channel_set(struct stfcamss_video *video) {struct stf_capture *cap =to_stf_capture (video);struct stfcamss *stfcamss = cap->video.stfcamss; +struct v4l2_pix_format *pix;This variable can be const as you don't modify the format.
drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) { · line 183
Quoted 4 lines
drivers/staging/media/starfive/camss/stf-capture.c +1
-0u32 val;if (cap->type ==STF_CAPTURE_RAW ) { + pix = &video->active_fmt.fmt.pix;And it can be declared and initialized here:
const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;drivers/staging/media/starfive/camss/stf-capture.c static void stf_channel_set(struct stfcamss_video *video) · line 199
Quoted 10 lines
drivers/staging/media/starfive/camss/stf-capture.c +2
-1+ val =stf_syscon_reg_read (stfcamss,VIN_CHANNEL_SEL_EN ); val &= ~U0_VIN_CHANNEL_SEL_MASK ; val |=CHANNEL (0 );@@ -193,7 +196,7 @@ static void stf_channel_set(struct stfcamss_video *video) val |=PIXEL_HEIGH_BIT_SEL (0 ); val &= ~U0_VIN_PIX_CNT_END_MASK ; - val |=PIX_CNT_END (IMAGE_MAX_WIDTH /4 -1 ); + val |=PIX_CNT_END (pix->width /4 -1 );Is there no need to consider the image height as well ? How does the driver prevent buffer overflows if the sensor sends more data than expected ?
Quoted 7 lines
Quoted 2 lines
Our hardware will confirm a frame of data through vblank signal, so there is no image height configuration.
What happens if the system expects, for instance, a 1920x1080 RAW8 image, and allocates a buffer of of 1920x1080 bytes, but the sensor outputs more lines ? Does the camera hardware in the SoC offer an option to prevent buffer overruns ?
The hardware can confirm the image height by using the VSYNC signal.
Image will transfer when VSYNC is high.
VSYNC time = (width +
h_blank) * height;Quoted 7 lines
Quoted 5 lines
What I'm trying to understand is what happens if the ISP is configured for 1080 lines, but the camera sensor sends more than 1080 lines (the VSYNC signal is active for more than 1080 lines). Where in the driver is the hardware configure with the 1080 lines
limit to avoid buffer overflows ?If is "
capture_raw" video device, no image height can be configured.In that case what happens if the camera sensor sends more lines than expected ? Will the raw video device write past the end of the buffer ?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Yes, the buffer will overflows, so we will use the software restrictions. Implement .link_validate hooks for the CSI2RX subdev and "
capture_raw" video device.Is there an IOMMU in the system that could help preventing buffer overflows to reach system memory ?
JH7110 SoC has no IOMMU.
Thank you for the information.
Based on this, the best we can do is hoping that the video source will never send more lines than expected. In most cases there will be no issue, but signal glitches or other hardware glitches on the sensor side may cause memory corruption. That sounds like a worrying hardware vulnerability :-(
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If so, is there a way to guard against that ?
Quoted 1 line
If is "
capture_yuv" video device, it will be set bystf_isp_config_crop.Thank you, that's the information I was looking for.
Signature · 3 lines
Regards, Laurent Pinchart