From e6e61028b13ad7e45d695371e1b9f6308ae97ea4 Mon Sep 17 00:00:00 2001 From: Alexander Kobel Date: Tue, 14 Apr 2020 19:35:40 +0200 Subject: [PATCH 1/2] Rename --debug-gl to --debug-rendering --- kitty/cli.py | 4 ++-- kitty/fast_data_types.pyi | 2 +- kitty/gl.c | 4 ++-- kitty/main.py | 2 +- kitty/state.c | 6 +++--- kitty/state.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kitty/cli.py b/kitty/cli.py index e27048652..46ffd96ce 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -662,9 +662,9 @@ can open a new kitty window to replay the commands with:: Path to file in which to store the raw bytes received from the child process ---debug-gl +--debug-rendering type=bool-set -Debug OpenGL commands. This will cause all OpenGL calls to check for errors +Debug rendering commands. This will cause all OpenGL calls to check for errors instead of ignoring them. Useful when debugging rendering problems diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 8bcb00fdb..7bdd303a6 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -553,7 +553,7 @@ def update_window_visibility( def set_options( opts: Options, is_wayland: bool = False, - debug_gl: bool = False, + debug_rendering: bool = False, debug_font_fallback: bool = False ) -> None: pass diff --git a/kitty/gl.c b/kitty/gl.c index cab14738a..b15fe0009 100644 --- a/kitty/gl.c +++ b/kitty/gl.c @@ -46,7 +46,7 @@ gl_init() { if (!gl_version) { fatal("Loading the OpenGL library failed"); } - if (!global_state.debug_gl) { + if (!global_state.debug_rendering) { gladUninstallGLDebug(); } gladSetGLPostCallback(check_for_gl_error); @@ -59,7 +59,7 @@ gl_init() { glad_loaded = true; int gl_major = GLAD_VERSION_MAJOR(gl_version); int gl_minor = GLAD_VERSION_MINOR(gl_version); - if (global_state.debug_gl) printf("GL version string: '%s' Detected version: %d.%d\n", glGetString(GL_VERSION), gl_major, gl_minor); + if (global_state.debug_rendering) printf("GL version string: '%s' Detected version: %d.%d\n", glGetString(GL_VERSION), 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/main.py b/kitty/main.py index bc7bf8cee..16ad3354b 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -152,7 +152,7 @@ class AppRunner: def __call__(self, opts: OptionsStub, args: CLIOptions, bad_lines: Sequence[BadLine] = ()) -> None: set_scale(opts.box_drawing_scale) - set_options(opts, is_wayland(), args.debug_gl, args.debug_font_fallback) + set_options(opts, is_wayland(), args.debug_rendering, args.debug_font_fallback) set_font_family(opts, debug_font_matching=args.debug_font_fallback) try: _run_app(opts, args, bad_lines) diff --git a/kitty/state.c b/kitty/state.c index 6577160c7..e8432b032 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -577,14 +577,14 @@ PYWRAP1(handle_for_window_id) { PYWRAP1(set_options) { PyObject *ret, *opts; - int is_wayland = 0, debug_gl = 0, debug_font_fallback = 0; - PA("O|ppp", &opts, &is_wayland, &debug_gl, &debug_font_fallback); + int is_wayland = 0, debug_rendering = 0, debug_font_fallback = 0; + PA("O|ppp", &opts, &is_wayland, &debug_rendering, &debug_font_fallback); global_state.is_wayland = is_wayland ? true : false; #ifdef __APPLE__ global_state.has_render_frames = true; #endif if (global_state.is_wayland) global_state.has_render_frames = true; - global_state.debug_gl = debug_gl ? true : false; + global_state.debug_rendering = debug_rendering ? true : false; global_state.debug_font_fallback = debug_font_fallback ? true : false; #define GA(name) ret = PyObject_GetAttrString(opts, #name); if (ret == NULL) return NULL; #define SS(name, dest, convert) { GA(name); dest = convert(ret); Py_DECREF(ret); if (PyErr_Occurred()) return NULL; } diff --git a/kitty/state.h b/kitty/state.h index ce7f3dc98..0a55e0c94 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -196,7 +196,7 @@ typedef struct { bool terminate; bool is_wayland; bool has_render_frames; - bool debug_gl, debug_font_fallback; + bool debug_rendering, debug_font_fallback; bool has_pending_resizes, has_pending_closes; bool in_sequence_mode; bool tab_bar_hidden; From 3b6277b9e24194c06fe54b0bb9c37df3ad8f3bf2 Mon Sep 17 00:00:00 2001 From: Alexander Kobel Date: Tue, 14 Apr 2020 19:36:58 +0200 Subject: [PATCH 2/2] Hide "No render frame received" without --debug-rendering --- kitty/child-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index f4a5320eb..1828c03c4 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -649,7 +649,7 @@ draw_resizing_text(OSWindow *w) { static inline bool no_render_frame_received_recently(OSWindow *w, monotonic_t now, monotonic_t max_wait) { bool ans = now - w->last_render_frame_received_at > max_wait; - if (ans) log_error("No render frame received in %.2f seconds, re-requesting at: %f", monotonic_t_to_s_double(max_wait), monotonic_t_to_s_double(now)); + if (ans && global_state.debug_rendering) log_error("No render frame received in %.2f seconds, re-requesting at: %f", monotonic_t_to_s_double(max_wait), monotonic_t_to_s_double(now)); return ans; }