From 4bcd7735694f27bf3dc139e987e98075017719c1 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 29 Aug 2021 18:47:22 -0400 Subject: [PATCH] [linux] reprogram font before mapping framebuffer You can't reprogram the Linux console font while holding a map of the framebuffer, annoyingly. Move the attempt to reprogram the fonts prior to the acquisition of the framebuffer. The problem with this is that it clears the framebuffer, so we're going to need to get a copy of it beforehand, which we will reblit afterwards #2108. --- src/lib/linux.c | 2 +- src/lib/termdesc.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/linux.c b/src/lib/linux.c index 7b77b80a7..0dfcdfef0 100644 --- a/src/lib/linux.c +++ b/src/lib/linux.c @@ -637,7 +637,7 @@ int reprogram_console_font(tinfo* ti, unsigned no_font_changes, free(cfo.data); return -1; } - int r = reprogram_linux_font(ti->linux_fb_fd, &cfo, &map, no_font_changes, + int r = reprogram_linux_font(ti->ttyfd, &cfo, &map, no_font_changes, halfblocks, quadrants); free(cfo.data); free(map.entries); diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index db039550d..08ea10002 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -582,6 +582,11 @@ apply_term_heuristics(tinfo* ti, const char* termname, queried_terminals_e qterm if(uname(&un) == 0){ ti->termversion = strdup(un.release); } + ti->caps.halfblocks = false; + ti->caps.braille = false; // no caps.braille, no caps.sextants in linux console + if(ti->ttyfd >= 0){ + reprogram_console_font(ti, nonewfonts, &ti->caps.halfblocks, &ti->caps.quadrants); + } if(is_linux_framebuffer(ti)){ termname = "Linux framebuffer"; setup_fbcon_bitmaps(ti, ti->linux_fb_fd); @@ -589,9 +594,6 @@ apply_term_heuristics(tinfo* ti, const char* termname, queried_terminals_e qterm termname = "Linux console"; } // assume no useful unicode drawing unless we're positively sure - ti->caps.halfblocks = false; - reprogram_console_font(ti, nonewfonts, &ti->caps.halfblocks, &ti->caps.quadrants); - ti->caps.braille = false; // no caps.braille, no caps.sextants in linux console #else (void)nonewfonts; #endif