Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nvidia and stuff fixes #44

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions src/core/LockSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
if (fractional) {
wp_fractional_scale_v1_add_listener(fractional, &fsListener, this);
viewport = wp_viewporter_get_viewport(g_pHyprlock->getViewporter(), surface);
wl_display_roundtrip(g_pHyprlock->getDisplay());
} else {
} else
Debug::log(LOG, "No fractional-scale support! Oops, won't be able to scale!");
}

configure(output->size, 0);
g_pRenderer->renderLock(*this);

lockSurface = ext_session_lock_v1_get_lock_surface(g_pHyprlock->getSessionLock(), surface, output->output);

Expand All @@ -63,8 +58,6 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
}

ext_session_lock_surface_v1_add_listener(lockSurface, &lockListener, this);
wl_display_roundtrip(g_pHyprlock->getDisplay());
wl_display_flush(g_pHyprlock->getDisplay());
}

void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
Expand All @@ -76,8 +69,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {

Debug::log(LOG, "Configuring surface for logical {} and pixel {}", logicalSize, size);

if (serial != 0)
ext_session_lock_surface_v1_ack_configure(lockSurface, serial);
ext_session_lock_surface_v1_ack_configure(lockSurface, serial);

if (fractional)
wp_viewport_set_destination(viewport, logicalSize.x, logicalSize.y);
Expand All @@ -95,7 +87,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
exit(1);
}

if (serial == 0)
if (!eglSurface)
eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT(g_pEGL->eglDisplay, g_pEGL->eglConfig, eglWindow, nullptr);

if (!eglSurface) {
Expand All @@ -105,18 +97,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {

readyForFrame = true;

if (serial != 0)
render();

if (fractional)
wp_viewport_set_destination(viewport, logicalSize.x, logicalSize.y);

wl_surface_set_buffer_scale(surface, 1);
wl_surface_damage_buffer(surface, 0, 0, 0xFFFF, 0xFFFF);

wl_surface_commit(surface);
wl_display_roundtrip(g_pHyprlock->getDisplay());
wl_display_flush(g_pHyprlock->getDisplay());
render();
}

static void handleDone(void* data, wl_callback* wl_callback, uint32_t callback_data) {
Expand All @@ -138,14 +119,8 @@ void CSessionLockSurface::render() {
const auto FEEDBACK = g_pRenderer->renderLock(*this);
frameCallback = wl_surface_frame(surface);
wl_callback_add_listener(frameCallback, &callbackListener, this);
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);

if (fractional)
wp_viewport_set_destination(viewport, logicalSize.x, logicalSize.y);

wl_surface_damage_buffer(surface, 0, 0, 0xFFFF, 0xFFFF);
wl_surface_set_buffer_scale(surface, 1);
wl_surface_commit(surface);
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);

needsFrame = FEEDBACK.needsFrame;
}
Expand Down
Loading