diff mbox

[v2] ui/opengl: Reduce build required libraries for opengl

Message ID 87a8r58qwj.fsf_-_@mail.parknet.co.jp
State New
Headers show

Commit Message

OGAWA Hirofumi Oct. 26, 2015, 5:45 p.m. UTC
We now use epoxy to load opengl libraries. This means we don't need to
link opengl libraries directly if interfaces handled by epoxy. With
this, we just need epoxy headers and epoxy's *.so to build.

Tested with epoxy-1.3.1.

- sdl2/gtk/console egl stuff doesn't require other than epoxy
- milkymist-tmu2 glx stuff doesn't require other than epoxy

(lm32 test is limited, because can't find mmone-bios.bin, so just test
to load libGL with "./lm32-softmmu/qemu-system-lm32 -M milkymist,accel=qtest")

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 configure                   |   20 +++-----------------
 hw/display/milkymist-tmu2.c |    4 ++--
 hw/lm32/milkymist-hw.h      |    3 ++-
 3 files changed, 7 insertions(+), 20 deletions(-)

Comments

Gerd Hoffmann Oct. 28, 2015, 9:18 a.m. UTC | #1
On Di, 2015-10-27 at 02:45 +0900, OGAWA Hirofumi wrote:
> We now use epoxy to load opengl libraries. This means we don't need to
> link opengl libraries directly if interfaces handled by epoxy. With
> this, we just need epoxy headers and epoxy's *.so to build.
> 
> Tested with epoxy-1.3.1.
> 
> - sdl2/gtk/console egl stuff doesn't require other than epoxy
> - milkymist-tmu2 glx stuff doesn't require other than epoxy
> 
> (lm32 test is limited, because can't find mmone-bios.bin, so just test
> to load libGL with "./lm32-softmmu/qemu-system-lm32 -M milkymist,accel=qtest")

I've tested it, works.  Patch queued up.

thanks,
  Gerd
diff mbox

Patch

diff -puN configure~use-epoxy configure
--- qemu/configure~use-epoxy	2015-10-27 02:20:09.394052857 +0900
+++ qemu-hirofumi/configure	2015-10-27 02:39:16.479498430 +0900
@@ -3149,25 +3149,11 @@  fi
 libs_softmmu="$libs_softmmu $fdt_libs"
 
 ##########################################
-# opengl probe (for sdl2, milkymist-tmu2)
-
-# GLX probe, used by milkymist-tmu2
-# this is temporary, code will be switched to egl mid-term.
-cat > $TMPC << EOF
-#include <X11/Xlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
-EOF
-if compile_prog "" "-lGL -lX11" ; then
-  have_glx=yes
-else
-  have_glx=no
-fi
+# opengl probe (for sdl2, gtk, milkymist-tmu2)
 
 if test "$opengl" != "no" ; then
-  opengl_pkgs="gl glesv2 epoxy egl"
-  if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then
+  opengl_pkgs="epoxy"
+  if $pkg_config $opengl_pkgs x11; then
     opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
     opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
     opengl=yes
diff -puN hw/lm32/milkymist-hw.h~use-epoxy hw/lm32/milkymist-hw.h
--- qemu/hw/lm32/milkymist-hw.h~use-epoxy	2015-10-27 02:20:09.398052849 +0900
+++ qemu-hirofumi/hw/lm32/milkymist-hw.h	2015-10-27 02:20:09.406052831 +0900
@@ -88,7 +88,8 @@  static inline DeviceState *milkymist_pfp
 
 #ifdef CONFIG_OPENGL
 #include <X11/Xlib.h>
-#include <GL/glx.h>
+#include <epoxy/gl.h>
+#include <epoxy/glx.h>
 static const int glx_fbconfig_attr[] = {
     GLX_GREEN_SIZE, 5,
     GLX_GREEN_SIZE, 6,
diff -puN hw/display/milkymist-tmu2.c~use-epoxy hw/display/milkymist-tmu2.c
--- qemu/hw/display/milkymist-tmu2.c~use-epoxy	2015-10-27 02:20:09.398052849 +0900
+++ qemu-hirofumi/hw/display/milkymist-tmu2.c	2015-10-27 02:20:09.406052831 +0900
@@ -30,8 +30,8 @@ 
 #include "qemu/error-report.h"
 
 #include <X11/Xlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
+#include <epoxy/gl.h>
+#include <epoxy/glx.h>
 
 enum {
     R_CTL = 0,