mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-12 00:47:49 -04:00
mpegplayer: remove IRAM save/restore hack
On targets where plugins can use IRAM, mpegplayer copies its own IRAM region to main memory before enabling voiced menus and then copies it back when exiting the menu. I'm reasonably certain this is unnecessary because the core IRAM area is completely separate from plugin IRAM (which is the same memory as codec IRAM). If they _did_ conflict, then we'd expect to see massive problems with voiced menus during normal playback since most codecs make fairly heavy use of IRAM. There are two other reasons to get rid of this hack: (1) it's ugly, and (2) it will not work on targets with "split" IRAM like on the STM32H743 where the fastest code/data memories are separate. Change-Id: Id8656539c7cafb724691494c54a07448fbcf8129
This commit is contained in:
parent
3083277ee4
commit
01f96e40a7
3 changed files with 0 additions and 121 deletions
|
|
@ -985,13 +985,6 @@ static int get_start_time(uint32_t duration)
|
|||
case STATE0:
|
||||
if (!sliding)
|
||||
{
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
rb->talk_disable(true);
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_restore();
|
||||
#endif
|
||||
}
|
||||
trigger_cpu_boost();
|
||||
sliding = true;
|
||||
}
|
||||
|
|
@ -1010,10 +1003,6 @@ static int get_start_time(uint32_t duration)
|
|||
cancel_cpu_boost();
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_preserve();
|
||||
#endif
|
||||
rb->talk_disable(false);
|
||||
talk_val(resume_time / TS_SECOND, UNIT_TIME, false);
|
||||
talk_val(resume_time * 100 / duration, UNIT_PERCENT, true);
|
||||
}
|
||||
|
|
@ -1053,14 +1042,6 @@ static int show_start_menu(uint32_t duration)
|
|||
ID2P(LANG_SETTINGS),
|
||||
ID2P(LANG_MENU_QUIT));
|
||||
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_preserve();
|
||||
#endif
|
||||
rb->talk_disable(false);
|
||||
}
|
||||
|
||||
rb->button_clear_queue();
|
||||
|
||||
while (!menu_quit)
|
||||
|
|
@ -1109,14 +1090,6 @@ static int show_start_menu(uint32_t duration)
|
|||
}
|
||||
}
|
||||
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
rb->talk_disable(true);
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_restore();
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1151,14 +1124,6 @@ int mpeg_menu(void)
|
|||
ID2P(LANG_RESUME_PLAYBACK),
|
||||
ID2P(LANG_MENU_QUIT));
|
||||
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_preserve();
|
||||
#endif
|
||||
rb->talk_disable(false);
|
||||
}
|
||||
|
||||
rb->button_clear_queue();
|
||||
|
||||
mpeg_sysevent_clear();
|
||||
|
|
@ -1184,14 +1149,6 @@ int mpeg_menu(void)
|
|||
if (mpeg_sysevent() != 0)
|
||||
result = MPEG_MENU_QUIT;
|
||||
|
||||
if (rb->global_settings->talk_menu)
|
||||
{
|
||||
rb->talk_disable(true);
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
mpegplayer_iram_restore();
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -690,54 +690,6 @@ static unsigned draw_blendcolor(unsigned c1, unsigned c2, unsigned char amount)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
/* IRAM preserving mechanism to enable talking menus */
|
||||
static char *iram_saved_copy;
|
||||
extern char iramstart[], iramend[];
|
||||
|
||||
static void iram_saving_init(void)
|
||||
{
|
||||
#ifndef SIMULATOR
|
||||
size_t size;
|
||||
iram_saved_copy = (char *)rb->plugin_get_buffer(&size);
|
||||
|
||||
if (size >= (size_t)(iramend-iramstart))
|
||||
iram_saved_copy += size - (size_t)(iramend - iramstart);
|
||||
else
|
||||
#endif
|
||||
iram_saved_copy = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void mpegplayer_iram_preserve(void)
|
||||
{
|
||||
if (iram_saved_copy)
|
||||
{
|
||||
rb->memcpy(iram_saved_copy, iramstart, iramend-iramstart);
|
||||
#ifdef HAVE_CPUCACHE_INVALIDATE
|
||||
/* make the icache (if it exists) up to date with the new code */
|
||||
rb->cpucache_invalidate();
|
||||
#endif /* HAVE_CPUCACHE_INVALIDATE */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void mpegplayer_iram_restore(void)
|
||||
{
|
||||
if (iram_saved_copy)
|
||||
{
|
||||
rb->audio_hard_stop();
|
||||
rb->memcpy(iramstart, iram_saved_copy, iramend-iramstart);
|
||||
#ifdef HAVE_CPUCACHE_INVALIDATE
|
||||
/* make the icache (if it exists) up to date with the new code */
|
||||
rb->cpucache_invalidate();
|
||||
#endif /* HAVE_CPUCACHE_INVALIDATE */
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Drawing functions that operate rotated on LCD_PORTRAIT displays -
|
||||
* most are just wrappers of lcd_* functions with transforms applied.
|
||||
* The origin is the upper-left corner of the OSD area */
|
||||
|
|
@ -2472,29 +2424,12 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
int status = PLUGIN_OK; /* assume success */
|
||||
bool quit = false;
|
||||
|
||||
#if defined(PLUGIN_USE_IRAM) && !defined(SIMULATOR)
|
||||
bool preserved_talk_state;
|
||||
#endif
|
||||
|
||||
if (parameter == NULL) {
|
||||
/* No file = GTFO */
|
||||
rb->splash(HZ*2, "No File");
|
||||
return PLUGIN_ERROR;
|
||||
}
|
||||
|
||||
/* Disable all talking before initializing IRAM */
|
||||
rb->talk_disable(true);
|
||||
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
iram_saving_init();
|
||||
|
||||
#ifndef SIMULATOR
|
||||
preserved_talk_state = rb->global_settings->talk_menu;
|
||||
if (!iram_saved_copy)
|
||||
rb->global_settings->talk_menu = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
rb->lcd_set_backdrop(NULL);
|
||||
rb->lcd_set_foreground(LCD_WHITE);
|
||||
|
|
@ -2645,13 +2580,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
|
||||
stream_exit();
|
||||
|
||||
#if defined(PLUGIN_USE_IRAM) && !defined(SIMULATOR)
|
||||
if (!iram_saved_copy)
|
||||
rb->global_settings->talk_menu = preserved_talk_state;
|
||||
#endif
|
||||
|
||||
rb->talk_disable(false);
|
||||
|
||||
/* Actually handle delayed processing of system events of interest
|
||||
* that were captured in other button loops */
|
||||
mpeg_sysevent_handle();
|
||||
|
|
|
|||
|
|
@ -86,10 +86,4 @@
|
|||
#define LCD_ENABLE_EVENT_0 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 0)
|
||||
#define LCD_ENABLE_EVENT_1 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 1)
|
||||
|
||||
#ifdef PLUGIN_USE_IRAM
|
||||
/* IRAM preserving mechanism to enable talking menus */
|
||||
extern void mpegplayer_iram_preserve(void);
|
||||
extern void mpegplayer_iram_restore(void);
|
||||
#endif
|
||||
|
||||
#endif /* MPEGPLAYER_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue