Commit 4dbce3d6 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Javier Martinez Canillas

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: 49d7d581 ("drm/ssd130x: Don't allocate buffers on each plane update")
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Tested-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c19cd5a57205597bb38a446c3871092993498f01.1692888745.git.geert@linux-m68k.org
parent 84f54d49
...@@ -553,14 +553,45 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x, ...@@ -553,14 +553,45 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x,
static void ssd130x_clear_screen(struct ssd130x_device *ssd130x, static void ssd130x_clear_screen(struct ssd130x_device *ssd130x,
struct ssd130x_plane_state *ssd130x_state) struct ssd130x_plane_state *ssd130x_state)
{ {
struct drm_rect fullscreen = { unsigned int page_height = ssd130x->device_info->page_height;
.x1 = 0, unsigned int pages = DIV_ROUND_UP(ssd130x->height, page_height);
.x2 = ssd130x->width, u8 *data_array = ssd130x_state->data_array;
.y1 = 0, unsigned int width = ssd130x->width;
.y2 = ssd130x->height, int ret, i;
};
if (!ssd130x->page_address_mode) {
ssd130x_update_rect(ssd130x, ssd130x_state, &fullscreen); memset(data_array, 0, width * pages);
/* Set address range for horizontal addressing mode */
ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset, width);
if (ret < 0)
return;
ret = ssd130x_set_page_range(ssd130x, ssd130x->page_offset, pages);
if (ret < 0)
return;
/* Write out update in one go if we aren't using page addressing mode */
ssd130x_write_data(ssd130x, data_array, width * pages);
} else {
/*
* In page addressing mode, the start address needs to be reset,
* and each page then needs to be written out separately.
*/
memset(data_array, 0, width);
for (i = 0; i < pages; i++) {
ret = ssd130x_set_page_pos(ssd130x,
ssd130x->page_offset + i,
ssd130x->col_offset);
if (ret < 0)
return;
ret = ssd130x_write_data(ssd130x, data_array, width);
if (ret < 0)
return;
}
}
} }
static int ssd130x_fb_blit_rect(struct drm_plane_state *state, static int ssd130x_fb_blit_rect(struct drm_plane_state *state,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment