gboolean gst_imx_egl_viv_trans_egl_platform_init_window(GstImxEglVivTransEGLPlatform *platform, gint x_coord, gint y_coord, guint width, guint height) { EGLint num_configs; EGLConfig config; int actual_x, actual_y, actual_width, actual_height; static EGLint const eglconfig_attribs[] = { EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; static EGLint const ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; if (!eglChooseConfig(platform->egl_display, eglconfig_attribs, &config, 1, &num_configs)) { GST_ERROR("eglChooseConfig failed: %s", gst_imx_egl_viv_trans_egl_platform_get_last_error_string()); return FALSE; } platform->native_window = fbCreateWindow(platform->native_display, x_coord, y_coord, width, height); fbGetWindowGeometry(platform->native_window, &actual_x, &actual_y, &actual_width, &actual_height); GST_LOG("fbGetWindowGeometry: x/y %d/%d width/height %d/%d", actual_x, actual_y, actual_width, actual_height); eglBindAPI(EGL_OPENGL_ES_API); platform->egl_context = eglCreateContext(platform->egl_display, config, EGL_NO_CONTEXT, ctx_attribs); platform->egl_surface = eglCreateWindowSurface(platform->egl_display, config, platform->native_window, NULL); eglMakeCurrent(platform->egl_display, platform->egl_surface, platform->egl_surface, platform->egl_context); glViewport(0, 0, actual_width, actual_height); return TRUE; }
int call_fbGetWindowGeometry(int *pDatabuf) { str_fbGetWindowGeometry *function; int width, height, x, y; int ret; function = (str_fbGetWindowGeometry *)pDatabuf; fbGetWindowGeometry(function->Window, &x, &y, &width, &height); function->Width = width; function->Height = height; function->X = x; function->Y = y; if(function->hd.retFlag == RT_REQUEST){ function->hd.retFlag = RT_RESPONSE; ret = write(dev, function, MAX_BUF_SIZE); } return 0; }