1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:08:13 +00:00

WindowServer: Query driver for framebuffer offset

Depending on the driver, the second buffer may not be located right
after the first, e.g. it may be page aligned. This removes this
assumption and queries the driver for the appropriate offset.
This commit is contained in:
Tom 2021-07-03 20:36:16 -06:00 committed by Andreas Kling
parent fdae117600
commit 6e792553f2
5 changed files with 47 additions and 6 deletions

View file

@ -28,6 +28,16 @@ ALWAYS_INLINE int fb_set_resolution(int fd, FBResolution* info)
return ioctl(fd, FB_IOCTL_SET_RESOLUTION, info);
}
ALWAYS_INLINE int fb_get_buffer_offset(int fd, int index, unsigned* offset)
{
FBBufferOffset fb_buffer_offset;
fb_buffer_offset.buffer_index = index;
int result = ioctl(fd, FB_IOCTL_GET_BUFFER_OFFSET, &fb_buffer_offset);
if (result == 0)
*offset = fb_buffer_offset.offset;
return result;
}
ALWAYS_INLINE int fb_get_buffer(int fd, int* index)
{
return ioctl(fd, FB_IOCTL_GET_BUFFER, index);