From f4c36bdab6a1ec1cfe6508e27c9c60a802b5d084 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 21 Feb 2017 10:37:16 +0100 Subject: console: rename dpy_gl_scanout to dpy_gl_scanout_texture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We'll add a variant which accepts dmabufs soon. Change the name so we can easily disturgish the two variants. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 1487669841-13668-2-git-send-email-kraxel@redhat.com --- include/ui/sdl2.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'include/ui/sdl2.h') diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 683bb6af2e..2de792f45f 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -62,11 +62,13 @@ int sdl2_gl_make_context_current(DisplayChangeListener *dcl, QEMUGLContext ctx); QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl); -void sdl2_gl_scanout(DisplayChangeListener *dcl, - uint32_t backing_id, bool backing_y_0_top, - uint32_t backing_width, uint32_t backing_height, - uint32_t x, uint32_t y, - uint32_t w, uint32_t h); +void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, + uint32_t backing_id, + bool backing_y_0_top, + uint32_t backing_width, + uint32_t backing_height, + uint32_t x, uint32_t y, + uint32_t w, uint32_t h); void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); -- cgit 1.4.1 From db6cdfbeba791a2e5047a44f61d068cefa0b7c91 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 21 Feb 2017 10:37:20 +0100 Subject: sdl2: add scanout_disable support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 1487669841-13668-6-git-send-email-kraxel@redhat.com --- include/ui/sdl2.h | 1 + ui/sdl2-gl.c | 16 +++++++++++----- ui/sdl2.c | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'include/ui/sdl2.h') diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 2de792f45f..aaf226c2c0 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -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, diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index e25aa3bf76..1cd77e2c16 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -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); diff --git a/ui/sdl2.c b/ui/sdl2.c index febda80fcf..faf9bdff5c 100644 --- 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, }; -- cgit 1.4.1