Skip to contentSkip to conversation

console: drop epoxy/gl.h include dependency

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Mar 20, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 ++++
 2 files changed, 7 insertions(+), 11 deletions(-)
include/ui/console.h +3 -11
index d759338..2f4aae2 100644
@@ -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
index aaf226c..1e8d07b 100644
@@ -7,6 +7,10 @@
 #include <SDL.h>
 #include <SDL_syswm.h>
 
+#ifdef CONFIG_OPENGL
+# include <epoxy/gl.h>
+#endif
+
 struct sdl2_console {
     DisplayChangeListener dcl;
     DisplaySurface *surface;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 12 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 from console.h

include/ui/sdl2.h +0 -0
index aaf226c..1e8d07b 100644

include/ui/sdl2.h line 16

Quoted 10 lines
include/ui/sdl2.h +4 -0
@@ -7,6 +7,10 @@
 #include <SDL.h>
 #include <SDL_syswm.h>
 
+#ifdef CONFIG_OPENGL
+# include <epoxy/gl.h>
+#endif
+
 struct sdl2_console {
     DisplayChangeListener dcl;
     DisplaySurface *surface;

ui/sdl2.h is included by ui/sdl2.c, ui/sdl2-2d.c, ui/sdl2-gl.c and ui/sdl2-input.c, but none of those are compiled with OPENGL_CFLAGS so this won't work if epoxy/gl.h isn't on the default include path, I think.

thanks
-- PMM