Add a preview window ability to remote servers. Always on for android

* On android in particular this shows some sense of what's happening on
  the device and gives user feedback that it's not completely dead.
This commit is contained in:
baldurk
2018-01-01 17:17:25 +00:00
parent 7a2305ae31
commit 96e39cb781
12 changed files with 499 additions and 51 deletions
+51 -25
View File
@@ -57,31 +57,6 @@ void Daemonise()
{
}
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
uint32_t height)
{
ANativeWindow *connectionScreenWindow = android_state->window;
pthread_mutex_lock(&m_DrawLock.lock);
IReplayOutput *out = renderer->CreateOutput(CreateAndroidWindowingData(connectionScreenWindow),
ReplayOutputType::Texture);
out->SetTextureDisplay(displayCfg);
for(int i = 0; i < 100; i++)
{
renderer->SetFrameEvent(10000000, true);
ANDROID_LOG("Frame %i", i);
out->Display();
usleep(100000);
}
pthread_mutex_unlock(&m_DrawLock.lock);
}
void DisplayGenericSplash()
{
// if something else is drawing and holding the lock, then bail
@@ -269,6 +244,57 @@ void main()
pthread_mutex_unlock(&m_DrawLock.lock);
}
WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSystem> &systems)
{
static bool wasActive = false;
// detect when the preview starts or stops
if(wasActive != active)
{
wasActive = active;
// if we're opening it, aquire the draw lock, otherwise release it.
if(active)
{
pthread_mutex_lock(&m_DrawLock.lock);
}
else
{
pthread_mutex_unlock(&m_DrawLock.lock);
// when we release it, re-draw the splash
DisplayGenericSplash();
}
}
return CreateAndroidWindowingData(android_state->window);
}
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
uint32_t height)
{
ANativeWindow *connectionScreenWindow = android_state->window;
pthread_mutex_lock(&m_DrawLock.lock);
IReplayOutput *out = renderer->CreateOutput(CreateAndroidWindowingData(connectionScreenWindow),
ReplayOutputType::Texture);
out->SetTextureDisplay(displayCfg);
for(int i = 0; i < 100; i++)
{
renderer->SetFrameEvent(10000000, true);
ANDROID_LOG("Frame %i", i);
out->Display();
usleep(100000);
}
pthread_mutex_unlock(&m_DrawLock.lock);
}
// Returns the renderdoccmd arguments passed via am start
// Examples: am start ... -e renderdoccmd "remoteserver"
// -e renderdoccmd "replay /sdcard/capture.rdc"