summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-01-11 00:46:09 +0000
committerJens Arnold <amiconn@rockbox.org>2008-01-11 00:46:09 +0000
commit753b65737f65296914bcf5055f82272af3ef2e65 (patch)
treeff1417794385a6fc675b4692ac9ed989fa45d67b
parent59f0e7023c86e64db4e6d95aa501ea5a48a35cdf (diff)
downloadrockbox-753b65737f65296914bcf5055f82272af3ef2e65.tar.gz
rockbox-753b65737f65296914bcf5055f82272af3ef2e65.zip
Greyscale mpegplayer: * Use uncached greyscale buffers on dual core targets, removing the need for special cache handling. * Make the OSD properly disappear when viewing a widescreen or small video.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16052 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/mpegplayer/mpeg_parser.c23
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c5
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h19
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c44
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.h3
-rw-r--r--apps/plugins/mpegplayer/stream_thread.h3
-rw-r--r--apps/plugins/mpegplayer/video_thread.c8
7 files changed, 9 insertions, 96 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c
index 0259bc9865..167f07da5c 100644
--- a/apps/plugins/mpegplayer/mpeg_parser.c
+++ b/apps/plugins/mpegplayer/mpeg_parser.c
@@ -1032,28 +1032,7 @@ intptr_t parser_send_video_msg(long id, intptr_t data)
1032 break; 1032 break;
1033 } 1033 }
1034 1034
1035 switch (id) 1035 retval = str_send_msg(&video_str, id, data);
1036 {
1037#ifdef GRAY_CACHE_MAINT
1038 /* This must be done internally here or refresh may be delayed far
1039 * too long */
1040 case VIDEO_DISPLAY_SHOW:
1041 case VIDEO_PRINT_FRAME:
1042 case VIDEO_PRINT_THUMBNAIL:
1043 stream_gray_pause(true);
1044
1045 GRAY_INVALIDATE_ICACHE();
1046
1047 retval = str_send_msg(&video_str, id, data);
1048
1049 GRAY_VIDEO_FLUSH_ICACHE();
1050
1051 stream_gray_pause(false);
1052 break;
1053#endif
1054 default:
1055 retval = str_send_msg(&video_str, id, data);
1056 }
1057 } 1036 }
1058 1037
1059 return retval; 1038 return retval;
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 2ecc2b45a2..935634c3e8 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -944,16 +944,13 @@ static void wvs_show(unsigned show)
944 944
945 stream_vo_set_clip(NULL); 945 stream_vo_set_clip(NULL);
946 946
947#ifdef HAVE_LCD_COLOR
948 draw_clear_area(0, 0, wvs.width, wvs.height); 947 draw_clear_area(0, 0, wvs.width, wvs.height);
949#endif
950 948
951 if (!(show & WVS_NODRAW)) { 949 if (!(show & WVS_NODRAW)) {
952#ifdef HAVE_LCD_COLOR
953 vo_lock(); 950 vo_lock();
954 draw_update_rect(0, 0, wvs.width, wvs.height); 951 draw_update_rect(0, 0, wvs.width, wvs.height);
955 vo_unlock(); 952 vo_unlock();
956#endif 953
957 stream_draw_frame(false); 954 stream_draw_frame(false);
958 } 955 }
959 } 956 }
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index 01ab9bdad6..11bc1ea669 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -89,25 +89,6 @@ enum mpeg_malloc_reason_t
89#define DRAW_WHITE GREY_WHITE 89#define DRAW_WHITE GREY_WHITE
90#define lcd_(fn) grey_##fn 90#define lcd_(fn) grey_##fn
91 91
92#if defined(CPU_PP) && NUM_CORES > 1
93#define GRAY_FLUSH_ICACHE() \
94 IF_COP(flush_icache())
95#define GRAY_INVALIDATE_ICACHE() \
96 IF_COP(invalidate_icache())
97#define GRAY_VIDEO_FLUSH_ICACHE() \
98 IF_COP(parser_send_video_msg(VIDEO_GRAY_CACHEOP, 0))
99#define GRAY_VIDEO_INVALIDATE_ICACHE() \
100 IF_COP(parser_send_video_msg(VIDEO_GRAY_CACHEOP, 1))
101
102#define GRAY_CACHE_MAINT
103#endif
104#endif
105
106#ifndef GRAY_CACHE_MAINT
107#define GRAY_FLUSH_ICACHE()
108#define GRAY_INVALIDATE_ICACHE()
109#define GRAY_VIDEO_FLUSH_ICACHE()
110#define GRAY_VIDEO_INVALIDATE_ICACHE()
111#endif 92#endif
112 93
113#include "mpeg2.h" 94#include "mpeg2.h"
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index 2d4cfb2650..14457a716e 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -661,12 +661,7 @@ bool stream_show_vo(bool show)
661 661
662 vis = parser_send_video_msg(VIDEO_DISPLAY_SHOW, show); 662 vis = parser_send_video_msg(VIDEO_DISPLAY_SHOW, show);
663#ifndef HAVE_LCD_COLOR 663#ifndef HAVE_LCD_COLOR
664 GRAY_VIDEO_INVALIDATE_ICACHE();
665 GRAY_INVALIDATE_ICACHE();
666
667 grey_show(show); 664 grey_show(show);
668
669 GRAY_FLUSH_ICACHE();
670#endif 665#endif
671 stream_mgr_unlock(); 666 stream_mgr_unlock();
672 667
@@ -722,42 +717,11 @@ void stream_gray_show(bool show)
722{ 717{
723 stream_mgr_lock(); 718 stream_mgr_lock();
724 719
725 GRAY_VIDEO_INVALIDATE_ICACHE();
726 GRAY_INVALIDATE_ICACHE();
727
728 grey_show(show); 720 grey_show(show);
729 721
730 GRAY_FLUSH_ICACHE();
731
732 stream_mgr_unlock(); 722 stream_mgr_unlock();
733} 723}
734 724
735#ifdef GRAY_CACHE_MAINT
736void stream_gray_pause(bool pause)
737{
738 static bool gray_paused = false;
739
740 if (pause && !gray_paused)
741 {
742 if (_grey_info.flags & _GREY_RUNNING)
743 {
744 rb->timer_unregister();
745#if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
746 rb->cpu_boost(false);
747#endif
748 _grey_info.flags &= ~_GREY_RUNNING;
749 rb->screen_dump_set_hook(NULL);
750 gray_paused = true;
751 }
752 }
753 else if (!pause && gray_paused)
754 {
755 gray_paused = false;
756 grey_show(true);
757 }
758}
759#endif
760
761#endif /* !HAVE_LCD_COLOR */ 725#endif /* !HAVE_LCD_COLOR */
762 726
763/* Display a thumbnail at the last seek point */ 727/* Display a thumbnail at the last seek point */
@@ -1013,11 +977,17 @@ int stream_init(void)
1013#ifndef HAVE_LCD_COLOR 977#ifndef HAVE_LCD_COLOR
1014 bool success; 978 bool success;
1015 long graysize; 979 long graysize;
980 void *graymem;
1016 981
982#ifdef PROC_NEEDS_CACHEALIGN
1017 /* This can run on another processor - align data */ 983 /* This can run on another processor - align data */
1018 memsize = CACHEALIGN_BUFFER(&mem, memsize); 984 memsize = CACHEALIGN_BUFFER(&mem, memsize);
985 graymem = UNCACHED_ADDR(mem);
986#else
987 graymem = mem;
988#endif
1019 989
1020 success = grey_init(rb, mem, memsize, true, LCD_WIDTH, 990 success = grey_init(rb, graymem, memsize, true, LCD_WIDTH,
1021 LCD_HEIGHT, &graysize); 991 LCD_HEIGHT, &graysize);
1022 992
1023 /* This can run on another processor - align size */ 993 /* This can run on another processor - align size */
diff --git a/apps/plugins/mpegplayer/stream_mgr.h b/apps/plugins/mpegplayer/stream_mgr.h
index b2aa90967e..c987181343 100644
--- a/apps/plugins/mpegplayer/stream_mgr.h
+++ b/apps/plugins/mpegplayer/stream_mgr.h
@@ -106,9 +106,6 @@ void stream_vo_set_clip(const struct vo_rect *rc);
106 106
107#ifndef HAVE_LCD_COLOR 107#ifndef HAVE_LCD_COLOR
108void stream_gray_show(bool show); 108void stream_gray_show(bool show);
109#ifdef GRAY_CACHE_MAINT
110void stream_gray_pause(bool pause);
111#endif
112#endif 109#endif
113 110
114/* Display thumbnail of the current seekpoint */ 111/* Display thumbnail of the current seekpoint */
diff --git a/apps/plugins/mpegplayer/stream_thread.h b/apps/plugins/mpegplayer/stream_thread.h
index 58cb7b93e4..ddacb4bd9a 100644
--- a/apps/plugins/mpegplayer/stream_thread.h
+++ b/apps/plugins/mpegplayer/stream_thread.h
@@ -107,9 +107,6 @@ enum stream_message
107 VIDEO_PRINT_FRAME, /* Print the frame at the current position */ 107 VIDEO_PRINT_FRAME, /* Print the frame at the current position */
108 VIDEO_PRINT_THUMBNAIL, /* Print a thumbnail of the current position */ 108 VIDEO_PRINT_THUMBNAIL, /* Print a thumbnail of the current position */
109 VIDEO_SET_CLIP_RECT, /* Set the visible video area */ 109 VIDEO_SET_CLIP_RECT, /* Set the visible video area */
110#ifdef GRAY_CACHE_MAINT
111 VIDEO_GRAY_CACHEOP,
112#endif
113 STREAM_MESSAGE_LAST, 110 STREAM_MESSAGE_LAST,
114}; 111};
115 112
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 4fc428d522..d10a9671d5 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -612,14 +612,6 @@ static void video_thread_msg(struct video_thread_data *td)
612 reply = video_str_scan(td, (struct str_sync_data *)td->ev.data); 612 reply = video_str_scan(td, (struct str_sync_data *)td->ev.data);
613 break; 613 break;
614 614
615#ifdef GRAY_CACHE_MAINT
616 case VIDEO_GRAY_CACHEOP:
617 td->ev.data ?
618 GRAY_INVALIDATE_ICACHE() :
619 GRAY_FLUSH_ICACHE();
620 break;
621#endif
622
623 case STREAM_QUIT: 615 case STREAM_QUIT:
624 /* Time to go - make thread exit */ 616 /* Time to go - make thread exit */
625 td->state = TSTATE_EOS; 617 td->state = TSTATE_EOS;