[1/1] media: camss: set VFE bpl_alignment to 16 for sdm845 and sm8250

Message ID 20230518215235.1668871-2-andrey.konovalov@linaro.org
State New
Headers
Series media: camss: fix VFE bpl_alignment for sdm845 and sm8250 |

Commit Message

Andrey Konovalov May 18, 2023, 9:52 p.m. UTC
  From the experiments with camera sensors using SGRBG10_1X10/3280x2464 and
SRGGB10_1X10/3280x2464 formats, it becomes clear that on sdm845 and sm8250
VFE outputs the lines padded to a length multiple of 16 bytes. As in the
current driver the value of the bpl_alignment is set to 8 bytes, the frames
captured in formats with the bytes-per-line value being not a multiple of
16 get corrupted.

Set the bpl_alignment of the camss video output device to 16 for sdm845 and
sm8250 to fix that.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
---
 drivers/media/platform/qcom/camss/camss-vfe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Bryan O'Donoghue May 22, 2023, 12:47 p.m. UTC | #1
On 18/05/2023 22:52, Andrey Konovalov wrote:
>  From the experiments with camera sensors using SGRBG10_1X10/3280x2464 and
> SRGGB10_1X10/3280x2464 formats, it becomes clear that on sdm845 and sm8250
> VFE outputs the lines padded to a length multiple of 16 bytes. As in the
> current driver the value of the bpl_alignment is set to 8 bytes, the frames
> captured in formats with the bytes-per-line value being not a multiple of
> 16 get corrupted.
> 
> Set the bpl_alignment of the camss video output device to 16 for sdm845 and
> sm8250 to fix that.
> 
> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
> ---
>   drivers/media/platform/qcom/camss/camss-vfe.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index e0832f3f4f25..06c95568e5af 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -1541,7 +1541,11 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
>   		}
>   
>   		video_out->ops = &vfe->video_ops;
> -		video_out->bpl_alignment = 8;
> +		if (vfe->camss->version == CAMSS_845 ||
> +		    vfe->camss->version == CAMSS_8250)
> +			video_out->bpl_alignment = 16;
> +		else
> +			video_out->bpl_alignment = 8;
>   		video_out->line_based = 0;
>   		if (i == VFE_LINE_PIX) {
>   			video_out->bpl_alignment = 16;

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
  

Patch

diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index e0832f3f4f25..06c95568e5af 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -1541,7 +1541,11 @@  int msm_vfe_register_entities(struct vfe_device *vfe,
 		}
 
 		video_out->ops = &vfe->video_ops;
-		video_out->bpl_alignment = 8;
+		if (vfe->camss->version == CAMSS_845 ||
+		    vfe->camss->version == CAMSS_8250)
+			video_out->bpl_alignment = 16;
+		else
+			video_out->bpl_alignment = 8;
 		video_out->line_based = 0;
 		if (i == VFE_LINE_PIX) {
 			video_out->bpl_alignment = 16;