[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

@ -241,30 +241,6 @@ int renderThread(void * unused)
format.stride = 0; format.stride = 0;
format.frames = 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();
while(state.running) while(state.running)
{ {
// ensure the header magic is valid, this will help prevent crash out when the memory hasn't yet been initialized // ensure the header magic is valid, this will help prevent crash out when the memory hasn't yet been initialized
@ -547,6 +523,31 @@ int main(int argc, char * argv[])
memset(&state, 0, sizeof(state)); memset(&state, 0, sizeof(state));
state.running = true; 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; int shm_fd = 0;
SDL_Thread *t_ivshmem = NULL; SDL_Thread *t_ivshmem = NULL;
SDL_Thread *t_spice = NULL; SDL_Thread *t_spice = NULL;