The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
fb.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
sys/types.h
>
4
5
/**
6
* @file fb.h
7
* @brief userspace access to the linear framebuffer.
8
*
9
* a program calls fbinfo() to learn the framebuffer geometry and pixel format,
10
* then fbmap() to map it into its address space and draw pixels directly.
11
* these are convenience wrappers over the /dev/fb0 fbdev (open + ioctl + mmap,
12
* see <sys/fb.h>); a program can use that interface directly instead. this is
13
* still a single-client path (no compositor yet): whoever maps it owns the
14
* whole screen until it exits.
15
*/
16
17
typedef
unsigned
int
uint32_t
;
18
typedef
unsigned
char
uint8_t
;
19
20
/**
21
* framebuffer geometry and pixel format, filled by fbinfo().
22
* mirrors the kernel's view; the channel size/shift pairs describe how r/g/b
23
* sit inside a pixel so a program can pack colours for any layout.
24
*/
25
typedef
struct
26
{
27
uint32_t
width
;
// width in pixels.
28
uint32_t
height
;
// height in pixels.
29
uint32_t
pitch
;
// bytes per scanline (may exceed width * bpp/8).
30
uint32_t
bpp
;
// bits per pixel (24 or 32).
31
uint8_t
red_size
,
red_shift
;
32
uint8_t
green_size
,
green_shift
;
33
uint8_t
blue_size
,
blue_shift
;
34
uint8_t
_pad
[2];
35
}
fb_info_t
;
36
37
/**
38
* query the framebuffer geometry and pixel format.
39
* @param info output struct.
40
* @return 0 on success, -1 if there is no framebuffer.
41
*/
42
int
fbinfo
(
fb_info_t
*info);
43
44
/**
45
* map the framebuffer into this process's address space.
46
* @return a writable pointer to the framebuffer, or NULL on failure. the
47
* returned buffer is `pitch * height` bytes; write packed pixels.
48
*/
49
void
*
fbmap
(
void
);
50
51
/**
52
* non-blocking keyboard poll for interactive graphics programs.
53
* @return the next pending character key, or 0 if none is waiting.
54
*/
55
int
pollkey
(
void
);
pollkey
int pollkey(void)
non-blocking keyboard poll for interactive graphics programs.
uint32_t
unsigned int uint32_t
Definition
fb.h:17
fbmap
void * fbmap(void)
map the framebuffer into this process's address space.
fbinfo
int fbinfo(fb_info_t *info)
query the framebuffer geometry and pixel format.
uint8_t
unsigned char uint8_t
Definition
fb.h:18
fb_info_t
framebuffer geometry and pixel format, filled by fbinfo().
Definition
fb.h:26
fb_info_t::bpp
uint32_t bpp
Definition
fb.h:30
fb_info_t::blue_size
uint8_t blue_size
Definition
fb.h:33
fb_info_t::pitch
uint32_t pitch
Definition
fb.h:29
fb_info_t::width
uint32_t width
Definition
fb.h:27
fb_info_t::_pad
uint8_t _pad[2]
Definition
fb.h:34
fb_info_t::height
uint32_t height
Definition
fb.h:28
fb_info_t::blue_shift
uint8_t blue_shift
Definition
fb.h:33
fb_info_t::green_size
uint8_t green_size
Definition
fb.h:32
fb_info_t::red_size
uint8_t red_size
Definition
fb.h:31
fb_info_t::red_shift
uint8_t red_shift
Definition
fb.h:31
fb_info_t::green_shift
uint8_t green_shift
Definition
fb.h:32
types.h
basic system types.
src
libc
include
fb.h
Generated by
1.18.0