コード例 #1
0
ファイル: Egl.cpp プロジェクト: ValXp/particles
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);
}
コード例 #2
0
ファイル: qeglfshooks_imx6.cpp プロジェクト: ghjinlei/qt5
EGLNativeWindowType QEglFSImx6Hooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format)
{
    Q_UNUSED(format);

    EGLNativeWindowType eglWindow = fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height());
    return eglWindow;
}
コード例 #3
0
//--------------------------------------------------------------------------------------
// Name: GLInit ()
// Desc: Initializate the EGL functions
//--------------------------------------------------------------------------------------
bool GLCVUtils::GLInit (void)
{
	static const EGLint s_configAttribs[] =
	{
		EGL_RED_SIZE,		5,
		EGL_GREEN_SIZE, 	6,
		EGL_BLUE_SIZE,		5,
		EGL_ALPHA_SIZE, 	EGL_DONT_CARE,
		EGL_SAMPLES,		0,
		EGL_DEPTH_SIZE, 	24,
		EGL_NONE
	};

	EGLint numconfigs;

	EGLint ContextAttribList[] =	{EGL_CONTEXT_CLIENT_VERSION, 2,	EGL_NONE};

	// Initialize Display - Get the default display.
	egldisplay = eglGetDisplay (EGL_DEFAULT_DISPLAY);
	eglInitialize (egldisplay, NULL, NULL);
	assert (eglGetError () == EGL_SUCCESS);
	
	//Initialize EGL.
	eglInitialize(egldisplay, NULL, NULL);
	assert (eglGetError () == EGL_SUCCESS);

	// EGL Surface Config
	eglChooseConfig (egldisplay, s_configAttribs, &eglconfig, 1, &numconfigs);
	assert (eglGetError () == EGL_SUCCESS);
	assert (numconfigs == 1);

	//You must pass in the file system handle to the linux framebuffer when creating a window
	EGLNativeDisplayType native_display = fbGetDisplay();
	EGLNativeWindowType  native_window  = fbCreateWindow(native_display, 0, 1, 1024, 768);

	eglsurface = eglCreateWindowSurface (egldisplay, eglconfig, native_window, NULL);
	assert (eglGetError () == EGL_SUCCESS);

	eglBindAPI (EGL_OPENGL_ES_API);

	// Create the EGL graphic Context
	EGLContext eglcontext = eglCreateContext (egldisplay, eglconfig, EGL_NO_CONTEXT, ContextAttribList);
	assert (eglGetError() == EGL_SUCCESS);

	eglMakeCurrent (egldisplay, eglsurface, eglsurface, eglcontext);
	assert (eglGetError() == EGL_SUCCESS);

	// clear buffer to the black color
	glClearColor (0.0, 0.0, 0.0, 0.0);
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	assert (eglGetError() == EGL_SUCCESS);

	// Swap Buffers.
	// Brings to the native display the current render surface.
	eglSwapBuffers (egldisplay, eglsurface);
	assert (eglGetError () == EGL_SUCCESS);

	return true;
}
コード例 #4
0
ファイル: EGLNativeTypeIMX.cpp プロジェクト: 7orlum/xbmc
bool CEGLNativeTypeIMX::CreateNativeWindow()
{
#ifdef HAS_IMXVPU
  m_window = fbCreateWindow(m_display, 0, 0, 0, 0);
  m_nativeWindow = &m_window;
  return true;
#else
  return false;
#endif
}
コード例 #5
0
//! create the driver
void CIrrDeviceFB::createDriver()
{
	switch(CreationParams.DriverType)
	{
	case video::EDT_SOFTWARE:
		#ifdef _IRR_COMPILE_WITH_SOFTWARE_
		VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
		#else
		os::Printer::log("No Software driver support compiled in.", ELL_WARNING);
		#endif
		break;

	case video::EDT_BURNINGSVIDEO:
		#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
		VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);
		#else
		os::Printer::log("Burning's video driver was not compiled in.", ELL_WARNING);
		#endif
		break;

	case video::EDT_OGLES2:
		#ifdef _IRR_COMPILE_WITH_OGLES2_
		{
			video::SExposedVideoData data;
			s32 width = 0;
			s32 height = 0;
			NativeDisplayType display = fbGetDisplay(0);
			fbGetDisplayGeometry(display, &width, &height);
			data.OpenGLFB.Window = (void*)fbCreateWindow(display, 0, 0, width, height);
			ContextManager = new video::CEGLManager();
			ContextManager->initialize(CreationParams, data);
			VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
		}
		#else
		os::Printer::log("No OpenGL-ES2 support compiled in.", ELL_ERROR);
		#endif
		break;

	case video::EDT_OGLES1:
	case video::EDT_OPENGL:
	case video::EDT_DIRECT3D8:
	case video::EDT_DIRECT3D9:
		os::Printer::log("This driver is not available in FB. Try Software renderer.",
			ELL_WARNING);
		break;

	default:
		VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
		break;
	}
}
コード例 #6
0
ファイル: kdrive.c プロジェクト: AmesianX/xorg-server
static Bool
KdCreateWindow(WindowPtr pWin)
{
#ifndef PHOENIX
    if (!pWin->parent) {
        KdScreenPriv(pWin->drawable.pScreen);

        if (!pScreenPriv->enabled) {
            RegionEmpty(&pWin->borderClip);
            RegionBreak(&pWin->clipList);
        }
    }
#endif
    return fbCreateWindow(pWin);
}
コード例 #7
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;
}
コード例 #8
0
ファイル: kdrive.c プロジェクト: Magister/x11rdp_xorg71
static Bool
KdCreateWindow (WindowPtr pWin)
{
#ifndef PHOENIX
    if (!pWin->parent)
    {
	KdScreenPriv(pWin->drawable.pScreen);

	if (!pScreenPriv->enabled)
	{
	    REGION_EMPTY (pWin->drawable.pScreen, &pWin->borderClip);
	    REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
	}
    }
#endif
    return fbCreateWindow (pWin);
}
コード例 #9
0
ファイル: vrx.c プロジェクト: eriytt/xserver-xsdl
static Bool
vrxCreateWindow (WindowPtr pWin)
{
  Bool ret = fbCreateWindow(pWin);

  ScreenPtr screen = pWin->drawable.pScreen;
  WindowPtr root = screen->root;

  LOGI("CreateWindow %p (%d), parent %p, root %p", pWin, pWin->drawable.id, pWin->parent, root);

  /* Ignore non top level windows */
  if (pWin->parent != root || pWin == root)
    return ret;

  if (ret && wcreate)
    wcreate(pWin, callback_arg);
  return ret;
}
コード例 #10
0
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;
}
コード例 #11
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;
}
コード例 #12
0
void
native_gfx_create_window(native_gfx_t *gfx, int width, int height)
{
  if (width == 0)
    width = gfx->disp_width;

  if (height == 0)
    height = gfx->disp_height;

  gfx->win = fbCreateWindow(gfx->disp, 0, 0, width, height);

  if (gfx->win == NULL) {
    fprintf(stderr, "native_gfx_create_window(): fbCreateWindow(): error\n");
    exit(EXIT_FAILURE);
  }

  gfx->win_width = width;
  gfx->win_height = height;
}
コード例 #13
0
EGLNativeWindowType _glusOsCreateNativeWindowType(const char* title, const GLUSint width, const GLUSint height, const GLUSboolean fullscreen, const GLUSboolean noResize, EGLint eglNativeVisualID)
{
	glusLogPrint(GLUS_LOG_INFO, "Parameters 'title', 'fullscreen' and 'noResize' are not used");
	glusLogPrint(GLUS_LOG_INFO, "Key events are mapped to US keyboard");
	glusLogPrint(GLUS_LOG_INFO, "Touch display is used for mouse events and are limited");

	g_keyFileDescriptor = open("/dev/input/event5", O_RDONLY | O_NONBLOCK);

	if (g_keyFileDescriptor < 0)
	{
		glusLogPrint(GLUS_LOG_WARNING, "Could not open key input device");
	}
	else
	{
		// Disable echo.
		system("stty -echo");
	}

	g_touchFileDescriptor = open("/dev/input/event0", O_RDONLY | O_NONBLOCK);

	if (g_touchFileDescriptor < 0)
	{
		glusLogPrint(GLUS_LOG_WARNING, "Could not open touch input device");
	}

	g_nativeWindow = fbCreateWindow(g_nativeDisplay, 0, 0, width, height);

	if (g_nativeWindow == 0)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not create native window");

		return 0;
	}

	g_width = width;
	g_height = height;

	return g_nativeWindow;
}
コード例 #14
0
ファイル: EGLNativeTypeIMX.cpp プロジェクト: tomlohave/xbmc
bool CEGLNativeTypeIMX::CreateNativeWindow()
{
  m_window = fbCreateWindow(m_display, 0, 0, 0, 0);
  m_nativeWindow = &m_window;
  return true;
}
コード例 #15
0
ファイル: glus_os_linux_imx6_es.c プロジェクト: AdJion/OpenGL
EGLNativeWindowType _glusOsCreateNativeWindowType(const char* title, const GLUSint width, const GLUSint height, const GLUSboolean fullscreen, const GLUSboolean noResize, EGLint eglNativeVisualID)
{
	char eventFilename[256];
	int eventNumber;

	int fileDescriptor;

	uint32_t eventBits;

	glusLogPrint(GLUS_LOG_INFO, "Parameters 'title', 'fullscreen' and 'noResize' are not used");
	glusLogPrint(GLUS_LOG_INFO, "Key events are mapped to US keyboard");
	glusLogPrint(GLUS_LOG_INFO, "Touch display is used for mouse events and are limited");

	strcpy(eventFilename, "/dev/input/event0");

	for (eventNumber = 0; eventNumber < 10; eventNumber++)
	{
		eventFilename[16] = '0' + (char)eventNumber;

		fileDescriptor = open(eventFilename, O_RDONLY | O_NONBLOCK);

		if (fileDescriptor < 0)
		{
			continue;
		}

		eventBits = 0;
		if (ioctl(fileDescriptor, EVIOCGBIT(0, EV_MAX), &eventBits) < 0)
		{
			close(fileDescriptor);

			continue;
		}

		if (eventBits == 0x120013 && g_keyFileDescriptor < 0)
		{
			glusLogPrint(GLUS_LOG_INFO, "Found keyboard on '%s'", eventFilename);

			g_keyFileDescriptor = fileDescriptor;

			// Disable echo.
			system("stty -echo");
		}
		else if (eventBits == 0x17 && g_powermateFileDescriptor < 0)
		{
			glusLogPrint(GLUS_LOG_INFO, "Found power mate on '%s'", eventFilename);

			g_powermateFileDescriptor = fileDescriptor;
		}
		else if (eventBits == 0xb && g_touchFileDescriptor < 0)
		{
			glusLogPrint(GLUS_LOG_INFO, "Found touch display on '%s'", eventFilename);

			g_touchFileDescriptor = fileDescriptor;
		}
		else
		{
			close(fileDescriptor);
		}
	}

	g_nativeWindow = fbCreateWindow(g_nativeDisplay, 0, 0, width, height);

	if (g_nativeWindow == 0)
	{
		glusLogPrint(GLUS_LOG_ERROR, "Could not create native window");

		return 0;
	}

	g_width = width;
	g_height = height;

	return g_nativeWindow;
}