Skip to contentSkip to conversation

ALSA on AMD64 with a 32-bit userspace

PATCH István Váradi 2 participants 2 messages Apr 22, 2005 – May 13, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I am using ALSA with a 64-bit AMD64 kernel (2.6.11) but with 32-bit applications. While trying to use Rosegarden4 (with JACK and Fluidsynth), I encountered some problems:

- some sequencer-related ioctl's did not work correctly because the kernel member of seq_port_info structure was not initialized. I attached a patch that initializes this to 0.

- start the playback with snd_pcm_hw_start failed with -EPIPE, because some pointers were not updated. I attached a patch for alsa-lib 1.0.8, in which sync_ptr is called before SNDRV_PCM_IOCTL_START. It seems to solve the problem, though I don't know alsa-lib enough to be sure that this is the right solution...

With these patches playback works, but JACK always reports xruns, whereas there aren't any. I discovered that the xruns are detected in the alsa_driver_wait function in alsa_driver.c (in JACK) returns 0, because the snd_pcm_avail_update calls in that function return 0. Putting sync_ptr into snd_pcm_avail_update does not seem to solve the problem.

JACK works properly when run with a 32-bit kernel or when compiled into a 64-bit executable.

Could you give me some hints as to what can I try? Or what can I do to help you debugging this problem? (Please reply to me directly, since I am not on the list).

Thanks,

István

core/ioctl32/seq32.c renamed from core/ioctl32/seq32.c.orig +1 -0
@@ -59,6 +59,7 @@
 	COPY(write_use);\
 	COPY(flags);\
 	COPY(time_queue);\
+        dst->kernel = 0;\
 }
 
 DEFINE_ALSA_IOCTL(seq_port_info);
pcm/pcm_hw.c renamed from pcm/pcm_hw.c.orig +1 -0
@@ -543,6 +543,7 @@
 	assert(pcm->stream != SND_PCM_STREAM_PLAYBACK ||
 	       snd_pcm_mmap_playback_hw_avail(pcm) > 0);
 #endif
+        sync_ptr(hw, 0);
 	if (ioctl(hw->fd, SNDRV_PCM_IOCTL_START) < 0) {
 		err = -errno;
 		SYSMSG("SNDRV_PCM_IOCTL_START failed");
#1 lore raw

Hi,

thanks for the patches.

At Fri, 22 Apr 2005 11:04:53 +0200,

Quoted 10 lines · István Váradi

Hi,

I am using ALSA with a 64-bit AMD64 kernel (2.6.11) but with 32-bit applications. While trying to use Rosegarden4 (with JACK and Fluidsynth), I encountered some problems:

- some sequencer-related ioctl's did not work correctly because the kernel member of seq_port_info structure was not initialized. I attached a patch that initializes this to 0.

Note that the 32bit-compat ioctl framework was majorly rewritten in the recent kernel, but this is still true for the old code remaining in alsa-driver tree.

Quoted 5 lines

- start the playback with snd_pcm_hw_start failed with -EPIPE, because some pointers were not updated. I attached a patch for alsa-lib 1.0.8, in which sync_ptr is called before SNDRV_PCM_IOCTL_START. It seems to solve the problem, though I don't know alsa-lib enough to be sure that this is the right solution...

Your fix should be OK. It's harmless for non sync-ptr case, anyway.

Both are applied to CVS now.

Quoted 6 lines

With these patches playback works, but JACK always reports xruns, whereas there aren't any. I discovered that the xruns are detected in the alsa_driver_wait function in alsa_driver.c (in JACK) returns 0, because the snd_pcm_avail_update calls in that function return 0. Putting sync_ptr into snd_pcm_avail_update does not seem to solve the problem.

Hmm, strange. Anyway, sync_ptr() is already there in snd_pcm_hw_avail_update() in the alsa-lib CVS version. So, it should be sync'ed before calculation of avail size.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_ids93&alloc_id281&op=click