pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/devel/SDL Enable oss dma backend for NetBSD-8.
details: https://anonhg.NetBSD.org/pkgsrc/rev/2eaca52ebe1f
branches: trunk
changeset: 370879:2eaca52ebe1f
user: nat <nat%pkgsrc.org@localhost>
date: Fri Oct 27 01:28:53 2017 +0000
description:
Enable oss dma backend for NetBSD-8.
Bump PKG_REVISION.
OK wiz@.
diffstat:
devel/SDL/MESSAGE | 16 ++
devel/SDL/Makefile | 4 +-
devel/SDL/distinfo | 3 +-
devel/SDL/patches/patch-src_audio_dma_SDL__dmaaudio.c | 124 ++++++++++++++++++
4 files changed, 144 insertions(+), 3 deletions(-)
diffs (178 lines):
diff -r 228ed3475f06 -r 2eaca52ebe1f devel/SDL/MESSAGE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/SDL/MESSAGE Fri Oct 27 01:28:53 2017 +0000
@@ -0,0 +1,16 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2017/10/27 01:28:53 nat Exp $
+
+To enable dma for use with NetBSD-8 or above.
+
+Set the following environment variables:
+ SDL_DSP_DMA_PRECISION
+ SDL_DSP_DMA_FREQ
+ SDL_DSP_DMA_CHANNELS
+
+ SDL_DSP_NOSELECT=1
+
+DMA parameters must match the hw virtual channel format for playback to
+work with dma.
+
+===========================================================================
diff -r 228ed3475f06 -r 2eaca52ebe1f devel/SDL/Makefile
--- a/devel/SDL/Makefile Thu Oct 26 15:10:17 2017 +0000
+++ b/devel/SDL/Makefile Fri Oct 27 01:28:53 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.126 2017/09/08 02:38:38 ryoon Exp $
+# $NetBSD: Makefile,v 1.127 2017/10/27 01:28:53 nat Exp $
DISTNAME= SDL-1.2.15
-PKGREVISION= 21
+PKGREVISION= 22
CATEGORIES= devel games
MASTER_SITES= http://www.libsdl.org/release/
diff -r 228ed3475f06 -r 2eaca52ebe1f devel/SDL/distinfo
--- a/devel/SDL/distinfo Thu Oct 26 15:10:17 2017 +0000
+++ b/devel/SDL/distinfo Fri Oct 27 01:28:53 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.78 2015/11/03 03:27:12 agc Exp $
+$NetBSD: distinfo,v 1.79 2017/10/27 01:28:53 nat Exp $
SHA1 (SDL-1.2.15.tar.gz) = 0c5f193ced810b0d7ce3ab06d808cbb5eef03a2c
RMD160 (SDL-1.2.15.tar.gz) = d4802a090cb4a24eeb0c8ce5690802f596d394c3
@@ -7,6 +7,7 @@
SHA1 (patch-aa) = 00fb7a85caf8fc9f08298d0a07a4587757fdffb0
SHA1 (patch-ac) = 8b2dddff9ad449b19b35ef364e2d960e46284563
SHA1 (patch-src_audio_bsd_SDL__bsdaudio.c) = 7f5fbf4d839e52fce028810dc807b404fcd51442
+SHA1 (patch-src_audio_dma_SDL__dmaaudio.c) = cede64d04e8872b11851bfcacbc99059df973881
SHA1 (patch-src_audio_sun_SDL__sunaudio.c) = 4b492b40d39e6444037dfda55766e4a149cc6c30
SHA1 (patch-src_joystick_bsd_SDL__sysjoystick.c) = 46029dda8975dcb891a5b14b718c27b034ce5b06
SHA1 (patch-src_video_quartz_SDL__QuartzVideo.h) = 19d952bade06dbd646e94f42139c38436969b1a8
diff -r 228ed3475f06 -r 2eaca52ebe1f devel/SDL/patches/patch-src_audio_dma_SDL__dmaaudio.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/SDL/patches/patch-src_audio_dma_SDL__dmaaudio.c Fri Oct 27 01:28:53 2017 +0000
@@ -0,0 +1,124 @@
+$NetBSD: patch-src_audio_dma_SDL__dmaaudio.c,v 1.1 2017/10/27 01:28:53 nat Exp $
+
+Enable dma for use with netbsd-8.
+
+DMA parameters must match the hw virtual channel format.
+These parameters are controlled by environment variables:
+ SDL_DSP_DMA_PRECISION, SDL_DSP_DMA_FREQ and SDL_DSP_DMA_CHANNELS.
+I found it also necessary to set SDL_DSP_NOSELECT=1 for playback to work with
+dma.
+--- src/audio/dma/SDL_dmaaudio.c.orig 2012-01-19 06:30:06.000000000 +0000
++++ src/audio/dma/SDL_dmaaudio.c
+@@ -24,6 +24,7 @@
+ /* Allow access to a raw mixing buffer */
+
+ #include <stdio.h>
++#include <stdbool.h>
+ #include <string.h> /* For strerror() */
+ #include <errno.h>
+ #include <unistd.h>
+@@ -29,6 +31,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
++#include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+@@ -311,7 +313,9 @@ static int DMA_OpenAudio(_THIS, SDL_Audi
+ int format;
+ int stereo;
+ int value;
++#if !defined(__NetBSD__) || (__NetBSD_Version__ < 800000000)
+ Uint16 test_format;
++#endif
+ struct audio_buf_info info;
+
+ /* Reset the timer synchronization flag */
+@@ -333,6 +337,7 @@ static int DMA_OpenAudio(_THIS, SDL_Audi
+ }
+
+ /* Try for a closest match on audio format */
++#if !defined(__NetBSD__) || (__NetBSD_Version__ < 800000000)
+ format = 0;
+ for ( test_format = SDL_FirstAudioFormat(spec->format);
+ ! format && test_format; ) {
+@@ -383,6 +388,78 @@ static int DMA_OpenAudio(_THIS, SDL_Audi
+ return(-1);
+ }
+ spec->format = test_format;
++#else
++ char *tmpenv;
++ int prec;
++ bool be = false;
++
++ if (_BYTE_ORDER == _BIG_ENDIAN)
++ be = true;
++ tmpenv = getenv("SDL_DSP_DMA_PRECISION");
++ if (tmpenv == NULL)
++ prec = 0;
++ else
++ prec = atoi(tmpenv);
++ tmpenv = getenv("SDL_DSP_DMA_FREQ");
++ if (tmpenv == NULL)
++ spec->freq = 0;
++ else
++ spec->freq = atoi(tmpenv);
++ tmpenv = getenv("SDL_DSP_DMA_CHANNELS");
++ if (tmpenv == NULL)
++ spec->channels = 0;
++ else
++ spec->channels = atoi(tmpenv);
++ if (prec == 0) {
++ fprintf(stderr, "SDL_DSP_DMA_PRECISION must be set to virtual "
++ "format precision");
++ return -1;
++ }
++ if (spec->channels == 0) {
++ fprintf(stderr, "SDL_DSP_DMA_CHANNELS must be set to virtual "
++ "format number of harware channels");
++ return -1;
++ }
++ if (spec->freq == 0) {
++ fprintf(stderr, "SDL_DSP_DMA_FREQ must be set to virtual "
++ "format frequency");
++ return -1;
++ }
++ switch(prec) {
++ case 8:
++ spec->format = AUDIO_S8;
++ format = AFMT_S8;
++ break;
++#ifdef notyet
++ case 24:
++ if (be) {
++ spec->format = AUDIO_S24MSB;
++ format = AFMT_S24_BE;
++ } else {
++ spec->format = AUDIO_S24LSB;
++ format = AFMT_S24_LE;
++ }
++ break;
++ case 32:
++ if (be) {
++ spec->format = AUDIO_S32MSB;
++ format = AFMT_S32_BE;
++ } else {
++ spec->format = AUDIO_S32LSB;
++ format = AFMT_S32_LE;
++ }
++ break;
++#endif
++ default:
++ if (be) {
++ spec->format = AUDIO_S16MSB;
++ format = AFMT_S16_BE;
++ } else {
++ spec->format = AUDIO_S16LSB;
++ format = AFMT_S16_LE;
++ }
++ }
++#endif
+
+ /* Set the audio format */
+ value = format;
Home |
Main Index |
Thread Index |
Old Index