set up framebuffer graphics

This commit is contained in:
nick black 2021-07-07 20:28:26 -04:00 committed by nick black
parent f8463270f1
commit 3e366ebe0e
5 changed files with 41 additions and 0 deletions

View File

@ -334,6 +334,8 @@ tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){
}else{
ncplane_printf(n, "%ssixel colorregs: %u\n", indent, ti->color_registers);
}
}else if(ti->linux_fb_fd >= 0){
ncplane_printf(n, "%sframebuffer graphics supported\n", indent);
}else if(ti->pixel_move == NULL){
ncplane_printf(n, "%siTerm2 graphics support\n", indent);
}else if(ti->sixel_maxy_pristine){

View File

@ -16,7 +16,11 @@ struct ncsharedstats;
typedef enum {
TERMINAL_UNKNOWN, // no useful information from queries; use termname
// the very limited linux VGA/serial console, or possibly the (deprecated,
// pixel-drawable, RGBA8888) linux framebuffer console. *not* fbterm.
TERMINAL_LINUX, // ioctl()s
// the linux KMS/DRM console, *not* kmscon, but DRM direct dumb buffers
TERMINAL_LINUXDRM, // ioctl()s
TERMINAL_XTERM, // XTVERSION == 'XTerm(ver)'
TERMINAL_VTE, // TDA: "~VTE"
TERMINAL_KITTY, // XTGETTCAP['TN'] == 'xterm-kitty'

View File

@ -10,6 +10,28 @@
#include <linux/kd.h>
#include <sys/ioctl.h>
int fbcon_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs, int bpp){
(void)nc;
(void)linesize;
(void)data;
(void)leny;
(void)lenx;
(void)bargs;
(void)bpp;
logerror("Haven't implemented yet FIXME\n");
return -1;
}
int fbcon_draw(const struct ncpile *p, sprixel* s, FILE* out){
(void)p;
(void)s;
(void)out;
logerror("Haven't implemented yet FIXME\n");
return -1;
}
// each row is a contiguous set of bits, starting at the msb
static inline size_t
row_bytes(const struct console_font_op* cfo){

View File

@ -193,6 +193,9 @@ int iterm_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int kitty_blit_animated(struct ncplane* n, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int fbcon_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int fbcon_draw(const struct ncpile *p, sprixel* s, FILE* out);
#ifdef __cplusplus
}

View File

@ -109,6 +109,15 @@ setup_kitty_bitmaps(tinfo* ti, int fd, int sixel_maxy_pristine){
sprite_init(ti, fd);
}
// kitty 0.19.3 didn't have C=1, and thus needs sixel_maxy_pristine. it also
// lacked animation, and thus requires the older interface.
static inline void
setup_fbcon_bitmaps(tinfo* ti){
// FIXME
ti->pixel_draw = fbcon_draw;
set_pixel_blitter(fbcon_blit);
}
static bool
query_rgb(void){
bool rgb = (tigetflag("RGB") > 1 || tigetflag("Tc") > 1);
@ -543,6 +552,7 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd,
}
if(ti->linux_fb_fd >= 0){
termname = "Linux framebuffer";
setup_fbcon_bitmaps(ti);
}else{
termname = "Linux console";
}