diff --git a/src/driver/fb_accel_sti.cpp b/src/driver/fb_accel_sti.cpp index dfe0ac5c3..17e342faf 100644 --- a/src/driver/fb_accel_sti.cpp +++ b/src/driver/fb_accel_sti.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -333,10 +334,12 @@ void CFbAccelSTi::run() time_t last_blit = 0; blit_pending = false; blit_thread = true; - blit_mutex.lock(); set_threadname("stifb::autoblit"); while (blit_thread) { + blit_mutex.lock(); blit_cond.wait(&blit_mutex, blit_pending ? BLIT_INTERVAL_MIN : BLIT_INTERVAL_MAX); + blit_mutex.unlock(); + time_t now = time_monotonic_ms(); if (now - last_blit < BLIT_INTERVAL_MIN) { @@ -346,20 +349,22 @@ void CFbAccelSTi::run() else { blit_pending = false; - blit_mutex.unlock(); _blit(); - blit_mutex.lock(); last_blit = now; } } - blit_mutex.unlock(); printf(LOGTAG "::run end\n"); } void CFbAccelSTi::blit() { //printf(LOGTAG "::blit\n"); - blit_mutex.lock(); + int status = blit_mutex.trylock(); + if (status) { + printf(LOGTAG "::blit trylock failed: %d (%s)\n", status, + (status > 0) ? strerror(status) : strerror(errno)); + return; + } blit_cond.signal(); blit_mutex.unlock(); }