hrydgard/ppsspp — pull request #4495 by unknownbrackets (2013-11-10 07:20:19+00:00)
Title: Fix some issues in multithreading on Android

This generally makes it more usable, but it still seems to have issues (might be issues it has on desktop as well...)

This definitely fixes the flickering/blinking for me, which seems to have been caused by afafa5fcd6975366d5ac9be9a20e01eaed00f55b and 1131463. It also cuts out on some battery power wasting in a couple places.

There's still some issue, causing (in some games) the fps to be wrong. For example, one game didn't enqueue any lists for a whole frame, but does every frame when multithreading is disabled. Not sure why.

I'm not actually sure it's using a separate core or not, still. I tried using SetCurrentThreadAffinity() with 0x55555555 and 0xAAAAAAAA, but it didn't really seem to change anything on my device. At least it seemed like it wasn't failing (it does fail if I enable power saving.)

If anyone wants to try it (you need this pull merged), find:
```c++
case CPU_THREAD_EXECUTE:
```

Add after:
```c++
// Comments online say it's necessary to set this every frame on Android.
if (!SetCurrentThreadAffinity(0xAAAAAAAA))
NOTICE_LOG(CPU, "Unable to set thread affinity for CPU");
```

Find:
```c++
gpu->SyncBeginFrame();
```

Add after:
```c++
if (!SetCurrentThreadAffinity(0x55555555))
NOTICE_LOG(CPU, "Unable to set thread affinity for GPU");
```

I think that should put them on separate cores.

-[Unknown]