buffer: track asynchronous buffers and don't release them until unref

synchronous buffers are read instantly and we can release them, but asynchronous ones have to be locked until they are unref'd from .current to avoid reading from a buffer after .release()
This commit is contained in:
Vaxry 2024-06-08 17:27:50 +02:00
parent d724556b7e
commit 9994b73ad0
6 changed files with 23 additions and 4 deletions

View file

@ -49,6 +49,7 @@ class IWLBuffer {
virtual eBufferCapability caps() = 0;
virtual eBufferType type() = 0;
virtual void update(const CRegion& damage) = 0;
virtual bool isSynchronous() = 0; // whether the updates to this buffer are synchronous, aka happen over cpu
virtual SDMABUFAttrs dmabuf();
virtual SSHMAttrs shm();
virtual std::tuple<uint8_t*, uint32_t, size_t> beginDataPtr(uint32_t flags);

View file

@ -43,6 +43,10 @@ void CDMABuffer::update(const CRegion& damage) {
;
}
bool CDMABuffer::isSynchronous() {
return false;
}
SDMABUFAttrs CDMABuffer::dmabuf() {
return attrs;
}

View file

@ -9,6 +9,7 @@ class CDMABuffer : public IWLBuffer {
virtual eBufferCapability caps();
virtual eBufferType type();
virtual bool isSynchronous();
virtual void update(const CRegion& damage);
virtual SDMABUFAttrs dmabuf();
virtual std::tuple<uint8_t*, uint32_t, size_t> beginDataPtr(uint32_t flags);