[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Please test ioquake3 on PowerPC, particularly without Altivec



Hi debian-powerpc,
Could someone please test a patched ioquake3 on PowerPC, preferably one
without Altivec? Please reply to me or to the bug, I'm not subscribed to
debian-powerpc.

You will need 3D acceleration supported by Linux (which probably means
some sort of ATI/AMD or nVidia). Testing on any of these platforms is
welcome, as long as you know which one you're using:

* PowerPC with no Altivec (e.g. Mac G3)
* PowerPC with Altivec (e.g. Mac G4/G5)
* powerpcspe with no Altivec

Please test ioquake3 from Debian unstable, with the attached patch applied.
Testing the unpatched ioquake3 from unstable for comparison would also
be helpful.

Brief background, from #701561: ioquake3 currently always builds with Altivec.
This causes it to FTBFS on powerpcspe (where Altivec doesn't exist),
and only work on a subset of supported powerpc machines (since, AIUI,
Debian still supports G3 Macs and other non-Altivec PowerPCs).
I would like to fix this, but I don't have a working PowerPC, and
I'm concerned that the bytecode JIT might have a hidden dependency on Altivec.

You can test the engine using either Quake III Arena (non-distributable,
but somewhat easier) or OpenArena (DFSG-free). Instructions below.

Thanks,
    S

Testing with Quake III Arena
----------------------------

If you have a copy of Quake III Arena for any platform (the only bit you
actually need from the retail game is baseq3/pak0.pk3), please try with
Debian's contrib quake3 package. game-data-packager can package the
necessary non-distributable data to get this working.

Testing with OpenArena
----------------------

This is a bit more involved, because the Debian package doesn't normally
use the bytecode JIT, and that's the part I'm worried about:

* Install Debian's openarena package

* Download http://www.pseudorandom.co.uk/~smcv/oa088upstream/vms.pk3
  and put it in ~/.openarena/oa088upstream/vms.pk3
  (it contains bytecode executables for the UI, server-side game and
  client-side game - we ship that part of OpenArena as native-code in Debian
  because it needs to be compiled with a non-DFSG compiler)

* Start openarena from a terminal

* Go to the Mods menu

* Select "oa088upstream" and click Load

* Open the console (Shift+Escape), you should see messages like this
  near the end:

  > Loading vm file vm/ui.qvm...
  > File "vm/ui.qvm" found in "/home/smcv/.openarena/oa088upstream/vms.pk3"
  > ...which has vmMagic VM_MAGIC_VER2

  If you see something about "DLL files" near the end instead, then the
  package of bytecode has not worked and I'll have to provide better
  instructions.

* Close the console (Shift+Escape).

* Start a single-player game and try it.
diff --git a/debian/changelog b/debian/changelog
index ca4692d..c015603 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ioquake3 (1.36+u20130504+g42eeb75-2+noaltivec) UNTESTED; urgency=low
+
+  * Add an untested patch to disable Altivec on the architectures
+    where it isn't guaranteed to be present, or is guaranteed not to be
+    present. Closes: #701561, if it works.
+
+ -- Simon McVittie <smcv@debian.org>  Tue, 04 Jun 2013 10:05:29 +0100
+
 ioquake3 (1.36+u20130504+g42eeb75-2) unstable; urgency=low
 
   * Enable Opus support now that #708008 is fixed
diff --git a/debian/patches/0001-untested-Add-support-for-PowerPCs-without-Altivec.patch b/debian/patches/0001-untested-Add-support-for-PowerPCs-without-Altivec.patch
new file mode 100644
index 0000000..c28eba6
--- /dev/null
+++ b/debian/patches/0001-untested-Add-support-for-PowerPCs-without-Altivec.patch
@@ -0,0 +1,119 @@
+From 6cb56d6ba2ef47813548efcbc02d26eb942ba713 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Sun, 19 May 2013 22:57:06 +0100
+Subject: [PATCH] [untested] Add support for PowerPCs without Altivec
+
+Debian's powerpc port still supports baseline PowerPCs without Altivec
+(e.g. Mac G3), and its powerpcspe port is a variant of PowerPC in
+which "Signal Processing Engine" extensions replace, and are
+incompatible with, the Altivec opcodes.
+
+(The Signal Processing Engine should not be confused with
+Synergistic Processing Elements, as seen in the Playstation 3;
+those don't conflict with having Altivec.)
+---
+ Makefile                  |   30 ++++++++++++++++++++++++------
+ README                    |    2 ++
+ code/qcommon/q_platform.h |    2 +-
+ 3 files changed, 27 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9561445..20876b2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -215,6 +215,10 @@ ifndef USE_RENDERER_DLOPEN
+ USE_RENDERER_DLOPEN=1
+ endif
+ 
++ifndef USE_ALTIVEC
++USE_ALTIVEC=1
++endif
++
+ ifndef DEBUG_CFLAGS
+ DEBUG_CFLAGS=-g -O0
+ endif
+@@ -335,11 +339,15 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
+     HAVE_VM_COMPILED=true
+   else
+   ifeq ($(ARCH),ppc)
+-    BASE_CFLAGS += -maltivec
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
++    endif
+     HAVE_VM_COMPILED=true
+   endif
+   ifeq ($(ARCH),ppc64)
+-    BASE_CFLAGS += -maltivec
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
++    endif
+     HAVE_VM_COMPILED=true
+   endif
+   ifeq ($(ARCH),sparc)
+@@ -409,11 +417,17 @@ ifeq ($(PLATFORM),darwin)
+   BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes
+ 
+   ifeq ($(ARCH),ppc)
+-    BASE_CFLAGS += -arch ppc -faltivec -mmacosx-version-min=10.2
++    BASE_CFLAGS += -arch ppc -mmacosx-version-min=10.2
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -faltivec -DUSE_ALTIVEC
++    endif
+     OPTIMIZEVM += -O3
+   endif
+   ifeq ($(ARCH),ppc64)
+-    BASE_CFLAGS += -arch ppc64 -faltivec -mmacosx-version-min=10.2
++    BASE_CFLAGS += -arch ppc64 -mmacosx-version-min=10.2
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -faltivec -DUSE_ALTIVEC
++    endif
+   endif
+   ifeq ($(ARCH),x86)
+     OPTIMIZEVM += -march=prescott -mfpmath=sse
+@@ -717,11 +731,15 @@ ifeq ($(PLATFORM),openbsd)
+     HAVE_VM_COMPILED=true
+   else
+   ifeq ($(ARCH),ppc)
+-    BASE_CFLAGS += -maltivec
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
++    endif
+     HAVE_VM_COMPILED=true
+   endif
+   ifeq ($(ARCH),ppc64)
+-    BASE_CFLAGS += -maltivec
++    ifeq ($(USE_ALTIVEC),1)
++      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
++    endif
+     HAVE_VM_COMPILED=true
+   endif
+   ifeq ($(ARCH),sparc64)
+diff --git a/README b/README
+index 1f4cf49..6d35132 100644
+--- a/README
++++ b/README
+@@ -105,6 +105,8 @@ Makefile.local:
+   USE_INTERNAL_OGG   - build and link against internal ogg library
+   USE_INTERNAL_OPUS  - build and link against internal opus/opusfile libraries
+   USE_LOCAL_HEADERS  - use headers local to ioq3 instead of system ones
++  USE_ALTIVEC        - set to 0 to support older or embedded PowerPCs
++                       without Altivec
+   DEBUG_CFLAGS       - C compiler flags to use for building debug version
+   COPYDIR            - the target installation directory
+   TEMPDIR            - specify user defined directory for temp files
+diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h
+index 9ae85d5..fb0ddff 100644
+--- a/code/qcommon/q_platform.h
++++ b/code/qcommon/q_platform.h
+@@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ #if (defined(powerc) || defined(powerpc) || defined(ppc) || \
+ 	defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
+ #define idppc 1
+-#if defined(__VEC__)
++#if defined(__VEC__) && defined(USE_ALTIVEC)
+ #define idppc_altivec 1
+ #ifdef MACOS_X  // Apple's GCC does this differently than the FSF.
+ #define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 31a5d4b..b3996ce 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
 0009-Run-in-a-window-by-default-on-new-installations.patch
 0010-Look-for-system-Vorbis-Opus-and-Ogg-via-pkg-config.patch
 ioquake3_hurd_support.patch
+0001-untested-Add-support-for-PowerPCs-without-Altivec.patch
diff --git a/debian/rules b/debian/rules
index 025b420..29c3059 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,12 +20,22 @@ else
 TARGET = debug
 endif
 
+# Use Altivec/VMX on ppc64, which is really "64-bit PowerPC with Altivec".
+# Don't use it on powerpcspe, which has SPE instead of Altivec.
+# Don't use it on powerpc yet, but we could if Debian's baseline CPU changes.
+ifneq ($(filter ppc64,$(DEB_HOST_ARCH_CPU)),)
+USE_ALTIVEC=1
+else
+USE_ALTIVEC=0
+endif
+
 override_dh_auto_build:
 	dh_auto_build \
 		-- \
 		BR=build \
 		BD=build \
 		V=1 \
+		USE_ALTIVEC=$(USE_ALTIVEC) \
 		USE_CODEC_OPUS=1 \
 		USE_CODEC_VORBIS=1 \
 		USE_CURL=1 \

Reply to: