Beispiel #1
0
void	initEglOnly()
{
  const EGLint config_attr[] =
    {
      EGL_RED_SIZE,	5,
      EGL_GREEN_SIZE, 	6,
      EGL_BLUE_SIZE,	5,
      EGL_ALPHA_SIZE, 	EGL_DONT_CARE,
      EGL_NONE
    };
 
  EGLint configs, major, minor;

  EGLNativeDisplayType native_disp = fbGetDisplayByIndex(0);                              /* i.MX6 specific */
  fbGetDisplayGeometry(native_disp, &m_width, &m_height);                                 /* i.MX6 specific */
  EGLNativeWindowType native_win  = fbCreateWindow(native_disp, 0, 0, m_width, m_height); /* i.MX6 specific */
  
  eglBindAPI(EGL_OPENGL_ES_API);

  m_egldisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
  eglInitialize(m_egldisplay, &major, &minor);
  
  eglGetConfigs(m_egldisplay, NULL, 0, &configs);
  
  eglChooseConfig(m_egldisplay, config_attr, &m_eglconfig, 1, &configs);
  m_eglsurface = eglCreateWindowSurface(m_egldisplay, m_eglconfig, native_win, NULL);
}
Beispiel #2
0
QEglFSImx6Hooks::QEglFSImx6Hooks()
{
    int width, height;
    mNativeDisplay = fbGetDisplayByIndex(0);
    fbGetDisplayGeometry(mNativeDisplay, &width, &height);
    mScreenSize.setHeight(height);
    mScreenSize.setWidth(width);
}
Beispiel #3
0
bool CEGLNativeTypeIMX::CreateNativeDisplay()
{
  // Force double-buffering
  CEnvironment::setenv("FB_MULTI_BUFFER", "2", 0);

  // EGL will be rendered on fb0
  m_display = fbGetDisplayByIndex(0);
  m_nativeDisplay = &m_display;
  return true;
}
Beispiel #4
0
static bool gfx_ctx_vivante_set_video_mode(void *data,
      unsigned width, unsigned height,
      bool fullscreen)
{
   EGLNativeWindowType window;
   static const EGLint attribs[] = {
      EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */
      EGL_NONE
   };

   /* Pick some arbitrary default. */
   if (!width || !fullscreen)
      width = 1280;
   if (!height || !fullscreen)
      height = 1024;

   g_width    = width;
   g_height   = height;

   window     = fbCreateWindow(fbGetDisplayByIndex(0), 0, 0, 0, 0);
   g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, window, 0);

   if (g_egl_surf == EGL_NO_SURFACE)
   {
      RARCH_ERR("eglCreateWindowSurface failed.\n");
      goto error;
   }

   g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, 0, attribs);
   if (g_egl_ctx == EGL_NO_CONTEXT)
   {
      RARCH_ERR("eglCreateContext failed.\n");
      goto error;
   }

   if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
   {
      RARCH_ERR("eglMakeCurrent failed.\n");
      goto error;
   }

   return true;

error:
   RARCH_ERR("[Vivante fbdev]: EGL error: %d.\n", eglGetError());
   gfx_ctx_vivante_destroy(data);
   return false;
}
Beispiel #5
0
QEglFSImx6Hooks::QEglFSImx6Hooks()
{
    int width, height;

    bool multiBufferNotEnabledYet = qEnvironmentVariableIsEmpty("FB_MULTI_BUFFER");
    bool multiBuffer = qEnvironmentVariableIsEmpty("QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER");
    if (multiBufferNotEnabledYet && multiBuffer) {
        qWarning() << "QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.\n"
                   << "If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1";
        qputenv("FB_MULTI_BUFFER", "2");
    }

    mNativeDisplay = fbGetDisplayByIndex(framebufferIndex());
    fbGetDisplayGeometry(mNativeDisplay, &width, &height);
    mScreenSize.setHeight(height);
    mScreenSize.setWidth(width);
}
Beispiel #6
0
int call_fbGetDisplayByIndex(int *pDatabuf)
{
	str_fbgetdpyidx *function;
	int display_index;
	int ret;
	
	function = (str_fbgetdpyidx *)pDatabuf;
	display_index = function->DisplayIndex;
	
	function->retVal = fbGetDisplayByIndex(display_index);

	if(function->hd.retFlag == RT_REQUEST){
		function->hd.retFlag = RT_RESPONSE;
		ret = write(dev, function, MAX_BUF_SIZE);
	}

	return 0;
}
Beispiel #7
0
static bool gfx_ctx_vivante_set_video_mode(void *data,
      video_frame_info_t *video_info,
      unsigned width, unsigned height,
      bool fullscreen)
{
#ifdef HAVE_EGL
   static const EGLint attribs[] = {
      EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */
      EGL_NONE
   };
#endif
   vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

   /* Pick some arbitrary default. */
   if (!width || !fullscreen)
      width = 1280;
   if (!height || !fullscreen)
      height = 1024;

   viv->width    = width;
   viv->height   = height;

#ifdef HAVE_EGL
   if (!egl_create_context(&viv->egl, attribs))
   {
      egl_report_error();
      goto error;
   }
#endif

   viv->native_window = fbCreateWindow(fbGetDisplayByIndex(0), 0, 0, 0, 0);

#ifdef HAVE_EGL
   if (!egl_create_surface(&viv->egl, viv->native_window))
      goto error;
#endif

   return true;

error:
   RARCH_ERR("[Vivante fbdev]: EGL error: %d.\n", eglGetError());
   gfx_ctx_vivante_destroy(data);
   return false;
}
Beispiel #8
0
EGLNativeDisplayType _glusOsGetNativeDisplayType()
{
	if (g_nativeDisplay != 0)
	{
		return g_nativeDisplay;
	}

	g_nativeDisplay = fbGetDisplayByIndex(0);

	if (g_nativeDisplay == 0)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not get native display");

		return 0;
	}

	fbGetDisplayGeometry(g_nativeDisplay, &g_displayWidth, &g_displayHeight);

	return g_nativeDisplay;
}
GstImxEglVivTransEGLPlatform* gst_imx_egl_viv_trans_egl_platform_create(gchar const *native_display_name)
{
	gint64 display_index;
	EGLint ver_major, ver_minor;
	GstImxEglVivTransEGLPlatform* platform;
	EGLNativeWindowType  native_window;

	init_debug_category();

	platform = (GstImxEglVivTransEGLPlatform *)g_new0(GstImxEglVivTransEGLPlatform, 1);

	if (native_display_name == NULL)
		display_index = 0;
	else
		display_index = g_ascii_strtoll(native_display_name, NULL, 10);
	platform->native_display = fbGetDisplayByIndex(display_index);
	platform->egl_display = eglGetDisplay(platform->native_display);
	if (platform->egl_display == EGL_NO_DISPLAY)
	{
		GST_ERROR("eglGetDisplay failed: %s with native_display_name:%s",
				gst_imx_egl_viv_trans_egl_platform_get_last_error_string(),native_display_name);
		goto cleanup;
	}

	if (!eglInitialize(platform->egl_display, &ver_major, &ver_minor))
	{
		GST_ERROR("eglInitialize failed: %s", gst_imx_egl_viv_trans_egl_platform_get_last_error_string());
		goto cleanup;
	}

	GST_INFO("FB EGL platform initialized, using EGL %d.%d", ver_major, ver_minor);

	return platform;


cleanup:
	g_free(platform);
	return NULL;
}