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