mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Revert "PictureFlow: Add move callback for buflib allocations"
It's not needed as picture flow has it's own buffer.
This reverts commit 9076b433d1.
Detailed explanation from Thomas Martiz (thanks!):
buflib buffers can be passed to yielding functions just fine. Problems
only arise if the are concurrent allocations, for example if two threads
allocate from the same context simultaneously or if the callee does it's
own allocations. This can't happen in the pictureflow case, it has it's
own context and a single thread allocating from it.
Therefore the problem isn't yield() itself, but possible concurrent
buflib_alloc() calls that result from the thread switch. This is because
compaction only ever happens on allocation (and not in a backgroud
thread or so).
This commit is contained in:
parent
55f1d9486f
commit
079d7fbb8b
1 changed files with 1 additions and 19 deletions
|
|
@ -443,18 +443,6 @@ static int track_list_visible_entries = 0;
|
|||
static int track_list_y;
|
||||
static int track_list_h;
|
||||
|
||||
static int locked_buflib_handle;
|
||||
static int move_callback(int handle, void *current, void *new)
|
||||
{
|
||||
(void)current; (void)new;
|
||||
if (handle == locked_buflib_handle)
|
||||
return BUFLIB_CB_CANNOT_MOVE;
|
||||
return BUFLIB_CB_OK;
|
||||
}
|
||||
static struct buflib_callbacks pictureflow_ops = {
|
||||
.move_callback = move_callback,
|
||||
};
|
||||
|
||||
/*
|
||||
Proposals for transitions:
|
||||
|
||||
|
|
@ -1546,7 +1534,7 @@ static int read_pfraw(char* filename, int prio)
|
|||
|
||||
int hid;
|
||||
do {
|
||||
hid = rb->buflib_alloc_ex(&buf_ctx, size, "PictureFlow", &pictureflow_ops);
|
||||
hid = rb->buflib_alloc(&buf_ctx, size);
|
||||
} while (hid < 0 && free_slide_prio(prio));
|
||||
|
||||
if (hid < 0) {
|
||||
|
|
@ -1556,7 +1544,6 @@ static int read_pfraw(char* filename, int prio)
|
|||
|
||||
rb->yield(); /* allow audio to play when fast scrolling */
|
||||
struct dim *bm = rb->buflib_get_data(&buf_ctx, hid);
|
||||
locked_buflib_handle = hid;
|
||||
|
||||
bm->width = bmph.width;
|
||||
bm->height = bmph.height;
|
||||
|
|
@ -1568,7 +1555,6 @@ static int read_pfraw(char* filename, int prio)
|
|||
rb->read( fh, data , sizeof( pix_t ) * bm->width );
|
||||
data += bm->width;
|
||||
}
|
||||
locked_buflib_handle = -1;
|
||||
rb->close( fh );
|
||||
return hid;
|
||||
}
|
||||
|
|
@ -1723,7 +1709,6 @@ static inline struct dim *get_slide(const int hid)
|
|||
struct dim *bmp;
|
||||
|
||||
bmp = rb->buflib_get_data(&buf_ctx, hid);
|
||||
locked_buflib_handle = hid;
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
|
@ -2115,9 +2100,6 @@ static void render_all_slides(void)
|
|||
if (step != 0 && num_slides <= 2) /* fading out center slide */
|
||||
alpha = (step > 0) ? 256 - fade / 2 : 128 + fade / 2;
|
||||
render_slide(¢er_slide, alpha);
|
||||
|
||||
/* free up lock on last used slide */
|
||||
locked_buflib_handle = -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue