summaryrefslogtreecommitdiff
path: root/src/protocols/core/Compositor.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-07-31 20:47:26 +0100
committerGitHub <noreply@github.com>2024-07-31 21:47:26 +0200
commit37e1411e8d94fe8f3fb678588a7df9b8f931910f (patch)
treece91aa3984b646f8a8569976edb8e78c85919ee5 /src/protocols/core/Compositor.hpp
parent548968279926a73d7ff19a9a185c977c50d56756 (diff)
core/surface/buffer: Buffer lock/release fixes (#7110)
Diffstat (limited to 'src/protocols/core/Compositor.hpp')
-rw-r--r--src/protocols/core/Compositor.hpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/protocols/core/Compositor.hpp b/src/protocols/core/Compositor.hpp
index 79cd1de6..460ec755 100644
--- a/src/protocols/core/Compositor.hpp
+++ b/src/protocols/core/Compositor.hpp
@@ -84,13 +84,13 @@ class CWLSurfaceResource {
} events;
struct SState {
- CRegion opaque, input = CBox{{}, {INT32_MAX, INT32_MAX}}, damage, bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}} /* initial damage */;
- wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
- int scale = 1;
- SP<IHLBuffer> buffer;
- SP<CTexture> texture;
- Vector2D offset;
- Vector2D size;
+ CRegion opaque, input = CBox{{}, {INT32_MAX, INT32_MAX}}, damage, bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}} /* initial damage */;
+ wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
+ int scale = 1;
+ SP<CHLBufferReference> buffer; // buffer ref will be released once the buffer is no longer locked. For checking if a buffer is attached to this state, check texture.
+ SP<CTexture> texture;
+ Vector2D offset;
+ Vector2D size, bufferSize;
struct {
bool hasDestination = false;
bool hasSource = false;
@@ -116,7 +116,7 @@ class CWLSurfaceResource {
std::vector<WP<CMonitor>> enteredOutputs;
bool mapped = false;
std::vector<WP<CWLSubsurfaceResource>> subsurfaces;
- WP<ISurfaceRole> role;
+ SP<ISurfaceRole> role;
WP<CViewportResource> viewportResource;
WP<CDRMSyncobjSurfaceResource> syncobj; // may not be present
@@ -134,12 +134,21 @@ class CWLSurfaceResource {
SP<CWlSurface> resource;
wl_client* pClient = nullptr;
- int stateLocks = 0;
+ // this is for cursor dumb copy. Due to our (and wayland's...) architecture,
+ // this stupid-ass hack is used
+ WP<IHLBuffer> lastBuffer;
- void destroy();
- void releaseBuffers(bool onlyCurrent = true);
- void commitPendingState();
- void bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
+ int stateLocks = 0;
+
+ void destroy();
+ void releaseBuffers(bool onlyCurrent = true);
+ void dropPendingBuffer();
+ void dropCurrentBuffer();
+ void commitPendingState();
+ void bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
+ void updateCursorShm();
+
+ friend class CWLPointerResource;
};
class CWLCompositorResource {