Skip to content

Commit fdccc30

Browse files
author
j4kuuu
committed
output: create session lock surface before mode commit
When an output appears during resume with an active session lock, Hyprland registers the wl_output global at size {0, 0} while the DRM session is still inactive. The size guard in createSessionLockSurface() rejected that state, leaving m_sessionLockSurface null. When the session activated, modeChanged fired and wl_output.done arrived with a valid mode. The setDone handler created the surface but then had to go through get_lock_surface and wait for Hyprland to respond with configure before rendering, so the lockdead fallback texture stayed visible for that extra exchange. Remove the size guard and handle size {0, 0} in configure() instead: ack the serial first, then return early if the size is not positive. This avoids a wp_viewport.set_destination(0, 0) protocol error and allows Hyprland's monitorMode listener on SSessionLockSurface to fire sendConfigure() directly on modeChanged without waiting for another get_lock_surface request.
1 parent 274154f commit fdccc30

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/core/LockSurface.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
6666
logicalSize = size_;
6767
appliedScale = fractionalScale;
6868

69+
if (!SAMESERIAL)
70+
lockSurface->sendAckConfigure(serial);
71+
72+
if (size_.x <= 0 || size_.y <= 0) {
73+
Log::logger->log(Log::WARN, "output {} configure with zero size, waiting for valid configure", m_outputID);
74+
readyForFrame = false;
75+
return;
76+
}
77+
6978
if (fractional) {
7079
size = (size_ * fractionalScale).floor();
7180
viewport->sendSetDestination(logicalSize.x, logicalSize.y);
@@ -75,9 +84,6 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
7584
surface->sendSetBufferScale(POUTPUT->scale);
7685
}
7786

78-
if (!SAMESERIAL)
79-
lockSurface->sendAckConfigure(serial);
80-
8187
Log::logger->log(Log::INFO, "Configuring surface for logical {} and pixel {}", logicalSize, size);
8288

8389
surface->sendDamageBuffer(0, 0, 0xFFFF, 0xFFFF);
@@ -92,7 +98,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
9298
eglWindow = wl_egl_window_create((wl_surface*)surface->resource(), size.x, size.y);
9399
if (!eglWindow) {
94100
// Only fails when unable to allocate the wl_egl_window structure or size x or y is <= 0.
95-
Log::logger->log(Log::CRIT, "Failed to create wayland egl window");
101+
Log::logger->log(Log::WARN, "Failed to create wayland egl window (size {}x{}), waiting for valid configure", size.x, size.y);
96102
readyForFrame = false;
97103
return;
98104
}

src/core/Output.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ void COutput::createSessionLockSurface() {
5656
return;
5757
}
5858

59-
if (size == Vector2D{0, 0}) {
60-
Log::logger->log(Log::WARN, "output {} refusing to create a lock surface with size 0x0", m_ID);
61-
return;
62-
}
63-
6459
m_sessionLockSurface = makeUnique<CSessionLockSurface>(m_self.lock());
6560
}
6661

0 commit comments

Comments
 (0)