Android: fix black screen at boot on some devices

This commit is contained in:
Flyinghead 2018-10-29 20:03:47 +01:00
parent 3e9d8d8a07
commit dc9780eb46
5 changed files with 23 additions and 6 deletions

View File

@ -269,7 +269,12 @@ bool rend_single_frame()
do
{
#if !defined(TARGET_NO_THREADS)
#if defined(_ANDROID)
if (!rs.Wait(100))
return false;
#else
rs.Wait();
#endif
#endif
if (!renderer_enabled)
return false;

View File

@ -169,9 +169,21 @@ void cResetEvent::Reset()//reset
state=false;
pthread_mutex_unlock( &mutx );
}
void cResetEvent::Wait(u32 msec)//Wait for signal , then reset
bool cResetEvent::Wait(u32 msec)//Wait for signal , then reset
{
verify(false);
bool rc = true;
pthread_mutex_lock( &mutx );
if (!state)
{
struct timespec ts;
ts.tv_sec = msec / 1000;
ts.tv_nsec = (msec % 1000) * 1000;
rc = pthread_cond_timedwait( &cond, &mutx, &ts ) == 0;
}
state=false;
pthread_mutex_unlock( &mutx );
return rc;
}
void cResetEvent::Wait()//Wait for signal , then reset
{

View File

@ -201,7 +201,7 @@ public :
~cResetEvent();
void Set(); //Set state to signaled
void Reset(); //Set state to non signaled
void Wait(u32 msec);//Wait for signal , then reset[if auto]
bool Wait(u32 msec);//Wait for signal , then reset[if auto]. Returns false if timed out
void Wait(); //Wait for signal , then reset[if auto]
};

View File

@ -785,12 +785,12 @@ void cResetEvent::Reset()//reset
#endif
ResetEvent(hEvent);
}
void cResetEvent::Wait(u32 msec)//Wait for signal , then reset
bool cResetEvent::Wait(u32 msec)//Wait for signal , then reset
{
#if defined(DEBUG_THREADS)
Sleep(rand() % 10);
#endif
WaitForSingleObject(hEvent,msec);
return WaitForSingleObject(hEvent,msec) == WAIT_OBJECT_0;
}
void cResetEvent::Wait()//Wait for signal , then reset
{

View File

@ -521,7 +521,7 @@ JNIEXPORT jint JNICALL Java_com_reicast_emulator_emu_JNIdc_data(JNIEnv *env, job
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_rendframe(JNIEnv *env,jobject obj)
{
while(!rend_single_frame()) ;
rend_single_frame();
}
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_kcode(JNIEnv * env, jobject obj, jintArray k_code, jintArray l_t, jintArray r_t, jintArray jx, jintArray jy)