Subject: pkg/15527: SDL should use DGA2 when available
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Wong <benjamin.wong@cc.gatech.edu>
List: netbsd-bugs
Date: 02/07/2002 09:44:09
>Number:         15527
>Category:       pkg
>Synopsis:       The SDL configure.in does not check for DGA under NetBSD.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 07 06:45:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ben Wong
>Release:        NetBSD 1.5.2
>Organization:
	
>Environment:
	
System: NetBSD ursula.wongs.net 1.5.2 NetBSD 1.5.2 (GENERIC) #0: Sat Nov 17 17:21:16 EST 2001 toor@ursula.wongs.net:/usr/src/sys/arch/i386/compile/GENERIC i386


>Description:

SDL, the Simple Directmedia Library, can normally use XFree86's DGA2
extension to access the raw frame buffer and perform double-buffering.
However, the configure.in file for SDL-1.2.2 doesn't call CheckDGA if
the OS is NetBSD, and so SDL compiled for NetBSD has to use the much
slower X11 video driver.

>How-To-Repeat:

Install SDL from devel/pkgsrc. 

Install apla from pkgsrc/graphics. (Actually any SDL program, such as
testsprite.c from the SDL cvs tree, will work). 

Su to root, set the SDL_VIDEODRIVER environment variable to dga, and
run apla:

	    su -l
	    setenv SDL_VIDEODRIVER dga
	    apla "somemovie.avi"

SDL will complain that there is no video driver available.


>Fix:

Patch configure.in to run CheckDGA when the OS is NetBSD. Here is a
patch which replaces patch-aj:

$NetBSD$

--- configure.in.orig	Mon Jul 23 15:54:03 2001
+++ configure.in
@@ -366,10 +366,7 @@
                   , enable_nas=yes)
     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
         AC_MSG_CHECKING(for NAS audio support)
-        have_nas=no
-        if test -r /usr/X11R6/include/audio/audiolib.h; then
-            have_nas=yes
-        fi
+        have_nas=yes
         AC_MSG_RESULT($have_nas)
         if test x$have_nas = xyes; then
             CFLAGS="$CFLAGS -DNAS_SUPPORT"
@@ -420,7 +417,7 @@
                   NASMFLAGS="-f win32"
                   ;;
               *)
-                  NASMFLAGS="-f elf"
+                  test -n "$NASMFLAGS" || NASMFLAGS="-f elf"
                   ;;
             esac
             AC_SUBST(NASMFLAGS)
@@ -930,8 +927,8 @@
             pthread_lib="-pthread"
             ;;
         *-*-netbsd*)
-            pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
-            pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
+            pthread_cflags="-D_REENTRANT"
+            pthread_lib="-lpthread"
             ;;
         *-*-openbsd*)
             pthread_cflags="-D_REENTRANT"
@@ -1348,11 +1345,13 @@
         CheckDummyVideo
         CheckDiskAudio
         CheckNASM
+        CheckOPENBSDAUDIO
         CheckOSS
         CheckARTSC
         CheckESD
         CheckNAS
         CheckX11
+        CheckDGA
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
@@ -1642,7 +1641,11 @@
             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
-            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
+	    if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
+		COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
+	    else
+		COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
+	    fi
             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
@@ -2021,6 +2024,10 @@
 
 if test $ARCH = solaris; then
   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
+fi
+
+if test $ARCH = netbsd; then
+  SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib -Wl,-rpath,${X11BASE}/lib"
 fi
 
 if test $ARCH = openbsd; then


>Release-Note:
>Audit-Trail:
>Unformatted: