57 mapped = ( ( ( red >>
map->red_scale ) <<
map->red_lsb ) |
58 ( ( green >>
map->green_scale ) <<
map->green_lsb ) |
59 ( ( blue >>
map->blue_scale ) <<
map->blue_lsb ) );
71 unsigned int ansicol ) {
75 rgb = ( ( ( ansicol & ( 1 << 0 ) ) ? 0xaa0000 : 0 ) |
76 ( ( ansicol & ( 1 << 1 ) ) ? 0x00aa00 : 0 ) |
77 ( ( ansicol & ( 1 << 2 ) ) ? 0x0000aa : 0 ) );
126 offset +=
sizeof ( cell );
140 unsigned int xpos,
unsigned int ypos ) {
158 unsigned int xpos,
unsigned int ypos ) {
199 column ; column--, bitmask <<= 1,
offset += pixel_len ) {
200 if ( bitmask & 0x80 ) {
202 }
else if ( ! transparent ) {
232 offset +=
sizeof ( cell );
293 int cx = ( params[1] - 1 );
294 int cy = ( params[0] - 1 );
349 for ( i = 0 ; i <
count ; i++ ) {
356 }
else if ( aspect == 1 ) {
358 }
else if ( aspect == 22 ) {
360 }
else if ( ( aspect >= 30 ) && ( aspect <= 37 ) ) {
363 }
else if ( aspect == 38 ) {
365 }
else if ( aspect == 39 ) {
367 }
else if ( ( aspect >= 40 ) && ( aspect <= 47 ) ) {
370 }
else if ( aspect == 48 ) {
372 }
else if ( aspect == 49 ) {
385 for ( ; ( i <
count ) && ( i <
end ) ; i++ )
386 rgb = ( ( rgb << 8 ) | params[i] );
511 size_t pixbuf_stride;
513 size_t pixbuf_indent;
515 size_t pixbuf_offset;
529 if ( ! picture->
start ) {
530 DBGC (
fbcon,
"FBCON %p could not allocate %zd bytes for " 537 pixbuf_stride = ( pixbuf->
width *
sizeof ( rgb ) );
538 xgap = ( ( ( int ) ( pixel->
width - pixbuf->
width ) ) / 2 );
539 ygap = ( ( ( int ) ( pixel->
height - pixbuf->
height ) ) / 2 );
540 indent = ( ( ( ( ygap >= 0 ) ? ygap : 0 ) * pixel->
stride ) +
541 ( ( ( xgap >= 0 ) ? xgap : 0 ) * pixel->
len ) );
542 pixbuf_indent = ( ( ( ( ygap < 0 ) ? -ygap : 0 ) * pixbuf_stride ) +
543 ( ( ( xgap < 0 ) ? -xgap : 0 ) *
sizeof ( rgb ) ) );
544 width = pixbuf->
width;
545 if ( width > pixel->
width )
546 width = pixel->
width;
548 if ( height > pixel->
height )
550 DBGC (
fbcon,
"FBCON %p picture is pixel %dx%d at [%d,%d),[%d,%d)\n",
551 fbcon, width, height, xgap, ( xgap + pixbuf->
width ), ygap,
552 ( ygap + pixbuf->
height ) );
556 for ( y = 0 ; y < height ; y++ ) {
558 pixbuf_offset = ( pixbuf_indent + ( y * pixbuf_stride ) );
559 for ( x = 0 ; x < width ; x++ ) {
566 pixbuf_offset +=
sizeof ( rgb );
628 right = ( xgap - left );
641 ( height < ( ( int ) font->
height ) ) ) {
642 DBGC (
fbcon,
"FBCON %p has unusable character area " 651 ygap = ( height % font->
height );
664 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.
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.
userptr_t start
Start address.
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.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
struct fbcon_geometry character
Character geometry.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
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 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.
static userptr_t bottom
Bottom of heap (current lowest allocated block)
ANSI escape sequence context.
void(* glyph)(unsigned int character, uint8_t *glyph)
Get character glyph.
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.
void memset_user(userptr_t userptr, off_t offset, int c, size_t len)
Fill user buffer with a constant byte.
#define ENOMEM
Not enough space.
uint32_t background
Background colour.
#define ANSIESC_CUP
Cursor position.
A frame buffer background picture.
uint32_t userptr_t
A pointer to a user buffer.
#define __unused
Declare a variable or data structure as unused.
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.
static void fbcon_handle_ed(struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused)
Handle ANSI ED (erase in page)
A frame buffer colour mapping.
static void fbcon_set_default_background(struct fbcon *fbcon)
Set default background colour.
uint16_t 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.
int fbcon_init(struct fbcon *fbcon, userptr_t start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config)
Initialise frame buffer console.
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.
userptr_t start
Stored text cells.
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
uint32_t foreground
Foreground colour.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static userptr_t top
Top of heap.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
unsigned int xpos
Text cursor X position.
struct fbcon_margin margin
Margin.
static __always_inline int struct dma_mapping * map
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.
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 void ufree(userptr_t userptr)
Free external memory.
static __always_inline userptr_t umalloc(size_t size)
Allocate external memory.
unsigned int height
Height (number of entities per displayed column)
struct pixel_buffer * pixbuf
Background picture, if any.
unsigned int top
Top margin.
unsigned int right
Right margin.
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.
void memmove_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers, allowing for overlap.
uint16_t offset
Offset to command line.
size_t indent
Indent to first character (in bytes)
userptr_t data
32-bit (8:8:8:8) xRGB pixel data, in host-endian order
struct fbcon_colour_map * map
Colour mapping.
userptr_t start
Start address.
static void fbcon_store(struct fbcon *fbcon, struct fbcon_text_cell *cell, unsigned int xpos, unsigned int ypos)
Store character at specified position.
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.
void memcpy_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers.
unsigned int left
Left margin.
void * memset(void *dest, int character, size_t len) __nonnull