-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Everywhere: Use IOSurface as backing store on macOS
Using mmap-allocated memory for backing stores does not allow us to benefit from using GPU-accelerated painting, because all the performance increase we get is mostly negated by reading the GPU-allocated texture back into RAM, so it can be shared with the browser process. With IOSurface, we get a framebuffer that is both shareable between processes and can be used as underlying memory for an OpenGL/Metal texture. This change does not yet benefit from using IOSurface and merely wraps them into Gfx::Bitmap to be used by the CPU painter.
- Loading branch information
1 parent
e37071a
commit c92f8ab
Showing
15 changed files
with
266 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,8 @@ class UDPSocket; | |
|
||
enum class TimerShouldFireWhenNotVisible; | ||
|
||
#ifdef AK_OS_MACH | ||
class MachPort; | ||
#endif | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2024, Andrew Kaster <[email protected]> | ||
* Copyright (c) 2024, Aliaksandr Kalenik <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <AK/Platform.h> | ||
|
||
#if !defined(AK_OS_MACH) | ||
# error "This file is only available on Mach platforms" | ||
#endif | ||
|
||
#include <mach/mach.h> | ||
|
||
namespace Core::Platform { | ||
|
||
struct MessageBodyWithSelfTaskPort { | ||
mach_msg_body_t body; | ||
mach_msg_port_descriptor_t port_descriptor; | ||
mach_msg_audit_trailer_t trailer; | ||
}; | ||
|
||
struct MessageWithSelfTaskPort { | ||
mach_msg_header_t header; | ||
mach_msg_body_t body; | ||
mach_msg_port_descriptor_t port_descriptor; | ||
}; | ||
|
||
struct BackingStoreMetadata { | ||
u64 page_id { 0 }; | ||
i32 back_backing_store_id { 0 }; | ||
i32 front_backing_store_id { 0 }; | ||
}; | ||
|
||
struct MessageBodyWithBackingStores { | ||
mach_msg_body_t body; | ||
mach_msg_port_descriptor_t front_descriptor; | ||
mach_msg_port_descriptor_t back_descriptor; | ||
BackingStoreMetadata metadata; | ||
mach_msg_audit_trailer_t trailer; | ||
}; | ||
|
||
struct MessageWithBackingStores { | ||
mach_msg_header_t header; | ||
mach_msg_body_t body; | ||
mach_msg_port_descriptor_t front_descriptor; | ||
mach_msg_port_descriptor_t back_descriptor; | ||
BackingStoreMetadata metadata; | ||
}; | ||
|
||
struct ReceivedMachMessage { | ||
mach_msg_header_t header; | ||
union { | ||
MessageBodyWithSelfTaskPort parent; | ||
MessageBodyWithBackingStores parent_iosurface; | ||
} body; | ||
}; | ||
|
||
static constexpr mach_msg_id_t SELF_TASK_PORT_MESSAGE_ID = 0x1234CAFE; | ||
static constexpr mach_msg_id_t BACKING_STORE_IOSURFACES_MESSAGE_ID = 0x1234CAFF; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.