mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-21 11:39:57 +03:00
X11: Reduce startup time by ~25% by only querying GLX for framebuffer configurations once
On my system reduces the number of getpid() calls from 67982 to 17327 I dont know why get framebuffer config attributes requires getpid() and why it is so slow, probably a driver bug. Fixes #2754
This commit is contained in:
parent
cd4dacb406
commit
27b6517594
@ -43,6 +43,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
|
||||
- X11: Recompile keymaps on XkbNewKeyboardNotify events (:iss:`2726`)
|
||||
|
||||
- X11: Reduce startup time by ~25% by only querying GLX for framebuffer
|
||||
configurations once (:iss:`2754`)
|
||||
|
||||
- macOS: Notarize the kitty application (:iss:`2040`)
|
||||
|
||||
|
||||
|
11
glfw/glx_context.c
vendored
11
glfw/glx_context.c
vendored
@ -58,6 +58,13 @@ static bool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
||||
int i, nativeCount, usableCount;
|
||||
const char* vendor;
|
||||
bool trustWindowBit = true;
|
||||
static _GLFWfbconfig prev_desired = {0};
|
||||
static uintptr_t prev_result = 0;
|
||||
if (prev_result != 0 && memcmp(&prev_desired, desired, sizeof(_GLFWfbconfig)) == 0) {
|
||||
*result = (GLXFBConfig)prev_result;
|
||||
return true;
|
||||
}
|
||||
prev_desired = *desired;
|
||||
|
||||
// HACK: This is a (hopefully temporary) workaround for Chromium
|
||||
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||
@ -133,8 +140,10 @@ static bool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
||||
}
|
||||
|
||||
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||
if (closest)
|
||||
if (closest) {
|
||||
*result = (GLXFBConfig) closest->handle;
|
||||
prev_result = (uintptr_t) closest->handle;
|
||||
}
|
||||
|
||||
XFree(nativeConfigs);
|
||||
free(usableConfigs);
|
||||
|
Loading…
Reference in New Issue
Block a user