fb_accel_sti: reorder blit_mutex locking

This seems to help spurious deadlocks in the STI framebuffer blit code.
Not 100% sure why, butthis helps, but I have not seen lockups with this.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 7c5bb95597
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-08-19 (Sat, 19 Aug 2017)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-08-19 21:43:54 +02:00
committed by vanhofen
parent 84b01945fb
commit 6055e3f088

View File

@@ -36,6 +36,7 @@
#include <memory.h>
#include <math.h>
#include <limits.h>
#include <errno.h>
#include <linux/kd.h>
@@ -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();
}