diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:45 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:45 +0000 |
commit | baa070cca6d459a7c5aed81f29e4cc4f6c7410b3 (patch) | |
tree | 5123360aea420b96e4a97a8e88cf51b4277152d9 /firmware/buflib.c | |
parent | d0b72e25903574acb1cf9184a6052cdd646dbc37 (diff) | |
download | rockbox-baa070cca6d459a7c5aed81f29e4cc4f6c7410b3.tar.gz rockbox-baa070cca6d459a7c5aed81f29e4cc4f6c7410b3.zip |
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
Diffstat (limited to 'firmware/buflib.c')
-rw-r--r-- | firmware/buflib.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c index 51cf86bf5b..880357ccf4 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c | |||
@@ -192,10 +192,6 @@ handle_table_shrink(struct buflib_context *ctx) | |||
192 | static bool | 192 | static bool |
193 | move_block(struct buflib_context* ctx, union buflib_data* block, int shift) | 193 | move_block(struct buflib_context* ctx, union buflib_data* block, int shift) |
194 | { | 194 | { |
195 | #if 1 /* moving temporarily disabled */ | ||
196 | (void)ctx;(void)block;(void)shift; | ||
197 | return false; | ||
198 | #else | ||
199 | char* new_start; | 195 | char* new_start; |
200 | union buflib_data *new_block, *tmp = block[1].handle; | 196 | union buflib_data *new_block, *tmp = block[1].handle; |
201 | struct buflib_callbacks *ops = block[2].ops; | 197 | struct buflib_callbacks *ops = block[2].ops; |
@@ -218,7 +214,6 @@ move_block(struct buflib_context* ctx, union buflib_data* block, int shift) | |||
218 | memmove(new_block, block, block->val * sizeof(union buflib_data)); | 214 | memmove(new_block, block, block->val * sizeof(union buflib_data)); |
219 | 215 | ||
220 | return true; | 216 | return true; |
221 | #endif | ||
222 | } | 217 | } |
223 | 218 | ||
224 | /* Compact allocations and handle table, adjusting handle pointers as needed. | 219 | /* Compact allocations and handle table, adjusting handle pointers as needed. |