diff mbox series

egl-helpers.h: add a missing X11 include

Message ID 20190115115047.39326-1-alex.kanavin@gmail.com
State New
Headers show
Series egl-helpers.h: add a missing X11 include | expand

Commit Message

Alexander Kanavin Jan. 15, 2019, 11:50 a.m. UTC
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

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 include/ui/egl-helpers.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Jan. 15, 2019, 7:58 p.m. UTC | #1
Hi Alexander,

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

On 1/15/19 12:50 PM, Alexander Kanavin wrote:
> 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.

> 
> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> ---
>  include/ui/egl-helpers.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
> index 9db7293bdb..2c32d77e7a 100644
> --- a/include/ui/egl-helpers.h
> +++ b/include/ui/egl-helpers.h
> @@ -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;
>
Alexander Kanavin Jan. 15, 2019, 8:47 p.m. UTC | #2
On Tue, 15 Jan 2019 at 20:58, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Cc'ing Gerd (the maintainer) and Marc-André.
>
> On 1/15/19 12:50 PM, Alexander Kanavin wrote:
> > 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.

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
Gerd Hoffmann Jan. 16, 2019, 5:53 a.m. UTC | #3
On Tue, Jan 15, 2019 at 09:47:08PM +0100, Alexander Kanavin wrote:
> On Tue, 15 Jan 2019 at 20:58, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> > Cc'ing Gerd (the maintainer) and Marc-André.
> >
> > > |  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.
> 
> 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
Philippe Mathieu-Daudé Jan. 16, 2019, 11:10 a.m. UTC | #4
On 1/16/19 6:53 AM, Gerd Hoffmann wrote:
> On Tue, Jan 15, 2019 at 09:47:08PM +0100, Alexander Kanavin wrote:
>> On Tue, 15 Jan 2019 at 20:58, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>> Cc'ing Gerd (the maintainer) and Marc-André.
>>>
>>>> |  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.
>>
>> 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?
Alexander Kanavin Jan. 16, 2019, 11:39 a.m. UTC | #5
On Wed, 16 Jan 2019 at 12:10, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> >> 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
no-reply@patchew.org Jan. 21, 2019, 3:51 a.m. UTC | #6
Patchew URL: https://patchew.org/QEMU/20190115115047.39326-1-alex.kanavin@gmail.com/



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/20190115115047.39326-1-alex.kanavin@gmail.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
diff mbox series

Patch

diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index 9db7293bdb..2c32d77e7a 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -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;