All of lore.kernel.org
 help / color / mirror / Atom feed
* alsa-lib patches
@ 2005-04-29 13:57 Martin Stransky
  2005-04-29 17:46 ` Lee Revell
  2005-05-02  8:43 ` Clemens Ladisch
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Stransky @ 2005-04-29 13:57 UTC (permalink / raw)
  To: Alsa-Devel

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

Hi,

there are some patches for alsa-lib (1.0.9rc2), we use them in Fedora 4. 
About mixer patch - some user had a problem with ICH6 and this patch helped.

Otherwise, we try to use dmix as the default pcm device in FC4, we have 
experimental ainit tool for run-time creation of ~/.asoundrc file with 
safely generated IPC keys for dmix/dsnoop/dshare plugins. Every feedback 
is welcome...

Ma.

[-- Attachment #2: alsa-lib-alpha.patch --]
[-- Type: text/x-patch, Size: 606 bytes --]

--- alsa-lib-1.0.6/include/alsa-symbols.h.orig	2004-11-30 17:40:41.543824072 +0300
+++ alsa-lib-1.0.6/include/alsa-symbols.h	2004-11-30 17:42:34.828002372 +0300
@@ -57,10 +57,16 @@
 	__asm__ (".set " #name "," #real);		\
 	__asm__ (".set ." #name ",." #real)
 #else
+#ifdef __alpha__
+#define use_default_symbol_version(real, name, version) \
+        __asm__ (".weak " #name); \
+        __asm__ (#name " = " #real)
+#else
 #define use_default_symbol_version(real, name, version) \
 	__asm__ (".weak " #name); \
 	__asm__ (".set " #name "," #real)
 #endif
 #endif
+#endif
 
 #endif /* __ALSA_SYMBOLS_H */

[-- Attachment #3: alsa-lib-gcc4.patch --]
[-- Type: text/x-patch, Size: 5014 bytes --]

--- alsa-lib-1.0.9rc2/src/control/control.c.gcc4	2005-01-03 12:52:40.000000000 +0100
+++ alsa-lib-1.0.9rc2/src/control/control.c	2005-04-22 14:33:49.000000000 +0200
@@ -560,7 +560,7 @@
 int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
 {
 	assert(ctl && event);
-	return ctl->ops->read(ctl, event);
+	return (ctl->ops->read)(ctl, event);
 }
 
 /**
--- alsa-lib-1.0.9rc2/src/timer/timer.c.gcc4	2004-05-24 16:57:48.000000000 +0200
+++ alsa-lib-1.0.9rc2/src/timer/timer.c	2005-04-22 14:33:49.000000000 +0200
@@ -876,7 +876,7 @@
 	assert(timer);
 	assert(((timer->mode & O_ACCMODE) == O_RDONLY) || ((timer->mode & O_ACCMODE) == O_RDWR));
 	assert(buffer || size == 0);
-	return timer->ops->read(timer, buffer, size);
+	return (timer->ops->read)(timer, buffer, size);
 }
 
 /**
--- alsa-lib-1.0.9rc2/src/conf.c.gcc4	2005-02-14 16:09:10.000000000 +0100
+++ alsa-lib-1.0.9rc2/src/conf.c	2005-04-22 14:33:49.000000000 +0200
@@ -2506,9 +2506,11 @@
  *               specified by \p result.
  * \return Zero if successful, otherwise a negative error code.
  */
+
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
+
 int snd_config_search_hooks(snd_config_t *config, const char *key, snd_config_t **result)
 {
-	static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
 	SND_CONFIG_SEARCH(config, key, result, \
 					err = snd_config_hooks(config, NULL); \
 					if (err < 0) \
@@ -2526,9 +2528,10 @@
  *               specified by \p result.
  * \return Zero if successful, otherwise a negative error code.
  */
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
+
 int snd_config_searcha_hooks(snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result)
 {
-	static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
 	SND_CONFIG_SEARCHA(root, config, key, result,
 					snd_config_searcha_hooks,
 					err = snd_config_hooks(config, NULL); \
--- alsa-lib-1.0.9rc2/src/pcm/pcm_dmix_generic.c.gcc4	2005-02-08 21:28:31.000000000 +0100
+++ alsa-lib-1.0.9rc2/src/pcm/pcm_dmix_generic.c	2005-04-22 14:49:57.000000000 +0200
@@ -72,9 +72,9 @@
 		} while (*sum != old_sample);
 		if (!--size)
 			return;
-		src += src_step;
-		dst += dst_step;
-		sum += sum_step;
+		src = (signed short *) ((char *)src + src_step);
+		dst = (signed short *) ((char *)dst + dst_step);
+		sum = (signed int *)   ((char *)sum + sum_step);
 	}
 }
 
@@ -106,9 +106,9 @@
 		} while (*sum != old_sample);
 		if (!--size)
 			return;
-		src += src_step;
-		dst += dst_step;
-		sum += sum_step;
+		src = (signed int *) ((char *)src + src_step);
+		dst = (signed int *) ((char *)dst + dst_step);
+		sum = (signed int *) ((char *)sum + sum_step);
 	}
 }
 
--- alsa-lib-1.0.9rc2/src/pcm/pcm_plugin.c.gcc4	2005-01-20 16:07:59.000000000 +0100
+++ alsa-lib-1.0.9rc2/src/pcm/pcm_plugin.c	2005-04-22 14:33:49.000000000 +0200
@@ -316,7 +316,7 @@
 		snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
 		if (slave_frames == 0)
 			break;
-		frames = plugin->read(pcm, areas, offset, frames,
+		frames = (plugin->read)(pcm, areas, offset, frames,
 				      slave_areas, slave_offset, &slave_frames);
 		if (CHECK_SANITY(slave_frames > snd_pcm_mmap_capture_avail(slave))) {
 			SNDMSG("read overflow %ld > %ld", slave_frames,
@@ -488,7 +488,7 @@
 				return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
 			if (frames > cont)
 				frames = cont;
-			frames = plugin->read(pcm, areas, hw_offset, frames,
+			frames = (plugin->read)(pcm, areas, hw_offset, frames,
 					      slave_areas, slave_offset, &slave_frames);
 			snd_atomic_write_begin(&plugin->watom);
 			snd_pcm_mmap_hw_forward(pcm, frames);
--- alsa-lib-1.0.9rc2/src/hwdep/hwdep.c.gcc4	2004-05-24 16:57:47.000000000 +0200
+++ alsa-lib-1.0.9rc2/src/hwdep/hwdep.c	2005-04-22 14:33:49.000000000 +0200
@@ -485,7 +485,7 @@
 	assert(hwdep);
 	assert(((hwdep->mode & O_ACCMODE) == O_RDONLY) || ((hwdep->mode & O_ACCMODE) == O_RDWR));
 	assert(buffer || size == 0);
-	return hwdep->ops->read(hwdep, buffer, size);
+	return (hwdep->ops->read)(hwdep, buffer, size);
 }
 
 /**
--- alsa-lib-1.0.9rc2/src/rawmidi/rawmidi.c.gcc4	2004-09-28 12:45:33.000000000 +0200
+++ alsa-lib-1.0.9rc2/src/rawmidi/rawmidi.c	2005-04-22 14:33:49.000000000 +0200
@@ -987,5 +987,5 @@
 	assert(rawmidi);
 	assert(rawmidi->stream == SND_RAWMIDI_STREAM_INPUT);
 	assert(buffer || size == 0);
-	return rawmidi->ops->read(rawmidi, buffer, size);
+	return (rawmidi->ops->read)(rawmidi, buffer, size);
 }
--- alsa-lib-1.0.9rc2/src/seq/seq.c.gcc4	2004-03-23 16:15:21.000000000 +0100
+++ alsa-lib-1.0.9rc2/src/seq/seq.c	2005-04-22 14:33:49.000000000 +0200
@@ -3914,7 +3914,7 @@
 static ssize_t snd_seq_event_read_buffer(snd_seq_t *seq)
 {
 	ssize_t len;
-	len = seq->ops->read(seq, seq->ibuf, seq->ibufsize * sizeof(snd_seq_event_t));
+	len = (seq->ops->read)(seq, seq->ibuf, seq->ibufsize * sizeof(snd_seq_event_t));
 	if (len < 0)
 		return len;
 	seq->ibuflen = len / sizeof(snd_seq_event_t);

[-- Attachment #4: alsa-lib-mixer.patch --]
[-- Type: text/x-patch, Size: 966 bytes --]

--- alsa-lib-1.0.9rc2/src/mixer/mixer.c.old	2005-04-22 14:15:33.000000000 +0200
+++ alsa-lib-1.0.9rc2/src/mixer/mixer.c	2005-04-22 14:27:40.000000000 +0200
@@ -520,14 +520,22 @@
 	return c1->class->compare(c1, c2);
 }
 
+static snd_mixer_t *qsort_mixer;
 typedef int (*qsort_func)(const void *, const void *);
+
+static int compar(const void *a, const void *b) {
+       return qsort_mixer->compare(*(const snd_mixer_elem_t * const *) a,
+                                   *(const snd_mixer_elem_t * const *) b);
+}
+
 static int snd_mixer_sort(snd_mixer_t *mixer)
 {
 	unsigned int k;
 	assert(mixer);
 	assert(mixer->compare);
 	INIT_LIST_HEAD(&mixer->elems);
-	qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t*), (qsort_func)mixer->compare);
+        qsort_mixer = mixer;
+	qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t*), compar);
 	for (k = 0; k < mixer->count; k++)
 		list_add_tail(&mixer->pelems[k]->list, &mixer->elems);
 	return 0;

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: alsa-lib patches
@ 2005-05-15 14:57 Kevin F.Quinn
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin F.Quinn @ 2005-05-15 14:57 UTC (permalink / raw)
  To: alsa-devel

Clemens Ladisch wrote:
> Martin Stransky wrote:
> > About mixer patch - some user had a problem with ICH6 and this patch helped.
> >
> > +static snd_mixer_t *qsort_mixer;
>
> This will break with multithreading.
>
> > +static int compar(const void *a, const void *b) {
> > +       return qsort_mixer->compare(*(const snd_mixer_elem_t * const *) a,
> > +                                   *(const snd_mixer_elem_t * const *) b);
> > +}
>
> So the actual problem is that qsort() calls us with a pointer to a
> pointer to the mixer_elem_t, but the compare function takes a single
> pointer.
>
>
> If we don"t want to change the mixer API, we have to use some
> pthread_mutex to protext qsort_mixer.

Some of us have been watching this at Gentoo, as we agree the patch applied to remove the nested function in src/mixer/mixer.c is broken.

See https://bugs.gentoo.org/show_bug.cgi?id=82242 (skip straight to the end, comment #13) where the PaX team have supplied a patch that ought to work, along the lines of a change made to src/control/hcontrol.c over a year ago which fixed the same issue there.  Patch at https://bugs.gentoo.org/attachment.cgi?id=58918

Cheers,
Kev.




-------------------------------------------------------
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_id\x16281&op=click

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-05-15 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-29 13:57 alsa-lib patches Martin Stransky
2005-04-29 17:46 ` Lee Revell
2005-05-02  7:43   ` Martin Stransky
2005-05-02  8:43 ` Clemens Ladisch
  -- strict thread matches above, loose matches on Subject: below --
2005-05-15 14:57 Kevin F.Quinn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.