Skip to content

Commit

Permalink
gtk-egl: add scanout_disable support
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1487669841-13668-7-git-send-email-kraxel@redhat.com
  • Loading branch information
kraxel committed Feb 27, 2017
1 parent db6cdfb commit 543a7a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/ui/gtk.h
Expand Up @@ -103,6 +103,7 @@ void gd_egl_switch(DisplayChangeListener *dcl,
DisplaySurface *surface);
QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
QEMUGLParams *params);
void gd_egl_scanout_disable(DisplayChangeListener *dcl);
void gd_egl_scanout_texture(DisplayChangeListener *dcl,
uint32_t backing_id,
bool backing_y_0_top,
Expand Down
15 changes: 10 additions & 5 deletions ui/gtk-egl.c
Expand Up @@ -170,6 +170,16 @@ QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
return qemu_egl_create_context(dcl, params);
}

void gd_egl_scanout_disable(DisplayChangeListener *dcl)
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);

vc->gfx.w = 0;
vc->gfx.h = 0;
vc->gfx.tex_id = 0;
gtk_egl_set_scanout_mode(vc, false);
}

void gd_egl_scanout_texture(DisplayChangeListener *dcl,
uint32_t backing_id, bool backing_y_0_top,
uint32_t backing_width, uint32_t backing_height,
Expand All @@ -188,11 +198,6 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
vc->gfx.esurface, vc->gfx.ectx);

if (vc->gfx.tex_id == 0 || vc->gfx.w == 0 || vc->gfx.h == 0) {
gtk_egl_set_scanout_mode(vc, false);
return;
}

gtk_egl_set_scanout_mode(vc, true);
if (!vc->gfx.fbo_id) {
glGenFramebuffers(1, &vc->gfx.fbo_id);
Expand Down
1 change: 1 addition & 0 deletions ui/gtk.c
Expand Up @@ -688,6 +688,7 @@ static const DisplayChangeListenerOps dcl_egl_ops = {
.dpy_gl_ctx_destroy = qemu_egl_destroy_context,
.dpy_gl_ctx_make_current = gd_egl_make_current,
.dpy_gl_ctx_get_current = qemu_egl_get_current_context,
.dpy_gl_scanout_disable = gd_egl_scanout_disable,
.dpy_gl_scanout_texture = gd_egl_scanout_texture,
.dpy_gl_update = gd_egl_scanout_flush,
};
Expand Down

0 comments on commit 543a7a1

Please sign in to comment.