Skip to content

Commit 4dbce3d

Browse files
geertumartinezjavier
authored andcommitted
drm/ssd130x: Fix screen clearing
Due to the reuse of buffers, ssd130x_clear_screen() no longers clears the screen, but merely redraws the last image that is residing in the intermediate buffer. As there is no point in clearing the intermediate buffer and transposing an all-black image, fix this by just clearing the HW format buffer, and writing it to the panel. Fixes: 49d7d58 ("drm/ssd130x: Don't allocate buffers on each plane update") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Tested-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/c19cd5a57205597bb38a446c3871092993498f01.1692888745.git.geert@linux-m68k.org
1 parent 84f54d4 commit 4dbce3d

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

drivers/gpu/drm/solomon/ssd130x.c

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,45 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
553553
static void ssd130x_clear_screen(struct ssd130x_device *ssd130x,
554554
struct ssd130x_plane_state *ssd130x_state)
555555
{
556-
struct drm_rect fullscreen = {
557-
.x1 = 0,
558-
.x2 = ssd130x->width,
559-
.y1 = 0,
560-
.y2 = ssd130x->height,
561-
};
562-
563-
ssd130x_update_rect(ssd130x, ssd130x_state, &fullscreen);
556+
unsigned int page_height = ssd130x->device_info->page_height;
557+
unsigned int pages = DIV_ROUND_UP(ssd130x->height, page_height);
558+
u8 *data_array = ssd130x_state->data_array;
559+
unsigned int width = ssd130x->width;
560+
int ret, i;
561+
562+
if (!ssd130x->page_address_mode) {
563+
memset(data_array, 0, width * pages);
564+
565+
/* Set address range for horizontal addressing mode */
566+
ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset, width);
567+
if (ret < 0)
568+
return;
569+
570+
ret = ssd130x_set_page_range(ssd130x, ssd130x->page_offset, pages);
571+
if (ret < 0)
572+
return;
573+
574+
/* Write out update in one go if we aren't using page addressing mode */
575+
ssd130x_write_data(ssd130x, data_array, width * pages);
576+
} else {
577+
/*
578+
* In page addressing mode, the start address needs to be reset,
579+
* and each page then needs to be written out separately.
580+
*/
581+
memset(data_array, 0, width);
582+
583+
for (i = 0; i < pages; i++) {
584+
ret = ssd130x_set_page_pos(ssd130x,
585+
ssd130x->page_offset + i,
586+
ssd130x->col_offset);
587+
if (ret < 0)
588+
return;
589+
590+
ret = ssd130x_write_data(ssd130x, data_array, width);
591+
if (ret < 0)
592+
return;
593+
}
594+
}
564595
}
565596

566597
static int ssd130x_fb_blit_rect(struct drm_plane_state *state,

0 commit comments

Comments
 (0)