Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.1
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Unhelpful - 2009-02-17
Last edited by Unhelpful - 2009-03-04

FS#9919 - lib/buffer_alloc support in pictureflow

Initial patch converting pictureflow to use buffer_alloc functions rather than rb→bufalloc. Works in sim, but many album covers are not drawn at all.

The task depends upon
ID Project Summary Priority Severity Assigned To Progress
9916 Rockbox  FS#9916 - bufalloc-like memory allocator for use with plugin buffer  Very Low Low
100%
Closed by  Unhelpful
2009-03-04 21:26
Reason for closing:  Accepted
Additional comments about closing:  

committed as r20203

Fix a few checks for allocation failure, as buffer_alloc returns 0 for that, not -1. Also, check for valid handle before trying to free it - this apparently works with rb→bufclose, it does not with buf_free.
EDIT: and another replacement, since i failed at diff.

Update data member of bitmap structs after fetching from buffer, free oldest *used* cache entry when loading new slide. need to remove assumption of fixed cache size, as this still eventually breaks when the freed slide doesn’t provide enough space for the now one - we should free *until* we can load the new slide.

Replaced slide cache with circular-linked-list-in-an-array, to simplify finding old slides, and clear oldest slide repeatedly until enough space is freed to load new one. Also reduced/optimized memory usage in some other places, dynamically allocating album title text cache from plugin buffer, and reducing the size of some integer values where it was reasonable. Works on my e200, though it can still hang occasionally (i suspect clearing items from LRU can get stuck sometimes, but haven’t tracked down where/how yet), and the plugin buffer remaining after the plugin’s code and static allocations is only large enough for about 8-9 covers.

Redo/cleanup of linked-list implementation, and store a second linked list for the free slides, rather than having to search the array for one. Works well on all of my targets, but requires 1MB plugin buffer to hold even one screenful of cached slides on color targets, until we have a way to steal only a part of the audio buffer.

Removed a 256KiB static buffer, reducing the space used by static allocations and code to about 49KiB on ARM. This now works quite nicely on my beast with number of slides set to 3, higher can still cause some cache fighting, as LRU is not actually the smartest way to manage this cache, at least not if slides are touched every time they are fetched for display.

Reduce album index to one long per album, fetch album names from tagcache as needed. album index, and a string buffer the length of the longest album are both allocated from the plugin buffer.
EDIT: fix some minor problems with the first patch uploaded

Final (I think) version before ready to commit. Album titles and their index table are both allocated from plugin buffer, and a new “stable cache” is implemented, which keeps as many slides loaded near the current center slide as possible. Ties in priority are determined in fixed ways that should prevent any of the “cache fight” flickering seen when using LRU caching. Album names from tagcache on demand is reverted, as it made PF crawl on my e200, but can be revisited if better-performing code for the needed query comes along.

Update to match renames in  FS#9916 

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing