xref: /openbmc/qemu/include/ui/console.h (revision 5f88dd43)
1 #ifndef CONSOLE_H
2 #define CONSOLE_H
3 
4 #include "ui/qemu-pixman.h"
5 #include "qom/object.h"
6 #include "qemu/notify.h"
7 #include "qapi/qapi-types-ui.h"
8 #include "ui/input.h"
9 
10 #ifdef CONFIG_OPENGL
11 # include <epoxy/gl.h>
12 # include "ui/shader.h"
13 #endif
14 
15 #define TYPE_QEMU_CONSOLE "qemu-console"
16 OBJECT_DECLARE_TYPE(QemuConsole, QemuConsoleClass, QEMU_CONSOLE)
17 
18 #define TYPE_QEMU_GRAPHIC_CONSOLE "qemu-graphic-console"
19 OBJECT_DECLARE_SIMPLE_TYPE(QemuGraphicConsole, QEMU_GRAPHIC_CONSOLE)
20 
21 #define TYPE_QEMU_TEXT_CONSOLE "qemu-text-console"
22 OBJECT_DECLARE_SIMPLE_TYPE(QemuTextConsole, QEMU_TEXT_CONSOLE)
23 
24 #define TYPE_QEMU_FIXED_TEXT_CONSOLE "qemu-fixed-text-console"
25 OBJECT_DECLARE_SIMPLE_TYPE(QemuFixedTextConsole, QEMU_FIXED_TEXT_CONSOLE)
26 
27 #define QEMU_IS_GRAPHIC_CONSOLE(c) \
28     object_dynamic_cast(OBJECT(c), TYPE_QEMU_GRAPHIC_CONSOLE)
29 
30 #define QEMU_IS_TEXT_CONSOLE(c) \
31     object_dynamic_cast(OBJECT(c), TYPE_QEMU_TEXT_CONSOLE)
32 
33 #define QEMU_IS_FIXED_TEXT_CONSOLE(c) \
34     object_dynamic_cast(OBJECT(c), TYPE_QEMU_FIXED_TEXT_CONSOLE)
35 
36 /* keyboard/mouse support */
37 
38 #define MOUSE_EVENT_LBUTTON 0x01
39 #define MOUSE_EVENT_RBUTTON 0x02
40 #define MOUSE_EVENT_MBUTTON 0x04
41 #define MOUSE_EVENT_WHEELUP 0x08
42 #define MOUSE_EVENT_WHEELDN 0x10
43 
44 /* identical to the ps/2 keyboard bits */
45 #define QEMU_SCROLL_LOCK_LED (1 << 0)
46 #define QEMU_NUM_LOCK_LED    (1 << 1)
47 #define QEMU_CAPS_LOCK_LED   (1 << 2)
48 
49 /* in ms */
50 #define GUI_REFRESH_INTERVAL_DEFAULT    30
51 #define GUI_REFRESH_INTERVAL_IDLE     3000
52 
53 /* Color number is match to standard vga palette */
54 enum qemu_color_names {
55     QEMU_COLOR_BLACK   = 0,
56     QEMU_COLOR_BLUE    = 1,
57     QEMU_COLOR_GREEN   = 2,
58     QEMU_COLOR_CYAN    = 3,
59     QEMU_COLOR_RED     = 4,
60     QEMU_COLOR_MAGENTA = 5,
61     QEMU_COLOR_YELLOW  = 6,
62     QEMU_COLOR_WHITE   = 7
63 };
64 /* Convert to curses char attributes */
65 #define ATTR2CHTYPE(c, fg, bg, bold) \
66     ((bold) << 21 | (bg) << 11 | (fg) << 8 | (c))
67 
68 typedef void QEMUPutKBDEvent(void *opaque, int keycode);
69 typedef void QEMUPutLEDEvent(void *opaque, int ledstate);
70 typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
71 
72 typedef struct QEMUPutMouseEntry QEMUPutMouseEntry;
73 typedef struct QEMUPutKbdEntry QEMUPutKbdEntry;
74 typedef struct QEMUPutLEDEntry QEMUPutLEDEntry;
75 
76 QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
77                                             void *opaque);
78 QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
79                                                 void *opaque, int absolute,
80                                                 const char *name);
81 void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry);
82 void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry);
83 
84 QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func, void *opaque);
85 void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry);
86 
87 void kbd_put_ledstate(int ledstate);
88 
89 bool qemu_mouse_set(int index, Error **errp);
90 
91 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
92    constants) */
93 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
94 #define QEMU_KEY_TAB        0x0009
95 #define QEMU_KEY_BACKSPACE  0x007f
96 #define QEMU_KEY_UP         QEMU_KEY_ESC1('A')
97 #define QEMU_KEY_DOWN       QEMU_KEY_ESC1('B')
98 #define QEMU_KEY_RIGHT      QEMU_KEY_ESC1('C')
99 #define QEMU_KEY_LEFT       QEMU_KEY_ESC1('D')
100 #define QEMU_KEY_HOME       QEMU_KEY_ESC1(1)
101 #define QEMU_KEY_END        QEMU_KEY_ESC1(4)
102 #define QEMU_KEY_PAGEUP     QEMU_KEY_ESC1(5)
103 #define QEMU_KEY_PAGEDOWN   QEMU_KEY_ESC1(6)
104 #define QEMU_KEY_DELETE     QEMU_KEY_ESC1(3)
105 
106 #define QEMU_KEY_CTRL_UP         0xe400
107 #define QEMU_KEY_CTRL_DOWN       0xe401
108 #define QEMU_KEY_CTRL_LEFT       0xe402
109 #define QEMU_KEY_CTRL_RIGHT      0xe403
110 #define QEMU_KEY_CTRL_HOME       0xe404
111 #define QEMU_KEY_CTRL_END        0xe405
112 #define QEMU_KEY_CTRL_PAGEUP     0xe406
113 #define QEMU_KEY_CTRL_PAGEDOWN   0xe407
114 
115 void kbd_put_keysym_console(QemuTextConsole *s, int keysym);
116 bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl);
117 void kbd_put_string_console(QemuTextConsole *s, const char *str, int len);
118 void kbd_put_keysym(int keysym);
119 
120 /* Touch devices */
121 typedef struct touch_slot {
122     int x;
123     int y;
124     int tracking_id;
125 } touch_slot;
126 
127 void console_handle_touch_event(QemuConsole *con,
128                                 struct touch_slot touch_slots[INPUT_EVENT_SLOTS_MAX],
129                                 uint64_t num_slot,
130                                 int width, int height,
131                                 double x, double y,
132                                 InputMultiTouchType type,
133                                 Error **errp);
134 /* consoles */
135 
136 struct QemuConsoleClass {
137     ObjectClass parent_class;
138 };
139 
140 #define QEMU_ALLOCATED_FLAG     0x01
141 #define QEMU_PLACEHOLDER_FLAG   0x02
142 
143 typedef struct ScanoutTexture {
144     uint32_t backing_id;
145     bool backing_y_0_top;
146     uint32_t backing_width;
147     uint32_t backing_height;
148     uint32_t x;
149     uint32_t y;
150     uint32_t width;
151     uint32_t height;
152     void *d3d_tex2d;
153 } ScanoutTexture;
154 
155 typedef struct DisplaySurface {
156     pixman_format_code_t format;
157     pixman_image_t *image;
158     uint8_t flags;
159 #ifdef CONFIG_OPENGL
160     GLenum glformat;
161     GLenum gltype;
162     GLuint texture;
163 #endif
164 #ifdef WIN32
165     HANDLE handle;
166     uint32_t handle_offset;
167 #endif
168 } DisplaySurface;
169 
170 typedef struct QemuUIInfo {
171     /* physical dimension */
172     uint16_t width_mm;
173     uint16_t height_mm;
174     /* geometry */
175     int       xoff;
176     int       yoff;
177     uint32_t  width;
178     uint32_t  height;
179     uint32_t  refresh_rate;
180 } QemuUIInfo;
181 
182 /* cursor data format is 32bit RGBA */
183 typedef struct QEMUCursor {
184     uint16_t            width, height;
185     int                 hot_x, hot_y;
186     int                 refcount;
187     uint32_t            data[];
188 } QEMUCursor;
189 
190 QEMUCursor *cursor_alloc(uint16_t width, uint16_t height);
191 QEMUCursor *cursor_ref(QEMUCursor *c);
192 void cursor_unref(QEMUCursor *c);
193 QEMUCursor *cursor_builtin_hidden(void);
194 QEMUCursor *cursor_builtin_left_ptr(void);
195 void cursor_print_ascii_art(QEMUCursor *c, const char *prefix);
196 int cursor_get_mono_bpl(QEMUCursor *c);
197 void cursor_set_mono(QEMUCursor *c,
198                      uint32_t foreground, uint32_t background, uint8_t *image,
199                      int transparent, uint8_t *mask);
200 void cursor_get_mono_image(QEMUCursor *c, int foreground, uint8_t *mask);
201 void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask);
202 
203 typedef void *QEMUGLContext;
204 typedef struct QEMUGLParams QEMUGLParams;
205 
206 struct QEMUGLParams {
207     int major_ver;
208     int minor_ver;
209 };
210 
211 typedef struct QemuDmaBuf {
212     int       fd;
213     uint32_t  width;
214     uint32_t  height;
215     uint32_t  stride;
216     uint32_t  fourcc;
217     uint64_t  modifier;
218     uint32_t  texture;
219     uint32_t  x;
220     uint32_t  y;
221     uint32_t  backing_width;
222     uint32_t  backing_height;
223     bool      y0_top;
224     void      *sync;
225     int       fence_fd;
226     bool      allow_fences;
227     bool      draw_submitted;
228 } QemuDmaBuf;
229 
230 enum display_scanout {
231     SCANOUT_NONE,
232     SCANOUT_SURFACE,
233     SCANOUT_TEXTURE,
234     SCANOUT_DMABUF,
235 };
236 
237 typedef struct DisplayScanout {
238     enum display_scanout kind;
239     union {
240         /* DisplaySurface *surface; is kept in QemuConsole */
241         ScanoutTexture texture;
242         QemuDmaBuf *dmabuf;
243     };
244 } DisplayScanout;
245 
246 typedef struct DisplayState DisplayState;
247 typedef struct DisplayGLCtx DisplayGLCtx;
248 
249 typedef struct DisplayChangeListenerOps {
250     const char *dpy_name;
251 
252     /* optional */
253     void (*dpy_refresh)(DisplayChangeListener *dcl);
254 
255     /* optional */
256     void (*dpy_gfx_update)(DisplayChangeListener *dcl,
257                            int x, int y, int w, int h);
258     /* optional */
259     void (*dpy_gfx_switch)(DisplayChangeListener *dcl,
260                            struct DisplaySurface *new_surface);
261     /* optional */
262     bool (*dpy_gfx_check_format)(DisplayChangeListener *dcl,
263                                  pixman_format_code_t format);
264 
265     /* optional */
266     void (*dpy_text_cursor)(DisplayChangeListener *dcl,
267                             int x, int y);
268     /* optional */
269     void (*dpy_text_resize)(DisplayChangeListener *dcl,
270                             int w, int h);
271     /* optional */
272     void (*dpy_text_update)(DisplayChangeListener *dcl,
273                             int x, int y, int w, int h);
274 
275     /* optional */
276     void (*dpy_mouse_set)(DisplayChangeListener *dcl,
277                           int x, int y, int on);
278     /* optional */
279     void (*dpy_cursor_define)(DisplayChangeListener *dcl,
280                               QEMUCursor *cursor);
281 
282     /* required if GL */
283     void (*dpy_gl_scanout_disable)(DisplayChangeListener *dcl);
284     /* required if GL */
285     void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl,
286                                    uint32_t backing_id,
287                                    bool backing_y_0_top,
288                                    uint32_t backing_width,
289                                    uint32_t backing_height,
290                                    uint32_t x, uint32_t y,
291                                    uint32_t w, uint32_t h,
292                                    void *d3d_tex2d);
293     /* optional (default to true if has dpy_gl_scanout_dmabuf) */
294     bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl);
295     /* optional */
296     void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl,
297                                   QemuDmaBuf *dmabuf);
298     /* optional */
299     void (*dpy_gl_cursor_dmabuf)(DisplayChangeListener *dcl,
300                                  QemuDmaBuf *dmabuf, bool have_hot,
301                                  uint32_t hot_x, uint32_t hot_y);
302     /* optional */
303     void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl,
304                                    uint32_t pos_x, uint32_t pos_y);
305     /* optional */
306     void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl,
307                                   QemuDmaBuf *dmabuf);
308     /* required if GL */
309     void (*dpy_gl_update)(DisplayChangeListener *dcl,
310                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
311 
312 } DisplayChangeListenerOps;
313 
314 struct DisplayChangeListener {
315     uint64_t update_interval;
316     const DisplayChangeListenerOps *ops;
317     DisplayState *ds;
318     QemuConsole *con;
319 
320     QLIST_ENTRY(DisplayChangeListener) next;
321 };
322 
323 typedef struct DisplayGLCtxOps {
324     bool (*dpy_gl_ctx_is_compatible_dcl)(DisplayGLCtx *dgc,
325                                          DisplayChangeListener *dcl);
326     QEMUGLContext (*dpy_gl_ctx_create)(DisplayGLCtx *dgc,
327                                        QEMUGLParams *params);
328     void (*dpy_gl_ctx_destroy)(DisplayGLCtx *dgc,
329                                QEMUGLContext ctx);
330     int (*dpy_gl_ctx_make_current)(DisplayGLCtx *dgc,
331                                    QEMUGLContext ctx);
332     void (*dpy_gl_ctx_create_texture)(DisplayGLCtx *dgc,
333                                       DisplaySurface *surface);
334     void (*dpy_gl_ctx_destroy_texture)(DisplayGLCtx *dgc,
335                                       DisplaySurface *surface);
336     void (*dpy_gl_ctx_update_texture)(DisplayGLCtx *dgc,
337                                       DisplaySurface *surface,
338                                       int x, int y, int w, int h);
339 } DisplayGLCtxOps;
340 
341 struct DisplayGLCtx {
342     const DisplayGLCtxOps *ops;
343 #ifdef CONFIG_OPENGL
344     QemuGLShader *gls; /* optional shared shader */
345 #endif
346 };
347 
348 DisplayState *init_displaystate(void);
349 DisplaySurface *qemu_create_displaysurface_from(int width, int height,
350                                                 pixman_format_code_t format,
351                                                 int linesize, uint8_t *data);
352 DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image);
353 DisplaySurface *qemu_create_placeholder_surface(int w, int h,
354                                                 const char *msg);
355 #ifdef WIN32
356 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface,
357                                           HANDLE h, uint32_t offset);
358 #endif
359 PixelFormat qemu_default_pixelformat(int bpp);
360 
361 DisplaySurface *qemu_create_displaysurface(int width, int height);
362 void qemu_free_displaysurface(DisplaySurface *surface);
363 
364 static inline int is_buffer_shared(DisplaySurface *surface)
365 {
366     return !(surface->flags & QEMU_ALLOCATED_FLAG);
367 }
368 
369 static inline int is_placeholder(DisplaySurface *surface)
370 {
371     return surface->flags & QEMU_PLACEHOLDER_FLAG;
372 }
373 
374 void register_displaychangelistener(DisplayChangeListener *dcl);
375 void update_displaychangelistener(DisplayChangeListener *dcl,
376                                   uint64_t interval);
377 void unregister_displaychangelistener(DisplayChangeListener *dcl);
378 
379 bool dpy_ui_info_supported(QemuConsole *con);
380 const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con);
381 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay);
382 
383 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h);
384 void dpy_gfx_update_full(QemuConsole *con);
385 void dpy_gfx_replace_surface(QemuConsole *con,
386                              DisplaySurface *surface);
387 void dpy_text_cursor(QemuConsole *con, int x, int y);
388 void dpy_text_update(QemuConsole *con, int x, int y, int w, int h);
389 void dpy_text_resize(QemuConsole *con, int w, int h);
390 void dpy_mouse_set(QemuConsole *con, int x, int y, int on);
391 void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor);
392 bool dpy_cursor_define_supported(QemuConsole *con);
393 bool dpy_gfx_check_format(QemuConsole *con,
394                           pixman_format_code_t format);
395 
396 void dpy_gl_scanout_disable(QemuConsole *con);
397 void dpy_gl_scanout_texture(QemuConsole *con,
398                             uint32_t backing_id, bool backing_y_0_top,
399                             uint32_t backing_width, uint32_t backing_height,
400                             uint32_t x, uint32_t y, uint32_t w, uint32_t h,
401                             void *d3d_tex2d);
402 void dpy_gl_scanout_dmabuf(QemuConsole *con,
403                            QemuDmaBuf *dmabuf);
404 void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
405                           bool have_hot, uint32_t hot_x, uint32_t hot_y);
406 void dpy_gl_cursor_position(QemuConsole *con,
407                             uint32_t pos_x, uint32_t pos_y);
408 void dpy_gl_release_dmabuf(QemuConsole *con,
409                            QemuDmaBuf *dmabuf);
410 void dpy_gl_update(QemuConsole *con,
411                    uint32_t x, uint32_t y, uint32_t w, uint32_t h);
412 
413 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
414                                 QEMUGLParams *params);
415 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx);
416 int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx);
417 
418 bool console_has_gl(QemuConsole *con);
419 
420 static inline int surface_stride(DisplaySurface *s)
421 {
422     return pixman_image_get_stride(s->image);
423 }
424 
425 static inline void *surface_data(DisplaySurface *s)
426 {
427     return pixman_image_get_data(s->image);
428 }
429 
430 static inline int surface_width(DisplaySurface *s)
431 {
432     return pixman_image_get_width(s->image);
433 }
434 
435 static inline int surface_height(DisplaySurface *s)
436 {
437     return pixman_image_get_height(s->image);
438 }
439 
440 static inline int surface_bits_per_pixel(DisplaySurface *s)
441 {
442     int bits = PIXMAN_FORMAT_BPP(s->format);
443     return bits;
444 }
445 
446 static inline int surface_bytes_per_pixel(DisplaySurface *s)
447 {
448     int bits = PIXMAN_FORMAT_BPP(s->format);
449     return DIV_ROUND_UP(bits, 8);
450 }
451 
452 static inline pixman_format_code_t surface_format(DisplaySurface *s)
453 {
454     return s->format;
455 }
456 
457 typedef uint32_t console_ch_t;
458 
459 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
460 {
461     *dest = ch;
462 }
463 
464 enum {
465     GRAPHIC_FLAGS_NONE     = 0,
466     /* require a console/display with GL callbacks */
467     GRAPHIC_FLAGS_GL       = 1 << 0,
468     /* require a console/display with DMABUF import */
469     GRAPHIC_FLAGS_DMABUF   = 1 << 1,
470 };
471 
472 typedef struct GraphicHwOps {
473     int (*get_flags)(void *opaque); /* optional, default 0 */
474     void (*invalidate)(void *opaque);
475     void (*gfx_update)(void *opaque);
476     bool gfx_update_async; /* if true, calls graphic_hw_update_done() */
477     void (*text_update)(void *opaque, console_ch_t *text);
478     void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info);
479     void (*gl_block)(void *opaque, bool block);
480 } GraphicHwOps;
481 
482 QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
483                                   const GraphicHwOps *ops,
484                                   void *opaque);
485 void graphic_console_set_hwops(QemuConsole *con,
486                                const GraphicHwOps *hw_ops,
487                                void *opaque);
488 void graphic_console_close(QemuConsole *con);
489 
490 void graphic_hw_update(QemuConsole *con);
491 void graphic_hw_update_done(QemuConsole *con);
492 void graphic_hw_invalidate(QemuConsole *con);
493 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
494 void graphic_hw_gl_block(QemuConsole *con, bool block);
495 
496 void qemu_console_early_init(void);
497 
498 void qemu_console_set_display_gl_ctx(QemuConsole *con, DisplayGLCtx *ctx);
499 
500 QemuConsole *qemu_console_lookup_by_index(unsigned int index);
501 QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head);
502 QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,
503                                                 uint32_t head, Error **errp);
504 QEMUCursor *qemu_console_get_cursor(QemuConsole *con);
505 bool qemu_console_is_visible(QemuConsole *con);
506 bool qemu_console_is_graphic(QemuConsole *con);
507 bool qemu_console_is_fixedsize(QemuConsole *con);
508 bool qemu_console_is_gl_blocked(QemuConsole *con);
509 bool qemu_console_is_multihead(DeviceState *dev);
510 char *qemu_console_get_label(QemuConsole *con);
511 int qemu_console_get_index(QemuConsole *con);
512 uint32_t qemu_console_get_head(QemuConsole *con);
513 int qemu_console_get_width(QemuConsole *con, int fallback);
514 int qemu_console_get_height(QemuConsole *con, int fallback);
515 /* Return the low-level window id for the console */
516 int qemu_console_get_window_id(QemuConsole *con);
517 /* Set the low-level window id for the console */
518 void qemu_console_set_window_id(QemuConsole *con, int window_id);
519 
520 void console_select(unsigned int index);
521 void qemu_console_resize(QemuConsole *con, int width, int height);
522 DisplaySurface *qemu_console_surface(QemuConsole *con);
523 void coroutine_fn qemu_console_co_wait_update(QemuConsole *con);
524 int qemu_invalidate_text_consoles(void);
525 
526 /* console-gl.c */
527 #ifdef CONFIG_OPENGL
528 bool console_gl_check_format(DisplayChangeListener *dcl,
529                              pixman_format_code_t format);
530 void surface_gl_create_texture(QemuGLShader *gls,
531                                DisplaySurface *surface);
532 void surface_gl_update_texture(QemuGLShader *gls,
533                                DisplaySurface *surface,
534                                int x, int y, int w, int h);
535 void surface_gl_render_texture(QemuGLShader *gls,
536                                DisplaySurface *surface);
537 void surface_gl_destroy_texture(QemuGLShader *gls,
538                                DisplaySurface *surface);
539 void surface_gl_setup_viewport(QemuGLShader *gls,
540                                DisplaySurface *surface,
541                                int ww, int wh);
542 #endif
543 
544 typedef struct QemuDisplay QemuDisplay;
545 
546 struct QemuDisplay {
547     DisplayType type;
548     void (*early_init)(DisplayOptions *opts);
549     void (*init)(DisplayState *ds, DisplayOptions *opts);
550 };
551 
552 void qemu_display_register(QemuDisplay *ui);
553 bool qemu_display_find_default(DisplayOptions *opts);
554 void qemu_display_early_init(DisplayOptions *opts);
555 void qemu_display_init(DisplayState *ds, DisplayOptions *opts);
556 void qemu_display_help(void);
557 
558 /* vnc.c */
559 void vnc_display_init(const char *id, Error **errp);
560 void vnc_display_open(const char *id, Error **errp);
561 void vnc_display_add_client(const char *id, int csock, bool skipauth);
562 int vnc_display_password(const char *id, const char *password);
563 int vnc_display_pw_expire(const char *id, time_t expires);
564 void vnc_parse(const char *str);
565 int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
566 bool vnc_display_reload_certs(const char *id,  Error **errp);
567 bool vnc_display_update(DisplayUpdateOptionsVNC *arg, Error **errp);
568 
569 /* input.c */
570 int index_from_key(const char *key, size_t key_length);
571 
572 #ifdef CONFIG_LINUX
573 /* udmabuf.c */
574 int udmabuf_fd(void);
575 #endif
576 
577 /* util.c */
578 bool qemu_console_fill_device_address(QemuConsole *con,
579                                       char *device_address,
580                                       size_t size,
581                                       Error **errp);
582 
583 #endif
584