|
@@ -70,6 +70,7 @@ void gd_egl_draw(VirtualConsole *vc)
|
|
|
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
|
|
|
#endif
|
|
|
int ww, wh, ws;
|
|
|
+ int fence_fd;
|
|
|
|
|
|
if (!vc->gfx.gls) {
|
|
|
return;
|
|
@@ -83,7 +84,7 @@ void gd_egl_draw(VirtualConsole *vc)
|
|
|
if (vc->gfx.scanout_mode) {
|
|
|
#ifdef CONFIG_GBM
|
|
|
if (dmabuf) {
|
|
|
- if (!dmabuf->draw_submitted) {
|
|
|
+ if (!qemu_dmabuf_get_draw_submitted(dmabuf)) {
|
|
|
return;
|
|
|
} else {
|
|
|
dmabuf->draw_submitted = false;
|
|
@@ -99,8 +100,9 @@ void gd_egl_draw(VirtualConsole *vc)
|
|
|
#ifdef CONFIG_GBM
|
|
|
if (dmabuf) {
|
|
|
egl_dmabuf_create_fence(dmabuf);
|
|
|
- if (dmabuf->fence_fd >= 0) {
|
|
|
- qemu_set_fd_handler(dmabuf->fence_fd, gd_hw_gl_flushed, NULL, vc);
|
|
|
+ fence_fd = qemu_dmabuf_get_fence_fd(dmabuf);
|
|
|
+ if (fence_fd >= 0) {
|
|
|
+ qemu_set_fd_handler(fence_fd, gd_hw_gl_flushed, NULL, vc);
|
|
|
return;
|
|
|
}
|
|
|
graphic_hw_gl_block(vc->gfx.dcl.con, false);
|
|
@@ -149,7 +151,8 @@ void gd_egl_refresh(DisplayChangeListener *dcl)
|
|
|
gd_update_monitor_refresh_rate(
|
|
|
vc, vc->window ? vc->window : vc->gfx.drawing_area);
|
|
|
|
|
|
- if (vc->gfx.guest_fb.dmabuf && vc->gfx.guest_fb.dmabuf->draw_submitted) {
|
|
|
+ if (vc->gfx.guest_fb.dmabuf &&
|
|
|
+ qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
|
|
|
gd_egl_draw(vc);
|
|
|
return;
|
|
|
}
|
|
@@ -265,22 +268,30 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
|
|
|
{
|
|
|
#ifdef CONFIG_GBM
|
|
|
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
|
|
+ uint32_t x, y, width, height, backing_width, backing_height, texture;
|
|
|
+ bool y0_top;
|
|
|
|
|
|
eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
|
|
|
vc->gfx.esurface, vc->gfx.ectx);
|
|
|
|
|
|
egl_dmabuf_import_texture(dmabuf);
|
|
|
- if (!dmabuf->texture) {
|
|
|
+ texture = qemu_dmabuf_get_texture(dmabuf);
|
|
|
+ if (!texture) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- gd_egl_scanout_texture(dcl, dmabuf->texture,
|
|
|
- dmabuf->y0_top,
|
|
|
- dmabuf->backing_width, dmabuf->backing_height,
|
|
|
- dmabuf->x, dmabuf->y, dmabuf->width,
|
|
|
- dmabuf->height, NULL);
|
|
|
+ x = qemu_dmabuf_get_x(dmabuf);
|
|
|
+ y = qemu_dmabuf_get_y(dmabuf);
|
|
|
+ width = qemu_dmabuf_get_width(dmabuf);
|
|
|
+ height = qemu_dmabuf_get_height(dmabuf);
|
|
|
+ backing_width = qemu_dmabuf_get_backing_width(dmabuf);
|
|
|
+ backing_height = qemu_dmabuf_get_backing_height(dmabuf);
|
|
|
+ y0_top = qemu_dmabuf_get_y0_top(dmabuf);
|
|
|
|
|
|
- if (dmabuf->allow_fences) {
|
|
|
+ gd_egl_scanout_texture(dcl, texture, y0_top, backing_width, backing_height,
|
|
|
+ x, y, width, height, NULL);
|
|
|
+
|
|
|
+ if (qemu_dmabuf_get_allow_fences(dmabuf)) {
|
|
|
vc->gfx.guest_fb.dmabuf = dmabuf;
|
|
|
}
|
|
|
#endif
|
|
@@ -292,15 +303,19 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl,
|
|
|
{
|
|
|
#ifdef CONFIG_GBM
|
|
|
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
|
|
+ uint32_t backing_width, backing_height, texture;
|
|
|
|
|
|
if (dmabuf) {
|
|
|
egl_dmabuf_import_texture(dmabuf);
|
|
|
- if (!dmabuf->texture) {
|
|
|
+ texture = qemu_dmabuf_get_texture(dmabuf);
|
|
|
+ if (!texture) {
|
|
|
return;
|
|
|
}
|
|
|
- egl_fb_setup_for_tex(&vc->gfx.cursor_fb,
|
|
|
- dmabuf->backing_width, dmabuf->backing_height,
|
|
|
- dmabuf->texture, false);
|
|
|
+
|
|
|
+ backing_width = qemu_dmabuf_get_backing_width(dmabuf);
|
|
|
+ backing_height = qemu_dmabuf_get_backing_height(dmabuf);
|
|
|
+ egl_fb_setup_for_tex(&vc->gfx.cursor_fb, backing_width, backing_height,
|
|
|
+ texture, false);
|
|
|
} else {
|
|
|
egl_fb_destroy(&vc->gfx.cursor_fb);
|
|
|
}
|
|
@@ -364,7 +379,8 @@ void gd_egl_flush(DisplayChangeListener *dcl,
|
|
|
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
|
|
GtkWidget *area = vc->gfx.drawing_area;
|
|
|
|
|
|
- if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitted) {
|
|
|
+ if (vc->gfx.guest_fb.dmabuf &&
|
|
|
+ !qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
|
|
|
graphic_hw_gl_block(vc->gfx.dcl.con, true);
|
|
|
vc->gfx.guest_fb.dmabuf->draw_submitted = true;
|
|
|
gtk_egl_set_scanout_mode(vc, true);
|