129
}
130
}
131
132
-void graphic_hw_update_done(QemuConsole *con)
132
+void qemu_console_hw_update_done(QemuConsole *con)
133
{
134
if (con) {
135
qemu_co_enter_all(&con->dump_queue, NULL);
136
}
137
}
138
139
-void graphic_hw_update(QemuConsole *con)
139
+void qemu_console_hw_update(QemuConsole *con)
140
{
141
if (!con) {
142
return;
143
}
144
if (!con->hw_ops->gfx_update || con->hw_ops->gfx_update(con->hw)) {
145
- graphic_hw_update_done(con);
145
+ qemu_console_hw_update_done(con);
146
}
147
}
148
149
-static void graphic_hw_update_bh(void *con)
149
+static void console_hw_update_bh(void *con)
150
{
151
- graphic_hw_update(con);
151
+ qemu_console_hw_update(con);
152
}
153
154
void qemu_console_co_wait_update(QemuConsole *con)
156
if (qemu_co_queue_empty(&con->dump_queue)) {
157
/* Defer the update, it will restart the pending coroutines */
158
aio_bh_schedule_oneshot(qemu_get_aio_context(),
159
- graphic_hw_update_bh, con);
159
+ console_hw_update_bh, con);
160
}
161
qemu_co_queue_wait(&con->dump_queue, NULL);
162
163
}
164
165
-static void graphic_hw_gl_unblock_timer(void *opaque)
165
+static void console_hw_gl_unblock_timer(void *opaque)
166
{
167
warn_report("console: no gl-unblock within one second");
168
}
169
170
-void graphic_hw_gl_block(QemuConsole *con, bool block)
170
+void qemu_console_hw_gl_block(QemuConsole *con, bool block)
171
{
172
uint64_t timeout;
173
assert(con != NULL);
205
con->window_id = window_id;
206
}
207
208
-void graphic_hw_invalidate(QemuConsole *con)
208
+void qemu_console_hw_invalidate(QemuConsole *con)
209
{
210
if (con && con->hw_ops->invalidate) {
211
con->hw_ops->invalidate(con->hw);
212
}
213
}
214
215
-void graphic_hw_text_update(QemuConsole *con, uint32_t *chardata)
215
+void qemu_console_hw_text_update(QemuConsole *con, uint32_t *chardata)
216
{
217
if (con && con->hw_ops->text_update) {
218
con->hw_ops->text_update(con->hw, chardata);
502
{
503
}
504
505
-bool console_has_gl(QemuConsole *con)
505
+bool qemu_console_has_gl(QemuConsole *con)
506
{
507
return con->gl != NULL;
508
}
527
528
flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0;
529
530
- if (console_has_gl(con) &&
530
+ if (qemu_console_has_gl(con) &&
531
!con->gl->ops->dpy_gl_ctx_is_compatible_dcl(con->gl, dcl)) {
532
error_setg(errp, "Display %s is incompatible with the GL context",
533
dcl->ops->dpy_name);
535
}
536
537
if (flags & GRAPHIC_FLAGS_GL &&
538
- !console_has_gl(con)) {
538
+ !qemu_console_has_gl(con)) {
539
error_setg(errp, "The console requires a GL context.");
540
return false;
541
605
vt100_update_cursor();
606
}
607
608
-void update_displaychangelistener(DisplayChangeListener *dcl,
609
- uint64_t interval)
608
+void qemu_console_listener_set_refresh(DisplayChangeListener *dcl,
609
+ uint64_t interval)
610
{
611
DisplayState *ds = dcl->ds;
612
645
con->hw_ops->ui_info(con->hw, head, &con->ui_info);
646
}
647
648
-bool dpy_ui_info_supported(const QemuConsole *con)
648
+bool qemu_console_ui_info_supported(const QemuConsole *con)
649
{
650
if (con == NULL) {
651
return false;
654
return con->hw_ops->ui_info != NULL;
655
}
656
657
-const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
657
+const QemuUIInfo *qemu_console_get_ui_info(const QemuConsole *con)
658
{
659
- assert(dpy_ui_info_supported(con));
659
+ assert(qemu_console_ui_info_supported(con));
660
661
return &con->ui_info;
662
}
663
664
-int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay)
664
+int qemu_console_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay)
665
{
666
- if (!dpy_ui_info_supported(con)) {
666
+ if (!qemu_console_ui_info_supported(con)) {
667
return -1;
668
}
669
if (memcmp(&con->ui_info, info, sizeof(con->ui_info)) == 0) {
682
return 0;
683
}
684
685
-void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
685
+void qemu_console_update(QemuConsole *con, int x, int y, int w, int h)
686
{
687
DisplayState *s = con->ds;
688
DisplayChangeListener *dcl;
707
}
708
}
709
710
-void dpy_gfx_update_full(QemuConsole *con)
710
+void qemu_console_update_full(QemuConsole *con)
711
{
712
int w = qemu_console_get_width(con, 0);
713
int h = qemu_console_get_height(con, 0);
714
715
- dpy_gfx_update(con, 0, 0, w, h);
715
+ qemu_console_update(con, 0, 0, w, h);
716
}
717
718
-void dpy_gfx_replace_surface(QemuConsole *con,
718
+void qemu_console_set_surface(QemuConsole *con,
719
DisplaySurface *surface)
720
{
721
static const char placeholder_msg[] = "Display output is not active.";
753
qemu_free_displaysurface(old_surface);
754
}
755
756
-bool dpy_gfx_check_format(QemuConsole *con,
757
- pixman_format_code_t format)
756
+bool qemu_console_check_format(QemuConsole *con,
757
+ pixman_format_code_t format)
758
{
759
DisplayChangeListener *dcl;
760
DisplayState *s = con->ds;
789
}
790
}
791
792
-void dpy_text_cursor(QemuConsole *con, int x, int y)
792
+void qemu_console_text_set_cursor(QemuConsole *con, int x, int y)
793
{
794
DisplayState *s = con->ds;
795
DisplayChangeListener *dcl;
804
}
805
}
806
807
-void dpy_text_update(QemuConsole *con, int x, int y, int w, int h)
807
+void qemu_console_text_update(QemuConsole *con, int x, int y, int w, int h)
808
{
809
DisplayState *s = con->ds;
810
DisplayChangeListener *dcl;
819
}
820
}
821
822
-void dpy_text_resize(QemuConsole *con, int w, int h)
822
+void qemu_console_text_resize(QemuConsole *con, int w, int h)
823
{
824
DisplayState *s = con->ds;
825
DisplayChangeListener *dcl;
834
}
835
}
836
837
-void dpy_mouse_set(QemuConsole *c, int x, int y, bool on)
837
+void qemu_console_set_mouse(QemuConsole *c, int x, int y, bool on)
838
{
839
QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c);
840
DisplayState *s = c->ds;
853
}
854
}
855
856
-void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor)
856
+void qemu_console_set_cursor(QemuConsole *c, QEMUCursor *cursor)
857
{
858
QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c);
859
DisplayState *s = c->ds;
871
}
872
}
873
874
-QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
875
- struct QEMUGLParams *qparams)
874
+QEMUGLContext qemu_console_gl_ctx_create(QemuConsole *con,
875
+ QEMUGLParams *qparams)
876
{
877
assert(con->gl);
878
return con->gl->ops->dpy_gl_ctx_create(con->gl, qparams);
879
}
880
881
-void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx)
881
+void qemu_console_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx)
882
{
883
assert(con->gl);
884
con->gl->ops->dpy_gl_ctx_destroy(con->gl, ctx);
885
}
886
887
-int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx)
887
+int qemu_console_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx)
888
{
889
assert(con->gl);
890
return con->gl->ops->dpy_gl_ctx_make_current(con->gl, ctx);
891
}
892
893
-void dpy_gl_scanout_disable(QemuConsole *con)
893
+void qemu_console_gl_scanout_disable(QemuConsole *con)
894
{
895
DisplayState *s = con->ds;
896
DisplayChangeListener *dcl;
908
}
909
}
910
911
-void dpy_gl_scanout_texture(QemuConsole *con,
912
- uint32_t backing_id,
913
- bool backing_y_0_top,
914
- uint32_t backing_width,
915
- uint32_t backing_height,
916
- uint32_t x, uint32_t y,
917
- uint32_t width, uint32_t height,
918
- void *d3d_tex2d)
911
+void qemu_console_gl_scanout_texture(QemuConsole *con,
912
+ uint32_t backing_id,
913
+ bool backing_y_0_top,
914
+ uint32_t backing_width,
915
+ uint32_t backing_height,
916
+ uint32_t x, uint32_t y,
917
+ uint32_t width, uint32_t height,
918
+ void *d3d_tex2d)
919
{
920
DisplayState *s = con->ds;
921
DisplayChangeListener *dcl;
939
}
940
}
941
942
-void dpy_gl_scanout_dmabuf(QemuConsole *con,
943
- QemuDmaBuf *dmabuf)
942
+void qemu_console_gl_scanout_dmabuf(QemuConsole *con,
943
+ QemuDmaBuf *dmabuf)
944
{
945
DisplayState *s = con->ds;
946
DisplayChangeListener *dcl;
957
}
958
}
959
960
-void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
961
- bool have_hot, uint32_t hot_x, uint32_t hot_y)
960
+void qemu_console_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
961
+ bool have_hot, uint32_t hot_x, uint32_t hot_y)
962
{
963
DisplayState *s = con->ds;
964
DisplayChangeListener *dcl;
974
}
975
}
976
977
-void dpy_gl_cursor_position(QemuConsole *con,
978
- uint32_t pos_x, uint32_t pos_y)
977
+void qemu_console_gl_cursor_position(QemuConsole *con,
978
+ uint32_t pos_x, uint32_t pos_y)
979
{
980
DisplayState *s = con->ds;
981
DisplayChangeListener *dcl;
990
}
991
}
992
993
-void dpy_gl_release_dmabuf(QemuConsole *con,
994
- QemuDmaBuf *dmabuf)
993
+void qemu_console_gl_release_dmabuf(QemuConsole *con,
994
+ QemuDmaBuf *dmabuf)
995
{
996
DisplayState *s = con->ds;
997
DisplayChangeListener *dcl;
1006
}
1007
}
1008
1009
-void dpy_gl_update(QemuConsole *con,
1010
- uint32_t x, uint32_t y, uint32_t w, uint32_t h)
1009
+void qemu_console_gl_update(QemuConsole *con,
1010
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h)
1011
{
1012
DisplayState *s = con->ds;
1013
DisplayChangeListener *dcl;
1014
1015
assert(con->gl);
1016
1017
- graphic_hw_gl_block(con, true);
1017
+ qemu_console_hw_gl_block(con, true);
1018
QLIST_FOREACH(dcl, &s->listeners, next) {
1019
if (con != dcl->con) {
1020
continue;
1023
dcl->ops->dpy_gl_update(dcl, x, y, w, h);
1024
}
1025
}
1026
- graphic_hw_gl_block(con, false);
1026
+ qemu_console_hw_gl_block(con, false);
1027
}
1028
1029
/***********************************************************/
1060
return display_state;
1061
}
1062
1063
-void graphic_console_set_hwops(QemuConsole *con,
1064
- const GraphicHwOps *hw_ops,
1065
- void *opaque)
1063
+void qemu_graphic_console_set_hwops(QemuConsole *con,
1064
+ const GraphicHwOps *hw_ops,
1065
+ void *opaque)
1066
{
1067
con->hw_ops = hw_ops;
1068
con->hw = opaque;
1069
}
1070
1071
-QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
1072
- const GraphicHwOps *hw_ops,
1073
- void *opaque)
1071
+QemuConsole *qemu_graphic_console_create(DeviceState *dev, uint32_t head,
1072
+ const GraphicHwOps *hw_ops,
1073
+ void *opaque)
1074
{
1075
static const char noinit[] =
1076
"Guest has not initialized the display (yet).";
1089
s = (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE);
1090
}
1091
QEMU_GRAPHIC_CONSOLE(s)->head = head;
1092
- graphic_console_set_hwops(s, hw_ops, opaque);
1092
+ qemu_graphic_console_set_hwops(s, hw_ops, opaque);
1093
if (dev) {
1094
object_property_set_link(OBJECT(s), "device", OBJECT(dev),
1095
&error_abort);
1096
}
1097
1098
surface = qemu_create_placeholder_surface(width, height, noinit);
1099
- dpy_gfx_replace_surface(s, surface);
1099
+ qemu_console_set_surface(s, surface);
1100
s->gl_unblock_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
1101
- graphic_hw_gl_unblock_timer, s);
1101
+ console_hw_gl_unblock_timer, s);
1102
return s;
1103
}
1104
1106
/* no callbacks */
1107
};
1108
1109
-void graphic_console_close(QemuConsole *con)
1109
+void qemu_graphic_console_close(QemuConsole *con)
1110
{
1111
static const char unplugged[] =
1112
"Guest display has been unplugged";
1116
1117
trace_console_gfx_close(con->index);
1118
object_property_set_link(OBJECT(con), "device", NULL, &error_abort);
1119
- graphic_console_set_hwops(con, &unused_ops, NULL);
1119
+ qemu_graphic_console_set_hwops(con, &unused_ops, NULL);
1120
1121
if (con->gl) {
1122
- dpy_gl_scanout_disable(con);
1122
+ qemu_console_gl_scanout_disable(con);
1123
}
1124
surface = qemu_create_placeholder_surface(width, height, unplugged);
1125
- dpy_gfx_replace_surface(con, surface);
1125
+ qemu_console_set_surface(con, surface);
1126
}
1127
1128
QemuConsole *qemu_console_lookup_default(void)
1308
}
1309
1310
surface = qemu_create_displaysurface(width, height);
1311
- dpy_gfx_replace_surface(s, surface);
1311
+ qemu_console_set_surface(s, surface);
1312
}
1313
1314
DisplaySurface *qemu_console_surface(QemuConsole *console)