mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 00:26:32 +00:00
[common] framebuffer: make use of framebuffer_wait
This commit is contained in:
parent
e87d2f1a20
commit
d20e4d1de5
@ -130,19 +130,8 @@ bool framebuffer_read_fn(const FrameBuffer * frame, size_t height, size_t width,
|
|||||||
|
|
||||||
while(y < height)
|
while(y < height)
|
||||||
{
|
{
|
||||||
uint_least32_t wp;
|
if (!framebuffer_wait(frame, rp + linewidth))
|
||||||
int spinCount = 0;
|
return false;
|
||||||
|
|
||||||
/* spinlock */
|
|
||||||
wp = atomic_load_explicit(&frame->wp, memory_order_acquire);
|
|
||||||
while(wp - rp < linewidth)
|
|
||||||
{
|
|
||||||
if (++spinCount == FB_SPIN_LIMIT)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
usleep(1);
|
|
||||||
wp = atomic_load_explicit(&frame->wp, memory_order_acquire);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fn(opaque, frame->data + rp, linewidth))
|
if (!fn(opaque, frame->data + rp, linewidth))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user