On Sun, Apr 02, 2006 at 12:21:52AM +0200, Juergen Lock wrote: > Here is what I have tested on i386 with kqemu. [...]
Updated version using yesterday's cvs snapshot and malc's latest sound patch (still needs the kqemu port update from the linked message which is archived here: http://docs.freebsd.org/cgi/mid.cgi?20060401222151.GA45952 ) With this you no longer need QEMU_AUDIO_DRV=sdl to get sound working with linux alsa guests. (thanks malc!) Removed files: files/patch-dyngen.h files/patch-hw-ne2000.c files/patch-hw-usb-uhci.c files/patch-hw-usb.c files/patch-sdl.c files/patch-slirp-socket.c files/patch-slirp_throttle files/patch-target-i386-translate.c New file: files/patch-malc-17h_aqemu Index: Makefile =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/Makefile,v retrieving revision 1.47 diff -u -r1.47 Makefile --- Makefile 26 Mar 2006 15:11:36 -0000 1.47 +++ Makefile 9 Apr 2006 15:57:39 -0000 @@ -6,8 +6,7 @@ # PORTNAME= qemu -PORTVERSION= 0.8.0 -PORTREVISION= 5 +PORTVERSION= 0.8.0s.20060408 CATEGORIES= emulators MASTER_SITES= http://www.qemu.org/:release \ http://people.fruitsalad.org/nox/qemu/:snapshot \ @@ -15,10 +14,8 @@ http://qemu.dad-answers.com/download/qemu/:snapshot \ http://people.brandeis.edu/~jcoiner/qemu_idedma/:idedma \ http://people.freebsd.org/~maho/qemu/:misc -DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:release -.if defined (WITH_HACKS_IDEDMA) || defined (WITH_HACKS) -DISTFILES+= qemu_dma_patch.tar.gz:idedma -.endif +DISTNAME= ${PORTNAME}-snapshot-2006-04-08_23 +DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:snapshot .if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS) DISTFILES+= patch3_cirrus:misc .endif @@ -33,10 +30,11 @@ RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba .endif .if defined(WITH_KQEMU) -BUILD_DEPENDS+= ${LOCALBASE}/include/kqemu/kqemu.h:${PORTSDIR}/emulators/kqemu-kmod +BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod .endif HAS_CONFIGURE= yes +USE_BZIP2= yes USE_GMAKE= yes USE_GETOPT_LONG= yes USE_SDL= sdl @@ -64,11 +62,9 @@ @${ECHO_MSG} "Notice: you can build qemu with the (alpha!) kqemu accelerator kernel module" @${ECHO_MSG} "by defining WITH_KQEMU." .endif -.if !defined(WITH_HACKS_IDEDMA) && !defined(WITH_HACKS_CIRRUS) && !defined(WITH_HACKS) +.if !defined(WITH_HACKS_CIRRUS) && !defined(WITH_HACKS) @${ECHO_MSG} "You can build qemu with some hacks (esp. for speedup)" @${ECHO_MSG} "by defining WITH_HACKS, or specifically:" - @${ECHO_MSG} "1. WITH_HACKS_IDEDMA: IDE Bus-master DMA Support by John Coiner" - @${ECHO_MSG} "http://people.brandeis.edu/~jcoiner/qemu_idedma/qemu_dma_patch.html" @${ECHO_MSG} "2. WITH_HACKS_CIRRUS: higher speed on large display (cirrus_vga)" @${ECHO_MSG} "by Juergen Pfennig" @${ECHO_MSG} "http://lists.gnu.org/archive/html/qemu-devel/2006-01/msg00208.html" @@ -92,9 +88,6 @@ done post-patch: -.if defined(WITH_HACKS_IDEDMA) || defined (WITH_HACKS) - @cd ${WRKDIR} ; ${TAR} xfz ${DISTDIR}/${DIST_SUBDIR}/qemu_dma_patch.tar.gz ; ${CP} new_qemu_dma_patch/bios.bin ${WRKSRC}/pc-bios; cd ${WRKSRC}; ${PATCH} --quiet -p1 < ../new_qemu_dma_patch/qemu-piix4-udma.patch -.endif .if defined(WITH_HACKS_CIRRUS) || defined (WITH_HACKS) @cd ${WRKSRC} ; ${PATCH} --quiet < ${DISTDIR}/${DIST_SUBDIR}/patch3_cirrus .endif Index: distinfo =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/distinfo,v retrieving revision 1.27 diff -u -r1.27 distinfo --- distinfo 21 Jan 2006 23:10:06 -0000 1.27 +++ distinfo 9 Apr 2006 15:58:11 -0000 @@ -1,9 +1,6 @@ -MD5 (qemu/qemu-0.8.0.tar.gz) = eb175b26583280706fe7e4d8910d320d -SHA256 (qemu/qemu-0.8.0.tar.gz) = de388539ce86971a2cbe8474fca8b6160898c95772e3e6e08a7794d48db32a61 -SIZE (qemu/qemu-0.8.0.tar.gz) = 1497965 -MD5 (qemu/qemu_dma_patch.tar.gz) = 5e339dc201d411af56bad684d3f89338 -SHA256 (qemu/qemu_dma_patch.tar.gz) = cdf74bf5e079d835e100f116d940686b13ec2b7ed6aee5a6a97a4441ea5f2b8f -SIZE (qemu/qemu_dma_patch.tar.gz) = 25837 +MD5 (qemu/qemu-snapshot-2006-04-08_23.tar.bz2) = 74fd8046d94d5d800f1df35282dba733 +SHA256 (qemu/qemu-snapshot-2006-04-08_23.tar.bz2) = 5cdcab83fa0fa6188c846f2d9c96d019300f6c7742d2ecf3cceae0a014fd6318 +SIZE (qemu/qemu-snapshot-2006-04-08_23.tar.bz2) = 1288264 MD5 (qemu/patch3_cirrus) = ebe7ed9fce804c49e024bc93bfdfc810 SHA256 (qemu/patch3_cirrus) = e862371834b7d895a896fbdb84fd9f70d17b5729a6f6789a48a61504fc941e11 SIZE (qemu/patch3_cirrus) = 8817 Index: files/patch-bsdusb.patch =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-bsdusb.patch,v retrieving revision 1.1 diff -u -r1.1 patch-bsdusb.patch --- files/patch-bsdusb.patch 18 Mar 2006 21:23:42 -0000 1.1 +++ files/patch-bsdusb.patch 27 Mar 2006 23:30:53 -0000 @@ -1,8 +1,9 @@ Index: qemu/configure -@@ -122,6 +122,7 @@ +@@ -122,7 +122,8 @@ *) oss="yes" linux="yes" + user="yes" +usb="linux" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" Index: files/patch-fbsd =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-fbsd,v retrieving revision 1.4 diff -u -r1.4 patch-fbsd --- files/patch-fbsd 1 Oct 2005 13:25:09 -0000 1.4 +++ files/patch-fbsd 27 Mar 2006 23:39:21 -0000 @@ -1,5 +1,5 @@ Index: qemu/Makefile -@@ -13,7 +13,7 @@ +@@ -13,11 +13,14 @@ endif DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 @@ -8,14 +8,6 @@ for d in $(TARGET_DIRS); do \ $(MAKE) -C $$d $@ || exit 1 ; \ done -@@ -21,10 +21,13 @@ - ifdef CONFIG_WIN32 - $(MAKE) -C kqemu -f Makefile.winnt - else -- $(MAKE) -C kqemu -+ ( cd kqemu && $(BSD_MAKE) -f Makefile.freebsd ) - endif - endif +bsd/libmath.a: + ( cd bsd ; $(BSD_MAKE) CC=$(CC) ) @@ -23,7 +15,7 @@ qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) -@@ -33,6 +36,7 @@ +@@ -26,6 +29,7 @@ clean: # avoid old build problems by removing potentially incorrect old files @@ -31,25 +23,6 @@ rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ $(MAKE) -C tests clean -@@ -40,7 +44,7 @@ - $(MAKE) -C $$d $@ || exit 1 ; \ - done - ifdef CONFIG_KQEMU -- $(MAKE) -C kqemu clean -+ cd kqemu && $(BSD_MAKE) -f Makefile.freebsd clean - endif - - distclean: clean -@@ -73,9 +77,6 @@ - for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ - done --ifdef CONFIG_KQEMU -- cd kqemu ; ./install.sh --endif - - # various test targets - test speed test2: all Index: qemu/Makefile.target @@ -391,8 +391,8 @@ VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld Index: files/patch-malc-17h_aqemu @@ -0,0 +1,243 @@ +Index: qemu/audio/alsaaudio.c +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/audio/alsaaudio.c,v +retrieving revision 1.1.1.4 +retrieving revision 1.1.1.1.2.8 +diff -u -r1.1.1.4 -r1.1.1.1.2.8 +--- audio/alsaaudio.c 21 Nov 2005 12:47:06 -0000 1.1.1.4 ++++ audio/alsaaudio.c 7 Apr 2006 22:05:21 -0000 1.1.1.1.2.8 +@@ -61,8 +61,8 @@ + .size_in_usec_in = 1, + .size_in_usec_out = 1, + #endif +- .pcm_name_out = "hw:0,0", +- .pcm_name_in = "hw:0,0", ++ .pcm_name_out = "default", ++ .pcm_name_in = "default", + #ifdef HIGH_LATENCY + .buffer_size_in = 400000, + .period_size_in = 400000 / 4, +Index: qemu/audio/audio.h +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/audio/audio.h,v +retrieving revision 1.1.1.3 +retrieving revision 1.1.1.1.2.5 +diff -u -r1.1.1.3 -r1.1.1.1.2.5 +--- audio/audio.h 21 Nov 2005 12:47:06 -0000 1.1.1.3 ++++ audio/audio.h 7 Apr 2006 22:05:21 -0000 1.1.1.1.2.5 +@@ -111,7 +111,7 @@ + } + + uint32_t popcount (uint32_t u); +-inline uint32_t lsbindex (uint32_t u); ++uint32_t lsbindex (uint32_t u); + + #ifdef __GNUC__ + #define audio_MIN(a, b) ( __extension__ ({ \ +Index: qemu/audio/dsound_template.h +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/audio/dsound_template.h,v +retrieving revision 1.1.1.2 +retrieving revision 1.1.1.1.2.2 +diff -u -r1.1.1.2 -r1.1.1.1.2.2 +--- audio/dsound_template.h 5 Nov 2005 20:42:14 -0000 1.1.1.2 ++++ audio/dsound_template.h 7 Apr 2006 22:05:21 -0000 1.1.1.1.2.2 +@@ -70,7 +70,13 @@ + int i; + LPVOID p1 = NULL, p2 = NULL; + DWORD blen1 = 0, blen2 = 0; ++ DWORD flag; + ++#ifdef DSBTYPE_IN ++ flag = entire ? DSCBLOCK_ENTIREBUFFER : 0; ++#else ++ flag = entire ? DSBLOCK_ENTIREBUFFER : 0; ++#endif + for (i = 0; i < conf.lock_retries; ++i) { + hr = glue (IFACE, _Lock) ( + buf, +@@ -80,13 +86,7 @@ + &blen1, + &p2, + &blen2, +- (entire +-#ifdef DSBTYPE_IN +- ? DSCBLOCK_ENTIREBUFFER +-#else +- ? DSBLOCK_ENTIREBUFFER +-#endif +- : 0) ++ flag + ); + + if (FAILED (hr)) { +Index: qemu/audio/dsoundaudio.c +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/audio/dsoundaudio.c,v +retrieving revision 1.1.1.2 +retrieving revision 1.1.1.1.2.2 +diff -u -r1.1.1.2 -r1.1.1.1.2.2 +--- audio/dsoundaudio.c 5 Nov 2005 20:42:14 -0000 1.1.1.2 ++++ audio/dsoundaudio.c 7 Apr 2006 22:05:21 -0000 1.1.1.1.2.2 +@@ -987,6 +987,12 @@ + hr = IDirectSound_Initialize (s->dsound, NULL); + if (FAILED (hr)) { + dsound_logerr (hr, "Could not initialize DirectSound\n"); ++ ++ hr = IDirectSound_Release (s->dsound); ++ if (FAILED (hr)) { ++ dsound_logerr (hr, "Could not release DirectSound\n"); ++ } ++ s->dsound = NULL; + return NULL; + } + +Index: qemu/audio/ossaudio.c +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/audio/ossaudio.c,v +retrieving revision 1.1.1.4 +retrieving revision 1.1.1.1.2.5 +diff -u -r1.1.1.4 -r1.1.1.1.2.5 +--- audio/ossaudio.c 21 Nov 2005 12:47:06 -0000 1.1.1.4 ++++ audio/ossaudio.c 7 Apr 2006 22:23:42 -0000 1.1.1.1.2.5 +@@ -324,9 +324,18 @@ + return 0; + } + +- if (abinfo.bytes < 0 || abinfo.bytes > bufsize) { +- ldebug ("warning: Invalid available size, size=%d bufsize=%d\n", +- abinfo.bytes, bufsize); ++ if (abinfo.bytes > bufsize) { ++#ifndef __FreeBSD__ ++ dolog ("warning: Invalid available size, size=%d bufsize=%d\n" ++ "please report your OS/audio hw to [EMAIL PROTECTED]", ++ abinfo.bytes, bufsize); ++#endif ++ abinfo.bytes = bufsize; ++ } ++ ++ if (abinfo.bytes < 0) { ++ dolog ("warning: Invalid available size, size=%d bufsize=%d\n", ++ abinfo.bytes, bufsize); + return 0; + } + +Index: qemu/hw/es1370.c +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/hw/es1370.c,v +retrieving revision 1.1.1.4 +retrieving revision 1.1.1.1.2.7 +diff -u -r1.1.1.4 -r1.1.1.1.2.7 +--- hw/es1370.c 21 Nov 2005 12:47:06 -0000 1.1.1.4 ++++ hw/es1370.c 7 Apr 2006 22:05:21 -0000 1.1.1.1.2.7 +@@ -479,9 +479,10 @@ + IO_WRITE_PROTO (es1370_writeb) + { + ES1370State *s = opaque; +- addr = es1370_fixup (s, addr); + uint32_t shift, mask; + ++ addr = es1370_fixup (s, addr); ++ + switch (addr) { + case ES1370_REG_CONTROL: + case ES1370_REG_CONTROL + 1: +Index: qemu/hw/sb16.c +=================================================================== +RCS file: /home/malc/cvsroot/bellard/qemu/hw/sb16.c,v +retrieving revision 1.1.1.4 +retrieving revision 1.1.1.1.2.6 +diff -u -r1.1.1.4 -r1.1.1.1.2.6 +--- hw/sb16.c 21 Nov 2005 12:47:06 -0000 1.1.1.4 ++++ hw/sb16.c 7 Apr 2006 22:23:59 -0000 1.1.1.1.2.6 +@@ -193,6 +193,31 @@ + #define DMA8_AUTO 1 + #define DMA8_HIGH 2 + ++static void continue_dma8 (SB16State *s) ++{ ++ if (s->freq > 0) { ++ audsettings_t as; ++ ++ s->audio_free = 0; ++ ++ as.freq = s->freq; ++ as.nchannels = 1 << s->fmt_stereo; ++ as.fmt = s->fmt; ++ ++ s->voice = AUD_open_out ( ++ &s->card, ++ s->voice, ++ "sb16", ++ s, ++ SB_audio_callback, ++ &as, ++ 0 /* little endian */ ++ ); ++ } ++ ++ control (s, 1); ++} ++ + static void dma_cmd8 (SB16State *s, int mask, int dma_len) + { + s->fmt = AUD_FMT_U8; +@@ -201,7 +226,8 @@ + s->fmt_signed = 0; + s->fmt_stereo = (s->mixer_regs[0x0e] & 2) != 0; + if (-1 == s->time_const) { +- s->freq = 11025; ++ if (s->freq <= 0) ++ s->freq = 11025; + } + else { + int tmp = (256 - s->time_const); +@@ -239,27 +265,7 @@ + s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits, + s->block_size, s->dma_auto, s->fifo, s->highspeed); + +- if (s->freq) { +- audsettings_t as; +- +- s->audio_free = 0; +- +- as.freq = s->freq; +- as.nchannels = 1 << s->fmt_stereo; +- as.fmt = s->fmt; +- +- s->voice = AUD_open_out ( +- &s->card, +- s->voice, +- "sb16", +- s, +- SB_audio_callback, +- &as, +- 0 /* little endian */ +- ); +- } +- +- control (s, 1); ++ continue_dma8 (s); + speaker (s, 1); + } + +@@ -437,7 +443,7 @@ + break; + + case 0x1c: /* Auto-Initialize DMA DAC, 8-bit */ +- control (s, 1); ++ dma_cmd8 (s, DMA8_AUTO, -1); + break; + + case 0x20: /* Direct ADC, Juice/PL */ +@@ -531,7 +537,9 @@ + break; + + case 0xd4: /* continue DMA operation. 8bit */ +- control (s, 1); ++ /* KQ6 (or maybe Sierras audblst.drv in general) resets ++ the frequency between halt/continue */ ++ continue_dma8 (s); + break; + + case 0xd5: /* halt DMA operation. 16bit */ _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel