blob: ee9ce3c0e37fc4ede7f2106a381afbd1b046dcb0 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass84c7fb32016-01-18 19:52:17 -07002/*
3 * Copyright (c) 2015 Google, Inc
Simon Glass84c7fb32016-01-18 19:52:17 -07004 */
5
6#ifndef __video_console_h
7#define __video_console_h
8
Simon Glass95bcad42025-04-02 06:29:36 +13009#include <alist.h>
Heinrich Schuchardt290e1d82018-02-08 21:47:11 +010010#include <video.h>
11
Simon Glass34b5c252023-10-01 19:13:19 -060012struct abuf;
Simon Glassbac91502020-07-02 21:12:18 -060013struct video_priv;
14
Simon Glass52c10c52016-01-14 18:10:37 -070015#define VID_FRAC_DIV 256
16
17#define VID_TO_PIXEL(x) ((x) / VID_FRAC_DIV)
18#define VID_TO_POS(x) ((x) * VID_FRAC_DIV)
19
Simon Glass377f79aa2023-10-01 19:13:21 -060020enum {
21 /* cursor width in pixels */
22 VIDCONSOLE_CURSOR_WIDTH = 2,
23};
24
Simon Glass84c7fb32016-01-18 19:52:17 -070025/**
26 * struct vidconsole_priv - uclass-private data about a console device
27 *
Simon Glass52c10c52016-01-14 18:10:37 -070028 * Drivers must set up @rows, @cols, @x_charsize, @y_charsize in their probe()
29 * method. Drivers may set up @xstart_frac if desired.
30 *
Simon Glassaea571d2024-10-14 16:31:54 -060031 * Note that these values relate to the rotated console, so that an 80x25
32 * console which is rotated 90 degrees will have rows=80 and cols=25
33 *
34 * The xcur_frac and ycur values refer to the unrotated coordinates, that is
35 * xcur_frac always advances with each character, even if its limit might be
36 * vid_priv->ysize instead of vid_priv->xsize if the console is rotated 90 or
37 * 270 degrees.
38 *
Heinrich Schuchardt9e933f12018-09-19 21:31:48 +020039 * @sdev: stdio device, acting as an output sink
40 * @xcur_frac: Current X position, in fractional units (VID_TO_POS(x))
41 * @ycur: Current Y position in pixels (0=top)
42 * @rows: Number of text rows
43 * @cols: Number of text columns
44 * @x_charsize: Character width in pixels
45 * @y_charsize: Character height in pixels
Simon Glass52c10c52016-01-14 18:10:37 -070046 * @tab_width_frac: Tab width in fractional units
Heinrich Schuchardt9e933f12018-09-19 21:31:48 +020047 * @xsize_frac: Width of the display in fractional units
Simon Glassa74451d2016-01-14 18:10:39 -070048 * @xstart_frac: Left margin for the text console in fractional units
Heinrich Schuchardt9e933f12018-09-19 21:31:48 +020049 * @last_ch: Last character written to the text console on this line
50 * @escape: TRUE if currently accumulating an ANSI escape sequence
51 * @escape_len: Length of accumulated escape sequence so far
52 * @col_saved: Saved X position, in fractional units (VID_TO_POS(x))
53 * @row_saved: Saved Y position in pixels (0=top)
54 * @escape_buf: Buffer to accumulate escape sequence
Janne Grunau5548c362024-03-16 22:50:19 +010055 * @utf8_buf: Buffer to accumulate UTF-8 byte sequence
Simon Glass84c7fb32016-01-18 19:52:17 -070056 */
57struct vidconsole_priv {
58 struct stdio_dev sdev;
Simon Glass52c10c52016-01-14 18:10:37 -070059 int xcur_frac;
60 int ycur;
Simon Glass84c7fb32016-01-18 19:52:17 -070061 int rows;
62 int cols;
Simon Glass52c10c52016-01-14 18:10:37 -070063 int x_charsize;
64 int y_charsize;
65 int tab_width_frac;
66 int xsize_frac;
Simon Glassa74451d2016-01-14 18:10:39 -070067 int xstart_frac;
Simon Glassafee7432016-01-14 18:10:40 -070068 int last_ch;
Rob Clark06e7a0d2017-09-13 18:12:21 -040069 /*
70 * ANSI escape sequences are accumulated character by character,
71 * starting after the ESC char (0x1b) until the entire sequence
72 * is consumed at which point it is acted upon.
73 */
74 int escape;
75 int escape_len;
Heinrich Schuchardt9e933f12018-09-19 21:31:48 +020076 int row_saved;
77 int col_saved;
Rob Clark06e7a0d2017-09-13 18:12:21 -040078 char escape_buf[32];
Janne Grunau5548c362024-03-16 22:50:19 +010079 char utf8_buf[5];
Simon Glass84c7fb32016-01-18 19:52:17 -070080};
81
82/**
Simon Glass3b175ba2023-01-06 08:52:32 -060083 * struct vidfont_info - information about a font
84 *
85 * @name: Font name, e.g. nimbus_sans_l_regular
86 */
87struct vidfont_info {
88 const char *name;
89};
90
91/**
Simon Glassa73a8b82023-06-01 10:22:45 -060092 * struct vidconsole_colour - Holds colour information
93 *
94 * @colour_fg: Foreground colour (pixel value)
95 * @colour_bg: Background colour (pixel value)
96 */
97struct vidconsole_colour {
98 u32 colour_fg;
99 u32 colour_bg;
100};
101
102/**
Simon Glass5caf1252023-06-01 10:22:46 -0600103 * struct vidconsole_bbox - Bounding box of text
104 *
105 * This describes the bounding box of something, measured in pixels. The x0/y0
106 * pair is inclusive; the x1/y2 pair is exclusive, meaning that it is one pixel
107 * beyond the extent of the object
108 *
109 * @valid: Values are valid (bounding box is known)
110 * @x0: left x position, in pixels from left side
111 * @y0: top y position, in pixels from top
112 * @x1: right x position + 1
113 * @y1: botton y position + 1
114 */
115struct vidconsole_bbox {
116 bool valid;
117 int x0;
118 int y0;
119 int x1;
120 int y1;
121};
122
123/**
Simon Glass95bcad42025-04-02 06:29:36 +1300124 * vidconsole_mline - Holds information about a line of measured text
125 *
126 * @bbox: Bounding box of the line, assuming it starts at 0,0
127 * @start: String index of the first character in the line
128 * @len: Number of characters in the line
129 */
130struct vidconsole_mline {
131 struct vidconsole_bbox bbox;
132 int start;
133 int len;
134};
135
136/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700137 * struct vidconsole_ops - Video console operations
138 *
139 * These operations work on either an absolute console position (measured
140 * in pixels) or a text row number (measured in rows, where each row consists
141 * of an entire line of text - typically 16 pixels).
142 */
143struct vidconsole_ops {
144 /**
145 * putc_xy() - write a single character to a position
146 *
147 * @dev: Device to write to
Simon Glass52c10c52016-01-14 18:10:37 -0700148 * @x_frac: Fractional pixel X position (0=left-most pixel) which
149 * is the X position multipled by VID_FRAC_DIV.
Simon Glass84c7fb32016-01-18 19:52:17 -0700150 * @y: Pixel Y position (0=top-most pixel)
Janne Grunau5548c362024-03-16 22:50:19 +0100151 * @cp: UTF-32 code point to write
Simon Glass52c10c52016-01-14 18:10:37 -0700152 * @return number of fractional pixels that the cursor should move,
153 * if all is OK, -EAGAIN if we ran out of space on this line, other -ve
154 * on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700155 */
Janne Grunau5548c362024-03-16 22:50:19 +0100156 int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, int cp);
Simon Glass84c7fb32016-01-18 19:52:17 -0700157
158 /**
159 * move_rows() - Move text rows from one place to another
160 *
161 * @dev: Device to adjust
162 * @rowdst: Destination text row (0=top)
163 * @rowsrc: Source start text row
164 * @count: Number of text rows to move
165 * @return 0 if OK, -ve on error
166 */
167 int (*move_rows)(struct udevice *dev, uint rowdst, uint rowsrc,
168 uint count);
169
170 /**
171 * set_row() - Set the colour of a text row
172 *
173 * Every pixel contained within the text row is adjusted
174 *
175 * @dev: Device to adjust
176 * @row: Text row to adjust (0=top)
177 * @clr: Raw colour (pixel value) to write to each pixel
178 * @return 0 if OK, -ve on error
179 */
180 int (*set_row)(struct udevice *dev, uint row, int clr);
Simon Glassafee7432016-01-14 18:10:40 -0700181
182 /**
183 * entry_start() - Indicate that text entry is starting afresh
184 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600185 * @dev: Device to adjust
186 * Returns: 0 on success, -ve on error
187 *
Simon Glassafee7432016-01-14 18:10:40 -0700188 * Consoles which use proportional fonts need to track the position of
189 * each character output so that backspace will return to the correct
190 * place. This method signals to the console driver that a new entry
191 * line is being start (e.g. the user pressed return to start a new
192 * command). The driver can use this signal to empty its list of
193 * positions.
194 */
195 int (*entry_start)(struct udevice *dev);
Simon Glass33bd3b62016-01-14 18:10:41 -0700196
197 /**
198 * backspace() - Handle erasing the last character
199 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600200 * @dev: Device to adjust
201 * Returns: 0 on success, -ve on error
202 *
Simon Glass33bd3b62016-01-14 18:10:41 -0700203 * With proportional fonts the vidconsole uclass cannot itself erase
204 * the previous character. This optional method will be called when
205 * a backspace is needed. The driver should erase the previous
206 * character and update the cursor position (xcur_frac, ycur) to the
207 * start of the previous character.
208 *
209 * If not implement, default behaviour will work for fixed-width
210 * characters.
211 */
212 int (*backspace)(struct udevice *dev);
Simon Glass3b175ba2023-01-06 08:52:32 -0600213
214 /**
215 * get_font() - Obtain information about a font (optional)
216 *
217 * @dev: Device to check
218 * @seq: Font number to query (0=first, 1=second, etc.)
219 * @info: Returns font information on success
220 * Returns: 0 on success, -ENOENT if no such font
221 */
222 int (*get_font)(struct udevice *dev, int seq,
223 struct vidfont_info *info);
224
225 /**
Dzmitry Sankouski86c6a532023-03-07 13:21:15 +0300226 * get_font_size() - get the current font name and size
227 *
228 * @dev: vidconsole device
229 * @sizep: Place to put the font size (nominal height in pixels)
230 * Returns: Current font name
231 */
232 const char *(*get_font_size)(struct udevice *dev, uint *sizep);
233
234 /**
Simon Glass3b175ba2023-01-06 08:52:32 -0600235 * select_font() - Select a particular font by name / size
236 *
237 * @dev: Device to adjust
238 * @name: Font name to use (NULL to use default)
239 * @size: Font size to use (0 to use default)
240 * Returns: 0 on success, -ENOENT if no such font
241 */
242 int (*select_font)(struct udevice *dev, const char *name, uint size);
Simon Glass5caf1252023-06-01 10:22:46 -0600243
244 /**
Simon Glass95bcad42025-04-02 06:29:36 +1300245 * measure() - Measure the bounding box of some text
Simon Glass5caf1252023-06-01 10:22:46 -0600246 *
Simon Glass95bcad42025-04-02 06:29:36 +1300247 * @dev: Console device to use
Simon Glass5caf1252023-06-01 10:22:46 -0600248 * @name: Font name to use (NULL to use default)
249 * @size: Font size to use (0 to use default)
250 * @text: Text to measure
251 * @bbox: Returns bounding box of text, assuming it is positioned
252 * at 0,0
Simon Glass95bcad42025-04-02 06:29:36 +1300253 * @lines: If non-NULL, this must be an alist of
254 * struct vidconsole_mline inited by caller. A separate
255 * record is added for each line of text
256 *
Simon Glass5caf1252023-06-01 10:22:46 -0600257 * Returns: 0 on success, -ENOENT if no such font
258 */
259 int (*measure)(struct udevice *dev, const char *name, uint size,
Simon Glass95bcad42025-04-02 06:29:36 +1300260 const char *text, struct vidconsole_bbox *bbox,
261 struct alist *lines);
Simon Glass8b82e592023-10-01 19:13:18 -0600262
263 /**
264 * nominal() - Measure the expected width of a line of text
265 *
266 * Uses an average font width and nominal height
267 *
268 * @dev: Console device to use
269 * @name: Font name, NULL for default
270 * @size: Font size, ignored if @name is NULL
271 * @num_chars: Number of characters to use
272 * @bbox: Returns nounding box of @num_chars characters
273 * Returns: 0 if OK, -ve on error
274 */
275 int (*nominal)(struct udevice *dev, const char *name, uint size,
276 uint num_chars, struct vidconsole_bbox *bbox);
Simon Glass34b5c252023-10-01 19:13:19 -0600277
278 /**
279 * entry_save() - Save any text-entry information for later use
280 *
281 * Saves text-entry context such as a list of positions for each
282 * character in the string.
283 *
284 * @dev: Console device to use
285 * @buf: Buffer to hold saved data
286 * Return: 0 if OK, -ENOMEM if out of memory
287 */
288 int (*entry_save)(struct udevice *dev, struct abuf *buf);
289
290 /**
291 * entry_restore() - Restore text-entry information for current use
292 *
293 * Restores text-entry context such as a list of positions for each
294 * character in the string.
295 *
296 * @dev: Console device to use
297 * @buf: Buffer containing data to restore
298 * Return: 0 if OK, -ve on error
299 */
300 int (*entry_restore)(struct udevice *dev, struct abuf *buf);
Simon Glass377f79aa2023-10-01 19:13:21 -0600301
302 /**
303 * set_cursor_visible() - Show or hide the cursor
304 *
305 * Shows or hides a cursor at the current position
306 *
307 * @dev: Console device to use
308 * @visible: true to show the cursor, false to hide it
309 * @x: X position in pixels
310 * @y: Y position in pixels
311 * @index: Character position (0 = at start)
312 * Return: 0 if OK, -ve on error
313 */
314 int (*set_cursor_visible)(struct udevice *dev, bool visible,
315 uint x, uint y, uint index);
Simon Glass84c7fb32016-01-18 19:52:17 -0700316};
317
318/* Get a pointer to the driver operations for a video console device */
319#define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops)
320
321/**
Simon Glass3b175ba2023-01-06 08:52:32 -0600322 * vidconsole_get_font() - Obtain information about a font
323 *
324 * @dev: Device to check
325 * @seq: Font number to query (0=first, 1=second, etc.)
326 * @info: Returns font information on success
327 * Returns: 0 on success, -ENOENT if no such font, -ENOSYS if there is no such
328 * method
329 */
330int vidconsole_get_font(struct udevice *dev, int seq,
331 struct vidfont_info *info);
332
333/**
334 * vidconsole_select_font() - Select a particular font by name / size
335 *
336 * @dev: Device to adjust
337 * @name: Font name to use (NULL to use default)
338 * @size: Font size to use (0 to use default)
339 */
340int vidconsole_select_font(struct udevice *dev, const char *name, uint size);
341
Simon Glass95bcad42025-04-02 06:29:36 +1300342/**
343 * vidconsole_measure() - Measure the bounding box of some text
344 *
345 * @dev: Device to adjust
346 * @name: Font name to use (NULL to use default)
347 * @size: Font size to use (0 to use default)
348 * @text: Text to measure
349 * @bbox: Returns bounding box of text, assuming it is positioned
350 * at 0,0
351 * @lines: If non-NULL, this must be an alist of
352 * struct vidconsole_mline inited by caller. The list is emptied
353 * and then a separate record is added for each line of text
Simon Glass5caf1252023-06-01 10:22:46 -0600354 *
Simon Glass95bcad42025-04-02 06:29:36 +1300355 * Returns: 0 on success, -ENOENT if no such font
Simon Glass5caf1252023-06-01 10:22:46 -0600356 */
357int vidconsole_measure(struct udevice *dev, const char *name, uint size,
Simon Glass95bcad42025-04-02 06:29:36 +1300358 const char *text, struct vidconsole_bbox *bbox,
359 struct alist *lines);
Simon Glass3b175ba2023-01-06 08:52:32 -0600360/**
Simon Glass8b82e592023-10-01 19:13:18 -0600361 * vidconsole_nominal() - Measure the expected width of a line of text
362 *
363 * Uses an average font width and nominal height
364 *
365 * @dev: Console device to use
366 * @name: Font name, NULL for default
367 * @size: Font size, ignored if @name is NULL
368 * @num_chars: Number of characters to use
369 * @bbox: Returns nounding box of @num_chars characters
370 * Returns: 0 if OK, -ve on error
371 */
372int vidconsole_nominal(struct udevice *dev, const char *name, uint size,
373 uint num_chars, struct vidconsole_bbox *bbox);
374
375/**
Simon Glass34b5c252023-10-01 19:13:19 -0600376 * vidconsole_entry_save() - Save any text-entry information for later use
377 *
378 * Saves text-entry context such as a list of positions for each
379 * character in the string.
380 *
381 * @dev: Console device to use
382 * @buf: Buffer to hold saved data
383 * Return: 0 if OK, -ENOMEM if out of memory
384 */
385int vidconsole_entry_save(struct udevice *dev, struct abuf *buf);
386
387/**
388 * entry_restore() - Restore text-entry information for current use
389 *
390 * Restores text-entry context such as a list of positions for each
391 * character in the string.
392 *
393 * @dev: Console device to use
394 * @buf: Buffer containing data to restore
395 * Return: 0 if OK, -ve on error
396 */
397int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf);
398
399/**
Simon Glass377f79aa2023-10-01 19:13:21 -0600400 * vidconsole_set_cursor_visible() - Show or hide the cursor
401 *
402 * Shows or hides a cursor at the current position
403 *
404 * @dev: Console device to use
405 * @visible: true to show the cursor, false to hide it
406 * @x: X position in pixels
407 * @y: Y position in pixels
408 * @index: Character position (0 = at start)
409 * Return: 0 if OK, -ve on error
410 */
411int vidconsole_set_cursor_visible(struct udevice *dev, bool visible,
412 uint x, uint y, uint index);
413
414/**
Simon Glassa73a8b82023-06-01 10:22:45 -0600415 * vidconsole_push_colour() - Temporarily change the font colour
416 *
417 * @dev: Device to adjust
418 * @fg: Foreground colour to select
419 * @bg: Background colour to select
420 * @old: Place to store the current colour, so it can be restored
421 */
422void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg,
423 enum colour_idx bg, struct vidconsole_colour *old);
424
425/**
426 * vidconsole_pop_colour() - Restore the original colour
427 *
428 * @dev: Device to adjust
429 * @old: Old colour to be restored
430 */
431void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
432
433/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700434 * vidconsole_putc_xy() - write a single character to a position
435 *
436 * @dev: Device to write to
Simon Glass52c10c52016-01-14 18:10:37 -0700437 * @x_frac: Fractional pixel X position (0=left-most pixel) which
438 * is the X position multipled by VID_FRAC_DIV.
Simon Glass84c7fb32016-01-18 19:52:17 -0700439 * @y: Pixel Y position (0=top-most pixel)
Janne Grunau5548c362024-03-16 22:50:19 +0100440 * @cp: UTF-32 code point to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100441 * Return: number of fractional pixels that the cursor should move,
Simon Glass52c10c52016-01-14 18:10:37 -0700442 * if all is OK, -EAGAIN if we ran out of space on this line, other -ve
443 * on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700444 */
Janne Grunau5548c362024-03-16 22:50:19 +0100445int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, int cp);
Simon Glass84c7fb32016-01-18 19:52:17 -0700446
447/**
448 * vidconsole_move_rows() - Move text rows from one place to another
449 *
450 * @dev: Device to adjust
451 * @rowdst: Destination text row (0=top)
452 * @rowsrc: Source start text row
453 * @count: Number of text rows to move
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100454 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700455 */
456int vidconsole_move_rows(struct udevice *dev, uint rowdst, uint rowsrc,
457 uint count);
458
459/**
460 * vidconsole_set_row() - Set the colour of a text row
461 *
462 * Every pixel contained within the text row is adjusted
463 *
464 * @dev: Device to adjust
465 * @row: Text row to adjust (0=top)
466 * @clr: Raw colour (pixel value) to write to each pixel
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100467 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700468 */
469int vidconsole_set_row(struct udevice *dev, uint row, int clr);
470
471/**
Simon Glass4446c4b2023-10-01 19:13:20 -0600472 * vidconsole_entry_start() - Set the start position of a vidconsole line
473 *
474 * Marks the current cursor position as the start of a line
475 *
476 * @dev: Device to adjust
477 */
478int vidconsole_entry_start(struct udevice *dev);
479
480/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700481 * vidconsole_put_char() - Output a character to the current console position
482 *
483 * Outputs a character to the console and advances the cursor. This function
484 * handles wrapping to new lines and scrolling the console. Special
485 * characters are handled also: \n, \r, \b and \t.
486 *
487 * The device always starts with the cursor at position 0,0 (top left). It
488 * can be adjusted manually using vidconsole_position_cursor().
489 *
490 * @dev: Device to adjust
491 * @ch: Character to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100492 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700493 */
494int vidconsole_put_char(struct udevice *dev, char ch);
495
496/**
Marek Vasuta89f9cb2019-05-17 20:22:31 +0200497 * vidconsole_put_string() - Output a string to the current console position
498 *
499 * Outputs a string to the console and advances the cursor. This function
500 * handles wrapping to new lines and scrolling the console. Special
501 * characters are handled also: \n, \r, \b and \t.
502 *
503 * The device always starts with the cursor at position 0,0 (top left). It
504 * can be adjusted manually using vidconsole_position_cursor().
505 *
506 * @dev: Device to adjust
507 * @str: String to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100508 * Return: 0 if OK, -ve on error
Marek Vasuta89f9cb2019-05-17 20:22:31 +0200509 */
510int vidconsole_put_string(struct udevice *dev, const char *str);
511
512/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700513 * vidconsole_position_cursor() - Move the text cursor
514 *
515 * @dev: Device to adjust
516 * @col: New cursor text column
517 * @row: New cursor text row
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100518 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700519 */
520void vidconsole_position_cursor(struct udevice *dev, unsigned col,
521 unsigned row);
522
Simon Glassd622c5b2022-10-06 08:36:04 -0600523/**
Simon Glass90679c62023-03-10 12:47:21 -0800524 * vidconsole_clear_and_reset() - Clear the console and reset the cursor
525 *
526 * The cursor is placed at the start of the console
527 *
528 * @dev: vidconsole device to adjust
529 */
530int vidconsole_clear_and_reset(struct udevice *dev);
531
532/**
Simon Glassd622c5b2022-10-06 08:36:04 -0600533 * vidconsole_set_cursor_pos() - set cursor position
534 *
535 * The cursor is set to the new position and the start-of-line information is
536 * updated to the same position, so that a newline will return to @x
537 *
538 * @dev: video console device to update
539 * @x: x position from left in pixels
540 * @y: y position from top in pixels
541 */
542void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y);
543
Simon Glass981f00b2022-10-06 08:36:14 -0600544/**
545 * vidconsole_list_fonts() - List the available fonts
546 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600547 * @dev: vidconsole device to check
Simon Glass981f00b2022-10-06 08:36:14 -0600548 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600549 * This shows a list of fonts known by this vidconsole. The list is displayed on
550 * the console (not necessarily @dev but probably)
Simon Glass981f00b2022-10-06 08:36:14 -0600551 */
Simon Glass3b175ba2023-01-06 08:52:32 -0600552void vidconsole_list_fonts(struct udevice *dev);
Simon Glass981f00b2022-10-06 08:36:14 -0600553
Simon Glass9e972c32022-10-06 08:36:16 -0600554/**
Simon Glass3b175ba2023-01-06 08:52:32 -0600555 * vidconsole_get_font_size() - get the current font name and size
Simon Glass9e972c32022-10-06 08:36:16 -0600556 *
557 * @dev: vidconsole device
558 * @sizep: Place to put the font size (nominal height in pixels)
Dzmitry Sankouski86c6a532023-03-07 13:21:15 +0300559 * @name: pointer to font name, a placeholder for result
560 * Return: 0 if OK, -ENOSYS if not implemented in driver
Simon Glass9e972c32022-10-06 08:36:16 -0600561 */
Dzmitry Sankouski86c6a532023-03-07 13:21:15 +0300562int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep);
Simon Glass9e972c32022-10-06 08:36:16 -0600563
Heinrich Schuchardt290e1d82018-02-08 21:47:11 +0100564#endif