diff --git a/docs/changelog.rst b/docs/changelog.rst index 0f337ceac..151136b1c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -54,6 +54,8 @@ Detailed list of changes - Fix a regression in the previous release that caused `kitten @ send-text` with a match tab parameter to send text twice to the active window (:iss:`7027`) +- Wayland+NVIDIA: Do not request an sRGB output buffer as a bug in Wayland causes kitty to not start (:iss:`7021`) + 0.32.0 [2024-01-19] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/gl.c b/kitty/gl.c index 188f4562f..5b8c2b429 100644 --- a/kitty/gl.c +++ b/kitty/gl.c @@ -38,6 +38,10 @@ check_for_gl_error(void UNUSED *ret, const char *name, GLADapiproc UNUSED funcpt } } +static bool is_nvidia = false; + +bool is_nvidia_gpu_driver(void) { return is_nvidia; } + void gl_init(void) { static bool glad_loaded = false; @@ -59,7 +63,9 @@ gl_init(void) { glad_loaded = true; int gl_major = GLAD_VERSION_MAJOR(gl_version); int gl_minor = GLAD_VERSION_MINOR(gl_version); - if (global_state.debug_rendering) printf("GL version string: '%s' Detected version: %d.%d\n", glGetString(GL_VERSION), gl_major, gl_minor); + const char *gvs = (const char*)glGetString(GL_VERSION); + if (strstr(gvs, "NVIDIA")) is_nvidia = true; + if (global_state.debug_rendering) printf("GL version string: '%s' Detected version: %d.%d\n", gvs, gl_major, gl_minor); if (gl_major < OPENGL_REQUIRED_VERSION_MAJOR || (gl_major == OPENGL_REQUIRED_VERSION_MAJOR && gl_minor < OPENGL_REQUIRED_VERSION_MINOR)) { fatal("OpenGL version is %d.%d, version >= 3.3 required for kitty", gl_major, gl_minor); } diff --git a/kitty/gl.h b/kitty/gl.h index 432b6643e..4bba1d5f6 100644 --- a/kitty/gl.h +++ b/kitty/gl.h @@ -56,3 +56,4 @@ void bind_vao_uniform_buffer(ssize_t vao_idx, size_t bufnum, GLuint block_index) void unbind_vertex_array(void); void unbind_program(void); GLuint compile_shaders(GLenum shader_type, GLsizei count, const GLchar * const * string); +bool is_nvidia_gpu_driver(void); diff --git a/kitty/glfw.c b/kitty/glfw.c index 0a3318805..bc23dcaf9 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -1075,7 +1075,9 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) { glfwSetIMECursorPositionCallback(get_ime_cursor_position); glfwSetSystemColorThemeChangeCallback(on_system_color_scheme_change); // Request SRGB output buffer - glfwWindowHint(GLFW_SRGB_CAPABLE, true); + // Prevents kitty from starting on Wayland + NVIDIA, sigh: https://github.com/kovidgoyal/kitty/issues/7021 + // Remove after https://github.com/NVIDIA/egl-wayland/issues/85 is fixed. + if (!global_state.is_wayland || !is_nvidia_gpu_driver()) glfwWindowHint(GLFW_SRGB_CAPABLE, true); #ifdef __APPLE__ cocoa_set_activation_policy(OPT(macos_hide_from_tasks)); glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, true);