renderer: Explicit sync fixes (#7151)
Enables explicit sync by default for most platforms `misc:no_direct_scanout` -> `render:direct_scanout`
This commit is contained in:
parent
0e86808e59
commit
640d161851
24 changed files with 378 additions and 165 deletions
|
|
@ -9,11 +9,6 @@ void IHLBuffer::sendRelease() {
|
|||
resource->sendRelease();
|
||||
}
|
||||
|
||||
void IHLBuffer::sendReleaseWithSurface(SP<CWLSurfaceResource> surf) {
|
||||
if (resource && resource->good())
|
||||
resource->sendReleaseWithSurface(surf);
|
||||
}
|
||||
|
||||
void IHLBuffer::lock() {
|
||||
nLocks++;
|
||||
}
|
||||
|
|
@ -27,26 +22,13 @@ void IHLBuffer::unlock() {
|
|||
sendRelease();
|
||||
}
|
||||
|
||||
void IHLBuffer::unlockWithSurface(SP<CWLSurfaceResource> surf) {
|
||||
nLocks--;
|
||||
|
||||
ASSERT(nLocks >= 0);
|
||||
|
||||
if (nLocks == 0)
|
||||
sendReleaseWithSurface(surf);
|
||||
}
|
||||
|
||||
bool IHLBuffer::locked() {
|
||||
return nLocks > 0;
|
||||
}
|
||||
|
||||
void IHLBuffer::unlockOnBufferRelease(WP<CWLSurfaceResource> surf) {
|
||||
unlockSurface = surf;
|
||||
hlEvents.backendRelease = events.backendRelease.registerListener([this](std::any data) {
|
||||
if (unlockSurface.expired())
|
||||
unlock();
|
||||
else
|
||||
unlockWithSurface(unlockSurface.lock());
|
||||
unlock();
|
||||
hlEvents.backendRelease.reset();
|
||||
});
|
||||
}
|
||||
|
|
@ -59,8 +41,5 @@ CHLBufferReference::~CHLBufferReference() {
|
|||
if (buffer.expired())
|
||||
return;
|
||||
|
||||
if (surface)
|
||||
buffer->unlockWithSurface(surface.lock());
|
||||
else
|
||||
buffer->unlock();
|
||||
buffer->unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <aquamarine/buffer/Buffer.hpp>
|
||||
|
||||
class CSyncReleaser;
|
||||
|
||||
class IHLBuffer : public Aquamarine::IBuffer {
|
||||
public:
|
||||
virtual ~IHLBuffer();
|
||||
|
|
@ -15,10 +17,8 @@ class IHLBuffer : public Aquamarine::IBuffer {
|
|||
virtual bool isSynchronous() = 0; // whether the updates to this buffer are synchronous, aka happen over cpu
|
||||
virtual bool good() = 0;
|
||||
virtual void sendRelease();
|
||||
virtual void sendReleaseWithSurface(SP<CWLSurfaceResource>);
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
virtual void unlockWithSurface(SP<CWLSurfaceResource> surf);
|
||||
virtual bool locked();
|
||||
|
||||
void unlockOnBufferRelease(WP<CWLSurfaceResource> surf /* optional */);
|
||||
|
|
@ -29,12 +29,11 @@ class IHLBuffer : public Aquamarine::IBuffer {
|
|||
|
||||
struct {
|
||||
CHyprSignalListener backendRelease;
|
||||
CHyprSignalListener backendRelease2; // for explicit ds
|
||||
} hlEvents;
|
||||
|
||||
private:
|
||||
int nLocks = 0;
|
||||
|
||||
WP<CWLSurfaceResource> unlockSurface;
|
||||
int nLocks = 0;
|
||||
};
|
||||
|
||||
// for ref-counting. Releases in ~dtor
|
||||
|
|
@ -44,7 +43,8 @@ class CHLBufferReference {
|
|||
CHLBufferReference(SP<IHLBuffer> buffer, SP<CWLSurfaceResource> surface);
|
||||
~CHLBufferReference();
|
||||
|
||||
WP<IHLBuffer> buffer;
|
||||
WP<IHLBuffer> buffer;
|
||||
SP<CSyncReleaser> releaser;
|
||||
|
||||
private:
|
||||
WP<CWLSurfaceResource> surface;
|
||||
|
|
|
|||
|
|
@ -32,16 +32,6 @@ void CWLBufferResource::sendRelease() {
|
|||
resource->sendRelease();
|
||||
}
|
||||
|
||||
void CWLBufferResource::sendReleaseWithSurface(SP<CWLSurfaceResource> surf) {
|
||||
sendRelease();
|
||||
|
||||
if (!surf || !surf->syncobj)
|
||||
return;
|
||||
|
||||
if (drmSyncobjTimelineSignal(g_pCompositor->m_iDRMFD, &surf->syncobj->releaseTimeline->timeline->handle, &surf->syncobj->releasePoint, 1))
|
||||
Debug::log(ERR, "sendReleaseWithSurface: drmSyncobjTimelineSignal failed");
|
||||
}
|
||||
|
||||
wl_resource* CWLBufferResource::getResource() {
|
||||
return resource->resource();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class CWLBufferResource {
|
|||
|
||||
bool good();
|
||||
void sendRelease();
|
||||
void sendReleaseWithSurface(SP<CWLSurfaceResource>);
|
||||
wl_resource* getResource();
|
||||
|
||||
WP<IHLBuffer> buffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue