mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
Move WindowServer to userspace.
This is a monster patch that required changing a whole bunch of things. There are performance and stability issues all over the place, but it works. Pretty cool, I have to admit :^)
This commit is contained in:
parent
0b1b21d622
commit
640360e958
41 changed files with 325 additions and 463 deletions
|
@ -1,19 +1,19 @@
|
|||
#include "Process.h"
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <WindowServer/WSScreen.h>
|
||||
#include <WindowServer/WSWindowManager.h>
|
||||
#include <WindowServer/WSMessageLoop.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
// NOTE: This actually runs as a kernel process.
|
||||
// I'd like to change this eventually.
|
||||
|
||||
void WindowServer_main()
|
||||
int main(int, char**)
|
||||
{
|
||||
WSMessageLoop::the().set_server_process(*current);
|
||||
current->set_priority(Process::HighPriority);
|
||||
dbgprintf("WindowServer starting...\n");
|
||||
WSMessageLoop loop;
|
||||
|
||||
int bxvga_fd = current->sys$open("/dev/bxvga", O_RDWR);
|
||||
int bxvga_fd = open("/dev/bxvga", O_RDWR);
|
||||
ASSERT(bxvga_fd >= 0);
|
||||
|
||||
struct BXVGAResolution {
|
||||
|
@ -21,24 +21,17 @@ void WindowServer_main()
|
|||
int height;
|
||||
};
|
||||
BXVGAResolution resolution { 1024, 768 };
|
||||
|
||||
int rc = current->sys$ioctl(bxvga_fd, 1985, (int)&resolution);
|
||||
int rc = ioctl(bxvga_fd, 1985, (int)&resolution);
|
||||
ASSERT(rc == 0);
|
||||
|
||||
Syscall::SC_mmap_params params;
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.fd = bxvga_fd;
|
||||
params.prot = PROT_READ | PROT_WRITE;
|
||||
params.flags = MAP_SHARED;
|
||||
params.size = resolution.width * resolution.height * sizeof(RGBA32) * 2;
|
||||
params.offset = 0;
|
||||
kprintf("Calling sys$mmap in WS\n");
|
||||
void* framebuffer = current->sys$mmap(¶ms);
|
||||
size_t framebuffer_size_in_bytes = resolution.width * resolution.height * sizeof(RGBA32) * 2;
|
||||
void* framebuffer = mmap(nullptr, framebuffer_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, bxvga_fd, 0);
|
||||
ASSERT(framebuffer && framebuffer != (void*)-1);
|
||||
|
||||
WSScreen screen((dword*)framebuffer, resolution.width, resolution.height);
|
||||
|
||||
WSWindowManager::the().set_framebuffer_fd(bxvga_fd);
|
||||
WSWindowManager window_manager;
|
||||
window_manager.set_framebuffer_fd(bxvga_fd);
|
||||
|
||||
dbgprintf("Entering WindowServer main loop.\n");
|
||||
WSMessageLoop::the().exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue