Skip to content

Commit e87ba61

Browse files
committed
Fix memory region in framebuffer and pan display
The width of a screen may be different to the virtual resolution.
1 parent 980bd4c commit e87ba61

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backend/fbdev.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void _twin_fbdev_put_span(twin_coord_t left,
5656
return;
5757

5858
twin_coord_t width = right - left;
59-
off_t off = top * screen->width + left;
59+
off_t off = top * tx->fb_var.xres_virtual + left;
6060
uint32_t *dest =
6161
(uint32_t *) ((uintptr_t) tx->fb_base + (off * sizeof(uint32_t)));
6262
memcpy(dest, pixels, width * sizeof(uint32_t));
@@ -82,9 +82,13 @@ static void twin_fbdev_damage(twin_screen_t *screen, twin_fbdev_t *tx)
8282
static bool twin_fbdev_work(void *closure)
8383
{
8484
twin_screen_t *screen = SCREEN(closure);
85+
twin_fbdev_t *tx = PRIV(closure);
8586

86-
if (twin_screen_damaged(screen))
87+
if (twin_screen_damaged(screen)) {
8788
twin_screen_update(screen);
89+
ioctl(tx->fb_fd, FBIOPAN_DISPLAY, &tx->fb_var);
90+
}
91+
8892
return true;
8993
}
9094

0 commit comments

Comments
 (0)