void NativeWindowRenderer::glThread() { initializeEGL(); createPrograms(); Mutex::Autolock autoLock(mLock); bool quit = false; while (!quit) { switch (mThreadCmd) { case CMD_IDLE: mCond.wait(mLock); continue; case CMD_RENDER_INPUT: render(mThreadRenderInput); break; case CMD_RESERVE_TEXTURE: glBindTexture(GL_TEXTURE_EXTERNAL_OES, mThreadTextureId); CHECK_GL_ERROR; break; case CMD_DELETE_TEXTURE: glDeleteTextures(1, &mThreadTextureId); break; case CMD_QUIT: terminateEGL(); quit = true; break; } // Tell the requester that the command is finished. mThreadCmd = CMD_IDLE; mCond.broadcast(); } ALOGD("quit"); }
bool GLPlatform::initialize() { if (false == initializeEGL()) { return false; } return true; }
EGLDisplay QDirectFbScreenEGL::eglDisplay() { if (m_eglDisplay == EGL_NO_DISPLAY) initializeEGL(); return m_eglDisplay; }
xdl_int XdevLWindowWayland::init() { XdevLWindowImpl::init(); wl_display_roundtrip(display); if(m_compositor == nullptr) { XDEVL_MODULE_ERROR("Wayland compositor object not received.\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Received Wayland compositor object proxy\n"); } if(m_shell == nullptr) { XDEVL_MODULE_ERROR("Wayland shell object not received.\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Received Wayland shell object proxy\n"); } if(m_sharedMemory == nullptr) { XDEVL_MODULE_ERROR("Wayland shared memory object not received.\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Received Wayland shared memory object proxy\n"); } // // Now we create the surface we can see on the screen. // m_surface = wl_compositor_create_surface(m_compositor); if(m_surface == nullptr) { XDEVL_MODULE_ERROR("Can't create Wayland surface\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Created surface\n"); } wl_surface_set_user_data(m_surface, this); m_shellSurface = wl_shell_get_shell_surface(m_shell, m_surface); if(m_shellSurface == nullptr) { XDEVL_MODULE_ERROR("Can't create Wayland shell surface\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Created shell surface\n"); } wl_shell_surface_add_listener(m_shellSurface, &shell_surface_listener, this); // Bring the surface to the front. wl_shell_surface_set_toplevel(m_shellSurface); // m_frameCallback = wl_surface_frame(m_surface); // wl_callback_add_listener(m_frameCallback, &frame_listener, this); createOpaqueRegion(m_attribute.position.x, m_attribute.position.y, m_attribute.size.width, m_attribute.size.height); xdl_int ret = initializeEGL(); if(ret == ERR_ERROR) { XDEVL_MODULE_ERROR("Initializing EGL failed.\n"); return ERR_ERROR; } m_egl.m_eglWindow = wl_egl_window_create(m_surface, getWidth(), getHeight()); if(m_egl.m_eglWindow == EGL_NO_SURFACE) { XDEVL_MODULE_ERROR("Can't create egl window\n"); return ERR_ERROR; } else { XDEVL_MODULE_SUCCESS("Created egl window\n"); } m_egl.m_eglSurface = eglCreateWindowSurface(m_egl.m_eglDisplay, m_egl.m_eglConfig, m_egl.m_eglWindow, nullptr); if(!eglMakeCurrent(m_egl.m_eglDisplay, m_egl.m_eglSurface, m_egl.m_eglSurface, m_egl.m_eglContext)) { XDEVL_MODULE_ERROR("eglMakeCurrent failed\n"); } glClearColor((1.0f/255.0)*m_backgroundColor[0], (1.0f/255.0)*m_backgroundColor[1], (1.0f/255.0)*m_backgroundColor[2], (1.0f/255.0)*m_backgroundColor[3]); glClear(GL_COLOR_BUFFER_BIT); glFlush(); if(!eglSwapBuffers(m_egl.m_eglDisplay, m_egl.m_eglSurface)) { XDEVL_MODULE_ERROR("eglSwapBuffers failed\n"); } wl_display_flush(display); return ERR_OK; }