From 753b65737f65296914bcf5055f82272af3ef2e65 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 11 Jan 2008 00:46:09 +0000 Subject: 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 --- apps/plugins/mpegplayer/mpeg_parser.c | 23 +---------------- apps/plugins/mpegplayer/mpegplayer.c | 5 +--- apps/plugins/mpegplayer/mpegplayer.h | 19 -------------- apps/plugins/mpegplayer/stream_mgr.c | 44 ++++++--------------------------- apps/plugins/mpegplayer/stream_mgr.h | 3 --- apps/plugins/mpegplayer/stream_thread.h | 3 --- apps/plugins/mpegplayer/video_thread.c | 8 ------ 7 files changed, 9 insertions(+), 96 deletions(-) (limited to 'apps/plugins/mpegplayer') 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) break; } - switch (id) - { -#ifdef GRAY_CACHE_MAINT - /* This must be done internally here or refresh may be delayed far - * too long */ - case VIDEO_DISPLAY_SHOW: - case VIDEO_PRINT_FRAME: - case VIDEO_PRINT_THUMBNAIL: - stream_gray_pause(true); - - GRAY_INVALIDATE_ICACHE(); - - retval = str_send_msg(&video_str, id, data); - - GRAY_VIDEO_FLUSH_ICACHE(); - - stream_gray_pause(false); - break; -#endif - default: - retval = str_send_msg(&video_str, id, data); - } + retval = str_send_msg(&video_str, id, data); } 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) stream_vo_set_clip(NULL); -#ifdef HAVE_LCD_COLOR draw_clear_area(0, 0, wvs.width, wvs.height); -#endif if (!(show & WVS_NODRAW)) { -#ifdef HAVE_LCD_COLOR vo_lock(); draw_update_rect(0, 0, wvs.width, wvs.height); vo_unlock(); -#endif + stream_draw_frame(false); } } 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 #define DRAW_WHITE GREY_WHITE #define lcd_(fn) grey_##fn -#if defined(CPU_PP) && NUM_CORES > 1 -#define GRAY_FLUSH_ICACHE() \ - IF_COP(flush_icache()) -#define GRAY_INVALIDATE_ICACHE() \ - IF_COP(invalidate_icache()) -#define GRAY_VIDEO_FLUSH_ICACHE() \ - IF_COP(parser_send_video_msg(VIDEO_GRAY_CACHEOP, 0)) -#define GRAY_VIDEO_INVALIDATE_ICACHE() \ - IF_COP(parser_send_video_msg(VIDEO_GRAY_CACHEOP, 1)) - -#define GRAY_CACHE_MAINT -#endif -#endif - -#ifndef GRAY_CACHE_MAINT -#define GRAY_FLUSH_ICACHE() -#define GRAY_INVALIDATE_ICACHE() -#define GRAY_VIDEO_FLUSH_ICACHE() -#define GRAY_VIDEO_INVALIDATE_ICACHE() #endif #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) vis = parser_send_video_msg(VIDEO_DISPLAY_SHOW, show); #ifndef HAVE_LCD_COLOR - GRAY_VIDEO_INVALIDATE_ICACHE(); - GRAY_INVALIDATE_ICACHE(); - grey_show(show); - - GRAY_FLUSH_ICACHE(); #endif stream_mgr_unlock(); @@ -722,42 +717,11 @@ void stream_gray_show(bool show) { stream_mgr_lock(); - GRAY_VIDEO_INVALIDATE_ICACHE(); - GRAY_INVALIDATE_ICACHE(); - grey_show(show); - GRAY_FLUSH_ICACHE(); - stream_mgr_unlock(); } -#ifdef GRAY_CACHE_MAINT -void stream_gray_pause(bool pause) -{ - static bool gray_paused = false; - - if (pause && !gray_paused) - { - if (_grey_info.flags & _GREY_RUNNING) - { - rb->timer_unregister(); -#if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ) - rb->cpu_boost(false); -#endif - _grey_info.flags &= ~_GREY_RUNNING; - rb->screen_dump_set_hook(NULL); - gray_paused = true; - } - } - else if (!pause && gray_paused) - { - gray_paused = false; - grey_show(true); - } -} -#endif - #endif /* !HAVE_LCD_COLOR */ /* Display a thumbnail at the last seek point */ @@ -1013,11 +977,17 @@ int stream_init(void) #ifndef HAVE_LCD_COLOR bool success; long graysize; + void *graymem; +#ifdef PROC_NEEDS_CACHEALIGN /* This can run on another processor - align data */ memsize = CACHEALIGN_BUFFER(&mem, memsize); + graymem = UNCACHED_ADDR(mem); +#else + graymem = mem; +#endif - success = grey_init(rb, mem, memsize, true, LCD_WIDTH, + success = grey_init(rb, graymem, memsize, true, LCD_WIDTH, LCD_HEIGHT, &graysize); /* 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); #ifndef HAVE_LCD_COLOR void stream_gray_show(bool show); -#ifdef GRAY_CACHE_MAINT -void stream_gray_pause(bool pause); -#endif #endif /* 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 VIDEO_PRINT_FRAME, /* Print the frame at the current position */ VIDEO_PRINT_THUMBNAIL, /* Print a thumbnail of the current position */ VIDEO_SET_CLIP_RECT, /* Set the visible video area */ -#ifdef GRAY_CACHE_MAINT - VIDEO_GRAY_CACHEOP, -#endif STREAM_MESSAGE_LAST, }; 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) reply = video_str_scan(td, (struct str_sync_data *)td->ev.data); break; -#ifdef GRAY_CACHE_MAINT - case VIDEO_GRAY_CACHEOP: - td->ev.data ? - GRAY_INVALIDATE_ICACHE() : - GRAY_FLUSH_ICACHE(); - break; -#endif - case STREAM_QUIT: /* Time to go - make thread exit */ td->state = TSTATE_EOS; -- cgit v1.2.3