diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp index b8ab086a4..41178109d 100644 --- a/src/protocols/DRMSyncobj.cpp +++ b/src/protocols/DRMSyncobj.cpp @@ -157,7 +157,7 @@ bool CDRMSyncobjManagerResource::good() { } CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { - drmFD = fcntl(g_pCompositor->m_iDRMFD, F_DUPFD_CLOEXEC, 0); + drmFD = g_pCompositor->m_iDRMFD; } void CDRMSyncobjProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 165f365cd..c9095e03c 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -414,7 +414,7 @@ void CWLSurfaceResource::commitPendingState() { // release the buffer if it's synchronous as update() has done everything thats needed // so we can let the app know we're done. if (current.buffer->isSynchronous()) { - current.buffer->sendRelease(); + current.buffer->sendReleaseWithSurface(self.lock()); bufferReleased = true; } } @@ -442,7 +442,7 @@ void CWLSurfaceResource::commitPendingState() { // for async buffers, we can only release the buffer once we are unrefing it from current. if (previousBuffer && !previousBuffer->isSynchronous() && !bufferReleased) { - previousBuffer->sendRelease(); + previousBuffer->sendReleaseWithSurface(self.lock()); bufferReleased = true; } } diff --git a/src/protocols/types/Buffer.cpp b/src/protocols/types/Buffer.cpp index 23679ce7e..a347a0fc9 100644 --- a/src/protocols/types/Buffer.cpp +++ b/src/protocols/types/Buffer.cpp @@ -3,3 +3,7 @@ void IHLBuffer::sendRelease() { resource->sendRelease(); } + +void IHLBuffer::sendReleaseWithSurface(SP surf) { + resource->sendReleaseWithSurface(surf); +} diff --git a/src/protocols/types/Buffer.hpp b/src/protocols/types/Buffer.hpp index 0b377bb37..2ae542d1b 100644 --- a/src/protocols/types/Buffer.hpp +++ b/src/protocols/types/Buffer.hpp @@ -17,6 +17,7 @@ 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); SP texture; bool opaque = false; diff --git a/src/protocols/types/WLBuffer.cpp b/src/protocols/types/WLBuffer.cpp index e53538cbc..7034dfc78 100644 --- a/src/protocols/types/WLBuffer.cpp +++ b/src/protocols/types/WLBuffer.cpp @@ -1,5 +1,9 @@ #include "WLBuffer.hpp" #include "Buffer.hpp" +#include "../core/Compositor.hpp" +#include "../DRMSyncobj.hpp" +#include "../../helpers/sync/SyncTimeline.hpp" +#include CWLBufferResource::CWLBufferResource(SP resource_) : resource(resource_) { if (!good()) @@ -27,6 +31,16 @@ void CWLBufferResource::sendRelease() { resource->sendRelease(); } +void CWLBufferResource::sendReleaseWithSurface(SP surf) { + sendRelease(); + + if (!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(); } diff --git a/src/protocols/types/WLBuffer.hpp b/src/protocols/types/WLBuffer.hpp index 83d042cd7..595121283 100644 --- a/src/protocols/types/WLBuffer.hpp +++ b/src/protocols/types/WLBuffer.hpp @@ -8,6 +8,7 @@ #include "../../helpers/signal/Signal.hpp" class IHLBuffer; +class CWLSurfaceResource; class CWLBufferResource { public: @@ -16,6 +17,7 @@ class CWLBufferResource { bool good(); void sendRelease(); + void sendReleaseWithSurface(SP); wl_resource* getResource(); WP buffer;