xref: /qemu/include/ui/console.h (revision f5360a0d)
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 
119 /* Touch devices */
120 typedef struct touch_slot {
121     int x;
122     int y;
123     int tracking_id;
124 } touch_slot;
125 
126 void console_handle_touch_event(QemuConsole *con,
127                                 struct touch_slot touch_slots[INPUT_EVENT_SLOTS_MAX],
128                                 uint64_t num_slot,
129                                 int width, int height,
130                                 double x, double y,
131                                 InputMultiTouchType type,
132                                 Error **errp);
133 /* consoles */
134 
135 struct QemuConsoleClass {
136     ObjectClass parent_class;
137 };
138 
139 #define QEMU_ALLOCATED_FLAG     0x01
140 #define QEMU_PLACEHOLDER_FLAG   0x02
141 
142 typedef struct ScanoutTexture {
143     uint32_t backing_id;
144     bool backing_y_0_top;
145     uint32_t backing_width;
146     uint32_t backing_height;
147     uint32_t x;
148     uint32_t y;
149     uint32_t width;
150     uint32_t height;
151     void *d3d_tex2d;
152 } ScanoutTexture;
153 
154 typedef struct DisplaySurface {
155     pixman_format_code_t format;
156     pixman_image_t *image;
157     uint8_t flags;
158 #ifdef CONFIG_OPENGL
159     GLenum glformat;
160     GLenum gltype;
161     GLuint texture;
162 #endif
163 #ifdef WIN32
164     HANDLE handle;
165     uint32_t handle_offset;
166 #endif
167 } DisplaySurface;
168 
169 typedef struct QemuUIInfo {
170     /* physical dimension */
171     uint16_t width_mm;
172     uint16_t height_mm;
173     /* geometry */
174     int       xoff;
175     int       yoff;
176     uint32_t  width;
177     uint32_t  height;
178     uint32_t  refresh_rate;
179 } QemuUIInfo;
180 
181 /* cursor data format is 32bit RGBA */
182 typedef struct QEMUCursor {
183     uint16_t            width, height;
184     int                 hot_x, hot_y;
185     int                 refcount;
186     uint32_t            data[];
187 } QEMUCursor;
188 
189 QEMUCursor *cursor_alloc(uint16_t width, uint16_t height);
190 QEMUCursor *cursor_ref(QEMUCursor *c);
191 void cursor_unref(QEMUCursor *c);
192 QEMUCursor *cursor_builtin_hidden(void);
193 QEMUCursor *cursor_builtin_left_ptr(void);
194 void cursor_print_ascii_art(QEMUCursor *c, const char *prefix);
195 int cursor_get_mono_bpl(QEMUCursor *c);
196 void cursor_set_mono(QEMUCursor *c,
197                      uint32_t foreground, uint32_t background, uint8_t *image,
198                      int transparent, uint8_t *mask);
199 void cursor_get_mono_image(QEMUCursor *c, int foreground, uint8_t *mask);
200 void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask);
201 
202 typedef void *QEMUGLContext;
203 typedef struct QEMUGLParams QEMUGLParams;
204 
205 struct QEMUGLParams {
206     int major_ver;
207     int minor_ver;
208 };
209 
210 typedef struct QemuDmaBuf {
211     int       fd;
212     uint32_t  width;
213     uint32_t  height;
214     uint32_t  stride;
215     uint32_t  fourcc;
216     uint64_t  modifier;
217     uint32_t  texture;
218     uint32_t  x;
219     uint32_t  y;
220     uint32_t  backing_width;
221     uint32_t  backing_height;
222     bool      y0_top;
223     void      *sync;
224     int       fence_fd;
225     bool      allow_fences;
226     bool      draw_submitted;
227 } QemuDmaBuf;
228 
229 enum display_scanout {
230     SCANOUT_NONE,
231     SCANOUT_SURFACE,
232     SCANOUT_TEXTURE,
233     SCANOUT_DMABUF,
234 };
235 
236 typedef struct DisplayScanout {
237     enum display_scanout kind;
238     union {
239         /* DisplaySurface *surface; is kept in QemuConsole */
240         ScanoutTexture texture;
241         QemuDmaBuf *dmabuf;
242     };
243 } DisplayScanout;
244 
245 typedef struct DisplayState DisplayState;
246 typedef struct DisplayGLCtx DisplayGLCtx;
247 
248 typedef struct DisplayChangeListenerOps {
249     const char *dpy_name;
250 
251     /* optional */
252     void (*dpy_refresh)(DisplayChangeListener *dcl);
253 
254     /* optional */
255     void (*dpy_gfx_update)(DisplayChangeListener *dcl,
256                            int x, int y, int w, int h);
257     /* optional */
258     void (*dpy_gfx_switch)(DisplayChangeListener *dcl,
259                            struct DisplaySurface *new_surface);
260     /* optional */
261     bool (*dpy_gfx_check_format)(DisplayChangeListener *dcl,
262                                  pixman_format_code_t format);
263 
264     /* optional */
265     void (*dpy_text_cursor)(DisplayChangeListener *dcl,
266                             int x, int y);
267     /* optional */
268     void (*dpy_text_resize)(DisplayChangeListener *dcl,
269                             int w, int h);
270     /* optional */
271     void (*dpy_text_update)(DisplayChangeListener *dcl,
272                             int x, int y, int w, int h);
273 
274     /* optional */
275     void (*dpy_mouse_set)(DisplayChangeListener *dcl,
276                           int x, int y, int on);
277     /* optional */
278     void (*dpy_cursor_define)(DisplayChangeListener *dcl,
279                               QEMUCursor *cursor);
280 
281     /* required if GL */
282     void (*dpy_gl_scanout_disable)(DisplayChangeListener *dcl);
283     /* required if GL */
284     void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl,
285                                    uint32_t backing_id,
286                                    bool backing_y_0_top,
287                                    uint32_t backing_width,
288                                    uint32_t backing_height,
289                                    uint32_t x, uint32_t y,
290                                    uint32_t w, uint32_t h,
291                                    void *d3d_tex2d);
292     /* optional (default to true if has dpy_gl_scanout_dmabuf) */
293     bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl);
294     /* optional */
295     void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl,
296                                   QemuDmaBuf *dmabuf);
297     /* optional */
298     void (*dpy_gl_cursor_dmabuf)(DisplayChangeListener *dcl,
299                                  QemuDmaBuf *dmabuf, bool have_hot,
300                                  uint32_t hot_x, uint32_t hot_y);
301     /* optional */
302     void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl,
303                                    uint32_t pos_x, uint32_t pos_y);
304     /* optional */
305     void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl,
306                                   QemuDmaBuf *dmabuf);
307     /* required if GL */
308     void (*dpy_gl_update)(DisplayChangeListener *dcl,
309                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
310 
311 } DisplayChangeListenerOps;
312 
313 struct DisplayChangeListener {
314     uint64_t update_interval;
315     const DisplayChangeListenerOps *ops;
316     DisplayState *ds;
317     QemuConsole *con;
318 
319     QLIST_ENTRY(DisplayChangeListener) next;
320 };
321 
322 typedef struct DisplayGLCtxOps {
323     bool (*dpy_gl_ctx_is_compatible_dcl)(DisplayGLCtx *dgc,
324                                          DisplayChangeListener *dcl);
325     QEMUGLContext (*dpy_gl_ctx_create)(DisplayGLCtx *dgc,
326                                        QEMUGLParams *params);
327     void (*dpy_gl_ctx_destroy)(DisplayGLCtx *dgc,
328                                QEMUGLContext ctx);
329     int (*dpy_gl_ctx_make_current)(DisplayGLCtx *dgc,
330                                    QEMUGLContext ctx);
331     void (*dpy_gl_ctx_create_texture)(DisplayGLCtx *dgc,
332                                       DisplaySurface *surface);
333     void (*dpy_gl_ctx_destroy_texture)(DisplayGLCtx *dgc,
334                                       DisplaySurface *surface);
335     void (*dpy_gl_ctx_update_texture)(DisplayGLCtx *dgc,
336                                       DisplaySurface *surface,
337                                       int x, int y, int w, int h);
338 } DisplayGLCtxOps;
339 
340 struct DisplayGLCtx {
341     const DisplayGLCtxOps *ops;
342 #ifdef CONFIG_OPENGL
343     QemuGLShader *gls; /* optional shared shader */
344 #endif
345 };
346 
347 DisplayState *init_displaystate(void);
348 DisplaySurface *qemu_create_displaysurface_from(int width, int height,
349                                                 pixman_format_code_t format,
350                                                 int linesize, uint8_t *data);
351 DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image);
352 DisplaySurface *qemu_create_placeholder_surface(int w, int h,
353                                                 const char *msg);
354 #ifdef WIN32
355 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface,
356                                           HANDLE h, uint32_t offset);
357 #endif
358 PixelFormat qemu_default_pixelformat(int bpp);
359 
360 DisplaySurface *qemu_create_displaysurface(int width, int height);
361 void qemu_free_displaysurface(DisplaySurface *surface);
362 
363 static inline int is_buffer_shared(DisplaySurface *surface)
364 {
365     return !(surface->flags & QEMU_ALLOCATED_FLAG);
366 }
367 
368 static inline int is_placeholder(DisplaySurface *surface)
369 {
370     return surface->flags & QEMU_PLACEHOLDER_FLAG;
371 }
372 
373 void register_displaychangelistener(DisplayChangeListener *dcl);
374 void update_displaychangelistener(DisplayChangeListener *dcl,
375                                   uint64_t interval);
376 void unregister_displaychangelistener(DisplayChangeListener *dcl);
377 
378 bool dpy_ui_info_supported(QemuConsole *con);
379 const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con);
380 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay);
381 
382 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h);
383 void dpy_gfx_update_full(QemuConsole *con);
384 void dpy_gfx_replace_surface(QemuConsole *con,
385                              DisplaySurface *surface);
386 void dpy_text_cursor(QemuConsole *con, int x, int y);
387 void dpy_text_update(QemuConsole *con, int x, int y, int w, int h);
388 void dpy_text_resize(QemuConsole *con, int w, int h);
389 void dpy_mouse_set(QemuConsole *con, int x, int y, int on);
390 void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor);
391 bool dpy_cursor_define_supported(QemuConsole *con);
392 bool dpy_gfx_check_format(QemuConsole *con,
393                           pixman_format_code_t format);
394 
395 void dpy_gl_scanout_disable(QemuConsole *con);
396 void dpy_gl_scanout_texture(QemuConsole *con,
397                             uint32_t backing_id, bool backing_y_0_top,
398                             uint32_t backing_width, uint32_t backing_height,
399                             uint32_t x, uint32_t y, uint32_t w, uint32_t h,
400                             void *d3d_tex2d);
401 void dpy_gl_scanout_dmabuf(QemuConsole *con,
402                            QemuDmaBuf *dmabuf);
403 void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
404                           bool have_hot, uint32_t hot_x, uint32_t hot_y);
405 void dpy_gl_cursor_position(QemuConsole *con,
406                             uint32_t pos_x, uint32_t pos_y);
407 void dpy_gl_release_dmabuf(QemuConsole *con,
408                            QemuDmaBuf *dmabuf);
409 void dpy_gl_update(QemuConsole *con,
410                    uint32_t x, uint32_t y, uint32_t w, uint32_t h);
411 
412 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
413                                 QEMUGLParams *params);
414 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx);
415 int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx);
416 
417 bool console_has_gl(QemuConsole *con);
418 
419 static inline int surface_stride(DisplaySurface *s)
420 {
421     return pixman_image_get_stride(s->image);
422 }
423 
424 static inline void *surface_data(DisplaySurface *s)
425 {
426     return pixman_image_get_data(s->image);
427 }
428 
429 static inline int surface_width(DisplaySurface *s)
430 {
431     return pixman_image_get_width(s->image);
432 }
433 
434 static inline int surface_height(DisplaySurface *s)
435 {
436     return pixman_image_get_height(s->image);
437 }
438 
439 static inline int surface_bits_per_pixel(DisplaySurface *s)
440 {
441     int bits = PIXMAN_FORMAT_BPP(s->format);
442     return bits;
443 }
444 
445 static inline int surface_bytes_per_pixel(DisplaySurface *s)
446 {
447     int bits = PIXMAN_FORMAT_BPP(s->format);
448     return DIV_ROUND_UP(bits, 8);
449 }
450 
451 static inline pixman_format_code_t surface_format(DisplaySurface *s)
452 {
453     return s->format;
454 }
455 
456 typedef uint32_t console_ch_t;
457 
458 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
459 {
460     *dest = ch;
461 }
462 
463 enum {
464     GRAPHIC_FLAGS_NONE     = 0,
465     /* require a console/display with GL callbacks */
466     GRAPHIC_FLAGS_GL       = 1 << 0,
467     /* require a console/display with DMABUF import */
468     GRAPHIC_FLAGS_DMABUF   = 1 << 1,
469 };
470 
471 typedef struct GraphicHwOps {
472     int (*get_flags)(void *opaque); /* optional, default 0 */
473     void (*invalidate)(void *opaque);
474     void (*gfx_update)(void *opaque);
475     bool gfx_update_async; /* if true, calls graphic_hw_update_done() */
476     void (*text_update)(void *opaque, console_ch_t *text);
477     void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info);
478     void (*gl_block)(void *opaque, bool block);
479 } GraphicHwOps;
480 
481 QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
482                                   const GraphicHwOps *ops,
483                                   void *opaque);
484 void graphic_console_set_hwops(QemuConsole *con,
485                                const GraphicHwOps *hw_ops,
486                                void *opaque);
487 void graphic_console_close(QemuConsole *con);
488 
489 void graphic_hw_update(QemuConsole *con);
490 void graphic_hw_update_done(QemuConsole *con);
491 void graphic_hw_invalidate(QemuConsole *con);
492 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
493 void graphic_hw_gl_block(QemuConsole *con, bool block);
494 
495 void qemu_console_early_init(void);
496 
497 void qemu_console_set_display_gl_ctx(QemuConsole *con, DisplayGLCtx *ctx);
498 
499 QemuConsole *qemu_console_lookup_by_index(unsigned int index);
500 QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head);
501 QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,
502                                                 uint32_t head, Error **errp);
503 QEMUCursor *qemu_console_get_cursor(QemuConsole *con);
504 bool qemu_console_is_visible(QemuConsole *con);
505 bool qemu_console_is_graphic(QemuConsole *con);
506 bool qemu_console_is_fixedsize(QemuConsole *con);
507 bool qemu_console_is_gl_blocked(QemuConsole *con);
508 bool qemu_console_is_multihead(DeviceState *dev);
509 char *qemu_console_get_label(QemuConsole *con);
510 int qemu_console_get_index(QemuConsole *con);
511 uint32_t qemu_console_get_head(QemuConsole *con);
512 int qemu_console_get_width(QemuConsole *con, int fallback);
513 int qemu_console_get_height(QemuConsole *con, int fallback);
514 /* Return the low-level window id for the console */
515 int qemu_console_get_window_id(QemuConsole *con);
516 /* Set the low-level window id for the console */
517 void qemu_console_set_window_id(QemuConsole *con, int window_id);
518 
519 void console_select(unsigned int index);
520 void qemu_console_resize(QemuConsole *con, int width, int height);
521 DisplaySurface *qemu_console_surface(QemuConsole *con);
522 void coroutine_fn qemu_console_co_wait_update(QemuConsole *con);
523 int qemu_invalidate_text_consoles(void);
524 
525 /* console-gl.c */
526 #ifdef CONFIG_OPENGL
527 bool console_gl_check_format(DisplayChangeListener *dcl,
528                              pixman_format_code_t format);
529 void surface_gl_create_texture(QemuGLShader *gls,
530                                DisplaySurface *surface);
531 void surface_gl_update_texture(QemuGLShader *gls,
532                                DisplaySurface *surface,
533                                int x, int y, int w, int h);
534 void surface_gl_render_texture(QemuGLShader *gls,
535                                DisplaySurface *surface);
536 void surface_gl_destroy_texture(QemuGLShader *gls,
537                                DisplaySurface *surface);
538 void surface_gl_setup_viewport(QemuGLShader *gls,
539                                DisplaySurface *surface,
540                                int ww, int wh);
541 #endif
542 
543 typedef struct QemuDisplay QemuDisplay;
544 
545 struct QemuDisplay {
546     DisplayType type;
547     void (*early_init)(DisplayOptions *opts);
548     void (*init)(DisplayState *ds, DisplayOptions *opts);
549 };
550 
551 void qemu_display_register(QemuDisplay *ui);
552 bool qemu_display_find_default(DisplayOptions *opts);
553 void qemu_display_early_init(DisplayOptions *opts);
554 void qemu_display_init(DisplayState *ds, DisplayOptions *opts);
555 void qemu_display_help(void);
556 
557 /* vnc.c */
558 void vnc_display_init(const char *id, Error **errp);
559 void vnc_display_open(const char *id, Error **errp);
560 void vnc_display_add_client(const char *id, int csock, bool skipauth);
561 int vnc_display_password(const char *id, const char *password);
562 int vnc_display_pw_expire(const char *id, time_t expires);
563 void vnc_parse(const char *str);
564 int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
565 bool vnc_display_reload_certs(const char *id,  Error **errp);
566 bool vnc_display_update(DisplayUpdateOptionsVNC *arg, Error **errp);
567 
568 /* input.c */
569 int index_from_key(const char *key, size_t key_length);
570 
571 #ifdef CONFIG_LINUX
572 /* udmabuf.c */
573 int udmabuf_fd(void);
574 #endif
575 
576 /* util.c */
577 bool qemu_console_fill_device_address(QemuConsole *con,
578                                       char *device_address,
579                                       size_t size,
580                                       Error **errp);
581 
582 #endif
583