bool CEGLNativeTypeIMX::SetNativeResolution(const RESOLUTION_INFO &res) { if (m_readonly) return false; std::string mode; SysfsUtils::GetString("/sys/class/graphics/fb0/mode", mode); if (res.strId == mode) return false; DestroyNativeWindow(); DestroyNativeDisplay(); ShowWindow(false); SysfsUtils::SetString("/sys/class/graphics/fb0/mode", res.strId + "\n"); CreateNativeDisplay(); CreateNativeWindow(); CLog::Log(LOGDEBUG, "%s: %s",__FUNCTION__, res.strId.c_str()); return true; }
bool CEGLNativeTypeIMX::SetNativeResolution(const RESOLUTION_INFO &res) { if (m_readonly) return false; std::string mode; get_sysfs_str("/sys/class/graphics/fb0/mode", mode); if (res.strId == mode) return false; DestroyNativeWindow(); DestroyNativeDisplay(); set_sysfs_str("/sys/class/graphics/fb0/mode", res.strId); CreateNativeDisplay(); CLog::Log(LOGDEBUG, "%s: %s",__FUNCTION__, res.strId.c_str()); // Reset AE CAEFactory::DeviceChange(); return true; }
/*!***************************************************************************************************************************************** @Function main @Input argc Number of arguments passed to the application, ignored. @Input argv Command line strings passed to the application, ignored. @Return Result code to send to the Operating System @Description Main function of the program, executes other functions. *******************************************************************************************************************************************/ int main(int /*argc*/, char **/*argv*/) { // X11 variables Display* nativeDisplay = NULL; Window nativeWindow = 0; // EGL variables EGLDisplay eglDisplay = NULL; EGLConfig eglConfig = NULL; EGLSurface eglSurface = NULL; EGLContext eglContext = NULL; // A vertex buffer object to store our model data. GLuint vertexBuffer = 0; // Get access to a native display if (!CreateNativeDisplay(&nativeDisplay)) { goto cleanup; } // Setup the windowing system, create a window if (!CreateNativeWindow(nativeDisplay, &nativeWindow)) { goto cleanup; } // Create and Initialise an EGLDisplay from the native display if (!CreateEGLDisplay(nativeDisplay, eglDisplay)) { goto cleanup; } // Choose an EGLConfig for the application, used when setting up the rendering surface and EGLContext if (!ChooseEGLConfig(eglDisplay, eglConfig)) { goto cleanup; } // Create an EGLSurface for rendering from the native window if (!CreateEGLSurface(nativeWindow, eglDisplay, eglConfig, eglSurface)) { goto cleanup; } // Setup the EGL Context from the other EGL constructs created so far, so that the application is ready to submit OpenGL ES commands if (!SetupEGLContext(eglDisplay, eglConfig, eglSurface, eglContext)) { goto cleanup; } // Initialise the vertex data in the application if (!InitialiseBuffer(vertexBuffer)) { goto cleanup; } // Renders a triangle for 800 frames using the state setup in the previous function for (int i = 0; i < 800; ++i) { if (!RenderScene(eglDisplay, eglSurface, nativeDisplay)) { break; } } // Release any resources we created in the Initialise functions DeInitialiseBuffer(vertexBuffer); cleanup: // Release the EGL State ReleaseEGLState(eglDisplay); // Release the windowing system resources ReleaseNativeResources(nativeDisplay, nativeWindow); // Destroy the eglWindow return 0; }