summary refs log tree commit diff stats
path: root/ui/console-gl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-05-17 17:25:19 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-05-17 17:25:19 +0100
commit1b46b4daa6fbf45eddcf77877379a0afac341df9 (patch)
tree83ca6edb7e62f01c6d82272b970e90a1d9b05354 /ui/console-gl.c
parent27cb89d1d321e6deb6fc7f80771bb0018af4cd49 (diff)
parent5fff13f245cddd3bc260dfe6ebe1b1f05b72116f (diff)
downloadfocaccia-qemu-1b46b4daa6fbf45eddcf77877379a0afac341df9.tar.gz
focaccia-qemu-1b46b4daa6fbf45eddcf77877379a0afac341df9.zip
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190517-pull-request' into staging
ui: bugfixes for curses, opengl console and kbd state tracker.

# gpg: Signature made Fri 17 May 2019 17:12:30 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20190517-pull-request:
  kbd-state: fix autorepeat handling
  ui/console: Precautionary glBindTexture and surface->texture validation in surface_gl_update_texture
  ui/curses: manipulate cchar_t with standard curses functions
  ui/curses: do not assume wchar_t contains unicode

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/console-gl.c')
-rw-r--r--ui/console-gl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/console-gl.c b/ui/console-gl.c
index a56e1cd8eb..c1cb3bd673 100644
--- a/ui/console-gl.c
+++ b/ui/console-gl.c
@@ -92,13 +92,17 @@ void surface_gl_update_texture(QemuGLShader *gls,
 
     assert(gls);
 
-    glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,
-                  surface_stride(surface) / surface_bytes_per_pixel(surface));
-    glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    x, y, w, h,
-                    surface->glformat, surface->gltype,
-                    data + surface_stride(surface) * y
-                    + surface_bytes_per_pixel(surface) * x);
+    if (surface->texture) {
+        glBindTexture(GL_TEXTURE_2D, surface->texture);
+        glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,
+                      surface_stride(surface)
+                      / surface_bytes_per_pixel(surface));
+        glTexSubImage2D(GL_TEXTURE_2D, 0,
+                        x, y, w, h,
+                        surface->glformat, surface->gltype,
+                        data + surface_stride(surface) * y
+                        + surface_bytes_per_pixel(surface) * x);
+    }
 }
 
 void surface_gl_render_texture(QemuGLShader *gls,