renderer: skip ds commits if buffer didn't change (#9556)

this fixes direct scanout glitches by ensuring that attemptDirectScanout doesn't try to recommit the same buffer to AQ
which would cause a pageflip event and the backendRelease to release the same buffer too early
This commit is contained in:
Ikalco 2025-03-08 13:24:22 -06:00 committed by GitHub
parent f15b49e0fd
commit d30cc19d25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 54 additions and 61 deletions

View file

@ -26,9 +26,14 @@ bool IHLBuffer::locked() {
return nLocks > 0;
}
void IHLBuffer::unlockOnBufferRelease(WP<CWLSurfaceResource> surf) {
hlEvents.backendRelease = events.backendRelease.registerListener([this](std::any data) {
unlock();
void IHLBuffer::onBackendRelease(const std::function<void()>& fn) {
if (hlEvents.backendRelease) {
hlEvents.backendRelease->emit(nullptr);
Debug::log(LOG, "backendRelease emitted early");
}
hlEvents.backendRelease = events.backendRelease.registerListener([this, fn](std::any) {
fn();
hlEvents.backendRelease.reset();
});
}

View file

@ -21,7 +21,7 @@ class IHLBuffer : public Aquamarine::IBuffer {
virtual void unlock();
virtual bool locked();
void unlockOnBufferRelease(WP<CWLSurfaceResource> surf /* optional */);
void onBackendRelease(const std::function<void()>& fn);
SP<CTexture> texture;
bool opaque = false;