mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Remove I/O priority. It is harmful when used with the new file code.
HAVE_IO_PRIORITY was defined for native targets with dircache. It is already effectively disabled for the most part since dircache no longer lowers its thread's I/O priority. It existed primarily for the aforementioned configuration. Change-Id: Ia04935305397ba14df34647c8ea29c2acaea92aa
This commit is contained in:
parent
5d31d3c3bc
commit
5b08f1a5b9
9 changed files with 0 additions and 121 deletions
|
@ -1572,15 +1572,6 @@ size_t buf_get_watermark(void)
|
||||||
return BUF_WATERMARK;
|
return BUF_WATERMARK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
void buf_back_off_storage(bool back_off)
|
|
||||||
{
|
|
||||||
int priority = back_off ?
|
|
||||||
IO_PRIORITY_BACKGROUND : IO_PRIORITY_IMMEDIATE;
|
|
||||||
thread_set_io_priority(buffering_thread_id, priority);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** -- buffer thread helpers -- **/
|
/** -- buffer thread helpers -- **/
|
||||||
static void shrink_buffer_inner(struct memory_handle *h)
|
static void shrink_buffer_inner(struct memory_handle *h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,9 +111,6 @@ size_t buf_length(void);
|
||||||
size_t buf_used(void);
|
size_t buf_used(void);
|
||||||
bool buf_pin_handle(int handle_id, bool pin);
|
bool buf_pin_handle(int handle_id, bool pin);
|
||||||
bool buf_signal_handle(int handle_id, bool signal);
|
bool buf_signal_handle(int handle_id, bool signal);
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
void buf_back_off_storage(bool back_off);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Settings */
|
/* Settings */
|
||||||
void buf_set_watermark(size_t bytes);
|
void buf_set_watermark(size_t bytes);
|
||||||
|
|
|
@ -470,15 +470,7 @@ static void load_codec(const struct codec_load_info *ev_data)
|
||||||
/* Either not a valid handle or the buffer method failed */
|
/* Either not a valid handle or the buffer method failed */
|
||||||
const char *codec_fn = get_codec_filename(data.afmt);
|
const char *codec_fn = get_codec_filename(data.afmt);
|
||||||
if (codec_fn)
|
if (codec_fn)
|
||||||
{
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(true);
|
|
||||||
#endif
|
|
||||||
status = codec_load_file(codec_fn, &ci);
|
status = codec_load_file(codec_fn, &ci);
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Types must agree */
|
/* Types must agree */
|
||||||
|
|
|
@ -1560,9 +1560,6 @@ static bool audio_load_cuesheet(struct track_info *info,
|
||||||
int hid = ERR_UNSUPPORTED_TYPE;
|
int hid = ERR_UNSUPPORTED_TYPE;
|
||||||
struct cuesheet_file cue_file;
|
struct cuesheet_file cue_file;
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(true);
|
|
||||||
#endif
|
|
||||||
if (look_for_cuesheet_file(track_id3, &cue_file))
|
if (look_for_cuesheet_file(track_id3, &cue_file))
|
||||||
{
|
{
|
||||||
hid = bufalloc(NULL, sizeof (struct cuesheet), TYPE_CUESHEET);
|
hid = bufalloc(NULL, sizeof (struct cuesheet), TYPE_CUESHEET);
|
||||||
|
@ -1586,9 +1583,6 @@ static bool audio_load_cuesheet(struct track_info *info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(false);
|
|
||||||
#endif
|
|
||||||
if (hid == ERR_BUFFER_FULL)
|
if (hid == ERR_BUFFER_FULL)
|
||||||
{
|
{
|
||||||
logf("buffer is full for now (%s)", __func__);
|
logf("buffer is full for now (%s)", __func__);
|
||||||
|
@ -1627,10 +1621,6 @@ static bool audio_load_albumart(struct track_info *info,
|
||||||
memset(&user_data, 0, sizeof(user_data));
|
memset(&user_data, 0, sizeof(user_data));
|
||||||
user_data.dim = &albumart_slots[i].dim;
|
user_data.dim = &albumart_slots[i].dim;
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We can only decode jpeg for embedded AA */
|
/* We can only decode jpeg for embedded AA */
|
||||||
if (track_id3->has_embedded_albumart && track_id3->albumart.type == AA_TYPE_JPG)
|
if (track_id3->has_embedded_albumart && track_id3->albumart.type == AA_TYPE_JPG)
|
||||||
{
|
{
|
||||||
|
@ -1651,9 +1641,6 @@ static bool audio_load_albumart(struct track_info *info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
buf_back_off_storage(false);
|
|
||||||
#endif
|
|
||||||
if (hid == ERR_BUFFER_FULL)
|
if (hid == ERR_BUFFER_FULL)
|
||||||
{
|
{
|
||||||
logf("buffer is full for now (%s)", __func__);
|
logf("buffer is full for now (%s)", __func__);
|
||||||
|
|
|
@ -1196,10 +1196,6 @@ Lyre prototype 1 */
|
||||||
#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_DIRCACHE) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
|
||||||
#define HAVE_IO_PRIORITY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CPU_COLDIRE) || CONFIG_CPU == IMX31L
|
#if defined(CPU_COLDIRE) || CONFIG_CPU == IMX31L
|
||||||
/* Can record and play simultaneously */
|
/* Can record and play simultaneously */
|
||||||
#define HAVE_PCM_FULL_DUPLEX
|
#define HAVE_PCM_FULL_DUPLEX
|
||||||
|
|
|
@ -169,11 +169,6 @@ int thread_set_priority(unsigned int thread_id, int priority);
|
||||||
int thread_get_priority(unsigned int thread_id);
|
int thread_get_priority(unsigned int thread_id);
|
||||||
#endif /* HAVE_PRIORITY_SCHEDULING */
|
#endif /* HAVE_PRIORITY_SCHEDULING */
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
void thread_set_io_priority(unsigned int thread_id, int io_priority);
|
|
||||||
int thread_get_io_priority(unsigned int thread_id);
|
|
||||||
#endif /* HAVE_IO_PRIORITY */
|
|
||||||
|
|
||||||
#if NUM_CORES > 1
|
#if NUM_CORES > 1
|
||||||
unsigned int switch_core(unsigned int new_core);
|
unsigned int switch_core(unsigned int new_core);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -134,9 +134,6 @@ struct thread_entry
|
||||||
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
||||||
unsigned char cpu_boost; /* CPU frequency boost flag */
|
unsigned char cpu_boost; /* CPU frequency boost flag */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
unsigned char io_priority;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Thread ID, 32 bits = |VVVVVVVV|VVVVVVVV|VVVVVVVV|SSSSSSSS| */
|
/* Thread ID, 32 bits = |VVVVVVVV|VVVVVVVV|VVVVVVVV|SSSSSSSS| */
|
||||||
|
|
|
@ -367,10 +367,6 @@ static void new_thread_base_init(struct thread_entry *thread,
|
||||||
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
||||||
thread->cpu_boost = 0;
|
thread->cpu_boost = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
/* Default to high (foreground) priority */
|
|
||||||
thread->io_priority = IO_PRIORITY_IMMEDIATE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
|
@ -1421,20 +1417,6 @@ int thread_get_priority(unsigned int thread_id)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_PRIORITY_SCHEDULING */
|
#endif /* HAVE_PRIORITY_SCHEDULING */
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
int thread_get_io_priority(unsigned int thread_id)
|
|
||||||
{
|
|
||||||
struct thread_entry *thread = __thread_id_entry(thread_id);
|
|
||||||
return thread->io_priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
void thread_set_io_priority(unsigned int thread_id,int io_priority)
|
|
||||||
{
|
|
||||||
struct thread_entry *thread = __thread_id_entry(thread_id);
|
|
||||||
thread->io_priority = io_priority;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
* Starts a frozen thread - similar semantics to wakeup_thread except that
|
* Starts a frozen thread - similar semantics to wakeup_thread except that
|
||||||
* the thread is on no scheduler or wakeup queue at all. It exists simply by
|
* the thread is on no scheduler or wakeup queue at all. It exists simply by
|
||||||
|
|
|
@ -33,63 +33,9 @@ static unsigned int storage_drivers[NUM_DRIVES];
|
||||||
static unsigned int num_drives;
|
static unsigned int num_drives;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
|
|
||||||
/* Same for flash? */
|
|
||||||
#define STORAGE_MINIMUM_IDLE_TIME (HZ/10)
|
|
||||||
#define STORAGE_DELAY_UNIT (HZ/20)
|
|
||||||
|
|
||||||
static unsigned int storage_last_thread[NUM_DRIVES];
|
|
||||||
static unsigned int storage_last_activity[NUM_DRIVES];
|
|
||||||
|
|
||||||
static bool storage_should_wait(int drive, int prio)
|
|
||||||
{
|
|
||||||
int other_prio = thread_get_io_priority(storage_last_thread[drive]);
|
|
||||||
if(TIME_BEFORE(current_tick,storage_last_activity[drive]+STORAGE_MINIMUM_IDLE_TIME))
|
|
||||||
{
|
|
||||||
if(prio<=other_prio)
|
|
||||||
{
|
|
||||||
/* There is another active thread, but we have lower priority */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* There is another active thread, but it has lower priority */
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* There's nothing going on anyway */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void storage_wait_turn(IF_MD_NONVOID(int drive))
|
|
||||||
{
|
|
||||||
#ifndef HAVE_MULTIDRIVE
|
|
||||||
int drive=0;
|
|
||||||
#endif
|
|
||||||
int my_prio = thread_get_io_priority(thread_self());
|
|
||||||
int loops=my_prio;
|
|
||||||
while(storage_should_wait(drive, my_prio) && (loops--)>=0)
|
|
||||||
{
|
|
||||||
sleep(STORAGE_DELAY_UNIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
storage_last_thread[drive] = thread_self();
|
|
||||||
storage_last_activity[drive] = current_tick;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
|
int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||||
void* buf)
|
void* buf)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
storage_wait_turn(IF_MD(drive));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STORAGE_MULTI
|
#ifdef CONFIG_STORAGE_MULTI
|
||||||
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
|
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
|
||||||
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
|
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
|
||||||
|
@ -132,10 +78,6 @@ int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||||
int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count,
|
int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||||
const void* buf)
|
const void* buf)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_IO_PRIORITY
|
|
||||||
storage_wait_turn(IF_MD(drive));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STORAGE_MULTI
|
#ifdef CONFIG_STORAGE_MULTI
|
||||||
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
|
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
|
||||||
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
|
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue