diff --git a/docs/man/kmscon.1.xml.in b/docs/man/kmscon.1.xml.in index 42da262a..435cc2b0 100644 --- a/docs/man/kmscon.1.xml.in +++ b/docs/man/kmscon.1.xml.in @@ -511,7 +511,7 @@ Specify console the rendering engine. Available engines are - `bblit', `bbulk', and `gltex'. + `bbulk', and `gltex'. (default: detect by GPU type) diff --git a/meson.build b/meson.build index 4fbe7c74..f31a0b6b 100644 --- a/meson.build +++ b/meson.build @@ -98,7 +98,6 @@ foreach name, reqs : { 'video_fbdev': [], 'video_drm2d': [libdrm_deps], 'video_drm3d': [libdrm_deps, gbm_deps, egl_deps, glesv2_deps], - 'renderer_bbulk': [], 'renderer_gltex': [glesv2_deps], 'font_unifont': [], 'font_pango': [pango_deps], diff --git a/meson.options b/meson.options index c043dd7f..a0501d39 100644 --- a/meson.options +++ b/meson.options @@ -20,8 +20,6 @@ option('video_drm3d', type: 'feature', value: 'auto', description: 'drm3d video backend') # renderers -option('renderer_bbulk', type: 'feature', value: 'auto', - description: 'bbulk renderer') option('renderer_gltex', type: 'feature', value: 'auto', description: 'gltex renderer') diff --git a/scripts/etc/kmscon.conf b/scripts/etc/kmscon.conf index 0272bb99..a3d7aae9 100644 --- a/scripts/etc/kmscon.conf +++ b/scripts/etc/kmscon.conf @@ -26,7 +26,7 @@ ## Enable 3d rendering (only useful with gltex) #hwaccel -## Text renderer, can be [gltex, bblit, bbluk] +## Text renderer, can be [gltex, bbluk] ## gltex only works with hwaccel enabled, and others work with hwaccel disabled #render-engine=gltex diff --git a/src/kmscon_main.c b/src/kmscon_main.c index 2322d646..7bb74c21 100644 --- a/src/kmscon_main.c +++ b/src/kmscon_main.c @@ -628,7 +628,7 @@ int main(int argc, char **argv) kmscon_load_modules(); kmscon_font_register(&kmscon_font_8x16_ops); - kmscon_text_register(&kmscon_text_bblit_ops); + kmscon_text_register(&kmscon_text_bbulk_ops); uterm_register_drm2d(); uterm_register_fbdev(); @@ -670,7 +670,7 @@ int main(int argc, char **argv) destroy_app(&app); err_unload: - kmscon_text_unregister(kmscon_text_bblit_ops.name); + kmscon_text_unregister(kmscon_text_bbulk_ops.name); kmscon_font_unregister(kmscon_font_8x16_ops.name); kmscon_unload_modules(); kmscon_conf_free(conf_ctx); diff --git a/src/kmscon_mod_bbulk.c b/src/kmscon_mod_bbulk.c deleted file mode 100644 index 34f83e19..00000000 --- a/src/kmscon_mod_bbulk.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * kmscon - BBulk rendering backend module - * - * Copyright (c) 2011-2013 David Herrmann - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * BBulk rendering backend module - * This module provides the bbulk renderer backend. - */ - -#include -#include -#include "text.h" -#include "shl_module_interface.h" -#include "shl_log.h" - -#define LOG_SUBSYSTEM "mod_bbulk" - -static int kmscon_bbulk_load(void) -{ - int ret; - - kmscon_text_bbulk_ops.owner = SHL_THIS_MODULE; - ret = kmscon_text_register(&kmscon_text_bbulk_ops); - if (ret) { - log_error("cannot register bbulk renderer"); - return ret; - } - - return 0; -} - -static void kmscon_bbulk_unload(void) -{ - kmscon_text_unregister(kmscon_text_bbulk_ops.name); -} - -SHL_MODULE(NULL, kmscon_bbulk_load, kmscon_bbulk_unload, NULL); diff --git a/src/meson.build b/src/meson.build index 12cefbd6..50fddd85 100644 --- a/src/meson.build +++ b/src/meson.build @@ -198,18 +198,6 @@ if enable_font_pango ) endif -if enable_renderer_bbulk - mod_bbulk = shared_module('mod-bbulk', [ - 'text_bbulk.c', - 'kmscon_mod_bbulk.c', - ], - name_prefix: '', - dependencies: [libtsm_deps, shl_deps], - install: true, - install_dir: moduledir, - ) -endif - if enable_renderer_gltex mod_gltex = shared_module('mod-gltex', [ 'text_gltex.c', @@ -244,7 +232,7 @@ kmscon_srcs = [ 'font_rotate.c', 'font_8x16.c', 'text.c', - 'text_bblit.c', + 'text_bbulk.c', 'kmscon_seat.c', 'kmscon_conf.c', 'kmscon_main.c', diff --git a/src/text.h b/src/text.h index cc08c1f2..da8a4926 100644 --- a/src/text.h +++ b/src/text.h @@ -132,7 +132,6 @@ int kmscon_text_draw_cb(struct tsm_screen *con, /* modularized backends */ -extern struct kmscon_text_ops kmscon_text_bblit_ops; extern struct kmscon_text_ops kmscon_text_bbulk_ops; extern struct kmscon_text_ops kmscon_text_gltex_ops; diff --git a/src/text_bblit.c b/src/text_bblit.c deleted file mode 100644 index 1d6dcc3a..00000000 --- a/src/text_bblit.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * kmscon - Bit-Blitting Text Renderer Backend - * - * Copyright (c) 2012-2013 David Herrmann - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * SECTION:text_bblit.c - * @short_description: Bit-Blitting Text Renderer Backend - * @include: text.h - * - * The bit-blitting renderer requires framebuffer access to the output device - * and simply blits the glyphs into the buffer. - */ - -#include -#include -#include -#include -#include "font_rotate.h" -#include "shl_log.h" -#include "shl_misc.h" -#include "text.h" -#include "uterm_video.h" - -#define LOG_SUBSYSTEM "text_bblit" - -struct bblit { - struct shl_hashtable *glyphs; - struct shl_hashtable *bold_glyphs; -}; - -static int bblit_init(struct kmscon_text *txt) -{ - struct bblit *bb; - - bb = malloc(sizeof(*bb)); - if (!bb) - return -ENOMEM; - - txt->data = bb; - return 0; -} - -static void bblit_destroy(struct kmscon_text *txt) -{ - struct bblit *bb = txt->data; - - free(bb); -} - -static void free_glyph(void *data) -{ - struct uterm_video_buffer *bb_glyph = data; - - free(bb_glyph->data); - free(bb_glyph); -} - -static int bblit_set(struct kmscon_text *txt) -{ - struct bblit *bb = txt->data; - unsigned int sw, sh; - struct uterm_mode *mode; - - mode = uterm_display_get_current(txt->disp); - if (!mode) - return -EINVAL; - sw = uterm_mode_get_width(mode); - sh = uterm_mode_get_height(mode); - - if (txt->orientation == OR_NORMAL || txt->orientation == OR_UPSIDE_DOWN) { - txt->cols = sw / FONT_WIDTH(txt); - txt->rows = sh / FONT_HEIGHT(txt); - } else { - txt->rows = sw / FONT_HEIGHT(txt); - txt->cols = sh / FONT_WIDTH(txt); - } - - return kmscon_rotate_create_tables(&bb->glyphs, &bb->bold_glyphs, free_glyph); -} - -static void bblit_unset(struct kmscon_text *txt) -{ - struct bblit *bb = txt->data; - - kmscon_rotate_free_tables(bb->glyphs, bb->bold_glyphs); -} - -static int bblit_rotate(struct kmscon_text *txt, enum Orientation orientation) -{ - bblit_unset(txt); - txt->orientation = orientation; - return bblit_set(txt); -} - -static int find_glyph(struct kmscon_text *txt, struct uterm_video_buffer **out, - uint64_t id, const uint32_t *ch, size_t len, const struct tsm_screen_attr *attr) -{ - struct bblit *bb = txt->data; - struct uterm_video_buffer *bb_glyph; - const struct kmscon_glyph *glyph; - struct shl_hashtable *gtable; - struct kmscon_font *font; - int ret; - bool res; - - if (attr->bold) { - gtable = bb->bold_glyphs; - font = txt->bold_font; - } else { - gtable = bb->glyphs; - font = txt->font; - } - - if (attr->underline) - font->attr.underline = true; - else - font->attr.underline = false; - - if (attr->italic) - font->attr.italic = true; - else - font->attr.italic = false; - - res = shl_hashtable_find(gtable, (void**)&bb_glyph, id); - if (res) { - *out = bb_glyph; - return 0; - } - - bb_glyph = malloc(sizeof(*bb_glyph)); - if (!bb_glyph) - return -ENOMEM; - memset(bb_glyph, 0, sizeof(*bb_glyph)); - - if (!len) - ret = kmscon_font_render_empty(font, &glyph); - else - ret = kmscon_font_render(font, id, ch, len, &glyph); - - if (ret) { - ret = kmscon_font_render_inval(font, &glyph); - if (ret) - goto err_free; - } - - ret = kmscon_rotate_glyph( bb_glyph, glyph, txt->orientation, 1); - if (ret) - goto err_free; - - ret = shl_hashtable_insert(gtable, id, bb_glyph); - if (ret) - goto err_free_vb; - - *out = bb_glyph; - return 0; - -err_free_vb: - free(bb_glyph->data); -err_free: - free(bb_glyph); - return ret; -} - - -static int bblit_draw(struct kmscon_text *txt, - uint64_t id, const uint32_t *ch, size_t len, - unsigned int width, - unsigned int posx, unsigned int posy, - const struct tsm_screen_attr *attr) -{ - struct uterm_video_buffer *bb_glyph; - struct uterm_mode *mode; - unsigned sw, sh, x, y, cwidth; - int ret; - - if (!width) - return 0; - - mode = uterm_display_get_current(txt->disp); - if (!mode) - return -EINVAL; - sw = uterm_mode_get_width(mode); - sh = uterm_mode_get_height(mode); - - ret = find_glyph(txt, &bb_glyph, id, ch, len, attr); - if (ret) - return ret; - - switch (txt->orientation) { - default: - case OR_NORMAL: - x = posx * FONT_WIDTH(txt); - y = posy * FONT_HEIGHT(txt); - break; - case OR_UPSIDE_DOWN: - cwidth = bb_glyph->width / FONT_WIDTH(txt); - x = sw - (posx + cwidth) * FONT_WIDTH(txt); - y = sh - (posy + 1) * FONT_HEIGHT(txt); - break; - case OR_RIGHT: - x = sw - (posy + 1) * FONT_HEIGHT(txt); - y = posx * FONT_WIDTH(txt); - break; - case OR_LEFT: - cwidth = bb_glyph->height / FONT_WIDTH(txt); - x = posy * FONT_HEIGHT(txt); - y = sh - (posx + cwidth) * FONT_WIDTH(txt); - break; - } - - /* draw glyph */ - if (attr->inverse) { - ret = uterm_display_fake_blend(txt->disp, bb_glyph, x, y, - attr->br, attr->bg, attr->bb, - attr->fr, attr->fg, attr->fb); - } else { - ret = uterm_display_fake_blend(txt->disp, bb_glyph, x, y, - attr->fr, attr->fg, attr->fb, - attr->br, attr->bg, attr->bb); - } - - return ret; -} - -static int bblit_draw_pointer(struct kmscon_text *txt, - unsigned int pointer_x, unsigned int pointer_y, - const struct tsm_screen_attr *attr) -{ - struct uterm_video_buffer *bb_glyph; - struct uterm_mode *mode; - uint32_t ch = 'I'; - uint64_t id = ch; - unsigned int sw, sh; - unsigned int m_x, m_y, x, y; - int ret; - - mode = uterm_display_get_current(txt->disp); - if (!mode) - return -EINVAL; - sw = uterm_mode_get_width(mode); - sh = uterm_mode_get_height(mode); - - if (txt->orientation == OR_NORMAL || txt->orientation == OR_UPSIDE_DOWN) { - m_x = SHL_DIV_ROUND_UP(FONT_WIDTH(txt), 2); - m_y = SHL_DIV_ROUND_UP(FONT_HEIGHT(txt), 2); - } else { - m_x = SHL_DIV_ROUND_UP(FONT_HEIGHT(txt), 2); - m_y = SHL_DIV_ROUND_UP(FONT_WIDTH(txt), 2); - } - - ret = find_glyph(txt, &bb_glyph, id, &ch, 1, attr); - if (ret) - return ret; - - switch (txt->orientation) { - default: - case OR_NORMAL: - x = pointer_x; - y = pointer_y; - break; - case OR_UPSIDE_DOWN: - x = sw - pointer_x; - y = sh - pointer_y; - break; - case OR_RIGHT: - x = sw - pointer_y; - y = pointer_x; - break; - case OR_LEFT: - x = pointer_y; - y = sh - pointer_x; - break; - } - if (x < m_x) - x = m_x; - if (x + m_x > sw) - x = sw - m_x; - if (y < m_y) - y = m_y; - if (y + m_y > sh) - y = sh - m_y; - x -= m_x; - y -= m_y; - - /* draw glyph */ - ret = uterm_display_fake_blend(txt->disp, bb_glyph, x, y, - attr->fr, attr->fg, attr->fb, - attr->br, attr->bg, attr->bb); - return ret; -} - -struct kmscon_text_ops kmscon_text_bblit_ops = { - .name = "bblit", - .owner = NULL, - .init = bblit_init, - .destroy = bblit_destroy, - .set = bblit_set, - .unset = bblit_unset, - .rotate = bblit_rotate, - .prepare = NULL, - .draw = bblit_draw, - .draw_pointer = bblit_draw_pointer, - .render = NULL, - .abort = NULL, -};