From 9ac3c64d4c089f1bbb48b8dff5364c97e9f2c6ca Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 11 Jul 2022 16:51:01 +0200 Subject: [PATCH] wayland/drmlease: split up DrmLeaseV1Interface::deny --- src/backends/drm/drm_gpu.cpp | 2 +- src/wayland/drmleasedevice_v1_interface.cpp | 10 ++++++++-- src/wayland/drmleasedevice_v1_interface.h | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/backends/drm/drm_gpu.cpp b/src/backends/drm/drm_gpu.cpp index ab78d8a122..7f894e45d7 100644 --- a/src/backends/drm/drm_gpu.cpp +++ b/src/backends/drm/drm_gpu.cpp @@ -244,7 +244,7 @@ bool DrmGpu::updateOutputs() } } if (!leaseActive) { - leaseOutput->lease()->deny(); + leaseOutput->lease()->revoke(); } } } diff --git a/src/wayland/drmleasedevice_v1_interface.cpp b/src/wayland/drmleasedevice_v1_interface.cpp index c82b254242..fba61910c2 100644 --- a/src/wayland/drmleasedevice_v1_interface.cpp +++ b/src/wayland/drmleasedevice_v1_interface.cpp @@ -339,8 +339,14 @@ void DrmLeaseV1Interface::deny() d->finished = true; d->send_finished(); } - if (!d->lesseeId) { - return; +} + +void DrmLeaseV1Interface::revoke() +{ + Q_ASSERT(d->lesseeId != 0); + if (!d->finished) { + d->finished = true; + d->send_finished(); } Q_EMIT d->device->q->leaseRevoked(this); // check if we should offer connectors again diff --git a/src/wayland/drmleasedevice_v1_interface.h b/src/wayland/drmleasedevice_v1_interface.h index 9df065272a..df754d0d88 100644 --- a/src/wayland/drmleasedevice_v1_interface.h +++ b/src/wayland/drmleasedevice_v1_interface.h @@ -102,10 +102,15 @@ public: /** * Deny the lease request. The compositor may call this in response to - * DrmLeaseDeviceV1Interface::leaseRequested or when it detects a lease being ended with libdrm + * DrmLeaseDeviceV1Interface::leaseRequested */ void deny(); + /** + * revoke a granted lease request and offer the leased connectors again + */ + void revoke(); + /** * The connectors this lease (request) encompasses */