Skip to content

Commit 36d9579

Browse files
Francesco Lavramartinezjavier
authored andcommitted
drm/solomon: Fix page start when updating rectangle in page addressing mode
In page addressing mode, the pixel values of a dirty rectangle must be sent to the display controller one page at a time. The range of pages corresponding to a given rectangle is being incorrectly calculated as if the Y value of the top left coordinate of the rectangle was 0. This can result in rectangle updates being displayed on wrong parts of the screen. Fix the above issue by consolidating the start page calculation in a single place at the beginning of the update_rect function, and using the calculated value for all addressing modes. Fixes: b0daaa5 ("drm/ssd130x: Support page addressing mode") Signed-off-by: Francesco Lavra <flavra@baylibre.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260210180932.736502-1-flavra@baylibre.com Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 parent 75c151c commit 36d9579

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/gpu/drm/solomon/ssd130x.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
737737
unsigned int height = drm_rect_height(rect);
738738
unsigned int line_length = DIV_ROUND_UP(width, 8);
739739
unsigned int page_height = SSD130X_PAGE_HEIGHT;
740+
u8 page_start = ssd130x->page_offset + y / page_height;
740741
unsigned int pages = DIV_ROUND_UP(height, page_height);
741742
struct drm_device *drm = &ssd130x->drm;
742743
u32 array_idx = 0;
@@ -774,14 +775,11 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
774775
*/
775776

776777
if (!ssd130x->page_address_mode) {
777-
u8 page_start;
778-
779778
/* Set address range for horizontal addressing mode */
780779
ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset + x, width);
781780
if (ret < 0)
782781
return ret;
783782

784-
page_start = ssd130x->page_offset + y / page_height;
785783
ret = ssd130x_set_page_range(ssd130x, page_start, pages);
786784
if (ret < 0)
787785
return ret;
@@ -813,7 +811,7 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
813811
*/
814812
if (ssd130x->page_address_mode) {
815813
ret = ssd130x_set_page_pos(ssd130x,
816-
ssd130x->page_offset + i,
814+
page_start + i,
817815
ssd130x->col_offset + x);
818816
if (ret < 0)
819817
return ret;

0 commit comments

Comments
 (0)