2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-08-18 12:25:22 +10:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
#include <stddef.h>
|
2019-08-18 12:25:22 +10:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
ALWAYS_INLINE int fb_get_size_in_bytes(int fd, size_t* out)
|
2019-08-18 12:25:22 +10:00
|
|
|
{
|
|
|
|
|
return ioctl(fd, FB_IOCTL_GET_SIZE_IN_BYTES, out);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
ALWAYS_INLINE int fb_get_resolution(int fd, FBResolution* info)
|
2019-08-18 12:25:22 +10:00
|
|
|
{
|
|
|
|
|
return ioctl(fd, FB_IOCTL_GET_RESOLUTION, info);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
ALWAYS_INLINE int fb_set_resolution(int fd, FBResolution* info)
|
2019-08-18 12:25:22 +10:00
|
|
|
{
|
|
|
|
|
return ioctl(fd, FB_IOCTL_SET_RESOLUTION, info);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
ALWAYS_INLINE int fb_get_buffer(int fd, int* index)
|
2019-08-18 12:25:22 +10:00
|
|
|
{
|
|
|
|
|
return ioctl(fd, FB_IOCTL_GET_BUFFER, index);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 23:59:06 +02:00
|
|
|
ALWAYS_INLINE int fb_set_buffer(int fd, int index)
|
2019-08-18 12:25:22 +10:00
|
|
|
{
|
|
|
|
|
return ioctl(fd, FB_IOCTL_SET_BUFFER, index);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-26 11:04:01 -06:00
|
|
|
ALWAYS_INLINE int fb_flush_buffers(int fd, FBRect const* rects, unsigned count)
|
2021-06-12 22:46:54 +10:00
|
|
|
{
|
2021-06-26 11:04:01 -06:00
|
|
|
FBRects fb_rects;
|
|
|
|
|
fb_rects.count = count;
|
|
|
|
|
fb_rects.rects = rects;
|
|
|
|
|
return ioctl(fd, FB_IOCTL_FLUSH_BUFFERS, &fb_rects);
|
2021-06-12 22:46:54 +10:00
|
|
|
}
|
|
|
|
|
|
2019-08-18 12:25:22 +10:00
|
|
|
__END_DECLS
|