[client] moved sdl and window init outside of the thread, needs to happen early

This commit is contained in:
Geoffrey McRae 2017-10-27 03:08:54 +11:00
parent 3173564b4d
commit b5ef81ff57

View File

@ -239,31 +239,7 @@ int renderThread(void * unused)
format.width = 0;
format.height = 0;
format.stride = 0;
format.frames = 0;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
DEBUG_ERROR("SDL_Init Failed");
return -1;
}
state.window = SDL_CreateWindow("KVM-GFX Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 100, 100, SDL_WINDOW_BORDERLESS);
if (!state.window)
{
DEBUG_ERROR("failed to create window");
return -1;
}
state.renderer = SDL_CreateRenderer(state.window, -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if (!state.renderer)
{
DEBUG_ERROR("failed to create window");
return -1;
}
startCopyThreads();
format.frames = 0;
while(state.running)
{
@ -547,6 +523,31 @@ int main(int argc, char * argv[])
memset(&state, 0, sizeof(state));
state.running = true;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
DEBUG_ERROR("SDL_Init Failed");
return -1;
}
state.window = SDL_CreateWindow("KVM-GFX Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 100, 100, SDL_WINDOW_BORDERLESS);
if (!state.window)
{
DEBUG_ERROR("failed to create window");
return -1;
}
state.renderer = SDL_CreateRenderer(state.window, -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if (!state.renderer)
{
DEBUG_ERROR("failed to create window");
return -1;
}
startCopyThreads();
int shm_fd = 0;
SDL_Thread *t_ivshmem = NULL;
SDL_Thread *t_spice = NULL;