From nobody Fri Nov 7 11:22:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548292842880337.01943337633986; Wed, 23 Jan 2019 17:20:42 -0800 (PST) Received: from localhost ([127.0.0.1]:44524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTh6-000794-NX for importer@patchew.org; Wed, 23 Jan 2019 20:20:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTcm-00042w-4M for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmTcl-0000Ss-DT for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44830) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmTcl-0000ST-8A for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:07 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 686A87AEB6; Thu, 24 Jan 2019 01:16:06 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3654E65947; Thu, 24 Jan 2019 01:16:04 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 02:15:51 +0100 Message-Id: <20190124011554.25418-2-philmd@redhat.com> In-Reply-To: <20190124011554.25418-1-philmd@redhat.com> References: <20190124011554.25418-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 24 Jan 2019 01:16:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/4] configure: LM32 Milkymist Texture Mapping Unit (tmu2) also depends of X11 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Michael Walle , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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=3Dyes, 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- configure | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configure b/configure index 8f312ac3e2..d50defceb7 100755 --- a/configure +++ b/configure @@ -4038,6 +4038,16 @@ EOF fi fi =20 +if test "$opengl" =3D "yes" -a "$have_x11" =3D "yes"; then + for target in $target_list; do + case $target in + lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL + need_x11=3Dyes + ;; + esac + done +fi + ########################################## # libxml2 probe if test "$libxml2" !=3D "no" ; then --=20 2.20.1 From nobody Fri Nov 7 11:22:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548292999799955.4345171889195; Wed, 23 Jan 2019 17:23:19 -0800 (PST) Received: from localhost ([127.0.0.1]:44580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTje-0000s8-43 for importer@patchew.org; Wed, 23 Jan 2019 20:23:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTco-00046w-TU for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmTco-0000X4-5X for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmTco-0000WZ-0D for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:10 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BF4BC049AFF; Thu, 24 Jan 2019 01:16:09 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB7D81727C; Thu, 24 Jan 2019 01:16:06 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 02:15:52 +0100 Message-Id: <20190124011554.25418-3-philmd@redhat.com> In-Reply-To: <20190124011554.25418-1-philmd@redhat.com> References: <20190124011554.25418-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 24 Jan 2019 01:16:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/4] hw/display/milkymist-tmu2: Explicit the dependency to both X11 / OpenGL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Michael Walle , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The TMU device requires both X11 and OpenGL. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- default-configs/lm32-softmmu.mak | 2 +- hw/display/Makefile.objs | 4 ++-- hw/lm32/milkymist-hw.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/default-configs/lm32-softmmu.mak b/default-configs/lm32-softmm= u.mak index 4889348a10..4049b23562 100644 --- a/default-configs/lm32-softmmu.mak +++ b/default-configs/lm32-softmmu.mak @@ -2,7 +2,7 @@ =20 CONFIG_LM32=3Dy CONFIG_MILKYMIST=3Dy -CONFIG_MILKYMIST_TMU2=3D$(CONFIG_OPENGL) +CONFIG_MILKYMIST_TMU2=3D$(call land,$(CONFIG_X11),$(CONFIG_OPENGL)) CONFIG_FRAMEBUFFER=3Dy CONFIG_PTIMER=3Dy CONFIG_PFLASH_CFI01=3Dy diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 97acd5b6cb..079e702f25 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -29,8 +29,8 @@ common-obj-$(CONFIG_MILKYMIST) +=3D milkymist-vgafb.o common-obj-$(CONFIG_ZAURUS) +=3D tc6393xb.o =20 common-obj-$(CONFIG_MILKYMIST_TMU2) +=3D milkymist-tmu2.o -milkymist-tmu2.o-cflags :=3D $(X11_CFLAGS) -milkymist-tmu2.o-libs :=3D $(X11_LIBS) +milkymist-tmu2.o-cflags :=3D $(X11_CFLAGS) $(OPENGL_CFLAGS) +milkymist-tmu2.o-libs :=3D $(X11_LIBS) $(OPENGL_LIBS) =20 obj-$(CONFIG_OMAP) +=3D omap_dss.o obj-$(CONFIG_OMAP) +=3D omap_lcdc.o diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h index d3be0cfb3a..32c344ef9f 100644 --- a/hw/lm32/milkymist-hw.h +++ b/hw/lm32/milkymist-hw.h @@ -88,7 +88,7 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr b= ase, return dev; } =20 -#ifdef CONFIG_OPENGL +#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) #include #include #include @@ -103,7 +103,7 @@ static const int glx_fbconfig_attr[] =3D { 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; --=20 2.20.1 From nobody Fri Nov 7 11:22:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548292999906381.75368156119384; Wed, 23 Jan 2019 17:23:19 -0800 (PST) Received: from localhost ([127.0.0.1]:44578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTjd-0000rY-P8 for importer@patchew.org; Wed, 23 Jan 2019 20:23:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTcr-00049Y-FO for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmTcq-0000ac-NY for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50806) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmTcq-0000YF-I6 for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:12 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB5CD2CD811; Thu, 24 Jan 2019 01:16:11 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83C5065947; Thu, 24 Jan 2019 01:16:09 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 02:15:53 +0100 Message-Id: <20190124011554.25418-4-philmd@redhat.com> In-Reply-To: <20190124011554.25418-1-philmd@redhat.com> References: <20190124011554.25418-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 24 Jan 2019 01:16:11 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/4] configure: Let SDL support be optional on OpenBSD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Michael Walle , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Currently if we try to build QEMU on OpenBSD with SDL disabled, we get: $ ./configure --cc=3Dx86_64-unknown-openbsd6.1-gcc-4.9.4 --python=3Dpytho= n2.7 --disable-sdl ERROR: sdl not found or disabled, can not use sdl audio driver Since SDL is not a requirement for OpenBSD, let it be optional. If it is not found, or the user explicitly disable it, remove it from the audio_drv_list. If no audio backends are available, QEMU will fall back to the null driver. Instead of displaying nothing when audio_drv_list ends up empty, display "none". This does not change the default behavior: $ ./configure --cc=3Dx86_64-unknown-openbsd6.1-gcc-4.9.4 --python=3Dpytho= n2.7 SDL support yes (1.2.15) Audio drivers sdl WARNING: Use of SDL 1.2 is deprecated and will be removed in WARNING: future releases. Please switch to using SDL 2.0 GEN config-host.h ... but allows to build without SDL: $ ./configure --cc=3Dx86_64-unknown-openbsd6.1-gcc-4.9.4 --python=3Dpytho= n2.7 --disable-sdl WARN: sdl not found or disabled, can not use sdl audio driver SDL support no Audio drivers none GEN config-host.h ... Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d50defceb7..fa444e9921 100755 --- a/configure +++ b/configure @@ -3379,7 +3379,8 @@ for drv in $audio_drv_list; do =20 sdl) if test "$sdl" =3D "no"; then - error_exit "sdl not found or disabled, can not use sdl audio drive= r" + echo "WARN: sdl not found or disabled, can not use sdl audio drive= r" + audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/sdl *//g') fi ;; =20 @@ -3408,6 +3409,9 @@ for drv in $audio_drv_list; do ;; esac done +if test -z "$audio_drv_list"; then + audio_drv_list=3D"none" +fi =20 ########################################## # BrlAPI probe --=20 2.20.1 From nobody Fri Nov 7 11:22:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548293094077407.98925307217144; Wed, 23 Jan 2019 17:24:54 -0800 (PST) Received: from localhost ([127.0.0.1]:44591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTlB-0001xE-2S for importer@patchew.org; Wed, 23 Jan 2019 20:24:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTcv-0004Du-TR for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmTct-0000fb-G5 for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59910) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmTct-0000eV-8C for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:16:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7847D58A5A; Thu, 24 Jan 2019 01:16:14 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42D1865331; Thu, 24 Jan 2019 01:16:12 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 02:15:54 +0100 Message-Id: <20190124011554.25418-5-philmd@redhat.com> In-Reply-To: <20190124011554.25418-1-philmd@redhat.com> References: <20190124011554.25418-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 24 Jan 2019 01:16:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/4] hw/display/milkymist-tmu2: Move inlined code from header to source X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Michael Walle , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 diff --git a/MAINTAINERS b/MAINTAINERS index af339b86db..3c040f21e7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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/ diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 3ce44fdfce..b33fc234e9 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -31,6 +31,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "hw/display/milkymist_tmu2.h" =20 #include #include @@ -499,3 +500,51 @@ static void milkymist_tmu2_register_types(void) } =20 type_init(milkymist_tmu2_register_types) + +DeviceState *milkymist_tmu2_create(hwaddr base, qemu_irq irq) +{ + DeviceState *dev; + Display *d; + GLXFBConfig *configs; + int nelements; + int ver_major, ver_minor; + + /* check that GLX will work */ + d =3D XOpenDisplay(NULL); + if (d =3D=3D NULL) { + return NULL; + } + + if (!glXQueryVersion(d, &ver_major, &ver_minor)) { + /* + * Yeah, sometimes getting the GLX version can fail. + * Isn't X beautiful? + */ + XCloseDisplay(d); + return NULL; + } + + if ((ver_major < 1) || ((ver_major =3D=3D 1) && (ver_minor < 3))) { + printf("Your GLX version is %d.%d," + "but TMU emulation needs at least 1.3. TMU disabled.\n", + ver_major, ver_minor); + XCloseDisplay(d); + return NULL; + } + + configs =3D glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements); + if (configs =3D=3D NULL) { + XCloseDisplay(d); + return NULL; + } + + XFree(configs); + XCloseDisplay(d); + + dev =3D qdev_create(NULL, TYPE_MILKYMIST_TMU2); + qdev_init_nofail(dev); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); + + return dev; +} diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h index 32c344ef9f..976cf9254d 100644 --- a/hw/lm32/milkymist-hw.h +++ b/hw/lm32/milkymist-hw.h @@ -88,69 +88,6 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr = base, return dev; } =20 -#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) -#include -#include -#include -static const int glx_fbconfig_attr[] =3D { - GLX_GREEN_SIZE, 5, - GLX_GREEN_SIZE, 6, - GLX_BLUE_SIZE, 5, - None -}; -#endif - -static inline DeviceState *milkymist_tmu2_create(hwaddr base, - qemu_irq irq) -{ -#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) - DeviceState *dev; - Display *d; - GLXFBConfig *configs; - int nelements; - int ver_major, ver_minor; - - /* check that GLX will work */ - d =3D XOpenDisplay(NULL); - if (d =3D=3D NULL) { - return NULL; - } - - if (!glXQueryVersion(d, &ver_major, &ver_minor)) { - /* Yeah, sometimes getting the GLX version can fail. - * Isn't X beautiful? */ - XCloseDisplay(d); - return NULL; - } - - if ((ver_major < 1) || ((ver_major =3D=3D 1) && (ver_minor < 3))) { - printf("Your GLX version is %d.%d," - "but TMU emulation needs at least 1.3. TMU disabled.\n", - ver_major, ver_minor); - XCloseDisplay(d); - return NULL; - } - - configs =3D glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements); - if (configs =3D=3D NULL) { - XCloseDisplay(d); - return NULL; - } - - XFree(configs); - XCloseDisplay(d); - - dev =3D qdev_create(NULL, "milkymist-tmu2"); - qdev_init_nofail(dev); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); - - return dev; -#else - return NULL; -#endif -} - static inline DeviceState *milkymist_ac97_create(hwaddr base, qemu_irq crrequest_irq, qemu_irq crreply_irq, qemu_irq dmar_irq, qemu_irq dmaw_irq) diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 63c6894c95..26a2398354 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -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" =20 diff --git a/include/hw/display/milkymist_tmu2.h b/include/hw/display/milky= mist_tmu2.h new file mode 100644 index 0000000000..148a119a1d --- /dev/null +++ b/include/hw/display/milkymist_tmu2.h @@ -0,0 +1,41 @@ +/* + * QEMU model of the Milkymist texture mapping unit. + * + * Copyright (c) 2010 Michael Walle + * Copyright (c) 2010 Sebastien Bourdeauducq + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * + * Specification available at: + * http://milkymist.walle.cc/socdoc/tmu2.pdf + * + */ + +#ifndef HW_DISPLAY_MILKYMIST_TMU2_H +#define HW_DISPLAY_MILKYMIST_TMU2_H + +#include "hw/qdev.h" + +#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) +DeviceState *milkymist_tmu2_create(hwaddr base, qemu_irq irq); +#else +static inline DeviceState *milkymist_tmu2_create(hwaddr base, qemu_irq irq) +{ + return NULL; +} +#endif + +#endif /* HW_DISPLAY_MILKYMIST_TMU2_H */ --=20 2.20.1