mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:38:10 +00:00
Kernel: Add ioctls to BochsVGADevice for mode setting and page flipping.
Use these in WindowServer instead of poking at the BochsVGADevice directly.
This commit is contained in:
parent
799177feda
commit
468113422f
6 changed files with 50 additions and 16 deletions
|
@ -12,27 +12,33 @@ void WindowServer_main()
|
|||
{
|
||||
WSMessageLoop::the().set_server_process(*current);
|
||||
current->set_priority(Process::HighPriority);
|
||||
auto info = current->set_video_resolution(1024, 768);
|
||||
|
||||
dbgprintf("Screen is %ux%ux%ubpp\n", info.width, info.height, info.bpp);
|
||||
|
||||
int bxvga_fd = current->sys$open("/dev/bxvga", O_RDWR);
|
||||
ASSERT(bxvga_fd >= 0);
|
||||
|
||||
struct BXVGAResolution {
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
BXVGAResolution resolution { 1024, 768 };
|
||||
|
||||
int rc = current->sys$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 = info.width * info.height * sizeof(RGBA32) * 2;
|
||||
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);
|
||||
ASSERT(framebuffer && framebuffer != (void*)-1);
|
||||
|
||||
WSScreen screen((dword*)framebuffer, info.width, info.height);
|
||||
WSScreen screen((dword*)framebuffer, resolution.width, resolution.height);
|
||||
|
||||
WSWindowManager::the();
|
||||
WSWindowManager::the().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