From patchwork Wed Jan 30 12:00:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10788451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0174A6C2 for ; Wed, 30 Jan 2019 12:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E52922E8A6 for ; Wed, 30 Jan 2019 12:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E892E8A2; Wed, 30 Jan 2019 12:02:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 939F72E8A3 for ; Wed, 30 Jan 2019 12:02:33 +0000 (UTC) Received: from localhost ([127.0.0.1]:36717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooZc-0006Vw-Mv for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 07:02:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooXs-0005Hk-2v for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gooXn-0000ai-Ij for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53044) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gooXn-0000Vv-Cb for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FE60C7E7C; Wed, 30 Jan 2019 12:00:18 +0000 (UTC) Received: from x1w.bcn.redhat.com (unknown [10.32.224.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B42C60462; Wed, 30 Jan 2019 12:00:17 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2019 13:00:02 +0100 Message-Id: <20190130120005.23123-2-philmd@redhat.com> In-Reply-To: <20190130120005.23123-1-philmd@redhat.com> References: <20190130120005.23123-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 30 Jan 2019 12:00:18 +0000 (UTC) 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 v4 1/4] hw/display: Move Milkymist specific hardware out of common-obj list 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: Michael Walle , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Brad Smith Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The Milkymist specific hardware is only used by the LM32 target, it is pointless to compile those objects in other targets. Signed-off-by: Philippe Mathieu-Daudé --- hw/display/Makefile.objs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 97acd5b6cb..5b770817c7 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -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) From patchwork Wed Jan 30 12:00:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10788453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A4036C2 for ; Wed, 30 Jan 2019 12:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76E6A2E762 for ; Wed, 30 Jan 2019 12:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B3272E7F9; Wed, 30 Jan 2019 12:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19C952E762 for ; Wed, 30 Jan 2019 12:02:42 +0000 (UTC) Received: from localhost ([127.0.0.1]:36719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooZl-0006Yz-Ca for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 07:02:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooXo-0005G3-Ln for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gooXn-0000ay-QC for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42850) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gooXn-0000WH-FN for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E3388AE72; Wed, 30 Jan 2019 12:00:20 +0000 (UTC) Received: from x1w.bcn.redhat.com (unknown [10.32.224.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D40B1600D7; Wed, 30 Jan 2019 12:00:18 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2019 13:00:03 +0100 Message-Id: <20190130120005.23123-3-philmd@redhat.com> In-Reply-To: <20190130120005.23123-1-philmd@redhat.com> References: <20190130120005.23123-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 30 Jan 2019 12:00:20 +0000 (UTC) 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 v4 2/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: Michael Walle , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Brad Smith Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Philippe Mathieu-Daudé --- configure | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configure b/configure index b18281c61f..c7024d6662 100755 --- a/configure +++ b/configure @@ -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 From patchwork Wed Jan 30 12:00:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10788459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA5CE6C2 for ; Wed, 30 Jan 2019 12:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96D8D2C56C for ; Wed, 30 Jan 2019 12:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A9642C584; Wed, 30 Jan 2019 12:05:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 065812C56C for ; Wed, 30 Jan 2019 12:05:34 +0000 (UTC) Received: from localhost ([127.0.0.1]:36777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goocX-0000Cq-SY for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 07:05:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooXp-0005G6-16 for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gooXn-0000bB-VN for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60022) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gooXn-0000WV-Pb for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 893DB89AF3; Wed, 30 Jan 2019 12:00:21 +0000 (UTC) Received: from x1w.bcn.redhat.com (unknown [10.32.224.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FB8260462; Wed, 30 Jan 2019 12:00:20 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2019 13:00:04 +0100 Message-Id: <20190130120005.23123-4-philmd@redhat.com> In-Reply-To: <20190130120005.23123-1-philmd@redhat.com> References: <20190130120005.23123-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 30 Jan 2019 12:00:21 +0000 (UTC) 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 v4 3/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: Michael Walle , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Brad Smith Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The TMU device requires both X11 and OpenGL. Signed-off-by: Philippe Mathieu-Daudé --- 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-softmmu.mak index 4889348a10..4049b23562 100644 --- a/default-configs/lm32-softmmu.mak +++ b/default-configs/lm32-softmmu.mak @@ -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 diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 5b770817c7..7c4ae9a0fd 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -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 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 base, return dev; } -#ifdef CONFIG_OPENGL +#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) #include #include #include @@ -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; From patchwork Wed Jan 30 12:00:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10788449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 243001390 for ; Wed, 30 Jan 2019 12:02:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10B0B2E8A2 for ; Wed, 30 Jan 2019 12:02:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04E892E896; Wed, 30 Jan 2019 12:02:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C32332E89C for ; Wed, 30 Jan 2019 12:02:27 +0000 (UTC) Received: from localhost ([127.0.0.1]:36715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooZX-0006Rb-1T for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 07:02:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gooXp-0005GM-Gb for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gooXn-0000at-Q1 for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58262) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gooXn-0000Wg-Da for qemu-devel@nongnu.org; Wed, 30 Jan 2019 07:00:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A5C37E60; Wed, 30 Jan 2019 12:00:23 +0000 (UTC) Received: from x1w.bcn.redhat.com (unknown [10.32.224.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E05CC60462; Wed, 30 Jan 2019 12:00:21 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2019 13:00:05 +0100 Message-Id: <20190130120005.23123-5-philmd@redhat.com> In-Reply-To: <20190130120005.23123-1-philmd@redhat.com> References: <20190130120005.23123-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 30 Jan 2019 12:00:23 +0000 (UTC) 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 v4 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: Michael Walle , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Brad Smith Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é --- 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 b334b53979..737a33b102 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" #include #include @@ -499,3 +500,51 @@ static void milkymist_tmu2_register_types(void) } 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 = XOpenDisplay(NULL); + if (d == 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 == 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 = glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements); + if (configs == NULL) { + XCloseDisplay(d); + return NULL; + } + + XFree(configs); + XCloseDisplay(d); + + dev = 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; } -#if defined(CONFIG_X11) && defined(CONFIG_OPENGL) -#include -#include -#include -static const int glx_fbconfig_attr[] = { - 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 = XOpenDisplay(NULL); - if (d == 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 == 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 = glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements); - if (configs == NULL) { - XCloseDisplay(d); - return NULL; - } - - XFree(configs); - XCloseDisplay(d); - - dev = 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" diff --git a/include/hw/display/milkymist_tmu2.h b/include/hw/display/milkymist_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 */