Skip to content

Commit

Permalink
Fix memory region in framebuffer (#65)
Browse files Browse the repository at this point in the history
If screen size is less than virtual resolution, it will draw multiple                                                                                         
screens on display. Use 'line_length' for calculation instead of screen
size.

Changeable information like virtual resolution or virtual terminal
settings may not apply across different hardware and drivers. e.g.,
on VirtualBox, virtual resolution is 2048x2048, visible resolution is
800x600, and line length is 2048 * 4. Any settings from guest machine to
these may be ignored.
  • Loading branch information
a1091150 authored Nov 22, 2024
1 parent b458e28 commit e4e0e70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ static void _twin_fbdev_put_span(twin_coord_t left,
return;

twin_coord_t width = right - left;
off_t off = top * screen->width + left;
uint32_t *dest =
(uint32_t *) ((uintptr_t) tx->fb_base + (off * sizeof(*dest)));
uint32_t *dest;
off_t off = sizeof(*dest) * left + top * tx->fb_fix.line_length;
dest = (uint32_t *) ((uintptr_t) tx->fb_base + off);
memcpy(dest, pixels, width * sizeof(*dest));
}

Expand Down

0 comments on commit e4e0e70

Please sign in to comment.