Skip to contentSkip to conversation

egl-headless: Allow OpenGL ES context creation

PATCH New Tomeu Vizoso 2 participants 2 messages Jun 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 egl-headless: Allow OpenGL ES context creation

This will be mainly useful for automated testing of virglrenderer on ES.

---
 include/ui/egl-helpers.h |  6 ++---
 qemu-options.hx          |  1 +
 ui/egl-headless.c        |  2 +-
 ui/egl-helpers.c         | 56 +++++++++++++++++++++++++++++-----------
 ui/gtk-egl.c             |  2 +-
 ui/spice-core.c          |  2 +-
 6 files changed, 48 insertions(+), 21 deletions(-)
include/ui/egl-helpers.h +3 -3
index 747233ce5846..9c76a04a2492 100644
@@ -34,7 +34,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, bool gles);
 int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
 
 void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
@@ -45,7 +45,7 @@ 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);
-EGLContext qemu_egl_init_ctx(void);
+int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, bool gles);
+EGLContext qemu_egl_init_ctx(bool gles);
 
 #endif /* EGL_HELPERS_H */
qemu-options.hx +1 -0
index c0d3951e9ffd..baa320ce615d 100644
@@ -1242,6 +1242,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
     "-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n"
     "            [,window_close=on|off][,gl=on|core|es|off]\n"
     "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
+    "-display egl-headless[,gl=core|es]|\n"
     "-display vnc=<display>[,<optargs>]\n"
     "-display curses\n"
     "-display none"
ui/egl-headless.c +1 -1
index 7c877122d385..796bce0bfa67 100644
@@ -175,7 +175,7 @@ static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
     egl_dpy *edpy;
     int idx;
 
-    if (egl_rendernode_init(NULL) < 0) {
+    if (egl_rendernode_init(NULL, opts->gl == DISPLAYGL_MODE_ES) < 0) {
         error_report("egl: render node init failed");
         exit(1);
     }
ui/egl-helpers.c +41 -15

121 lines not on this page · raw message

ui/gtk-egl.c +1 -1
index 9390c6762e87..9ab50a17c029 100644
@@ -57,7 +57,7 @@ void gd_egl_init(VirtualConsole *vc)
         return;
     }
 
-    vc->gfx.ectx = qemu_egl_init_ctx();
+    vc->gfx.ectx = qemu_egl_init_ctx(false);
     vc->gfx.esurface = qemu_egl_init_surface_x11(vc->gfx.ectx, x11_window);
 
     assert(vc->gfx.esurface);
ui/spice-core.c +1 -1
index ae8921a201ca..6d659b64b4ce 100644
@@ -829,7 +829,7 @@ 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"), false) != 0) {
             error_report("Failed to initialize EGL render node for SPICE GL");
             exit(1);
         }
Signature · 1 line
2.17.0
#1 lore raw
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] egl-headless: Allow OpenGL ES context creation

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
b4015e9211 egl-headless: Allow OpenGL ES context creation

=== OUTPUT BEGIN ===
Checking PATCH 1/1: egl-headless: Allow OpenGL ES context creation...
ERROR: braces {} are necessary for all arms of this statement #122: FILE: ui/egl-helpers.c:433:
+ if (gles)
[...]
+ else
[...]

total: 1 errors, 0 warnings, 169 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]