Beispiel #1
0
static struct pipe_screen *
swrast_screen_create (struct sw_winsys *ws)
{
	const char         *default_driver;
	const char         *driver;
	struct pipe_screen *screen = NULL;

#ifdef USE_LLVM
	default_driver = "llvmpipe";
#else
	default_driver = "softpipe";
#endif

	driver = debug_get_option ("GALLIUM_DRIVER", default_driver);

#ifdef USE_LLVM
	if (screen == NULL && strcmp (driver, "llvmpipe") == 0)
		screen = llvmpipe_create_screen (ws);
#endif

	if (screen == NULL)
		screen = softpipe_create_screen (ws);

	return screen;
}
Beispiel #2
0
struct vl_screen*
vl_screen_create(Display *display, int screen)
{
   struct vl_xsp_screen *xsp_screen;
   struct sw_winsys *winsys;

   assert(display);

   xsp_screen = CALLOC_STRUCT(vl_xsp_screen);
   if (!xsp_screen)
      return NULL;

   winsys = xlib_create_sw_winsys(display);
   if (!winsys) {
      FREE(xsp_screen);
      return NULL;
   }

   xsp_screen->base.pscreen = softpipe_create_screen(winsys);
   if (!xsp_screen->base.pscreen) {
      winsys->destroy(winsys);
      FREE(xsp_screen);
      return NULL;
   }

   xsp_screen->display = display;
   xsp_screen->screen = screen;
   xsp_screen->xdraw.visual = XDefaultVisual(display, screen);

   return &xsp_screen->base;
}
static struct pipe_screen *
st_softpipe_screen_create(void)
{
   static struct pipe_winsys *winsys;
   struct pipe_screen *screen;

   winsys = CALLOC_STRUCT(pipe_winsys);
   if(!winsys)
      return NULL;

   winsys->destroy = st_softpipe_destroy;
   
   winsys->buffer_create = st_softpipe_buffer_create;
   winsys->user_buffer_create = st_softpipe_user_buffer_create;
   winsys->buffer_map = st_softpipe_buffer_map;
   winsys->buffer_unmap = st_softpipe_buffer_unmap;
   winsys->buffer_destroy = st_softpipe_buffer_destroy;

   winsys->surface_buffer_create = st_softpipe_surface_buffer_create;

   winsys->fence_reference = st_softpipe_fence_reference;
   winsys->fence_signalled = st_softpipe_fence_signalled;
   winsys->fence_finish = st_softpipe_fence_finish;

   winsys->flush_frontbuffer = st_softpipe_flush_frontbuffer;
   winsys->get_name = st_softpipe_get_name;

   screen = softpipe_create_screen(winsys);
   if(!screen)
      st_softpipe_destroy(winsys);

   return screen;
}
Beispiel #4
0
/* Create a pipe_screen. */
struct pipe_screen* radeon_create_screen(struct drm_api* api,
                                         int drmFB,
                                         struct drm_create_screen_arg *arg)
{
    struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);

    if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
        return softpipe_create_screen((struct pipe_winsys*)winsys);
    } else {
        struct r300_winsys* r300 = radeon_create_r300_winsys(drmFB, winsys);
        FREE(winsys);
        return r300_create_screen(r300);
    }
}
Beispiel #5
0
struct pipe_screen*
vl_screen_create(Display *display, int screen)
{
   struct xsp_pipe_winsys *xsp_winsys;

   assert(display);

   xsp_winsys = CALLOC_STRUCT(xsp_pipe_winsys);
   if (!xsp_winsys)
      return NULL;

   xsp_winsys->base.buffer_create = xsp_buffer_create;
   xsp_winsys->base.user_buffer_create = xsp_user_buffer_create;
   xsp_winsys->base.buffer_map = xsp_buffer_map;
   xsp_winsys->base.buffer_unmap = xsp_buffer_unmap;
   xsp_winsys->base.buffer_destroy = xsp_buffer_destroy;
   xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create;
   xsp_winsys->base.fence_reference = xsp_fence_reference;
   xsp_winsys->base.fence_signalled = xsp_fence_signalled;
   xsp_winsys->base.fence_finish = xsp_fence_finish;
   xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer;
   xsp_winsys->base.get_name = xsp_get_name;
   xsp_winsys->base.destroy = xsp_destroy;
   xsp_winsys->display = display;
   xsp_winsys->screen = screen;
   xsp_winsys->fbimage = XCreateImage
   (
      display,
      XDefaultVisual(display, screen),
      XDefaultDepth(display, screen),
      ZPixmap,
      0,
      NULL,
      0, /* Don't know the width and height until flush_frontbuffer */
      0,
      32,
      0
   );

   if (!xsp_winsys->fbimage) {
      FREE(xsp_winsys);
      return NULL;
   }

   XInitImage(xsp_winsys->fbimage);

   return softpipe_create_screen(&xsp_winsys->base);
}
Beispiel #6
0
/**
 * This is the main entrypoint into the driver.
 * Called by libEGL to instantiate an _EGLDriver object.
 */
_EGLDriver *
_eglMain(_EGLDisplay *dpy, const char *args)
{
   struct xlib_egl_driver *xdrv;

   _eglLog(_EGL_INFO, "Entering EGL/Xlib _eglMain(%s)", args);

   xdrv = CALLOC_STRUCT(xlib_egl_driver);
   if (!xdrv)
      return NULL;

   if (!dpy->Xdpy) {
      dpy->Xdpy = XOpenDisplay(NULL);
   }

   _eglInitDriverFallbacks(&xdrv->Base);
   xdrv->Base.API.Initialize = xlib_eglInitialize;
   xdrv->Base.API.Terminate = xlib_eglTerminate;
   xdrv->Base.API.GetProcAddress = xlib_eglGetProcAddress;
   xdrv->Base.API.CreateContext = xlib_eglCreateContext;
   xdrv->Base.API.DestroyContext = xlib_eglDestroyContext;
   xdrv->Base.API.CreateWindowSurface = xlib_eglCreateWindowSurface;
   xdrv->Base.API.DestroySurface = xlib_eglDestroySurface;
   xdrv->Base.API.MakeCurrent = xlib_eglMakeCurrent;
   xdrv->Base.API.SwapBuffers = xlib_eglSwapBuffers;

   xdrv->Base.ClientAPIsMask = find_supported_apis();
   if (xdrv->Base.ClientAPIsMask == 0x0) {
      /* the app isn't directly linked with any EGL-supprted APIs
       * (such as libGLESv2.so) so use an EGL utility to see what
       * APIs might be loaded dynamically on this system.
       */
      xdrv->Base.ClientAPIsMask = _eglFindAPIs();
   }      

   xdrv->Base.Name = "Xlib/softpipe";

   /* create one winsys and use it for all contexts/surfaces */
   xdrv->winsys = create_sw_winsys();
   xdrv->winsys->flush_frontbuffer = flush_frontbuffer;

   xdrv->screen = softpipe_create_screen(xdrv->winsys);

   return &xdrv->Base;
}
Beispiel #7
0
static struct pipe_screen *
gdi_screen_create(void)
{
   const char *default_driver;
   const char *driver;
   struct pipe_screen *screen = NULL;
   struct sw_winsys *winsys;

   winsys = gdi_create_sw_winsys();
   if(!winsys)
      goto no_winsys;

#ifdef HAVE_LLVMPIPE
   default_driver = "llvmpipe";
#else
   default_driver = "softpipe";
#endif

   driver = debug_get_option("GALLIUM_DRIVER", default_driver);

#ifdef HAVE_LLVMPIPE
   if (strcmp(driver, "llvmpipe") == 0) {
      screen = llvmpipe_create_screen( winsys );
   }
#else
   (void) driver;
#endif

   if (screen == NULL) {
      screen = softpipe_create_screen( winsys );
   } else {
      use_llvmpipe = TRUE;
   }

   if(!screen)
      goto no_screen;

   return screen;
   
no_screen:
   winsys->destroy(winsys);
no_winsys:
   return NULL;
}
Beispiel #8
0
static struct pipe_screen *
swrast_create_screen(struct sw_winsys *winsys)
{
   const char *default_driver;
   const char *driver;
   struct pipe_screen *screen = NULL;

#if defined(GALLIUM_CELL)
   default_driver = "cell";
#elif defined(GALLIUM_LLVMPIPE)
   default_driver = "llvmpipe";
#elif defined(GALLIUM_SOFTPIPE)
   default_driver = "softpipe";
#else
   default_driver = "";
#endif

   driver = debug_get_option("GALLIUM_DRIVER", default_driver);

#if defined(GALLIUM_CELL)
   if (screen == NULL && strcmp(driver, "cell") == 0)
      screen = cell_create_screen( winsys );
#endif

#if defined(GALLIUM_LLVMPIPE)
   if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
      screen = llvmpipe_create_screen( winsys );
#endif

#if defined(GALLIUM_SOFTPIPE)
   if (screen == NULL)
      screen = softpipe_create_screen( winsys );
#endif

#if defined(GALLIUM_GALAHAD)
   if (screen) {
      struct pipe_screen *galahad_screen = galahad_screen_create(screen);
      if (galahad_screen)
         screen = galahad_screen;
   }
#endif

   return screen;
}
static struct pipe_screen *
gdi_softpipe_screen_create(void)
{
   static struct sw_winsys *winsys;
   struct pipe_screen *screen;

   winsys = gdi_create_sw_winsys();
   if(!winsys)
      goto no_winsys;

   screen = softpipe_create_screen(winsys);
   if(!screen)
      goto no_screen;

   return screen;
   
no_screen:
   winsys->destroy(winsys);
no_winsys:
   return NULL;
}
Beispiel #10
0
static struct pipe_screen *
xlib_create_softpipe_screen( void )
{
   struct pipe_winsys *winsys;
   struct pipe_screen *screen;

   winsys = xlib_create_softpipe_winsys();
   if (winsys == NULL)
      return NULL;

   screen = softpipe_create_screen(winsys);
   if (screen == NULL)
      goto fail;

   return screen;

fail:
   if (winsys)
      winsys->destroy( winsys );

   return NULL;
}
Beispiel #11
0
struct pipe_screen*
hgl_sw_screen_create(void)
{
	struct sw_winsys* winsys = hgl_create_sw_winsys();
	struct pipe_screen* screen = NULL;

	if (!winsys)
		return NULL;

	#ifdef HAVE_LLVMPIPE
	screen = llvmpipe_create_screen(winsys);
	#else
	screen = softpipe_create_screen(winsys);
	#endif
	
	if (!screen) {
		winsys->destroy(winsys);
		return NULL;
	}
	
	return screen;
}