-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Rendering Push Performance Using MIT-SHM #17118
base: master
Are you sure you want to change the base?
Optimize Rendering Push Performance Using MIT-SHM #17118
Conversation
You can test this PR using the following package version. |
You can test this PR using the following package version. |
…PutImage work. But the conversion is slowly, so we should not use XShmPutImage when the depth is not 32
You can test this PR using the following package version. |
You can test this PR using the following package version. |
This reverts commit 97e3673.
You can test this PR using the following package version. |
You can test this PR using the following package version. |
return; | ||
} | ||
|
||
// The reason for using `_x11.Display` instead of `_x11.DeferredDisplay` is that XSHM requires pushing to a Display that can receive Events, in order to obtain the XShmCompletionEvent when rendering is complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeferredDisplay should be used for rendering since compositor runs on a separate thread. You can get events from that connection too as previously discussed in #16690 (reply in thread) (see DeferredDisplayEvents class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks The DeferredDisplay do not call the XSelectInput
, and I do not know how to recevice the XShmCompletionEvent from DeferredDisplay. Thank you.
|
||
namespace Avalonia.X11.XShmExtensions; | ||
|
||
internal static class X11ShmDebugLogger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger.TryGet(LogEventLevel.Information, "X11")?.Log(...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks Thank you. I intend for the X11ShmDebugLogger to be used by Avalonia framework developers when investigating the XShm module, rather than by application developers using the Avalonia framework. Application developers should not be misled by the debug output from XShm. I'm not sure if this expectation is reasonable.
…ll be called in render thread and the OnXShmCompletion method will be called in UI thread
From https://www.x.org/releases/X11R7.5/doc/Xext/mit-shm.html The XShmCompletionEvent event type value that will be used can be determined at run time
You can test this PR using the following package version. |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
What does the pull request do?
This pull request implements the use of MIT-SHM for pushing rendered images. It replaces the
XPutImage
method withXShmPutImage
. This change significantly reduces Bitmap copying at the X11 layer, enhancing rendering push performance.What is the current behavior?
Currently, only
XPutImage
is used for pushing rendered images in soft rendering mode.What is the updated/expected behavior with this PR?
This pull request provides additional options, allowing developers to configure the use of MIT-SHM shared memory for pushing rendered images. This can effectively improve rendering performance and reduce rendering latency on low-performance devices.
How was the solution implemented (if it's not obvious)?
The solution involves using MIT-SHM to push rendered images, following the method outlined by @kekekeks in #16690 (reply in thread) .
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues