console: drop epoxy/gl.h include dependency
PATCH v3 1/1 console: drop epoxy/gl.h include dependency
Use "unsigned int" instead of GLenum and GLuint, so we don't depend on these types from opengl headers. Drop all CONFIG_OPENGL #ifdefs from console.h
--- include/ui/console.h | 14 +++----------- include/ui/sdl2.h | 4 ++++ ui/sdl2-gl.c | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-)
include/ui/console.h +3 -11
@@ -9,10 +9,6 @@#include "qemu/error-report.h" #include "qapi/error.h" -#ifdef CONFIG_OPENGL -# include <epoxy/gl.h> -#endif -/* keyboard/mouse support */ #define MOUSE_EVENT_LBUTTON 0x01
@@ -136,11 +132,9 @@ struct DisplaySurface {pixman_format_code_t format;pixman_image_t *image;uint8_t flags; -#ifdef CONFIG_OPENGL -GLenum glformat; -GLenum gltype; -GLuint texture; -#endif +unsigned int glformat; +unsigned int gltype; +unsigned int texture; }; typedef struct QemuUIInfo {
@@ -410,7 +404,6 @@ DisplaySurface *qemu_console_surface(QemuConsole *con);/* console-gl.c */ typedef struct ConsoleGLState ConsoleGLState ; -#ifdef CONFIG_OPENGL ConsoleGLState *console_gl_init_context (void );void console_gl_fini_context (ConsoleGLState *gls); bool console_gl_check_format(DisplayChangeListener *dcl,
@@ -427,7 +420,6 @@ void surface_gl_destroy_texture(ConsoleGLState *gls,void surface_gl_setup_viewport (ConsoleGLState *gls,DisplaySurface *surface,int ww,int wh); -#endif /* sdl.c */ #ifdef CONFIG_SDL
include/ui/sdl2.h +4 -0
@@ -7,6 +7,10 @@#include <SDL.h> #include <SDL_syswm.h> +#ifdef CONFIG_OPENGL +# include <SDL_opengl.h> +#endif +struct sdl2_console {DisplayChangeListener dcl;DisplaySurface *surface;
ui/sdl2-gl.c +1 -1
@@ -29,10 +29,10 @@#include "qemu-common.h" #include "ui/console.h" #include "ui/input.h" -#include "ui/sdl2.h" #include "sysemu/sysemu.h" #include <epoxy/gl.h> +#include "ui/sdl2.h" static void sdl2_set_scanout_mode (struct sdl2_console *scon,bool scanout) {
Signature · 1 line
1.8.3.1
Quoted 6 lines · Gerd Hoffmann
Use "unsigned int" instead of GLenum and GLuint, so we don't depend on these types from opengl headers. Drop all
CONFIG_OPENGL#ifdefs fromconsole.hReported-by Peter Maydell <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>
This isn't sufficient to fix the compile failure on OpenBSD, because there are still files which #include <epoxy/gl.h> but which aren't being compiled with OPENGL_CFLAGS:
hw/lm32/milkymist.c (via milkymist-hw.h) ui/sdl2-gl.c
ui/egl-context.c (via ui/egl-context.h and ui/egl-helpers.h) ui/gtk.c (via ui/gtk.h and ui/egl-helpers.h)
just to take the first few I found via grep. (The OpenBSD build fails on egl-context.o.)
Rather than trying to figure out exactly which .c files need to have the OPENGL_CFLAGS applied to them, I think it would be better if we just put them into the standard QEMU_CFLAGS that we use for building all objects, the same way we do for other library CFLAGS requirements. Or is there a reason we can't do that with OpenGL?
thanks
-- PMM
Hi,
Quoted 12 lines
This isn't sufficient to fix the compile failure on OpenBSD, because there are still files which #include <
epoxy/gl.h> but which aren't being compiled withOPENGL_CFLAGS:
hw/lm32/milkymist.c(viamilkymist-hw.h)ui/sdl2-gl.c
ui/egl-context.c(viaui/egl-context.handui/egl-helpers.h)ui/gtk.c(viaui/gtk.handui/egl-helpers.h)just to take the first few I found via grep. (The OpenBSD build fails on egl-context.o.)
Quoted 6 lines
Rather than trying to figure out exactly which .c files need to have the
OPENGL_CFLAGSapplied to them, I think it would be better if we just put them into the standardQEMU_CFLAGSthat we use for building all objects, the same way we do for other library CFLAGS requirements. Or is there a reason we can't do that with OpenGL?
I don't want do this for OPENGL_LIBS, so if we modularize UIs some day only the ui modules with opengl support depend on opengl libs, and I somehow dislike the asymmetry between OPENGL_LIBS and QEMU_CFLAGS. But other than that there are no reasons I'm aware of why this shouldn't work. Patch follows in a moment.
cheers,
Gerd