Lines Matching refs:vc
21 static void gtk_gl_area_set_scanout_mode(VirtualConsole *vc, bool scanout) in gtk_gl_area_set_scanout_mode() argument
23 if (vc->gfx.scanout_mode == scanout) { in gtk_gl_area_set_scanout_mode()
27 vc->gfx.scanout_mode = scanout; in gtk_gl_area_set_scanout_mode()
28 if (!vc->gfx.scanout_mode) { in gtk_gl_area_set_scanout_mode()
29 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gtk_gl_area_set_scanout_mode()
30 egl_fb_destroy(&vc->gfx.guest_fb); in gtk_gl_area_set_scanout_mode()
31 if (vc->gfx.surface) { in gtk_gl_area_set_scanout_mode()
32 surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds); in gtk_gl_area_set_scanout_mode()
33 surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds); in gtk_gl_area_set_scanout_mode()
40 void gd_gl_area_draw(VirtualConsole *vc) in gd_gl_area_draw() argument
43 QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf; in gd_gl_area_draw()
47 if (!vc->gfx.gls) { in gd_gl_area_draw()
51 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_draw()
52 ws = gdk_window_get_scale_factor(gtk_widget_get_window(vc->gfx.drawing_area)); in gd_gl_area_draw()
53 ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * ws; in gd_gl_area_draw()
54 wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * ws; in gd_gl_area_draw()
56 if (vc->gfx.scanout_mode) { in gd_gl_area_draw()
57 if (!vc->gfx.guest_fb.framebuffer) { in gd_gl_area_draw()
71 glBindFramebuffer(GL_READ_FRAMEBUFFER, vc->gfx.guest_fb.framebuffer); in gd_gl_area_draw()
75 y1 = vc->gfx.y0_top ? 0 : vc->gfx.h; in gd_gl_area_draw()
76 y2 = vc->gfx.y0_top ? vc->gfx.h : 0; in gd_gl_area_draw()
77 glBlitFramebuffer(0, y1, vc->gfx.w, y2, in gd_gl_area_draw()
92 qemu_set_fd_handler(fence_fd, gd_hw_gl_flushed, NULL, vc); in gd_gl_area_draw()
95 graphic_hw_gl_block(vc->gfx.dcl.con, false); in gd_gl_area_draw()
99 if (!vc->gfx.ds) { in gd_gl_area_draw()
102 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_draw()
104 surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); in gd_gl_area_draw()
105 surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); in gd_gl_area_draw()
112 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_update() local
114 if (!vc->gfx.gls || !vc->gfx.ds) { in gd_gl_area_update()
118 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_update()
119 surface_gl_update_texture(vc->gfx.gls, vc->gfx.ds, x, y, w, h); in gd_gl_area_update()
120 vc->gfx.glupdates++; in gd_gl_area_update()
126 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_refresh() local
128 gd_update_monitor_refresh_rate(vc, vc->window ? vc->window : vc->gfx.drawing_area); in gd_gl_area_refresh()
130 if (vc->gfx.guest_fb.dmabuf && in gd_gl_area_refresh()
131 qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { in gd_gl_area_refresh()
132 gd_gl_area_draw(vc); in gd_gl_area_refresh()
136 if (!vc->gfx.gls) { in gd_gl_area_refresh()
137 if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { in gd_gl_area_refresh()
140 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_refresh()
141 vc->gfx.gls = qemu_gl_init_shader(); in gd_gl_area_refresh()
142 if (vc->gfx.ds) { in gd_gl_area_refresh()
143 surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds); in gd_gl_area_refresh()
149 if (vc->gfx.glupdates) { in gd_gl_area_refresh()
150 vc->gfx.glupdates = 0; in gd_gl_area_refresh()
151 gtk_gl_area_set_scanout_mode(vc, false); in gd_gl_area_refresh()
152 gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_refresh()
159 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_switch() local
162 trace_gd_switch(vc->label, surface_width(surface), surface_height(surface)); in gd_gl_area_switch()
164 if (vc->gfx.ds && in gd_gl_area_switch()
165 surface_width(vc->gfx.ds) == surface_width(surface) && in gd_gl_area_switch()
166 surface_height(vc->gfx.ds) == surface_height(surface)) { in gd_gl_area_switch()
170 if (vc->gfx.gls) { in gd_gl_area_switch()
171 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_switch()
172 surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds); in gd_gl_area_switch()
173 surface_gl_create_texture(vc->gfx.gls, surface); in gd_gl_area_switch()
175 vc->gfx.ds = surface; in gd_gl_area_switch()
178 gd_update_windowsize(vc); in gd_gl_area_switch()
202 VirtualConsole *vc = container_of(dgc, VirtualConsole, gfx.dgc); in gd_gl_area_create_context() local
208 window = gtk_widget_get_window(vc->gfx.drawing_area); in gd_gl_area_create_context()
229 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_create_context()
260 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_scanout_texture() local
262 vc->gfx.x = x; in gd_gl_area_scanout_texture()
263 vc->gfx.y = y; in gd_gl_area_scanout_texture()
264 vc->gfx.w = w; in gd_gl_area_scanout_texture()
265 vc->gfx.h = h; in gd_gl_area_scanout_texture()
266 vc->gfx.y0_top = backing_y_0_top; in gd_gl_area_scanout_texture()
268 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_scanout_texture()
270 if (backing_id == 0 || vc->gfx.w == 0 || vc->gfx.h == 0) { in gd_gl_area_scanout_texture()
271 gtk_gl_area_set_scanout_mode(vc, false); in gd_gl_area_scanout_texture()
275 gtk_gl_area_set_scanout_mode(vc, true); in gd_gl_area_scanout_texture()
276 egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height, in gd_gl_area_scanout_texture()
282 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_scanout_disable() local
284 gtk_gl_area_set_scanout_mode(vc, false); in gd_gl_area_scanout_disable()
290 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_scanout_flush() local
292 if (vc->gfx.guest_fb.dmabuf && in gd_gl_area_scanout_flush()
293 !qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { in gd_gl_area_scanout_flush()
294 graphic_hw_gl_block(vc->gfx.dcl.con, true); in gd_gl_area_scanout_flush()
295 qemu_dmabuf_set_draw_submitted(vc->gfx.guest_fb.dmabuf, true); in gd_gl_area_scanout_flush()
296 gtk_gl_area_set_scanout_mode(vc, true); in gd_gl_area_scanout_flush()
298 gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_scanout_flush()
305 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); in gd_gl_area_scanout_dmabuf() local
309 gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); in gd_gl_area_scanout_dmabuf()
329 vc->gfx.guest_fb.dmabuf = dmabuf; in gd_gl_area_scanout_dmabuf()