]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
sdl2: add scanout_disable support
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 21 Feb 2017 09:37:20 +0000 (10:37 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 27 Feb 2017 15:15:29 +0000 (16:15 +0100)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1487669841-13668-6-git-send-email-kraxel@redhat.com

include/ui/sdl2.h
ui/sdl2-gl.c
ui/sdl2.c

index 2de792f45f68b686fd049058225285b54be3273e..aaf226c2c0f75983edc6bb83d486fb844a490b9e 100644 (file)
@@ -62,6 +62,7 @@ int sdl2_gl_make_context_current(DisplayChangeListener *dcl,
                                  QEMUGLContext ctx);
 QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl);
 
+void sdl2_gl_scanout_disable(DisplayChangeListener *dcl);
 void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
                              uint32_t backing_id,
                              bool backing_y_0_top,
index e25aa3bf760d16af8e98b4b98a5269c77716497e..1cd77e2c16d5272d1f8190a7178ee5fbc4a82321 100644 (file)
@@ -184,6 +184,17 @@ QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl)
     return (QEMUGLContext)sdlctx;
 }
 
+void sdl2_gl_scanout_disable(DisplayChangeListener *dcl)
+{
+    struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
+
+    assert(scon->opengl);
+    scon->w = 0;
+    scon->h = 0;
+    scon->tex_id = 0;
+    sdl2_set_scanout_mode(scon, false);
+}
+
 void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
                              uint32_t backing_id,
                              bool backing_y_0_top,
@@ -204,11 +215,6 @@ void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
 
     SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
 
-    if (scon->tex_id == 0 || scon->w == 0 || scon->h == 0) {
-        sdl2_set_scanout_mode(scon, false);
-        return;
-    }
-
     sdl2_set_scanout_mode(scon, true);
     if (!scon->fbo_id) {
         glGenFramebuffers(1, &scon->fbo_id);
index febda80fcfbc4c7b38ff40e422bf3f9330cbc930..faf9bdff5c3ff08e69a41d6e7a53417dbd3f6646 100644 (file)
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -733,6 +733,7 @@ static const DisplayChangeListenerOps dcl_gl_ops = {
     .dpy_gl_ctx_destroy      = sdl2_gl_destroy_context,
     .dpy_gl_ctx_make_current = sdl2_gl_make_context_current,
     .dpy_gl_ctx_get_current  = sdl2_gl_get_current_context,
+    .dpy_gl_scanout_disable  = sdl2_gl_scanout_disable,
     .dpy_gl_scanout_texture  = sdl2_gl_scanout_texture,
     .dpy_gl_update           = sdl2_gl_scanout_flush,
 };