diff mbox series

[3/3] drm/ssd130x: ensure ssd132x pitch is correct

Message ID 20250113152752.3369731-4-jkeeping@inmusicbrands.com (mailing list archive)
State New
Headers show
Series drm/ssd130x: some small ssd132x fixes | expand

Commit Message

John Keeping Jan. 13, 2025, 3:27 p.m. UTC
The bounding rectangle is adjusted to ensure it aligns to
SSD132X_SEGMENT_WIDTH, which may adjust the pitch.  Calcuate the pitch
after alighting the left and right edge.

Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
---
 drivers/gpu/drm/solomon/ssd130x.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Javier Martinez Canillas Jan. 14, 2025, 11:19 p.m. UTC | #1
John Keeping <jkeeping@inmusicbrands.com> writes:

> The bounding rectangle is adjusted to ensure it aligns to
> SSD132X_SEGMENT_WIDTH, which may adjust the pitch.  Calcuate the pitch

Calculate

> after alighting the left and right edge.
>

aligning

> Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
> ---
>  drivers/gpu/drm/solomon/ssd130x.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
> index 64f1123080996..38f31c3624062 100644
> --- a/drivers/gpu/drm/solomon/ssd130x.c
> +++ b/drivers/gpu/drm/solomon/ssd130x.c
> @@ -1037,7 +1037,7 @@ static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,
>  				struct drm_format_conv_state *fmtcnv_state)
>  {
>  	struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev);
> -	unsigned int dst_pitch = drm_rect_width(rect);
> +	unsigned int dst_pitch;
>  	struct iosys_map dst;
>  	int ret = 0;
>  
> @@ -1046,6 +1046,8 @@ static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,
>  	rect->x2 = min_t(unsigned int, round_up(rect->x2, SSD132X_SEGMENT_WIDTH),
>  			 ssd130x->width);
>  
> +	dst_pitch = drm_rect_width(rect);
> +
>  	ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
>  	if (ret)
>  		return ret;
> -- 
> 2.47.1
>

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Javier Martinez Canillas Jan. 15, 2025, 8:48 a.m. UTC | #2
Javier Martinez Canillas <javierm@redhat.com> writes:

> John Keeping <jkeeping@inmusicbrands.com> writes:
>
>> The bounding rectangle is adjusted to ensure it aligns to
>> SSD132X_SEGMENT_WIDTH, which may adjust the pitch.  Calcuate the pitch
>
> Calculate
>
>> after alighting the left and right edge.
>>
>
> aligning
>

I forgot that this patch also needs a

Fixes: fdd591e00a9c ("drm/ssd130x: Add support for the SSD132x OLED controller family")

>> Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
index 64f1123080996..38f31c3624062 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -1037,7 +1037,7 @@  static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,
 				struct drm_format_conv_state *fmtcnv_state)
 {
 	struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev);
-	unsigned int dst_pitch = drm_rect_width(rect);
+	unsigned int dst_pitch;
 	struct iosys_map dst;
 	int ret = 0;
 
@@ -1046,6 +1046,8 @@  static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,
 	rect->x2 = min_t(unsigned int, round_up(rect->x2, SSD132X_SEGMENT_WIDTH),
 			 ssd130x->width);
 
+	dst_pitch = drm_rect_width(rect);
+
 	ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
 	if (ret)
 		return ret;