1
0
Fork 0
forked from len0rd/rockbox

GSoC/Buflib: Enable compaction in buflib.

This enables the ability to allocate (and free) memory dynamically
without fragmentation, through compaction. This means allocations can move
and fragmentation be reduced. Most changes are preparing Rockbox for this,
which many times means adding a move callback which can temporarily disable
movement when the corresponding code is in a critical section.

For now, the audio buffer allocation has a central role, because it's the one
having allocated most. This buffer is able to shrink itself, for which it
needs to stop playback for a very short moment. For this,
audio_buffer_available() returns the size of the audio buffer which can
possibly be used by other allocations because the audio buffer can shrink.

lastfm scrobbling and timestretch can now be toggled at runtime without
requiring a reboot.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-08-30 14:01:45 +00:00
parent d0b72e2590
commit baa070cca6
28 changed files with 865 additions and 298 deletions

View file

@ -192,10 +192,6 @@ handle_table_shrink(struct buflib_context *ctx)
static bool
move_block(struct buflib_context* ctx, union buflib_data* block, int shift)
{
#if 1 /* moving temporarily disabled */
(void)ctx;(void)block;(void)shift;
return false;
#else
char* new_start;
union buflib_data *new_block, *tmp = block[1].handle;
struct buflib_callbacks *ops = block[2].ops;
@ -218,7 +214,6 @@ move_block(struct buflib_context* ctx, union buflib_data* block, int shift)
memmove(new_block, block, block->val * sizeof(union buflib_data));
return true;
#endif
}
/* Compact allocations and handle table, adjusting handle pointers as needed.