Skip to contentSkip to conversation

Ui 20180626 patches

GIT PULL Applied Gerd Hoffmann 2 participants 5 messages Jun 26, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit 595123df1d54ed8fbab9e1a73d5a58c5bb71058f:

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2018-06-26 09:45:14 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/ui-20180626-pull-request

for you to fetch changes up to 49213b721f4620364aa09142b5f4d559fed26b53:

sdl2: add checking for NULL (2018-06-26 13:48:49 +0200)

----------------------------------------------------------------
ui: sdl2 fixes, gles support.

----------------------------------------------------------------

Gerd Hoffmann (1):
Add gles support to egl-helpers, wire up in egl-headless and gtk.

Pavel Dovgalyuk (2):
sdl2: fix copypaste issues
sdl2: add checking for NULL

 include/ui/egl-helpers.h |  7 +++---
 include/ui/gtk.h         |  2 +-
 ui/egl-context.c         | 11 ++++++++--
 ui/egl-headless.c        |  3 ++-
 ui/egl-helpers.c         | 55 ++++++++++++++++++++++++++++++++++--------------
 ui/gtk-egl.c             |  4 ++--
 ui/gtk.c                 |  7 ++----
 ui/sdl2.c                | 14 ++++++------
 ui/spice-core.c          |  3 ++-
 9 files changed, 68 insertions(+), 38 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL 2/3] sdl2: fix copypaste issues

From: Pavel Dovgalyuk <[email protected]>

This patch fixes text and mouse event processing. These functions used 'key' field of the event instead of appropriate 'text', 'motion', 'button', or 'wheel'.

Message-id: 20180626064017.17031.47954.stgit@pasha-VirtualBox

---
 ui/sdl2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ui/sdl2.c +4 -4
index 3ae4719c32..3fff9f5b63 100644
@@ -424,7 +424,7 @@ static void handle_keyup(SDL_Event *ev)
 
 static void handle_textinput(SDL_Event *ev)
 {
-    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    struct sdl2_console *scon = get_scon_from_window(ev->text.windowID);
     QemuConsole *con = scon ? scon->dcl.con : NULL;
 
     if (qemu_console_is_graphic(con)) {
@@ -436,7 +436,7 @@ static void handle_textinput(SDL_Event *ev)
 static void handle_mousemotion(SDL_Event *ev)
 {
     int max_x, max_y;
-    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    struct sdl2_console *scon = get_scon_from_window(ev->motion.windowID);
 
     if (!qemu_console_is_graphic(scon->dcl.con)) {
         return;
@@ -468,7 +468,7 @@ static void handle_mousebutton(SDL_Event *ev)
 {
     int buttonstate = SDL_GetMouseState(NULL, NULL);
     SDL_MouseButtonEvent *bev;
-    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    struct sdl2_console *scon = get_scon_from_window(ev->button.windowID);
 
     if (!qemu_console_is_graphic(scon->dcl.con)) {
         return;
@@ -492,7 +492,7 @@ static void handle_mousebutton(SDL_Event *ev)
 
 static void handle_mousewheel(SDL_Event *ev)
 {
-    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    struct sdl2_console *scon = get_scon_from_window(ev->wheel.windowID);
     SDL_MouseWheelEvent *wev = &ev->wheel;
     InputButton btn;
 
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 3/3] sdl2: add checking for NULL

In reply to Gerd Hoffmann

From: Pavel Dovgalyuk <[email protected]>

Sometimes SDL2 console can't be retrieved on events and scon variable becomes NULL. This patch prevents processing of the events when the console is not available.

Message-id: 20180626064729.18070.47600.stgit@pasha-VirtualBox

---
 ui/sdl2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
ui/sdl2.c +3 -3
index 3fff9f5b63..76e59427cc 100644
@@ -438,7 +438,7 @@ static void handle_mousemotion(SDL_Event *ev)
     int max_x, max_y;
     struct sdl2_console *scon = get_scon_from_window(ev->motion.windowID);
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
@@ -470,7 +470,7 @@ static void handle_mousebutton(SDL_Event *ev)
     SDL_MouseButtonEvent *bev;
     struct sdl2_console *scon = get_scon_from_window(ev->button.windowID);
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
@@ -496,7 +496,7 @@ static void handle_mousewheel(SDL_Event *ev)
     SDL_MouseWheelEvent *wev = &ev->wheel;
     InputButton btn;
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
Signature · 1 line
2.9.3
#3 lore raw

[Qemu-devel] [PULL 1/3] Add gles support to egl-helpers, wire up in egl-headless and gtk.

In reply to Gerd Hoffmann

Add support for OpenGL ES to egl-helpers. Wire up the new option for egl-headless and gtk UIs. egl-headless actually works fine. gtk hits a not-yet implemented code path in libEGL when trying to use gles mode:

libEGL warning: FIXME: egl/x11 doesn't support front buffer rendering.

(This is mesa 17.2.3).

Message-id: [email protected]

---
 include/ui/egl-helpers.h |  7 +++---
 include/ui/gtk.h         |  2 +-
 ui/egl-context.c         | 11 ++++++++--
 ui/egl-headless.c        |  3 ++-
 ui/egl-helpers.c         | 55 ++++++++++++++++++++++++++++++++++--------------
 ui/gtk-egl.c             |  4 ++--
 ui/gtk.c                 |  7 ++----
 ui/spice-core.c          |  3 ++-
 8 files changed, 61 insertions(+), 31 deletions(-)
include/ui/egl-helpers.h +4 -3
index 747233ce58..9db7293bdb 100644
@@ -7,6 +7,7 @@
 
 extern EGLDisplay *qemu_egl_display;
 extern EGLConfig qemu_egl_config;
+extern DisplayGLMode qemu_egl_mode;
 
 typedef struct egl_fb {
     int width;
@@ -34,7 +35,7 @@ extern int qemu_egl_rn_fd;
 extern struct gbm_device *qemu_egl_rn_gbm_dev;
 extern EGLContext qemu_egl_rn_ctx;
 
-int egl_rendernode_init(const char *rendernode);
+int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
 int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
 
 void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
@@ -44,8 +45,8 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
 
 EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
 
-int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy);
-int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy);
+int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
+int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
 EGLContext qemu_egl_init_ctx(void);
 
 #endif /* EGL_HELPERS_H */
include/ui/gtk.h +1 -1
index 2922fc64b2..a79780afc7 100644
@@ -127,7 +127,7 @@ void gd_egl_release_dmabuf(DisplayChangeListener *dcl,
                            QemuDmaBuf *dmabuf);
 void gd_egl_scanout_flush(DisplayChangeListener *dcl,
                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
-void gtk_egl_init(void);
+void gtk_egl_init(DisplayGLMode mode);
 int gd_egl_make_current(DisplayChangeListener *dcl,
                         QEMUGLContext ctx);
 
ui/egl-context.c +9 -2
index 2161969abe..78e6c7ab7c 100644
@@ -6,15 +6,22 @@ QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl,
                                       QEMUGLParams *params)
 {
    EGLContext ctx;
-   EGLint ctx_att[] = {
+   EGLint ctx_att_core[] = {
        EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
        EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
        EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
        EGL_NONE
    };
+   EGLint ctx_att_gles[] = {
+       EGL_CONTEXT_CLIENT_VERSION, params->major_ver,
+       EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver,
+       EGL_NONE
+   };
+   bool gles = (qemu_egl_mode == DISPLAYGL_MODE_ES);
 
    ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
-                          eglGetCurrentContext(), ctx_att);
+                          eglGetCurrentContext(),
+                          gles ? ctx_att_gles : ctx_att_core);
    return ctx;
 }
 
ui/egl-headless.c +2 -1
index 7c877122d3..42a41310b0 100644
@@ -171,11 +171,12 @@ static void early_egl_headless_init(DisplayOptions *opts)
 
 static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
 {
+    DisplayGLMode mode = opts->has_gl ? opts->gl : DISPLAYGL_MODE_ON;
     QemuConsole *con;
     egl_dpy *edpy;
     int idx;
 
-    if (egl_rendernode_init(NULL) < 0) {
+    if (egl_rendernode_init(NULL, mode) < 0) {
         error_report("egl: render node init failed");
         exit(1);
     }
ui/egl-helpers.c +39 -16

127 lines not on this page · raw message

ui/gtk-egl.c +2 -2
index 9390c6762e..fb00ad12ec 100644
@@ -280,12 +280,12 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,
     eglSwapBuffers(qemu_egl_display, vc->gfx.esurface);
 }
 
-void gtk_egl_init(void)
+void gtk_egl_init(DisplayGLMode mode)
 {
     GdkDisplay *gdk_display = gdk_display_get_default();
     Display *x11_display = gdk_x11_display_get_xdisplay(gdk_display);
 
-    if (qemu_egl_init_dpy_x11(x11_display) < 0) {
+    if (qemu_egl_init_dpy_x11(x11_display, mode) < 0) {
         return;
     }
 
ui/gtk.c +2 -5
index 903f136b8f..5cce6ed42d 100644
@@ -2485,10 +2485,6 @@ static void early_gtk_display_init(DisplayOptions *opts)
 
     assert(opts->type == DISPLAY_TYPE_GTK);
     if (opts->has_gl && opts->gl != DISPLAYGL_MODE_OFF) {
-        if (opts->gl == DISPLAYGL_MODE_ES) {
-            error_report("gtk: opengl es not supported");
-            return;
-        }
 #if defined(CONFIG_OPENGL)
 #if defined(CONFIG_GTK_GL) && defined(GDK_WINDOWING_WAYLAND)
         if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
@@ -2497,7 +2493,8 @@ static void early_gtk_display_init(DisplayOptions *opts)
         } else
 #endif
         {
-            gtk_egl_init();
+            DisplayGLMode mode = opts->has_gl ? opts->gl : DISPLAYGL_MODE_ON;
+            gtk_egl_init(mode);
         }
 #endif
     }
ui/spice-core.c +2 -1
index ae8921a201..f8c0878529 100644
@@ -829,7 +829,8 @@ void qemu_spice_init(void)
                          "incompatible with -spice port/tls-port");
             exit(1);
         }
-        if (egl_rendernode_init(qemu_opt_get(opts, "rendernode")) != 0) {
+        if (egl_rendernode_init(qemu_opt_get(opts, "rendernode"),
+                                DISPLAYGL_MODE_ON) != 0) {
             error_report("Failed to initialize EGL render node for SPICE GL");
             exit(1);
         }
Signature · 1 line
2.9.3
#4 lore raw
In reply to Gerd Hoffmann
Quoted 15 lines · Gerd Hoffmann

The following changes since commit 595123df1d54ed8fbab9e1a73d5a58c5bb71058f:

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2018-06-26 09:45:14 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/ui-20180626-pull-request

for you to fetch changes up to 49213b721f4620364aa09142b5f4d559fed26b53:

sdl2: add checking for NULL (2018-06-26 13:48:49 +0200)

----------------------------------------------------------------
ui: sdl2 fixes, gles support.

Quoted 9 lines

----------------------------------------------------------------

Gerd Hoffmann (1):
Add gles support to egl-helpers, wire up in egl-headless and gtk.

Pavel Dovgalyuk (2):
sdl2: fix copypaste issues
sdl2: add checking for NULL

Applied, thanks.

-- PMM