Skip to contentSkip to conversation

egl-helpers.h: add a missing X11 include

PATCH In review Alexander Kanavin 4 participants 7 messages Jan 15, 2019 – Jan 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 egl-helpers.h: add a missing X11 include

Otherwise these errors occur, when qemu is built in the Yocto project:

| In file included from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-context.h:5,
|                  from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/ui/egl-context.c:3:
| /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-helpers.h:46:55: error: unknown type name 'Window'; did you mean 'minor'?
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor
---
 include/ui/egl-helpers.h | 1 +
 1 file changed, 1 insertion(+)
include/ui/egl-helpers.h +1 -0
index 9db7293bdb..2c32d77e7a 100644
@@ -4,6 +4,7 @@
 #include <epoxy/gl.h>
 #include <epoxy/egl.h>
 #include <gbm.h>
+#include <X11/Xlib.h>
 
 extern EGLDisplay *qemu_egl_display;
 extern EGLConfig qemu_egl_config;
Signature · 1 line
2.17.1
#1 lore raw

Hi Alexander,

Cc'ing Gerd (the maintainer) and Marc-André.

Quoted 7 lines · Alexander Kanavin

Otherwise these errors occur, when qemu is built in the Yocto project:

| In file included from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-context.h:5,
|                  from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/ui/egl-context.c:3:
| /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-helpers.h:46:55: error: unknown type name 'Window'; did you mean 'minor'?
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor

Can you provide more information to reproduce this failure?

It seems some dependency is missing in your build setup. Missing headers would trigger the definition of MESA_EGL_NO_X11_HEADERS and this error.

<epoxy/egl.h> includes <EGL/eglplatform.h> which contains:

  #if defined(MESA_EGL_NO_X11_HEADERS)
  typedef void            *EGLNativeDisplayType;
  typedef khronos_uintptr_t EGLNativePixmapType;
  typedef khronos_uintptr_t EGLNativeWindowType;
  #else
  /* X11 (tentative)  */
  #include <X11/Xlib.h>

So Window should already be declared.

Thanks,

Phil.

Quoted 19 lines
---
 include/ui/egl-helpers.h | 1 +
 1 file changed, 1 insertion(+)
include/ui/egl-helpers.h +1 -0
index 9db7293bdb..2c32d77e7a 100644
@@ -4,6 +4,7 @@
 #include <epoxy/gl.h>
 #include <epoxy/egl.h>
 #include <gbm.h>
+#include <X11/Xlib.h>
 
 extern EGLDisplay *qemu_egl_display;
 extern EGLConfig qemu_egl_config;
#2 lore raw
Quoted 26 lines · Philippe Mathieu-Daudé

Cc'ing Gerd (the maintainer) and Marc-André.

Quoted 7 lines · Alexander Kanavin

Otherwise these errors occur, when qemu is built in the Yocto project:

| In file included from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-context.h:5,
|                  from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/ui/egl-context.c:3:
| /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-helpers.h:46:55: error: unknown type name 'Window'; did you mean 'minor'?
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor

Can you provide more information to reproduce this failure?

It seems some dependency is missing in your build setup. Missing headers would trigger the definition of MESA_EGL_NO_X11_HEADERS and this error.

<epoxy/egl.h> includes <EGL/eglplatform.h> which contains:

  #if defined(MESA_EGL_NO_X11_HEADERS)
  typedef void            *EGLNativeDisplayType;
  typedef khronos_uintptr_t EGLNativePixmapType;
  typedef khronos_uintptr_t EGLNativeWindowType;
  #else
  /* X11 (tentative)  */
  #include <X11/Xlib.h>
Quoted 1 line

So Window should already be declared.

Hello Philippe,

we build mesa explicitly using "--with-platforms='drm surfaceless'" (x11 is not in the list), which means MESA_EGL_NO_X11_HEADERS is indeed defined according to [1]. We also enable opengl and gtk in qemu.
I believe this is a valid configuration, and so should not lead to compile errors (we're fine if it will cause run-time errors for some combinations of qemu options). A header should not rely on a conditional include happening somewhere else.

[1] https://cgit.freedesktop.org/mesa/mesa/tree/configure.ac#n2533

Thanks,
Alex

#3 lore raw
Quoted 17 lines · Alexander Kanavin
Quoted 16 lines · Philippe Mathieu-Daudé

Cc'ing Gerd (the maintainer) and Marc-André.

Quoted 3 lines
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor

<epoxy/egl.h> includes <EGL/eglplatform.h> which contains:

  #if defined(MESA_EGL_NO_X11_HEADERS)
  typedef void            *EGLNativeDisplayType;
  typedef khronos_uintptr_t EGLNativePixmapType;
  typedef khronos_uintptr_t EGLNativeWindowType;
  #else
  /* X11 (tentative)  */
  #include <X11/Xlib.h>
Quoted 8 lines
Quoted 1 line

So Window should already be declared.

Hello Philippe,

we build mesa explicitly using "--with-platforms='drm surfaceless'" (x11 is not in the list), which means MESA_EGL_NO_X11_HEADERS is indeed defined according to [1]. We also enable opengl and gtk in qemu.

Hmm, should we use EGLNativeWindowType instead of Window then?

cheers,
Gerd

#4 lore raw
Quoted 20 lines · Gerd Hoffmann
Quoted 19 lines · Alexander Kanavin
Quoted 17 lines · Philippe Mathieu-Daudé

Cc'ing Gerd (the maintainer) and Marc-André.

Quoted 3 lines
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor

<epoxy/egl.h> includes <EGL/eglplatform.h> which contains:

  #if defined(MESA_EGL_NO_X11_HEADERS)
  typedef void            *EGLNativeDisplayType;
  typedef khronos_uintptr_t EGLNativePixmapType;
  typedef khronos_uintptr_t EGLNativeWindowType;
  #else
  /* X11 (tentative)  */
  #include <X11/Xlib.h>

So Window should already be declared.

Quoted 8 lines
Quoted 6 lines

Hello Philippe,

we build mesa explicitly using "--with-platforms='drm surfaceless'" (x11 is not in the list), which means MESA_EGL_NO_X11_HEADERS is indeed defined according to [1]. We also enable opengl and gtk in qemu.

Hmm, should we use EGLNativeWindowType instead of Window then?

Yes, I prefer this too but was not sure you'd like that :)

Alexander do you want to write the patch or should I?

#5 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 6 lines
Quoted 4 lines

we build mesa explicitly using "--with-platforms='drm surfaceless'" (x11 is not in the list), which means MESA_EGL_NO_X11_HEADERS is indeed defined according to [1]. We also enable opengl and gtk in qemu.

Hmm, should we use EGLNativeWindowType instead of Window then?

Yes, I prefer this too but was not sure you'd like that :)

Alexander do you want to write the patch or should I?

I just sent the patch; I am not subscribed to qemu-devel so might take a moment to get through moderation (I suppose?).

Alex

#6 lore raw
In reply to Alexander Kanavin
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 === TEST SCRIPT END ===

CC chardev/testdev.o
CC disas/arm.o
/tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
/tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]

     strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]