nvidia and stuff fixes

This commit is contained in:
Vaxry 2024-02-21 15:55:20 +00:00
parent 06b07c53e5
commit 0127370429
2 changed files with 14 additions and 31 deletions

View file

@ -48,12 +48,8 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
wp_fractional_scale_v1_add_listener(fractional, &fsListener, this); wp_fractional_scale_v1_add_listener(fractional, &fsListener, this);
viewport = wp_viewporter_get_viewport(g_pHyprlock->getViewporter(), surface); viewport = wp_viewporter_get_viewport(g_pHyprlock->getViewporter(), surface);
wl_display_roundtrip(g_pHyprlock->getDisplay()); wl_display_roundtrip(g_pHyprlock->getDisplay());
} else { } else
Debug::log(LOG, "No fractional-scale support! Oops, won't be able to scale!"); 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); lockSurface = ext_session_lock_v1_get_lock_surface(g_pHyprlock->getSessionLock(), surface, output->output);
@ -62,21 +58,21 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
exit(1); exit(1);
} }
configure(output->size, {});
ext_session_lock_surface_v1_add_listener(lockSurface, &lockListener, this); 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_) { void CSessionLockSurface::configure(const Vector2D& size_, std::optional<uint32_t> serial_) {
Debug::log(LOG, "configure with serial {}", serial_); Debug::log(LOG, "configure with serial {}", serial_.value_or(0));
serial = serial_; serial = serial_.value_or(0);
size = (size_ * fractionalScale).floor(); size = (size_ * fractionalScale).floor();
logicalSize = size_; logicalSize = size_;
Debug::log(LOG, "Configuring surface for logical {} and pixel {}", logicalSize, size); Debug::log(LOG, "Configuring surface for logical {} and pixel {}", logicalSize, size);
if (serial != 0) if (serial_.has_value())
ext_session_lock_surface_v1_ack_configure(lockSurface, serial); ext_session_lock_surface_v1_ack_configure(lockSurface, serial);
if (fractional) if (fractional)
@ -95,7 +91,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
exit(1); exit(1);
} }
if (serial == 0) if (!eglSurface)
eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT(g_pEGL->eglDisplay, g_pEGL->eglConfig, eglWindow, nullptr); eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT(g_pEGL->eglDisplay, g_pEGL->eglConfig, eglWindow, nullptr);
if (!eglSurface) { if (!eglSurface) {
@ -105,18 +101,10 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
readyForFrame = true; readyForFrame = true;
if (serial != 0) if (serial_.has_value())
render(); render();
else
if (fractional) eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);
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());
} }
static void handleDone(void* data, wl_callback* wl_callback, uint32_t callback_data) { static void handleDone(void* data, wl_callback* wl_callback, uint32_t callback_data) {
@ -138,15 +126,9 @@ void CSessionLockSurface::render() {
const auto FEEDBACK = g_pRenderer->renderLock(*this); const auto FEEDBACK = g_pRenderer->renderLock(*this);
frameCallback = wl_surface_frame(surface); frameCallback = wl_surface_frame(surface);
wl_callback_add_listener(frameCallback, &callbackListener, this); wl_callback_add_listener(frameCallback, &callbackListener, this);
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface); 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);
needsFrame = FEEDBACK.needsFrame; needsFrame = FEEDBACK.needsFrame;
} }

View file

@ -7,6 +7,7 @@
#include <wayland-egl.h> #include <wayland-egl.h>
#include "../helpers/Vector2D.hpp" #include "../helpers/Vector2D.hpp"
#include <EGL/egl.h> #include <EGL/egl.h>
#include <optional>
class COutput; class COutput;
class CRenderer; class CRenderer;
@ -16,7 +17,7 @@ class CSessionLockSurface {
CSessionLockSurface(COutput* output); CSessionLockSurface(COutput* output);
~CSessionLockSurface(); ~CSessionLockSurface();
void configure(const Vector2D& size, uint32_t serial); void configure(const Vector2D& size, std::optional<uint32_t> serial);
bool readyForFrame = false; bool readyForFrame = false;