Lines Matching refs:con

76 static bool console_compatible_with(QemuConsole *con,
128 void graphic_hw_update_done(QemuConsole *con) in graphic_hw_update_done() argument
130 if (con) { in graphic_hw_update_done()
131 qemu_co_enter_all(&con->dump_queue, NULL); in graphic_hw_update_done()
135 void graphic_hw_update(QemuConsole *con) in graphic_hw_update() argument
138 if (!con) { in graphic_hw_update()
141 if (con->hw_ops->gfx_update) { in graphic_hw_update()
142 con->hw_ops->gfx_update(con->hw); in graphic_hw_update()
143 async = con->hw_ops->gfx_update_async; in graphic_hw_update()
146 graphic_hw_update_done(con); in graphic_hw_update()
150 static void graphic_hw_update_bh(void *con) in graphic_hw_update_bh() argument
152 graphic_hw_update(con); in graphic_hw_update_bh()
155 void qemu_console_co_wait_update(QemuConsole *con) in qemu_console_co_wait_update() argument
157 if (qemu_co_queue_empty(&con->dump_queue)) { in qemu_console_co_wait_update()
160 graphic_hw_update_bh, con); in qemu_console_co_wait_update()
162 qemu_co_queue_wait(&con->dump_queue, NULL); in qemu_console_co_wait_update()
171 void graphic_hw_gl_block(QemuConsole *con, bool block) in graphic_hw_gl_block() argument
174 assert(con != NULL); in graphic_hw_gl_block()
177 con->gl_block++; in graphic_hw_gl_block()
179 con->gl_block--; in graphic_hw_gl_block()
181 assert(con->gl_block >= 0); in graphic_hw_gl_block()
182 if (!con->hw_ops->gl_block) { in graphic_hw_gl_block()
185 if ((block && con->gl_block != 1) || (!block && con->gl_block != 0)) { in graphic_hw_gl_block()
188 con->hw_ops->gl_block(con->hw, block); in graphic_hw_gl_block()
193 timer_mod(con->gl_unblock_timer, timeout); in graphic_hw_gl_block()
195 timer_del(con->gl_unblock_timer); in graphic_hw_gl_block()
199 int qemu_console_get_window_id(QemuConsole *con) in qemu_console_get_window_id() argument
201 return con->window_id; in qemu_console_get_window_id()
204 void qemu_console_set_window_id(QemuConsole *con, int window_id) in qemu_console_set_window_id() argument
206 con->window_id = window_id; in qemu_console_set_window_id()
209 void graphic_hw_invalidate(QemuConsole *con) in graphic_hw_invalidate() argument
211 if (con && con->hw_ops->invalidate) { in graphic_hw_invalidate()
212 con->hw_ops->invalidate(con->hw); in graphic_hw_invalidate()
216 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata) in graphic_hw_text_update() argument
218 if (con && con->hw_ops->text_update) { in graphic_hw_text_update()
219 con->hw_ops->text_update(con->hw, chardata); in graphic_hw_text_update()
238 static void dpy_gfx_create_texture(QemuConsole *con, DisplaySurface *surface) in dpy_gfx_create_texture() argument
240 if (con->gl && con->gl->ops->dpy_gl_ctx_create_texture) { in dpy_gfx_create_texture()
241 con->gl->ops->dpy_gl_ctx_create_texture(con->gl, surface); in dpy_gfx_create_texture()
245 static void dpy_gfx_destroy_texture(QemuConsole *con, DisplaySurface *surface) in dpy_gfx_destroy_texture() argument
247 if (con->gl && con->gl->ops->dpy_gl_ctx_destroy_texture) { in dpy_gfx_destroy_texture()
248 con->gl->ops->dpy_gl_ctx_destroy_texture(con->gl, surface); in dpy_gfx_destroy_texture()
252 static void dpy_gfx_update_texture(QemuConsole *con, DisplaySurface *surface, in dpy_gfx_update_texture() argument
255 if (con->gl && con->gl->ops->dpy_gl_ctx_update_texture) { in dpy_gfx_update_texture()
256 con->gl->ops->dpy_gl_ctx_update_texture(con->gl, surface, x, y, w, h); in dpy_gfx_update_texture()
266 QemuConsole *con = dcl->con; in displaychangelistener_display_console() local
268 if (!con || !console_compatible_with(con, dcl, errp)) { in displaychangelistener_display_console()
272 if (con) { in displaychangelistener_display_console()
273 dpy_gfx_create_texture(con, dummy); in displaychangelistener_display_console()
279 dpy_gfx_create_texture(con, con->surface); in displaychangelistener_display_console()
280 displaychangelistener_gfx_switch(dcl, con->surface, in displaychangelistener_display_console()
281 con->scanout.kind == SCANOUT_SURFACE); in displaychangelistener_display_console()
283 if (con->scanout.kind == SCANOUT_DMABUF && in displaychangelistener_display_console()
285 dcl->ops->dpy_gl_scanout_dmabuf(dcl, con->scanout.dmabuf); in displaychangelistener_display_console()
286 } else if (con->scanout.kind == SCANOUT_TEXTURE && in displaychangelistener_display_console()
289 con->scanout.texture.backing_id, in displaychangelistener_display_console()
290 con->scanout.texture.backing_y_0_top, in displaychangelistener_display_console()
291 con->scanout.texture.backing_width, in displaychangelistener_display_console()
292 con->scanout.texture.backing_height, in displaychangelistener_display_console()
293 con->scanout.texture.x, in displaychangelistener_display_console()
294 con->scanout.texture.y, in displaychangelistener_display_console()
295 con->scanout.texture.width, in displaychangelistener_display_console()
296 con->scanout.texture.height, in displaychangelistener_display_console()
297 con->scanout.texture.d3d_tex2d); in displaychangelistener_display_console()
554 bool console_has_gl(QemuConsole *con) in console_has_gl() argument
556 return con->gl != NULL; in console_has_gl()
572 static bool console_compatible_with(QemuConsole *con, in console_compatible_with() argument
577 flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0; in console_compatible_with()
579 if (console_has_gl(con) && in console_compatible_with()
580 !con->gl->ops->dpy_gl_ctx_is_compatible_dcl(con->gl, dcl)) { in console_compatible_with()
587 !console_has_gl(con)) { in console_compatible_with()
602 void console_handle_touch_event(QemuConsole *con, in console_handle_touch_event() argument
645 qemu_input_queue_mtt(con, update, i, slot->tracking_id); in console_handle_touch_event()
648 qemu_input_queue_mtt(con, update, i, slot->tracking_id); in console_handle_touch_event()
649 qemu_input_queue_btn(con, INPUT_BUTTON_TOUCH, true); in console_handle_touch_event()
650 qemu_input_queue_mtt_abs(con, in console_handle_touch_event()
654 qemu_input_queue_mtt_abs(con, in console_handle_touch_event()
667 void qemu_console_set_display_gl_ctx(QemuConsole *con, DisplayGLCtx *gl) in qemu_console_set_display_gl_ctx() argument
670 assert(con); in qemu_console_set_display_gl_ctx()
671 if (con->gl) { in qemu_console_set_display_gl_ctx()
675 con->gl = gl; in qemu_console_set_display_gl_ctx()
679 dcl_set_graphic_cursor(DisplayChangeListener *dcl, QemuGraphicConsole *con) in dcl_set_graphic_cursor() argument
681 if (con && con->cursor && dcl->ops->dpy_cursor_define) { in dcl_set_graphic_cursor()
682 dcl->ops->dpy_cursor_define(dcl, con->cursor); in dcl_set_graphic_cursor()
684 if (con && dcl->ops->dpy_mouse_set) { in dcl_set_graphic_cursor()
685 dcl->ops->dpy_mouse_set(dcl, con->cursor_x, con->cursor_y, con->cursor_on); in dcl_set_graphic_cursor()
697 if (dcl->con) { in register_displaychangelistener()
698 dcl->con->dcls++; in register_displaychangelistener()
701 if (QEMU_IS_GRAPHIC_CONSOLE(dcl->con)) { in register_displaychangelistener()
702 dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(dcl->con)); in register_displaychangelistener()
703 } else if (QEMU_IS_TEXT_CONSOLE(dcl->con)) { in register_displaychangelistener()
704 qemu_text_console_update_size(QEMU_TEXT_CONSOLE(dcl->con)); in register_displaychangelistener()
724 if (dcl->con) { in unregister_displaychangelistener()
725 dcl->con->dcls--; in unregister_displaychangelistener()
734 QemuConsole *con = opaque; in dpy_set_ui_info_timer() local
735 uint32_t head = qemu_console_get_head(con); in dpy_set_ui_info_timer()
737 con->hw_ops->ui_info(con->hw, head, &con->ui_info); in dpy_set_ui_info_timer()
740 bool dpy_ui_info_supported(const QemuConsole *con) in dpy_ui_info_supported() argument
742 if (con == NULL) { in dpy_ui_info_supported()
746 return con->hw_ops->ui_info != NULL; in dpy_ui_info_supported()
749 const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con) in dpy_get_ui_info() argument
751 assert(dpy_ui_info_supported(con)); in dpy_get_ui_info()
753 return &con->ui_info; in dpy_get_ui_info()
756 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info, bool delay) in dpy_set_ui_info() argument
758 if (!dpy_ui_info_supported(con)) { in dpy_set_ui_info()
761 if (memcmp(&con->ui_info, info, sizeof(con->ui_info)) == 0) { in dpy_set_ui_info()
771 con->ui_info = *info; in dpy_set_ui_info()
772 timer_mod(con->ui_timer, in dpy_set_ui_info()
777 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h) in dpy_gfx_update() argument
779 DisplayState *s = con->ds; in dpy_gfx_update()
781 int width = qemu_console_get_width(con, x + w); in dpy_gfx_update()
782 int height = qemu_console_get_height(con, y + h); in dpy_gfx_update()
791 if (!qemu_console_is_visible(con)) { in dpy_gfx_update()
794 dpy_gfx_update_texture(con, con->surface, x, y, w, h); in dpy_gfx_update()
796 if (con != dcl->con) { in dpy_gfx_update()
805 void dpy_gfx_update_full(QemuConsole *con) in dpy_gfx_update_full() argument
807 int w = qemu_console_get_width(con, 0); in dpy_gfx_update_full()
808 int h = qemu_console_get_height(con, 0); in dpy_gfx_update_full()
810 dpy_gfx_update(con, 0, 0, w, h); in dpy_gfx_update_full()
813 void dpy_gfx_replace_surface(QemuConsole *con, in dpy_gfx_replace_surface() argument
817 DisplayState *s = con->ds; in dpy_gfx_replace_surface()
818 DisplaySurface *old_surface = con->surface; in dpy_gfx_replace_surface()
838 con->scanout.kind = SCANOUT_SURFACE; in dpy_gfx_replace_surface()
839 con->surface = new_surface; in dpy_gfx_replace_surface()
840 dpy_gfx_create_texture(con, new_surface); in dpy_gfx_replace_surface()
842 if (con != dcl->con) { in dpy_gfx_replace_surface()
847 dpy_gfx_destroy_texture(con, old_surface); in dpy_gfx_replace_surface()
851 bool dpy_gfx_check_format(QemuConsole *con, in dpy_gfx_check_format() argument
855 DisplayState *s = con->ds; in dpy_gfx_check_format()
858 if (dcl->con && dcl->con != con) { in dpy_gfx_check_format()
887 void dpy_text_cursor(QemuConsole *con, int x, int y) in dpy_text_cursor() argument
889 DisplayState *s = con->ds; in dpy_text_cursor()
892 if (!qemu_console_is_visible(con)) { in dpy_text_cursor()
896 if (con != dcl->con) { in dpy_text_cursor()
905 void dpy_text_update(QemuConsole *con, int x, int y, int w, int h) in dpy_text_update() argument
907 DisplayState *s = con->ds; in dpy_text_update()
910 if (!qemu_console_is_visible(con)) { in dpy_text_update()
914 if (con != dcl->con) { in dpy_text_update()
923 void dpy_text_resize(QemuConsole *con, int w, int h) in dpy_text_resize() argument
925 DisplayState *s = con->ds; in dpy_text_resize()
928 if (!qemu_console_is_visible(con)) { in dpy_text_resize()
932 if (con != dcl->con) { in dpy_text_resize()
943 QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c); in dpy_mouse_set() local
947 con->cursor_x = x; in dpy_mouse_set()
948 con->cursor_y = y; in dpy_mouse_set()
949 con->cursor_on = on; in dpy_mouse_set()
954 if (c != dcl->con) { in dpy_mouse_set()
965 QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c); in dpy_cursor_define() local
969 cursor_unref(con->cursor); in dpy_cursor_define()
970 con->cursor = cursor_ref(cursor); in dpy_cursor_define()
975 if (c != dcl->con) { in dpy_cursor_define()
984 QEMUGLContext dpy_gl_ctx_create(QemuConsole *con, in dpy_gl_ctx_create() argument
987 assert(con->gl); in dpy_gl_ctx_create()
988 return con->gl->ops->dpy_gl_ctx_create(con->gl, qparams); in dpy_gl_ctx_create()
991 void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx) in dpy_gl_ctx_destroy() argument
993 assert(con->gl); in dpy_gl_ctx_destroy()
994 con->gl->ops->dpy_gl_ctx_destroy(con->gl, ctx); in dpy_gl_ctx_destroy()
997 int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx) in dpy_gl_ctx_make_current() argument
999 assert(con->gl); in dpy_gl_ctx_make_current()
1000 return con->gl->ops->dpy_gl_ctx_make_current(con->gl, ctx); in dpy_gl_ctx_make_current()
1003 void dpy_gl_scanout_disable(QemuConsole *con) in dpy_gl_scanout_disable() argument
1005 DisplayState *s = con->ds; in dpy_gl_scanout_disable()
1008 if (con->scanout.kind != SCANOUT_SURFACE) { in dpy_gl_scanout_disable()
1009 con->scanout.kind = SCANOUT_NONE; in dpy_gl_scanout_disable()
1012 if (con != dcl->con) { in dpy_gl_scanout_disable()
1021 void dpy_gl_scanout_texture(QemuConsole *con, in dpy_gl_scanout_texture() argument
1030 DisplayState *s = con->ds; in dpy_gl_scanout_texture()
1033 con->scanout.kind = SCANOUT_TEXTURE; in dpy_gl_scanout_texture()
1034 con->scanout.texture = (ScanoutTexture) { in dpy_gl_scanout_texture()
1039 if (con != dcl->con) { in dpy_gl_scanout_texture()
1052 void dpy_gl_scanout_dmabuf(QemuConsole *con, in dpy_gl_scanout_dmabuf() argument
1055 DisplayState *s = con->ds; in dpy_gl_scanout_dmabuf()
1058 con->scanout.kind = SCANOUT_DMABUF; in dpy_gl_scanout_dmabuf()
1059 con->scanout.dmabuf = dmabuf; in dpy_gl_scanout_dmabuf()
1061 if (con != dcl->con) { in dpy_gl_scanout_dmabuf()
1070 void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf, in dpy_gl_cursor_dmabuf() argument
1073 DisplayState *s = con->ds; in dpy_gl_cursor_dmabuf()
1077 if (con != dcl->con) { in dpy_gl_cursor_dmabuf()
1087 void dpy_gl_cursor_position(QemuConsole *con, in dpy_gl_cursor_position() argument
1090 DisplayState *s = con->ds; in dpy_gl_cursor_position()
1094 if (con != dcl->con) { in dpy_gl_cursor_position()
1103 void dpy_gl_release_dmabuf(QemuConsole *con, in dpy_gl_release_dmabuf() argument
1106 DisplayState *s = con->ds; in dpy_gl_release_dmabuf()
1110 if (con != dcl->con) { in dpy_gl_release_dmabuf()
1119 void dpy_gl_update(QemuConsole *con, in dpy_gl_update() argument
1122 DisplayState *s = con->ds; in dpy_gl_update()
1125 assert(con->gl); in dpy_gl_update()
1127 graphic_hw_gl_block(con, true); in dpy_gl_update()
1129 if (con != dcl->con) { in dpy_gl_update()
1136 graphic_hw_gl_block(con, false); in dpy_gl_update()
1158 QemuConsole *con; in init_displaystate() local
1160 QTAILQ_FOREACH(con, &consoles, next) { in init_displaystate()
1164 name = g_strdup_printf("console[%d]", con->index); in init_displaystate()
1166 name, OBJECT(con)); in init_displaystate()
1173 void graphic_console_set_hwops(QemuConsole *con, in graphic_console_set_hwops() argument
1177 con->hw_ops = hw_ops; in graphic_console_set_hwops()
1178 con->hw = opaque; in graphic_console_set_hwops()
1219 void graphic_console_close(QemuConsole *con) in graphic_console_close() argument
1224 int width = qemu_console_get_width(con, 640); in graphic_console_close()
1225 int height = qemu_console_get_height(con, 480); in graphic_console_close()
1227 trace_console_gfx_close(con->index); in graphic_console_close()
1228 object_property_set_link(OBJECT(con), "device", NULL, &error_abort); in graphic_console_close()
1229 graphic_console_set_hwops(con, &unused_ops, NULL); in graphic_console_close()
1231 if (con->gl) { in graphic_console_close()
1232 dpy_gl_scanout_disable(con); in graphic_console_close()
1235 dpy_gfx_replace_surface(con, surface); in graphic_console_close()
1240 QemuConsole *con; in qemu_console_lookup_default() local
1242 QTAILQ_FOREACH(con, &consoles, next) { in qemu_console_lookup_default()
1243 if (QEMU_IS_GRAPHIC_CONSOLE(con)) { in qemu_console_lookup_default()
1244 return con; in qemu_console_lookup_default()
1252 QemuConsole *con; in qemu_console_lookup_by_index() local
1254 QTAILQ_FOREACH(con, &consoles, next) { in qemu_console_lookup_by_index()
1255 if (con->index == index) { in qemu_console_lookup_by_index()
1256 return con; in qemu_console_lookup_by_index()
1264 QemuConsole *con; in qemu_console_lookup_by_device() local
1268 QTAILQ_FOREACH(con, &consoles, next) { in qemu_console_lookup_by_device()
1269 obj = object_property_get_link(OBJECT(con), in qemu_console_lookup_by_device()
1274 h = object_property_get_uint(OBJECT(con), in qemu_console_lookup_by_device()
1279 return con; in qemu_console_lookup_by_device()
1288 QemuConsole *con; in qemu_console_lookup_by_device_name() local
1297 con = qemu_console_lookup_by_device(dev, head); in qemu_console_lookup_by_device_name()
1298 if (con == NULL) { in qemu_console_lookup_by_device_name()
1304 return con; in qemu_console_lookup_by_device_name()
1309 QemuConsole *con; in qemu_graphic_console_lookup_unused() local
1312 QTAILQ_FOREACH(con, &consoles, next) { in qemu_graphic_console_lookup_unused()
1313 if (!QEMU_IS_GRAPHIC_CONSOLE(con) || con->hw_ops != &unused_ops) { in qemu_graphic_console_lookup_unused()
1316 obj = object_property_get_link(OBJECT(con), in qemu_graphic_console_lookup_unused()
1321 return con; in qemu_graphic_console_lookup_unused()
1326 QEMUCursor *qemu_console_get_cursor(QemuConsole *con) in qemu_console_get_cursor() argument
1328 return QEMU_IS_GRAPHIC_CONSOLE(con) ? QEMU_GRAPHIC_CONSOLE(con)->cursor : NULL; in qemu_console_get_cursor()
1331 bool qemu_console_is_visible(QemuConsole *con) in qemu_console_is_visible() argument
1333 return con->dcls > 0; in qemu_console_is_visible()
1336 bool qemu_console_is_graphic(QemuConsole *con) in qemu_console_is_graphic() argument
1338 return con && QEMU_IS_GRAPHIC_CONSOLE(con); in qemu_console_is_graphic()
1341 bool qemu_console_is_fixedsize(QemuConsole *con) in qemu_console_is_fixedsize() argument
1343 return con && (QEMU_IS_GRAPHIC_CONSOLE(con) || QEMU_IS_FIXED_TEXT_CONSOLE(con)); in qemu_console_is_fixedsize()
1346 bool qemu_console_is_gl_blocked(QemuConsole *con) in qemu_console_is_gl_blocked() argument
1348 assert(con != NULL); in qemu_console_is_gl_blocked()
1349 return con->gl_block; in qemu_console_is_gl_blocked()
1354 QemuConsole *con; in qemu_graphic_console_is_multihead() local
1356 QTAILQ_FOREACH(con, &consoles, next) { in qemu_graphic_console_is_multihead()
1359 if (!QEMU_IS_GRAPHIC_CONSOLE(con)) { in qemu_graphic_console_is_multihead()
1363 candidate = QEMU_GRAPHIC_CONSOLE(con); in qemu_graphic_console_is_multihead()
1375 char *qemu_console_get_label(QemuConsole *con) in qemu_console_get_label() argument
1377 if (QEMU_IS_GRAPHIC_CONSOLE(con)) { in qemu_console_get_label()
1378 QemuGraphicConsole *c = QEMU_GRAPHIC_CONSOLE(con); in qemu_console_get_label()
1397 } else if (QEMU_IS_TEXT_CONSOLE(con)) { in qemu_console_get_label()
1398 const char *label = qemu_text_console_get_label(QEMU_TEXT_CONSOLE(con)); in qemu_console_get_label()
1404 return g_strdup_printf("vc%d", con->index); in qemu_console_get_label()
1407 int qemu_console_get_index(QemuConsole *con) in qemu_console_get_index() argument
1409 return con ? con->index : -1; in qemu_console_get_index()
1412 uint32_t qemu_console_get_head(QemuConsole *con) in qemu_console_get_head() argument
1414 if (con == NULL) { in qemu_console_get_head()
1417 if (QEMU_IS_GRAPHIC_CONSOLE(con)) { in qemu_console_get_head()
1418 return QEMU_GRAPHIC_CONSOLE(con)->head; in qemu_console_get_head()
1423 int qemu_console_get_width(QemuConsole *con, int fallback) in qemu_console_get_width() argument
1425 if (con == NULL) { in qemu_console_get_width()
1428 switch (con->scanout.kind) { in qemu_console_get_width()
1430 return qemu_dmabuf_get_width(con->scanout.dmabuf); in qemu_console_get_width()
1432 return con->scanout.texture.width; in qemu_console_get_width()
1434 return surface_width(con->surface); in qemu_console_get_width()
1440 int qemu_console_get_height(QemuConsole *con, int fallback) in qemu_console_get_height() argument
1442 if (con == NULL) { in qemu_console_get_height()
1445 switch (con->scanout.kind) { in qemu_console_get_height()
1447 return qemu_dmabuf_get_height(con->scanout.dmabuf); in qemu_console_get_height()
1449 return con->scanout.texture.height; in qemu_console_get_height()
1451 return surface_height(con->surface); in qemu_console_get_height()