mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:47:35 +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
|
@ -9,7 +9,6 @@
|
|||
#include <SharedGraphics/Painter.h>
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/BochsVGADevice.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include "WSMenu.h"
|
||||
#include "WSMenuBar.h"
|
||||
|
@ -126,10 +125,11 @@ void WSWindowManager::flip_buffers()
|
|||
{
|
||||
swap(m_front_bitmap, m_back_bitmap);
|
||||
swap(m_front_painter, m_back_painter);
|
||||
if (m_buffers_are_flipped)
|
||||
BochsVGADevice::the().set_y_offset(0);
|
||||
else
|
||||
BochsVGADevice::the().set_y_offset(m_screen_rect.height());
|
||||
if (m_framebuffer_fd != -1) {
|
||||
int new_y_offset = m_buffers_are_flipped ? 0 : m_screen_rect.height();
|
||||
int rc = current->sys$ioctl(m_framebuffer_fd, 1982, new_y_offset);
|
||||
ASSERT(rc == 0);
|
||||
}
|
||||
m_buffers_are_flipped = !m_buffers_are_flipped;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ public:
|
|||
Color menu_selection_color() const { return m_menu_selection_color; }
|
||||
int menubar_menu_margin() const;
|
||||
|
||||
int api$menu_add_separator(int menu_id);
|
||||
int api$menu_add_item(int menu_id, unsigned identifier, String&& text);
|
||||
int framebuffer_fd() const { return m_framebuffer_fd; }
|
||||
void set_framebuffer_fd(int fd) { m_framebuffer_fd = fd; }
|
||||
|
||||
private:
|
||||
WSWindowManager();
|
||||
|
@ -151,4 +151,6 @@ private:
|
|||
Color m_menu_selection_color;
|
||||
WeakPtr<WSMenuBar> m_current_menubar;
|
||||
WeakPtr<WSMenu> m_current_menu;
|
||||
|
||||
int m_framebuffer_fd { -1 };
|
||||
};
|
||||
|
|
|
@ -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