Skip to contentSkip to conversation

Milkymist: Allow building on OpenBSD (without SDL)

PATCH New Philippe Mathieu-Daudé 1 participant 5 messages Jan 30, 2019

lore
Share & tools
lore
#0 lore raw

v4 cover Milkymist: Allow building on OpenBSD (without SDL)

since v3:
- simply move LM32 'display' specific hardware (Gerd)
- drop ./configure patch (Gerd)

since v2:
- move LM32 specific hardware out of common-obj to bypass make rules limitations
- use "WARNING" string in configure

v1 was too simple to work, so here we go again.
I hit a problem with the Milkymist TMU device when disabling SDL, so I fixed it and added another patch in this series which clean a bit the device, but is not required for this series. The important patches are 1-3, and eventually 1-2 could be squashed altogether, although the changes are slighly different.

Regards,

Phil.

v1 https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg05509.html
v2 https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg06072.html
v3 https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg07482.html

Philippe Mathieu-Daudé (4):
hw/display: Move Milkymist specific hardware out of common-obj list
configure: LM32 Milkymist Texture Mapping Unit (tmu2) also depends of

    X11

hw/display/milkymist-tmu2: Explicit the dependency to both X11 /
OpenGL
hw/display/milkymist-tmu2: Move inlined code from header to source

 MAINTAINERS                         |  1 +
 configure                           | 10 +++++
 default-configs/lm32-softmmu.mak    |  2 +-
 hw/display/Makefile.objs            |  8 ++--
 hw/display/milkymist-tmu2.c         | 49 ++++++++++++++++++++++
 hw/lm32/milkymist-hw.h              | 63 -----------------------------
 hw/lm32/milkymist.c                 |  1 +
 include/hw/display/milkymist_tmu2.h | 41 +++++++++++++++++++
 8 files changed, 107 insertions(+), 68 deletions(-)
 create mode 100644 include/hw/display/milkymist_tmu2.h
Signature · 1 line
2.20.1
#4 lore raw

PATCH v4 4/4 hw/display/milkymist-tmu2: Move inlined code from header to source

Move the complexity of milkymist_tmu2_create() into the source file. Doing so we avoid to include the X11/OpenGL headers in all LM32 devices, and we also avoid the duplicate declaration of glx_fbconfig_attr[] (it is already declared in hw/display/milkymist-tmu2.c).
Since TYPE_MILKYMIST_TMU2 is now accessible, use it.

---
 MAINTAINERS                         |  1 +
 hw/display/milkymist-tmu2.c         | 49 ++++++++++++++++++++++
 hw/lm32/milkymist-hw.h              | 63 -----------------------------
 hw/lm32/milkymist.c                 |  1 +
 include/hw/display/milkymist_tmu2.h | 41 +++++++++++++++++++
 5 files changed, 92 insertions(+), 63 deletions(-)
 create mode 100644 include/hw/display/milkymist_tmu2.h
MAINTAINERS +1 -0
index b334b53979..737a33b102 100644
@@ -185,6 +185,7 @@ F: disas/lm32.c
 F: hw/lm32/
 F: hw/*/lm32_*
 F: hw/*/milkymist-*
+F: include/hw/display/milkymist_tmu2.h
 F: include/hw/char/lm32_juart.h
 F: include/hw/lm32/
 F: tests/tcg/lm32/
hw/display/milkymist-tmu2.c +49 -0

58 lines not on this page · raw message

hw/lm32/milkymist-hw.h +0 -63

69 lines not on this page · raw message

hw/lm32/milkymist.c +1 -0
index 63c6894c95..26a2398354 100644
@@ -32,6 +32,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "milkymist-hw.h"
+#include "hw/display/milkymist_tmu2.h"
 #include "lm32.h"
 #include "exec/address-spaces.h"
 
include/hw/display/milkymist_tmu2.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH v4 1/4 hw/display: Move Milkymist specific hardware out of common-obj list

In reply to Philippe Mathieu-Daudé

The Milkymist specific hardware is only used by the LM32 target, it is pointless to compile those objects in other targets.

---
 hw/display/Makefile.objs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/Makefile.objs +2 -2
index 97acd5b6cb..5b770817c7 100644
@@ -25,10 +25,10 @@ common-obj-$(CONFIG_BOCHS_DISPLAY) += edid-region.o
 common-obj-$(CONFIG_BLIZZARD) += blizzard.o
 common-obj-$(CONFIG_EXYNOS4) += exynos4210_fimd.o
 common-obj-$(CONFIG_FRAMEBUFFER) += framebuffer.o
-common-obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
+obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
 common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
 
-common-obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
+obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
 milkymist-tmu2.o-cflags := $(X11_CFLAGS)
 milkymist-tmu2.o-libs := $(X11_LIBS)
 
Signature · 1 line
2.20.1
#3 lore raw

PATCH v4 3/4 hw/display/milkymist-tmu2: Explicit the dependency to both X11 / OpenGL

In reply to Philippe Mathieu-Daudé

The TMU device requires both X11 and OpenGL.

---
 default-configs/lm32-softmmu.mak | 2 +-
 hw/display/Makefile.objs         | 4 ++--
 hw/lm32/milkymist-hw.h           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
default-configs/lm32-softmmu.mak +1 -1
index 4889348a10..4049b23562 100644
@@ -2,7 +2,7 @@
 
 CONFIG_LM32=y
 CONFIG_MILKYMIST=y
-CONFIG_MILKYMIST_TMU2=$(CONFIG_OPENGL)
+CONFIG_MILKYMIST_TMU2=$(call land,$(CONFIG_X11),$(CONFIG_OPENGL))
 CONFIG_FRAMEBUFFER=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI01=y
hw/display/Makefile.objs +2 -2
index 5b770817c7..7c4ae9a0fd 100644
@@ -29,8 +29,8 @@ obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
 common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
 
 obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
-milkymist-tmu2.o-cflags := $(X11_CFLAGS)
-milkymist-tmu2.o-libs := $(X11_LIBS)
+milkymist-tmu2.o-cflags := $(X11_CFLAGS) $(OPENGL_CFLAGS)
+milkymist-tmu2.o-libs := $(X11_LIBS) $(OPENGL_LIBS)
 
 obj-$(CONFIG_OMAP) += omap_dss.o
 obj-$(CONFIG_OMAP) += omap_lcdc.o
hw/lm32/milkymist-hw.h +2 -2
index d3be0cfb3a..32c344ef9f 100644
@@ -88,7 +88,7 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
     return dev;
 }
 
-#ifdef CONFIG_OPENGL
+#if defined(CONFIG_X11) && defined(CONFIG_OPENGL)
 #include <X11/Xlib.h>
 #include <epoxy/gl.h>
 #include <epoxy/glx.h>
@@ -103,7 +103,7 @@ static const int glx_fbconfig_attr[] = {
 static inline DeviceState *milkymist_tmu2_create(hwaddr base,
         qemu_irq irq)
 {
-#ifdef CONFIG_OPENGL
+#if defined(CONFIG_X11) && defined(CONFIG_OPENGL)
     DeviceState *dev;
     Display *d;
     GLXFBConfig *configs;
Signature · 1 line
2.20.1
#2 lore raw

PATCH v4 2/4 configure: LM32 Milkymist Texture Mapping Unit (tmu2) also depends of X11

In reply to Philippe Mathieu-Daudé

Commit 5f9b1e35060b8 remove the dependency between OpenGL and X11. However the milkymist-tmu2 device do require X11.
When using SDL, the configure script sets need_x11=yes, so the X11 flags are populated to the makefiles.
When building without SDL, X11 is not pulled and populated, leading to a link failure:

LINK lm32-softmmu/qemu-system-lm32
hw/lm32/milkymist.o: In function `milkymist_tmu2_create':
hw/lm32/milkymist-hw.h:114: undefined reference to XOpenDisplay' hw/lm32/milkymist-hw.h:140: undefined reference to XFree' hw/lm32/milkymist-hw.h:141: undefined reference to XCloseDisplay' hw/lm32/milkymist-hw.h:130: undefined reference to XCloseDisplay' ../hw/display/milkymist-tmu2.o: In function `tmu2_glx_init':
hw/display/milkymist-tmu2.c:112: undefined reference to XOpenDisplay' hw/display/milkymist-tmu2.c:123: undefined reference to XFree'
collect2: error: ld returned 1 exit status
gmake[1]: *** [Makefile:199: qemu-system-lm32] Error 1

Enforce the X11 dependency when the LM32 target is built. This will allow us to build QEMU without SDL.

---
 configure | 10 ++++++++++
 1 file changed, 10 insertions(+)
configure +10 -0
index b18281c61f..c7024d6662 100755
@@ -4047,6 +4047,16 @@ EOF
   fi
 fi
 
+if test "$opengl" = "yes" -a "$have_x11" = "yes"; then
+  for target in $target_list; do
+    case $target in
+      lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
+        need_x11=yes
+      ;;
+    esac
+  done
+fi
+
 ##########################################
 # libxml2 probe
 if test "$libxml2" != "no" ; then
Signature · 1 line
2.20.1