Files
MontaukOS/montaukos.org/docs/man/framebuffer.html
T
2026-07-09 11:32:27 +02:00

160 lines
4.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="MontaukOS manual page: framebuffer(2) - direct framebuffer access">
<title>framebuffer(2) - MontaukOS Manual</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Open Sans', Arial, sans-serif;
max-width: 960px;
margin: 0 auto;
padding: 1em;
line-height: 1.5;
display: flex;
gap: 2em;
}
p { margin: 0 0 0.5em; }
h2 { margin: 0.5em 0; }
.sidebar {
width: 160px;
flex-shrink: 0;
}
.sidebar ul {
list-style: none;
padding: 0;
}
.sidebar li {
margin: 0.5em 0;
}
.sidebar a {
color: #0066CC;
text-decoration: none;
font-weight: 600;
}
.sidebar a:hover {
color: #004499;
text-decoration: underline;
}
.sidebar .current {
color: #004499;
}
.sidebar hr {
border: none;
border-top: 1px solid #999;
margin: 0.75em 0;
}
.main {
flex: 1;
min-width: 0;
}
a { color: #0000EE; }
a:visited { color: #0066CC; }
hr { border-style: solid; border-width: 1px 0 0 0; border-color: #999; }
pre { background: #f0f0f0; padding: 0.5em; overflow-x: auto; }
code { background: #f0f0f0; padding: 0 0.15em; }
pre code { padding: 0; }
.center { text-align: center; }
.box {
border: 1px solid #999;
padding: 0.5em;
margin: 0.5em 0;
}
</style>
</head>
<body>
<div class="sidebar">
<ul>
<li><a href="../../index.html">Home</a></li>
<li><a href="../index.html">Documentation</a></li>
</ul>
<hr>
<ul>
<li><a href="index.html" class="current">Man Pages</a></li>
</ul>
</div>
<div class="main">
<div class="center">
<h1>framebuffer(2)</h1>
</div>
<hr>
<pre><code><strong>NAME</strong>
fb_info, fb_map - direct framebuffer access
<strong>SYNOPSIS</strong>
<strong> void montauk::fb_info(montauk::abi::FbInfo* info);</strong>
<strong> void* montauk::fb_map();</strong>
<strong>DESCRIPTION</strong>
These syscalls allow userspace programs to access the linear
framebuffer directly for graphical output.
<strong>fb_info</strong>
Fills in an FbInfo structure with the framebuffer geometry:
montauk::abi::FbInfo fb;
montauk::fb_info(&amp;fb);
// fb.width, fb.height, fb.pitch, fb.bpp
The pitch is the number of bytes per scanline (may be larger
than width * 4 due to alignment). bpp is always 32.
<strong>fb_map</strong>
Maps the physical framebuffer into the process address space at
a fixed virtual address (0x50000000) and returns that address.
uint32_t* pixels = (uint32_t*)montauk::fb_map();
Each pixel is a 32-bit value in 0xAARRGGBB format (blue in the
low byte). Writing to this memory directly updates the screen.
<strong>PIXEL FORMAT</strong>
Bits 31-24: Alpha (unused, typically 0xFF)
Bits 23-16: Red
Bits 15-8: Green
Bits 7-0: Blue
Example: red = 0x00FF0000, green = 0x0000FF00, blue = 0x000000FF
<strong>EXAMPLE</strong>
Fill the screen with blue:
montauk::abi::FbInfo fb;
montauk::fb_info(&amp;fb);
uint32_t* pixels = (uint32_t*)montauk::fb_map();
for (uint64_t y = 0; y &lt; fb.height; y++) {
uint32_t* row = (uint32_t*)((uint8_t*)pixels + y * fb.pitch);
for (uint64_t x = 0; x &lt; fb.width; x++) {
row[x] = 0x000000FF;
}
}
<strong>NOTES</strong>
After mapping, the cursor overlay is not composited. Programs
that use the framebuffer take full control of screen output.
Only one mapping per process is supported. Calling fb_map()
multiple times returns the same address.
<strong>SEE ALSO</strong>
syscalls(2), malloc(3)</code></pre>
<hr>
<div class="center">
<a href="../index.html">Back to Documentation Index</a>
</div>
</div>
</body>
</html>