Commit graph

1036 commits

Author SHA1 Message Date
Daniel Mack
542fa468c2 Mac OS X: add semaphore implementation
On Wed, Sep 16, 2009 at 11:57:04PM +0200, Lennart Poettering wrote:
> On Wed, 16.09.09 15:15, Daniel Mack (daniel@caiaq.de) wrote:
>
> > +    s = pa_xnew(pa_semaphore, 1);
> > +    MPCreateSemaphore(UINT_MAX, value, &(s->sema));
> > +    pa_assert(s->sema != 0);
>
> Hmm, I'd prefer if the ret val of MPCreateSemaphore() would be checked
> here.
>
> Also I find it a bit weird checking for s->sema, though not
> initializing it to 0 in the beginning. If the call actually failed,
> then the assert will check uninitialized memory. Also, comparing
> pointers with 0 sucks. That should be NULL.
>
> Given that this can not realisitically fail, only in OOM or OOM-like
> situations in which case we abort anyway it mght be enough just writing:
>
> pa_assert_se(MPCreateSemaphore(UINT_MAX, value, &s->sema) == 0);
>
> (Assuming that success is signalled by retval == 0 on MacOSX)
>
> > +void pa_semaphore_free(pa_semaphore *s) {
> > +    pa_assert(s);
> > +    MPDeleteSemaphore(s->sema);
>
> Same here.
>
> > +    pa_xfree(s);
> > +}
> > +
> > +void pa_semaphore_post(pa_semaphore *s) {
> > +    pa_assert(s);
> > +    MPSignalSemaphore(s->sema);
>
> And here.
>
> > +}
> > +
> > +void pa_semaphore_wait(pa_semaphore *s) {
> > +    pa_assert(s);
> > +    /* should probably check return value (-ve is error), noErr is ok. */
> > +    MPWaitOnSemaphore(s->sema, kDurationForever);
>
> And here.

Ok, done. See the patch below.

Daniel

>From 26df2fbae6d9215a3ae084876fb5f79e4d9cf4f0 Mon Sep 17 00:00:00 2001
From: Kim Lester <kim@dfusion.com.au>
Date: Wed, 16 Sep 2009 09:23:39 +0800
Subject: [PATCH] Mac OS X: add semaphore implementation
2009-10-31 01:34:04 +01:00
Daniel Mack
b04fe9b516 Wrap clock_gettime and friends
On Wed, Sep 16, 2009 at 11:48:58PM +0200, Lennart Poettering wrote:
> On Wed, 16.09.09 15:15, Daniel Mack (daniel@caiaq.de) wrote:
>
> > From: Kim Lester <kim@dfusion.com.au>
> >
> > OS X does not define clockid_t or clock_gettime() and friends.
> > Add a wrapper to fix this.
>
> Hmpf. I am not particularly happy with this. This adds a lot of
> unnecessary compat code. We don't actually need implementations of
> clock_getres(). All we need is some kind of check whether system
> timers are accurate or whether they are rounded up to scheduling
> slices. On Linux we do that check with clock_getres(), but all the
> information it returns is actually not intertesting at all. We just
> check if this is below some trheshold, that's all.
>
> clock_settime() we don't use at all! We shouldn't carry compat code
> for that.
>
> And clock_gettime we don't really need either. We need some kind of
> accurate system timers (preferably monotonic), and on Linux we use
> clock_gettime() for that. But we already have a fallback there for
> gettimeofday().
>
> Or in other words, the current APIs pa_rtclock_get(),
> pa_rtclock_hrtimer() is supposed to be the abstract API that has
> different backends on different systems. I'd very much prefer if any
> MacOS specific code would simply be plugged in there instead of
> creating various new abstraction interfaces!

Ok - what about the version below? I don't particularily like the

Daniel

>From 9f0a051953ec354ccdb8aa44a9845c408b26ae0b Mon Sep 17 00:00:00 2001
From: Kim Lester <kim@dfusion.com.au>
Date: Wed, 16 Sep 2009 14:40:01 +0800
Subject: [PATCH] Implement pa_rtclock_get() and pa_rtclock_hrtimer() for Darwin

OS X does not define clockid_t or clock_gettime() and friends.
Add wrappers to fix this. Based on a patch from Kim Lester
<kim@dfusion.com.au>.
2009-10-31 01:33:13 +01:00
Leszek Koltunski
65e8078a3b X11: attach X11 properties to Screen, not Display 2009-10-30 05:24:41 +01:00
Wim Taymans
056930cbcd svolume: fix MMX error
We need to sign extend the lower part of the multiplication before adding it to
the higher part. Makes -1 * 0xffff work again.
2009-10-30 05:09:15 +01:00
Wim Taymans
8a49514f74 sink: simplify silence checks 2009-10-30 05:09:05 +01:00
Lennart Poettering
a82c6b0cd5 socket-util: drop redundant casts 2009-10-30 04:55:13 +01:00
Lennart Poettering
75f7a971db socket-util: allocate at least sizeof(sockaddr_storage) space 2009-10-30 04:54:55 +01:00
Lennart Poettering
168be3830a use pa_fopen_cloexec() where applicable 2009-10-30 04:54:19 +01:00
Lennart Poettering
88b72958be tdb: use O_CLOEXEC if available 2009-10-30 04:53:15 +01:00
Lennart Poettering
752727a13d core-util: introduce pa_fopen_cloexec() 2009-10-30 04:20:24 +01:00
Lennart Poettering
a698ee3f52 core-util: make sure to enable FD_CLOEXEC unconditionally to cope with kernels that silently accept but ignore O_CLOEXEC 2009-10-30 04:16:59 +01:00
Lennart Poettering
65e7bc18a9 use cloexec wrappers wherever applicable 2009-10-30 03:32:38 +01:00
Lennart Poettering
9c1a98953f core-util: introduce FD_CLOEXEC wrappers for open/socket/pipe/accept 2009-10-30 03:30:42 +01:00
Lennart Poettering
e7e4e4459e simd: update test cases 2009-10-29 01:52:39 +01:00
Lennart Poettering
2edb4df175 smoother: add comments about optimization recommendations from Jason Newton 2009-10-29 01:49:40 +01:00
Lennart Poettering
f27a50691c libpulse: introduce PA_STREAM_RELATIVE_VOLUME 2009-10-29 00:46:22 +01:00
Lennart Poettering
546bcf3f2f protocol-native: if a client set volume/mute/device store it since it is user input 2009-10-28 23:50:42 +01:00
Lennart Poettering
27c6a80ccb protocol-native: declare that user configured volumes are always absolute 2009-10-28 23:47:21 +01:00
Lennart Poettering
744490a681 memblock: decrease tile size to 64k again 2009-10-28 21:29:01 +01:00
Diego Elio 'Flameeyes' Pettenò
8ec304d2d1 Fix build when using -fweb, accept both register and memory constraints.
This was reported as Gentoo bug #287391 by Torsten Kaiser, and the fix was
suggested by Mike Frysinger.
2009-10-07 19:31:11 +02:00
Lennart Poettering
9f226d25d6 Merge remote branch 'phish3/master' 2009-10-07 03:43:24 +02:00
Tanu Kaskinen
019331d25b Merge branch 'master' into dbus-work
Conflicts:
	src/daemon/daemon-conf.c
2009-10-02 17:24:44 +03:00
Jason Newton
cf8331a0da module-equalizer-sink: trying new buffering strategies 2009-09-29 23:50:52 -07:00
Wim Taymans
5eecd8ea7d svolume: tweak constraints for 32 bits
Tweak the constraints a little so that register starved 32bit systems
can select a stack variable for the channel paramter instead of reusing one of
the registers we're using in the code.
2009-09-23 17:18:20 +02:00
Lennart Poettering
e7686a607d core: dump proplist when creating stream similar to how we already to it for sinks/sources 2009-09-20 03:18:03 +02:00
Lennart Poettering
996051ebc1 memtrap: properly add items to linked list 2009-09-19 00:21:34 +02:00
Lennart Poettering
8ad8e393f1 namereg: choose default sink/source as soon as one becomes available 2009-09-18 22:42:37 +02:00
Lennart Poettering
9697c5dc18 memblock: don't try to reuse PA_MEMBLOCK_APPENDED memblocks since they usually are much bigger than we want them 2009-09-18 22:16:26 +02:00
Lennart Poettering
cd5d6e7b42 socket-client: modernizations 2009-09-18 22:16:25 +02:00
Lennart Poettering
c010172c66 memblock: modernizations 2009-09-18 22:16:25 +02:00
Lennart Poettering
c024aeaae9 timeval: make timeval conversion routines handle PA_USEC_INVALID special 2009-09-18 04:14:39 +02:00
Lennart Poettering
fdec460661 core-rtclock: introduce pa_timespec_store() akin pa_timeval_store() 2009-09-18 04:14:37 +02:00
Lennart Poettering
56f217f3f8 macro: introduce PA_INT_TYPE_MIN, PA_INT_TYPE_MAX, PA_INT_TYPE_SIGNED macros 2009-09-18 04:14:37 +02:00
Lennart Poettering
7b76ea3784 core-util: unify how we determine the temporary directory 2009-09-17 21:06:54 +02:00
Lennart Poettering
2d9168ceb3 Improve TMPDIR handling
Patch from 'jnelson',

http://pulseaudio.org/ticket/653
2009-09-17 20:58:36 +02:00
Lennart Poettering
231c17be03 svolume_mmx: disable test accidentaly left on 2009-09-17 01:34:02 +02:00
Lennart Poettering
4e6dce593f Merge remote branch 'wtay/optimize' 2009-09-17 01:32:03 +02:00
Lennart Poettering
e2899f8bf3 memblock: make it easy to disable mempool usage with $PULSE_MEMPOOL_DISABLE 2009-09-17 01:21:56 +02:00
Wim Taymans
3d5a572694 svolume_mmx: optimize some more
We can reorder the algortihm a bit like we do for sse so that we
don't need the contants and masking instructions. Saves 2 instructions
for the mmx code.
2009-09-16 17:14:12 +02:00
Wim Taymans
d397a82e14 svolume_sse: fix comment 2009-09-16 17:14:11 +02:00
Lennart Poettering
a015d56fac core: add an additional volume factor that is applied after resampling took place 2009-09-11 03:26:25 +02:00
Lennart Poettering
807f2a9923 native: send PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED messages only to clients that understand it 2009-09-10 02:15:12 +02:00
Lennart Poettering
71e066c873 simd: be more precise which SIMD optimizations we activate 2009-09-09 04:28:22 +02:00
Lennart Poettering
1f0904b800 sample-util: add pa_convert_size() call for converting sizes between two sample specs 2009-09-09 04:27:16 +02:00
Lennart Poettering
12df6860ad ratelimit: allow non-static ratelimit structs 2009-09-09 02:41:34 +02:00
Lennart Poettering
31d1d9088e protocol-native: log explicitly when someone asks us to quit 2009-09-08 23:53:28 +02:00
Lennart Poettering
31ae7deefa core-util: properly fill in exception array for pa_reset_sigs() (llvm-clang-analyzer) 2009-09-08 23:52:58 +02:00
Lennart Poettering
1516b7c047 conf-parser: properly initialize variable we free() later (llvm-clang-analyzer) 2009-09-08 23:51:39 +02:00
Lennart Poettering
3c9a09bc45 cli-command: don't necessarily ovveride failure code of files (llvm-clang-analyzer) 2009-09-08 23:51:00 +02:00
Lennart Poettering
5fd751fc2e cli-command: modernizations 2009-09-08 23:50:14 +02:00