58 mapped = ( ( ( red >>
map->red_scale ) <<
map->red_lsb ) |
59 ( ( green >>
map->green_scale ) <<
map->green_lsb ) |
60 ( ( blue >>
map->blue_scale ) <<
map->blue_lsb ) );
72 unsigned int ansicol ) {
76 rgb = ( ( ( ansicol & ( 1 << 0 ) ) ? 0xaa0000 : 0 ) |
77 ( ( ansicol & ( 1 << 1 ) ) ? 0x00aa00 : 0 ) |
78 ( ( ansicol & ( 1 << 2 ) ) ? 0x0000aa : 0 ) );
116 unsigned int ypos ) {
154 unsigned int xpos,
unsigned int ypos ) {
195 column ; column--, bitmask <<= 1,
offset += pixel_len ) {
196 if ( bitmask & 0x80 ) {
198 }
else if ( ! transparent ) {
312 int cx = ( params[1] - 1 );
313 int cy = ( params[0] - 1 );
368 for ( i = 0 ; i <
count ; i++ ) {
375 }
else if ( aspect == 1 ) {
377 }
else if ( aspect == 22 ) {
379 }
else if ( ( aspect >= 30 ) && ( aspect <= 37 ) ) {
382 }
else if ( aspect == 38 ) {
384 }
else if ( aspect == 39 ) {
386 }
else if ( ( aspect >= 40 ) && ( aspect <= 47 ) ) {
389 }
else if ( aspect == 48 ) {
391 }
else if ( aspect == 49 ) {
404 for ( ; ( i <
count ) && ( i <
end ) ; i++ )
405 rgb = ( ( rgb << 8 ) | params[i] );
545 if ( ! picture->
start ) {
546 DBGC (
fbcon,
"FBCON %p could not allocate %zd bytes for " 553 xgap = ( ( ( int ) ( pixel->
width - pixbuf->
width ) ) / 2 );
554 ygap = ( ( ( int ) ( pixel->
height - pixbuf->
height ) ) / 2 );
555 indent = ( ( ( ( ygap >= 0 ) ? ygap : 0 ) * pixel->
stride ) +
556 ( ( ( xgap >= 0 ) ? xgap : 0 ) * pixel->
len ) );
557 width = pixbuf->
width;
558 if ( width > pixel->
width )
559 width = pixel->
width;
561 if ( height > pixel->
height )
563 DBGC (
fbcon,
"FBCON %p picture is pixel %dx%d at [%d,%d),[%d,%d)\n",
564 fbcon, width, height, xgap, ( xgap + pixbuf->
width ), ygap,
565 ( ygap + pixbuf->
height ) );
569 for (
y = 0 ;
y < height ;
y++ ) {
571 rgb = pixbuf_pixel ( pixbuf, ( ( xgap < 0 ) ? -xgap : 0 ),
572 ( ( ( ygap < 0 ) ? -ygap : 0 ) +
y ) );
573 for (
x = 0 ;
x < width ;
x++ ) {
640 right = ( xgap - left );
642 bottom = ( ygap - top );
653 ( height < ( ( int ) font->
height ) ) ) {
654 DBGC (
fbcon,
"FBCON %p has unusable character area " 663 ygap = ( height % font->
height );
676 DBGC (
fbcon,
"FBCON %p is pixel %dx%d, char %dx%d at " static void console_set_size(unsigned int width, unsigned int height)
Set console size.
static __always_inline void ufree(void *ptr)
Free external memory.
unsigned int height
Character height (in pixels)
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
static struct ansiesc_handler fbcon_ansiesc_handlers[]
ANSI escape sequence handlers.
static void fbcon_draw(struct fbcon *fbcon, struct fbcon_text_cell *cell, unsigned int xpos, unsigned int ypos)
Draw character at specified position.
A handler for an escape sequence.
#define FBCON_BOLD
Bold colour modifier (RGB value)
struct ansiesc_handler * handlers
Array of handlers.
unsigned int height
Height.
int fbcon_init(struct fbcon *fbcon, void *start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config)
Initialise frame buffer console.
unsigned int ypos
Text cursor Y position.
static uint32_t fbcon_ansi_colour(struct fbcon *fbcon, unsigned int ansicol)
Calculate ANSI font colour.
unsigned int height
Height.
unsigned int bottom
Bottom margin.
struct fbcon_font * font
Font definition.
unsigned int width
Width (number of entities per displayed row)
static void fbcon_draw_cursor(struct fbcon *fbcon, int show_cursor)
Draw character at cursor position.
struct fbcon_geometry character
Character geometry.
struct ansiesc_context ctx
ANSI escape sequence context.
static void fbcon_handle_dectcem_reset(struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM reset (hide cursor)
void * start
Start address.
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
A frame buffer text cell.
static uint32_t fbcon_colour(struct fbcon *fbcon, uint32_t rgb)
Calculate raw colour value.
ANSI escape sequence context.
struct golan_eq_context ctx
static void fbcon_handle_cup(struct ansiesc_context *ctx, unsigned int count __unused, int params[])
Handle ANSI CUP (cursor position)
static void fbcon_clear(struct fbcon *fbcon, unsigned int ypos)
Clear rows of characters.
struct fbcon_geometry * pixel
Pixel geometry.
unsigned int left
Left margin.
#define ANSIESC_ED
Erase in page.
uint32_t start
Starting offset.
int ansiesc_process(struct ansiesc_context *ctx, int c)
Process character that may be part of ANSI escape sequence.
unsigned int bottom
Bottom margin.
static void fbcon_scroll(struct fbcon *fbcon)
Scroll screen.
#define ANSIESC_ED_ALL
Erase whole page.
#define ENOMEM
Not enough space.
uint32_t background
Background colour.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define ANSIESC_CUP
Cursor position.
A frame buffer background picture.
uint32_t foreground
Text foreground raw colour.
size_t len
Length of a single entity.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
Access to external ("user") memory.
static void fbcon_handle_ed(struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused)
Handle ANSI ED (erase in page)
#define __unused
Declare a variable or data structure as unused.
A frame buffer colour mapping.
static void fbcon_set_default_background(struct fbcon *fbcon)
Set default background colour.
static unsigned int count
Number of entries.
static void fbcon_handle_sgr(struct ansiesc_context *ctx, unsigned int count, int params[])
Handle ANSI SGR (set graphics rendition)
#define ANSIESC_SGR
Select graphic rendition.
unsigned int top
Top margin.
static void fbcon_handle_dectcem_set(struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM set (show cursor)
#define cpu_to_le32(value)
unsigned int character
Unicode character.
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
uint32_t foreground
Foreground colour.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int xpos
Text cursor X position.
struct fbcon_margin margin
Margin.
unsigned int right
Right margin.
#define FBCON_CHAR_WIDTH
Character width, in pixels.
static int fbcon_picture_init(struct fbcon *fbcon, struct pixel_buffer *pixbuf)
Initialise background picture.
static struct fbcon_text_cell * fbcon_cell(struct fbcon *fbcon, unsigned int xpos, unsigned int ypos)
Get character cell.
struct fbcon_text_cell * cells
Stored text cells.
uint32_t background
Text background raw colour.
#define FBCON_TRANSPARENT
Transparent background magic colour (raw colour value)
#define ANSIESC_DECTCEM_RESET
Hide cursor.
struct fbcon_text text
Text array.
struct utf8_accumulator utf8
UTF-8 accumulator.
#define ANSIESC_DECTCEM_SET
Show cursor.
size_t len
Length of one complete displayed screen.
static __always_inline int struct dma_mapping * map
const uint8_t *(* glyph)(unsigned int character)
Get character glyph.
unsigned int height
Height (number of entities per displayed column)
struct pixel_buffer * pixbuf
Background picture, if any.
static __always_inline void * umalloc(size_t size)
Allocate external memory.
unsigned int top
Top margin.
unsigned int right
Right margin.
static unsigned int unsigned int y
void * start
Start address.
uint32_t end
Ending offset.
unsigned int utf8_accumulate(struct utf8_accumulator *utf8, uint8_t byte)
Accumulate Unicode character from UTF-8 byte sequence.
uint32_t bold
Bold colour modifier raw colour.
struct fbcon_picture picture
Background picture.
size_t indent
Indent to first character (in bytes)
uint16_t offset
Offset to command line.
struct fbcon_colour_map * map
Colour mapping.
int show_cursor
Display cursor.
#define NULL
NULL pointer (VOID *)
static void fbcon_set_default_foreground(struct fbcon *fbcon)
Set default foreground colour.
size_t stride
Stride (offset between vertically adjacent entities)
static void fbcon_redraw(struct fbcon *fbcon)
Redraw all characters.
unsigned int left
Left margin.
void * memset(void *dest, int character, size_t len) __nonnull