1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:07:44 +00:00

Paper over annoying race in GraphicsBitmap instantiation.

This works for now. This has to be done quite differently when I eventually
move the WindowServer to userspace.
This commit is contained in:
Andreas Kling 2019-01-17 02:58:34 +01:00
parent 36e0ab3f18
commit 3ad0ec9b1b

View file

@ -20,13 +20,13 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
{ {
size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32); size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32);
auto vmo = VMObject::create_anonymous(size_in_bytes); auto vmo = VMObject::create_anonymous(size_in_bytes);
m_client_region = process.allocate_region_with_vmo(LinearAddress(), size_in_bytes, vmo.copyRef(), 0, "GraphicsBitmap (shared)", true, true); m_client_region = process.allocate_region_with_vmo(LinearAddress(), size_in_bytes, vmo.copyRef(), 0, "GraphicsBitmap (client)", true, true);
m_client_region->commit(process); m_client_region->commit(process);
{ {
auto& server = WSEventLoop::the().server_process(); auto& server = WSEventLoop::the().server_process();
ProcessInspectionHandle composer_handle(server); InterruptDisabler disabler;
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (shared)", true, true); m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, true);
} }
m_data = (RGBA32*)m_server_region->linearAddress.asPtr(); m_data = (RGBA32*)m_server_region->linearAddress.asPtr();
} }