diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-10-16 01:25:17 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-10-16 01:25:17 +0000 |
commit | a9b2fb5ee3114fe835f6515b6aeae7454f66d821 (patch) | |
tree | fc4e96d0c1f215565918406c8827b16b806c1345 /apps/plugins/mpegplayer | |
parent | a3fbbc9fa7e12fd3fce122bbd235dc362050e024 (diff) | |
download | rockbox-a9b2fb5ee3114fe835f6515b6aeae7454f66d821.tar.gz rockbox-a9b2fb5ee3114fe835f6515b6aeae7454f66d821.zip |
Finally full multicore support for PortalPlayer 502x targets with an eye towards the possibility of other types. All SVN targets the low-lag code to speed up blocking operations. Most files are modified here simple due to a name change to actually support a real event object and a param change to create_thread. Add some use of new features but just sit on things for a bit and leave full integration for later. Work will continue on to address size on sensitive targets and simplify things if possible. Any PP target having problems with SWP can easily be changed to sw corelocks with one #define change in config.h though only PP5020 has shown an issue and seems to work without any difficulties.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15134 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index ea10411f3f..12282a3322 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -189,11 +189,11 @@ typedef struct | |||
189 | { | 189 | { |
190 | struct thread_entry *thread; /* Stream's thread */ | 190 | struct thread_entry *thread; /* Stream's thread */ |
191 | int status; /* Current stream status */ | 191 | int status; /* Current stream status */ |
192 | struct event ev; /* Event sent to steam */ | 192 | struct queue_event ev; /* Event sent to steam */ |
193 | int have_msg; /* 1=event pending */ | 193 | int have_msg; /* 1=event pending */ |
194 | int replied; /* 1=replied to last event */ | 194 | int replied; /* 1=replied to last event */ |
195 | int reply; /* reply value */ | 195 | int reply; /* reply value */ |
196 | struct mutex msg_lock; /* serialization for event senders */ | 196 | struct spinlock msg_lock; /* serialization for event senders */ |
197 | uint8_t* curr_packet; /* Current stream packet beginning */ | 197 | uint8_t* curr_packet; /* Current stream packet beginning */ |
198 | uint8_t* curr_packet_end; /* Current stream packet end */ | 198 | uint8_t* curr_packet_end; /* Current stream packet end */ |
199 | 199 | ||
@@ -256,7 +256,7 @@ static void str_wait_msg(Stream *str) | |||
256 | 256 | ||
257 | /* Returns a message waiting or blocks until one is available - removes the | 257 | /* Returns a message waiting or blocks until one is available - removes the |
258 | event */ | 258 | event */ |
259 | static void str_get_msg(Stream *str, struct event *ev) | 259 | static void str_get_msg(Stream *str, struct queue_event *ev) |
260 | { | 260 | { |
261 | str_wait_msg(str); | 261 | str_wait_msg(str); |
262 | ev->id = str->ev.id; | 262 | ev->id = str->ev.id; |
@@ -266,7 +266,7 @@ static void str_get_msg(Stream *str, struct event *ev) | |||
266 | 266 | ||
267 | /* Peeks at the current message without blocking, returns the data but | 267 | /* Peeks at the current message without blocking, returns the data but |
268 | does not remove the event */ | 268 | does not remove the event */ |
269 | static bool str_look_msg(Stream *str, struct event *ev) | 269 | static bool str_look_msg(Stream *str, struct queue_event *ev) |
270 | { | 270 | { |
271 | if (!str_have_msg(str)) | 271 | if (!str_have_msg(str)) |
272 | return false; | 272 | return false; |
@@ -345,9 +345,9 @@ static size_t file_remaining IBSS_ATTR; | |||
345 | 345 | ||
346 | #if NUM_CORES > 1 | 346 | #if NUM_CORES > 1 |
347 | /* Some stream variables are shared between cores */ | 347 | /* Some stream variables are shared between cores */ |
348 | struct mutex stream_lock IBSS_ATTR; | 348 | struct spinlock stream_lock IBSS_ATTR; |
349 | static inline void init_stream_lock(void) | 349 | static inline void init_stream_lock(void) |
350 | { rb->spinlock_init(&stream_lock); } | 350 | { rb->spinlock_init(&stream_lock, SPINLOCK_TASK_SWITCH); } |
351 | static inline void lock_stream(void) | 351 | static inline void lock_stream(void) |
352 | { rb->spinlock_lock(&stream_lock); } | 352 | { rb->spinlock_lock(&stream_lock); } |
353 | static inline void unlock_stream(void) | 353 | static inline void unlock_stream(void) |
@@ -1050,7 +1050,7 @@ static int button_loop(void) | |||
1050 | 1050 | ||
1051 | if (str_have_msg(&audio_str)) | 1051 | if (str_have_msg(&audio_str)) |
1052 | { | 1052 | { |
1053 | struct event ev; | 1053 | struct queue_event ev; |
1054 | str_get_msg(&audio_str, &ev); | 1054 | str_get_msg(&audio_str, &ev); |
1055 | 1055 | ||
1056 | if (ev.id == STREAM_QUIT) | 1056 | if (ev.id == STREAM_QUIT) |
@@ -1375,7 +1375,7 @@ static void audio_thread(void) | |||
1375 | { | 1375 | { |
1376 | if (str_have_msg(&audio_str)) | 1376 | if (str_have_msg(&audio_str)) |
1377 | { | 1377 | { |
1378 | struct event ev; | 1378 | struct queue_event ev; |
1379 | str_look_msg(&audio_str, &ev); | 1379 | str_look_msg(&audio_str, &ev); |
1380 | 1380 | ||
1381 | if (ev.id == STREAM_QUIT) | 1381 | if (ev.id == STREAM_QUIT) |
@@ -1498,7 +1498,7 @@ static uint32_t video_stack[VIDEO_STACKSIZE / sizeof(uint32_t)] IBSS_ATTR; | |||
1498 | 1498 | ||
1499 | static void video_thread(void) | 1499 | static void video_thread(void) |
1500 | { | 1500 | { |
1501 | struct event ev; | 1501 | struct queue_event ev; |
1502 | const mpeg2_info_t * info; | 1502 | const mpeg2_info_t * info; |
1503 | mpeg2_state_t state; | 1503 | mpeg2_state_t state; |
1504 | char str[80]; | 1504 | char str[80]; |
@@ -1929,9 +1929,8 @@ void display_thumb(int in_file) | |||
1929 | video_str.status = STREAM_PLAYING; | 1929 | video_str.status = STREAM_PLAYING; |
1930 | 1930 | ||
1931 | if ((video_str.thread = rb->create_thread(video_thread, | 1931 | if ((video_str.thread = rb->create_thread(video_thread, |
1932 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" | 1932 | (uint8_t*)video_stack,VIDEO_STACKSIZE, 0,"mpgvideo" |
1933 | IF_PRIO(,PRIORITY_PLAYBACK) | 1933 | IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP))) == NULL) |
1934 | IF_COP(, COP, true))) == NULL) | ||
1935 | { | 1934 | { |
1936 | rb->splash(HZ, "Cannot create video thread!"); | 1935 | rb->splash(HZ, "Cannot create video thread!"); |
1937 | } | 1936 | } |
@@ -2354,8 +2353,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2354 | initialize_stream( &video_str, disk_buf_start, disk_buf_len, 0xe0 ); | 2353 | initialize_stream( &video_str, disk_buf_start, disk_buf_len, 0xe0 ); |
2355 | initialize_stream( &audio_str, disk_buf_start, disk_buf_len, 0xc0 ); | 2354 | initialize_stream( &audio_str, disk_buf_start, disk_buf_len, 0xc0 ); |
2356 | 2355 | ||
2357 | rb->spinlock_init(&audio_str.msg_lock); | 2356 | rb->spinlock_init(&audio_str.msg_lock IF_COP(, SPINLOCK_TASK_SWITCH)); |
2358 | rb->spinlock_init(&video_str.msg_lock); | 2357 | rb->spinlock_init(&video_str.msg_lock IF_COP(, SPINLOCK_TASK_SWITCH)); |
2359 | 2358 | ||
2360 | audio_str.status = STREAM_BUFFERING; | 2359 | audio_str.status = STREAM_BUFFERING; |
2361 | video_str.status = STREAM_PLAYING; | 2360 | video_str.status = STREAM_PLAYING; |
@@ -2372,14 +2371,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2372 | 2371 | ||
2373 | /* We put the video thread on the second processor for multi-core targets. */ | 2372 | /* We put the video thread on the second processor for multi-core targets. */ |
2374 | if ((video_str.thread = rb->create_thread(video_thread, | 2373 | if ((video_str.thread = rb->create_thread(video_thread, |
2375 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) | 2374 | (uint8_t*)video_stack, VIDEO_STACKSIZE, 0, |
2376 | IF_COP(, COP, true))) == NULL) | 2375 | "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP))) == NULL) |
2377 | { | 2376 | { |
2378 | rb->splash(HZ, "Cannot create video thread!"); | 2377 | rb->splash(HZ, "Cannot create video thread!"); |
2379 | } | 2378 | } |
2380 | else if ((audio_str.thread = rb->create_thread(audio_thread, | 2379 | else if ((audio_str.thread = rb->create_thread(audio_thread, |
2381 | (uint8_t*)audio_stack,AUDIO_STACKSIZE,"mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK) | 2380 | (uint8_t*)audio_stack,AUDIO_STACKSIZE, 0,"mpgaudio" |
2382 | IF_COP(, CPU, false))) == NULL) | 2381 | IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, CPU))) == NULL) |
2383 | { | 2382 | { |
2384 | rb->splash(HZ, "Cannot create audio thread!"); | 2383 | rb->splash(HZ, "Cannot create audio thread!"); |
2385 | } | 2384 | } |