OSDN Git Service

drm/ssd130x: Fix rectangle updates
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 17 Mar 2022 08:18:28 +0000 (09:18 +0100)
committerJavier Martinez Canillas <javierm@redhat.com>
Thu, 17 Mar 2022 11:29:42 +0000 (12:29 +0100)
commita97e753fd358e23155ae42c61292dfd57eb54c4a
treed00f341f7a012beefe4bdb5fcb0f5c08eb59b507
parent7392f2459eefcdab1d998af002d2b8b16fe4a2fd
drm/ssd130x: Fix rectangle updates

The rectangle update functions ssd130x_fb_blit_rect() and
ssd130x_update_rect() do not behave correctly when x1 != 0 or y1 !=
0, or when y1 or y2 are not aligned to display page boundaries.
E.g. when used as a text console, only the first line of text is shown
on the display.

  1. The buffer passed by ssd130x_fb_blit_rect() points to the first
     byte of monochrome bitmap data, and thus has its origin at (x1,
     y1), while ssd130x_update_rect() assumes it is at (0, 0).
     Fix ssd130x_update_rect() by changing the vertical and horizontal
     loop ranges, and adding the offsets only when needed.

  2. In ssd130x_fb_blit_rect(), align y1 and y2 to the display page
     boundaries before doing the color conversion, so the full page
     is converted and updated.
     Remove the correction for an unaligned y1 from
     ssd130x_update_rect(), and add a check to make sure y1 is aligned.

Fixes: a61732e808672cfa ("drm: Add driver for Solomon SSD130x OLED displays")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220317081830.1211400-4-geert@linux-m68k.org
drivers/gpu/drm/solomon/ssd130x.c