diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-03-25 02:34:12 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-03-25 02:34:12 +0000 |
commit | 27cf67733936abd75fcb1f8da765977cd75906ee (patch) | |
tree | f894211a8a0c77b402dd3250b2bee2d17dcfe13f /apps/plugins | |
parent | bc2f8fd8f38a3e010cd67bbac358f6e9991153c6 (diff) | |
download | rockbox-27cf67733936abd75fcb1f8da765977cd75906ee.tar.gz rockbox-27cf67733936abd75fcb1f8da765977cd75906ee.zip |
Add a complete priority inheritance implementation to the scheduler (all mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/mpegplayer/audio_thread.c | 6 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/disk_buf.c | 4 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/stream_mgr.c | 4 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/video_thread.c | 6 |
4 files changed, 14 insertions, 6 deletions
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c index 2bb766ad88..7d2f849a44 100644 --- a/apps/plugins/mpegplayer/audio_thread.c +++ b/apps/plugins/mpegplayer/audio_thread.c | |||
@@ -714,12 +714,14 @@ bool audio_thread_init(void) | |||
714 | /* Start the audio thread */ | 714 | /* Start the audio thread */ |
715 | audio_str.hdr.q = &audio_str_queue; | 715 | audio_str.hdr.q = &audio_str_queue; |
716 | rb->queue_init(audio_str.hdr.q, false); | 716 | rb->queue_init(audio_str.hdr.q, false); |
717 | rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send); | ||
718 | 717 | ||
719 | /* One-up on the priority since the core DSP over-yields internally */ | 718 | /* One-up on the priority since the core DSP over-yields internally */ |
720 | audio_str.thread = rb->create_thread( | 719 | audio_str.thread = rb->create_thread( |
721 | audio_thread, audio_stack, audio_stack_size, 0, | 720 | audio_thread, audio_stack, audio_stack_size, 0, |
722 | "mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK-1) IF_COP(, CPU)); | 721 | "mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK-4) IF_COP(, CPU)); |
722 | |||
723 | rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send, | ||
724 | audio_str.thread); | ||
723 | 725 | ||
724 | if (audio_str.thread == NULL) | 726 | if (audio_str.thread == NULL) |
725 | return false; | 727 | return false; |
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index a408b90a67..289918fc63 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c | |||
@@ -837,7 +837,6 @@ bool disk_buf_init(void) | |||
837 | 837 | ||
838 | disk_buf.q = &disk_buf_queue; | 838 | disk_buf.q = &disk_buf_queue; |
839 | rb->queue_init(disk_buf.q, false); | 839 | rb->queue_init(disk_buf.q, false); |
840 | rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send); | ||
841 | 840 | ||
842 | disk_buf.state = TSTATE_EOS; | 841 | disk_buf.state = TSTATE_EOS; |
843 | disk_buf.status = STREAM_STOPPED; | 842 | disk_buf.status = STREAM_STOPPED; |
@@ -886,6 +885,9 @@ bool disk_buf_init(void) | |||
886 | disk_buf_thread, disk_buf_stack, sizeof(disk_buf_stack), 0, | 885 | disk_buf_thread, disk_buf_stack, sizeof(disk_buf_stack), 0, |
887 | "mpgbuffer" IF_PRIO(, PRIORITY_BUFFERING) IF_COP(, CPU)); | 886 | "mpgbuffer" IF_PRIO(, PRIORITY_BUFFERING) IF_COP(, CPU)); |
888 | 887 | ||
888 | rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send, | ||
889 | disk_buf.thread); | ||
890 | |||
889 | if (disk_buf.thread == NULL) | 891 | if (disk_buf.thread == NULL) |
890 | return false; | 892 | return false; |
891 | 893 | ||
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index 9da664effe..b962c5b993 100644 --- a/apps/plugins/mpegplayer/stream_mgr.c +++ b/apps/plugins/mpegplayer/stream_mgr.c | |||
@@ -987,7 +987,6 @@ int stream_init(void) | |||
987 | 987 | ||
988 | stream_mgr.q = &stream_mgr_queue; | 988 | stream_mgr.q = &stream_mgr_queue; |
989 | rb->queue_init(stream_mgr.q, false); | 989 | rb->queue_init(stream_mgr.q, false); |
990 | rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send); | ||
991 | 990 | ||
992 | /* sets audiosize and returns buffer pointer */ | 991 | /* sets audiosize and returns buffer pointer */ |
993 | mem = rb->plugin_get_audio_buffer(&memsize); | 992 | mem = rb->plugin_get_audio_buffer(&memsize); |
@@ -1028,6 +1027,9 @@ int stream_init(void) | |||
1028 | stream_mgr_thread_stack, sizeof(stream_mgr_thread_stack), | 1027 | stream_mgr_thread_stack, sizeof(stream_mgr_thread_stack), |
1029 | 0, "mpgstream_mgr" IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU)); | 1028 | 0, "mpgstream_mgr" IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU)); |
1030 | 1029 | ||
1030 | rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send, | ||
1031 | stream_mgr.thread); | ||
1032 | |||
1031 | if (stream_mgr.thread == NULL) | 1033 | if (stream_mgr.thread == NULL) |
1032 | { | 1034 | { |
1033 | rb->splash(HZ, "Could not create stream manager thread!"); | 1035 | rb->splash(HZ, "Could not create stream manager thread!"); |
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c index 6508d28d1d..d16eb771b0 100644 --- a/apps/plugins/mpegplayer/video_thread.c +++ b/apps/plugins/mpegplayer/video_thread.c | |||
@@ -955,7 +955,7 @@ static void video_thread(void) | |||
955 | else | 955 | else |
956 | { | 956 | { |
957 | /* Just a little left - spin and be accurate */ | 957 | /* Just a little left - spin and be accurate */ |
958 | rb->priority_yield(); | 958 | rb->yield(); |
959 | if (str_have_msg(&video_str)) | 959 | if (str_have_msg(&video_str)) |
960 | goto message_wait; | 960 | goto message_wait; |
961 | } | 961 | } |
@@ -998,13 +998,15 @@ bool video_thread_init(void) | |||
998 | 998 | ||
999 | video_str.hdr.q = &video_str_queue; | 999 | video_str.hdr.q = &video_str_queue; |
1000 | rb->queue_init(video_str.hdr.q, false); | 1000 | rb->queue_init(video_str.hdr.q, false); |
1001 | rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send); | ||
1002 | 1001 | ||
1003 | /* We put the video thread on another processor for multi-core targets. */ | 1002 | /* We put the video thread on another processor for multi-core targets. */ |
1004 | video_str.thread = rb->create_thread( | 1003 | video_str.thread = rb->create_thread( |
1005 | video_thread, video_stack, VIDEO_STACKSIZE, 0, | 1004 | video_thread, video_stack, VIDEO_STACKSIZE, 0, |
1006 | "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP)); | 1005 | "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP)); |
1007 | 1006 | ||
1007 | rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send, | ||
1008 | video_str.thread); | ||
1009 | |||
1008 | if (video_str.thread == NULL) | 1010 | if (video_str.thread == NULL) |
1009 | return false; | 1011 | return false; |
1010 | 1012 | ||