- printf("egl=%p glx=%p\n", eglGetCurrentContext(), glXGetCurrentContext());
- //printf("threads: %p %p\n", QThread::currentThread(), qGuiApp->thread());
-
- QSurface *surface = create_surface(format());
- QSurface *surface2 = create_surface(format());
- QSurface *surface3 = create_surface(format());
- QSurface *surface4 = create_surface(format());
- std::thread([surface, surface2, surface3, surface4]{
- mixer_thread(surface, surface2, surface3, surface4);
- }).detach();
+ Mixer::DisplayFrame frame;
+ if (!global_mixer->get_display_frame(output, &frame)) {
+ glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
+ check_error();
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ check_error();
+ return;
+ }
+
+ check_error();
+ glWaitSync(frame.ready_fence.get(), /*flags=*/0, GL_TIMEOUT_IGNORED);
+ check_error();
+ frame.setup_chain();
+ check_error();
+ frame.chain->render_to_screen();
+ check_error();
+
+ if (resource_pool == nullptr) {
+ resource_pool = frame.chain->get_resource_pool();
+ } else {
+ assert(resource_pool == frame.chain->get_resource_pool());
+ }