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
Notes: sideshowbarker 2024-07-19 16:00:56 +09:00

View file

@ -20,13 +20,13 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
{
size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32);
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);
{
auto& server = WSEventLoop::the().server_process();
ProcessInspectionHandle composer_handle(server);
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (shared)", true, true);
InterruptDisabler disabler;
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();
}