blob: a0ee9ab62e9899f9d8727cf15e90ae29a7d2025a [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 Glass3c686e62025-04-02 06:29:38 +1300247 * The text can include newlines
248 *
Simon Glass95bcad42025-04-02 06:29:36 +1300249 * @dev: Console device to use
Simon Glass5caf1252023-06-01 10:22:46 -0600250 * @name: Font name to use (NULL to use default)
251 * @size: Font size to use (0 to use default)
252 * @text: Text to measure
253 * @bbox: Returns bounding box of text, assuming it is positioned
254 * at 0,0
Simon Glass95bcad42025-04-02 06:29:36 +1300255 * @lines: If non-NULL, this must be an alist of
256 * struct vidconsole_mline inited by caller. A separate
257 * record is added for each line of text
258 *
Simon Glass5caf1252023-06-01 10:22:46 -0600259 * Returns: 0 on success, -ENOENT if no such font
260 */
261 int (*measure)(struct udevice *dev, const char *name, uint size,
Simon Glass95bcad42025-04-02 06:29:36 +1300262 const char *text, struct vidconsole_bbox *bbox,
263 struct alist *lines);
Simon Glass8b82e592023-10-01 19:13:18 -0600264
265 /**
266 * nominal() - Measure the expected width of a line of text
267 *
268 * Uses an average font width and nominal height
269 *
270 * @dev: Console device to use
271 * @name: Font name, NULL for default
272 * @size: Font size, ignored if @name is NULL
273 * @num_chars: Number of characters to use
274 * @bbox: Returns nounding box of @num_chars characters
275 * Returns: 0 if OK, -ve on error
276 */
277 int (*nominal)(struct udevice *dev, const char *name, uint size,
278 uint num_chars, struct vidconsole_bbox *bbox);
Simon Glass34b5c252023-10-01 19:13:19 -0600279
280 /**
281 * entry_save() - Save any text-entry information for later use
282 *
283 * Saves text-entry context such as a list of positions for each
284 * character in the string.
285 *
286 * @dev: Console device to use
287 * @buf: Buffer to hold saved data
288 * Return: 0 if OK, -ENOMEM if out of memory
289 */
290 int (*entry_save)(struct udevice *dev, struct abuf *buf);
291
292 /**
293 * entry_restore() - Restore text-entry information for current use
294 *
295 * Restores text-entry context such as a list of positions for each
296 * character in the string.
297 *
298 * @dev: Console device to use
299 * @buf: Buffer containing data to restore
300 * Return: 0 if OK, -ve on error
301 */
302 int (*entry_restore)(struct udevice *dev, struct abuf *buf);
Simon Glass377f79aa2023-10-01 19:13:21 -0600303
304 /**
305 * set_cursor_visible() - Show or hide the cursor
306 *
307 * Shows or hides a cursor at the current position
308 *
309 * @dev: Console device to use
310 * @visible: true to show the cursor, false to hide it
311 * @x: X position in pixels
312 * @y: Y position in pixels
313 * @index: Character position (0 = at start)
314 * Return: 0 if OK, -ve on error
315 */
316 int (*set_cursor_visible)(struct udevice *dev, bool visible,
317 uint x, uint y, uint index);
Simon Glass84c7fb32016-01-18 19:52:17 -0700318};
319
320/* Get a pointer to the driver operations for a video console device */
321#define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops)
322
323/**
Simon Glass3b175ba2023-01-06 08:52:32 -0600324 * vidconsole_get_font() - Obtain information about a font
325 *
326 * @dev: Device to check
327 * @seq: Font number to query (0=first, 1=second, etc.)
328 * @info: Returns font information on success
329 * Returns: 0 on success, -ENOENT if no such font, -ENOSYS if there is no such
330 * method
331 */
332int vidconsole_get_font(struct udevice *dev, int seq,
333 struct vidfont_info *info);
334
335/**
336 * vidconsole_select_font() - Select a particular font by name / size
337 *
338 * @dev: Device to adjust
339 * @name: Font name to use (NULL to use default)
340 * @size: Font size to use (0 to use default)
341 */
342int vidconsole_select_font(struct udevice *dev, const char *name, uint size);
343
Simon Glass95bcad42025-04-02 06:29:36 +1300344/**
345 * vidconsole_measure() - Measure the bounding box of some text
346 *
Simon Glass3c686e62025-04-02 06:29:38 +1300347 * The text can include newlines
348 *
Simon Glass95bcad42025-04-02 06:29:36 +1300349 * @dev: Device to adjust
350 * @name: Font name to use (NULL to use default)
351 * @size: Font size to use (0 to use default)
352 * @text: Text to measure
353 * @bbox: Returns bounding box of text, assuming it is positioned
354 * at 0,0
355 * @lines: If non-NULL, this must be an alist of
356 * struct vidconsole_mline inited by caller. The list is emptied
357 * and then a separate record is added for each line of text
Simon Glass5caf1252023-06-01 10:22:46 -0600358 *
Simon Glass95bcad42025-04-02 06:29:36 +1300359 * Returns: 0 on success, -ENOENT if no such font
Simon Glass5caf1252023-06-01 10:22:46 -0600360 */
361int vidconsole_measure(struct udevice *dev, const char *name, uint size,
Simon Glass95bcad42025-04-02 06:29:36 +1300362 const char *text, struct vidconsole_bbox *bbox,
363 struct alist *lines);
Simon Glass3b175ba2023-01-06 08:52:32 -0600364/**
Simon Glass8b82e592023-10-01 19:13:18 -0600365 * vidconsole_nominal() - Measure the expected width of a line of text
366 *
367 * Uses an average font width and nominal height
368 *
369 * @dev: Console device to use
370 * @name: Font name, NULL for default
371 * @size: Font size, ignored if @name is NULL
372 * @num_chars: Number of characters to use
373 * @bbox: Returns nounding box of @num_chars characters
374 * Returns: 0 if OK, -ve on error
375 */
376int vidconsole_nominal(struct udevice *dev, const char *name, uint size,
377 uint num_chars, struct vidconsole_bbox *bbox);
378
379/**
Simon Glass34b5c252023-10-01 19:13:19 -0600380 * vidconsole_entry_save() - Save any text-entry information for later use
381 *
382 * Saves text-entry context such as a list of positions for each
383 * character in the string.
384 *
385 * @dev: Console device to use
386 * @buf: Buffer to hold saved data
387 * Return: 0 if OK, -ENOMEM if out of memory
388 */
389int vidconsole_entry_save(struct udevice *dev, struct abuf *buf);
390
391/**
392 * entry_restore() - Restore text-entry information for current use
393 *
394 * Restores text-entry context such as a list of positions for each
395 * character in the string.
396 *
397 * @dev: Console device to use
398 * @buf: Buffer containing data to restore
399 * Return: 0 if OK, -ve on error
400 */
401int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf);
402
403/**
Simon Glass377f79aa2023-10-01 19:13:21 -0600404 * vidconsole_set_cursor_visible() - Show or hide the cursor
405 *
406 * Shows or hides a cursor at the current position
407 *
408 * @dev: Console device to use
409 * @visible: true to show the cursor, false to hide it
410 * @x: X position in pixels
411 * @y: Y position in pixels
412 * @index: Character position (0 = at start)
413 * Return: 0 if OK, -ve on error
414 */
415int vidconsole_set_cursor_visible(struct udevice *dev, bool visible,
416 uint x, uint y, uint index);
417
418/**
Simon Glassa73a8b82023-06-01 10:22:45 -0600419 * vidconsole_push_colour() - Temporarily change the font colour
420 *
421 * @dev: Device to adjust
422 * @fg: Foreground colour to select
423 * @bg: Background colour to select
424 * @old: Place to store the current colour, so it can be restored
425 */
426void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg,
427 enum colour_idx bg, struct vidconsole_colour *old);
428
429/**
430 * vidconsole_pop_colour() - Restore the original colour
431 *
432 * @dev: Device to adjust
433 * @old: Old colour to be restored
434 */
435void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
436
437/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700438 * vidconsole_putc_xy() - write a single character to a position
439 *
440 * @dev: Device to write to
Simon Glass52c10c52016-01-14 18:10:37 -0700441 * @x_frac: Fractional pixel X position (0=left-most pixel) which
442 * is the X position multipled by VID_FRAC_DIV.
Simon Glass84c7fb32016-01-18 19:52:17 -0700443 * @y: Pixel Y position (0=top-most pixel)
Janne Grunau5548c362024-03-16 22:50:19 +0100444 * @cp: UTF-32 code point to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100445 * Return: number of fractional pixels that the cursor should move,
Simon Glass52c10c52016-01-14 18:10:37 -0700446 * if all is OK, -EAGAIN if we ran out of space on this line, other -ve
447 * on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700448 */
Janne Grunau5548c362024-03-16 22:50:19 +0100449int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, int cp);
Simon Glass84c7fb32016-01-18 19:52:17 -0700450
451/**
452 * vidconsole_move_rows() - Move text rows from one place to another
453 *
454 * @dev: Device to adjust
455 * @rowdst: Destination text row (0=top)
456 * @rowsrc: Source start text row
457 * @count: Number of text rows to move
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100458 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700459 */
460int vidconsole_move_rows(struct udevice *dev, uint rowdst, uint rowsrc,
461 uint count);
462
463/**
464 * vidconsole_set_row() - Set the colour of a text row
465 *
466 * Every pixel contained within the text row is adjusted
467 *
468 * @dev: Device to adjust
469 * @row: Text row to adjust (0=top)
470 * @clr: Raw colour (pixel value) to write to each pixel
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100471 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700472 */
473int vidconsole_set_row(struct udevice *dev, uint row, int clr);
474
475/**
Simon Glass4446c4b2023-10-01 19:13:20 -0600476 * vidconsole_entry_start() - Set the start position of a vidconsole line
477 *
478 * Marks the current cursor position as the start of a line
479 *
480 * @dev: Device to adjust
481 */
482int vidconsole_entry_start(struct udevice *dev);
483
484/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700485 * vidconsole_put_char() - Output a character to the current console position
486 *
487 * Outputs a character to the console and advances the cursor. This function
488 * handles wrapping to new lines and scrolling the console. Special
489 * characters are handled also: \n, \r, \b and \t.
490 *
491 * The device always starts with the cursor at position 0,0 (top left). It
492 * can be adjusted manually using vidconsole_position_cursor().
493 *
494 * @dev: Device to adjust
495 * @ch: Character to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100496 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700497 */
498int vidconsole_put_char(struct udevice *dev, char ch);
499
500/**
Marek Vasuta89f9cb2019-05-17 20:22:31 +0200501 * vidconsole_put_string() - Output a string to the current console position
502 *
503 * Outputs a string to the console and advances the cursor. This function
504 * handles wrapping to new lines and scrolling the console. Special
505 * characters are handled also: \n, \r, \b and \t.
506 *
507 * The device always starts with the cursor at position 0,0 (top left). It
508 * can be adjusted manually using vidconsole_position_cursor().
509 *
510 * @dev: Device to adjust
511 * @str: String to write
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100512 * Return: 0 if OK, -ve on error
Marek Vasuta89f9cb2019-05-17 20:22:31 +0200513 */
514int vidconsole_put_string(struct udevice *dev, const char *str);
515
516/**
Simon Glass84c7fb32016-01-18 19:52:17 -0700517 * vidconsole_position_cursor() - Move the text cursor
518 *
519 * @dev: Device to adjust
520 * @col: New cursor text column
521 * @row: New cursor text row
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100522 * Return: 0 if OK, -ve on error
Simon Glass84c7fb32016-01-18 19:52:17 -0700523 */
524void vidconsole_position_cursor(struct udevice *dev, unsigned col,
525 unsigned row);
526
Simon Glassd622c5b2022-10-06 08:36:04 -0600527/**
Simon Glass90679c62023-03-10 12:47:21 -0800528 * vidconsole_clear_and_reset() - Clear the console and reset the cursor
529 *
530 * The cursor is placed at the start of the console
531 *
532 * @dev: vidconsole device to adjust
533 */
534int vidconsole_clear_and_reset(struct udevice *dev);
535
536/**
Simon Glassd622c5b2022-10-06 08:36:04 -0600537 * vidconsole_set_cursor_pos() - set cursor position
538 *
539 * The cursor is set to the new position and the start-of-line information is
540 * updated to the same position, so that a newline will return to @x
541 *
542 * @dev: video console device to update
543 * @x: x position from left in pixels
544 * @y: y position from top in pixels
545 */
546void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y);
547
Simon Glass981f00b2022-10-06 08:36:14 -0600548/**
549 * vidconsole_list_fonts() - List the available fonts
550 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600551 * @dev: vidconsole device to check
Simon Glass981f00b2022-10-06 08:36:14 -0600552 *
Simon Glass3b175ba2023-01-06 08:52:32 -0600553 * This shows a list of fonts known by this vidconsole. The list is displayed on
554 * the console (not necessarily @dev but probably)
Simon Glass981f00b2022-10-06 08:36:14 -0600555 */
Simon Glass3b175ba2023-01-06 08:52:32 -0600556void vidconsole_list_fonts(struct udevice *dev);
Simon Glass981f00b2022-10-06 08:36:14 -0600557
Simon Glass9e972c32022-10-06 08:36:16 -0600558/**
Simon Glass3b175ba2023-01-06 08:52:32 -0600559 * vidconsole_get_font_size() - get the current font name and size
Simon Glass9e972c32022-10-06 08:36:16 -0600560 *
561 * @dev: vidconsole device
562 * @sizep: Place to put the font size (nominal height in pixels)
Dzmitry Sankouski86c6a532023-03-07 13:21:15 +0300563 * @name: pointer to font name, a placeholder for result
564 * Return: 0 if OK, -ENOSYS if not implemented in driver
Simon Glass9e972c32022-10-06 08:36:16 -0600565 */
Dzmitry Sankouski86c6a532023-03-07 13:21:15 +0300566int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep);
Simon Glass9e972c32022-10-06 08:36:16 -0600567
Heinrich Schuchardt290e1d82018-02-08 21:47:11 +0100568#endif