static int pipe_init_screen(struct pipe_manager *pm)
{
	struct pipe_screen *screen = NULL;

#ifdef ENABLE_PIPE_NOUVEAU
	if (strcmp(pm->driver, "nouveau") == 0)
		screen = nouveau_drm_screen_create(pm->fd);
#endif
#ifdef ENABLE_PIPE_R300
	if (strcmp(pm->driver, "r300") == 0) {
		struct radeon_winsys *sws = radeon_drm_winsys_create(pm->fd);

		if (sws) {
			screen = r300_screen_create(sws);
			if (!screen)
				sws->destroy(sws);
		}
	}
#endif
#ifdef ENABLE_PIPE_R600
	if (strcmp(pm->driver, "r600") == 0) {
		struct radeon *rw = r600_drm_winsys_create(pm->fd);

		if (rw) {
			screen = r600_screen_create(rw);
			if (!screen)
				FREE(rw);
		}
	}
#endif
#ifdef ENABLE_PIPE_VMWGFX
	if (strcmp(pm->driver, "vmwgfx") == 0) {
		struct svga_winsys_screen *sws =
			svga_drm_winsys_screen_create(pm->fd);

		if (sws) {
			screen = svga_screen_create(sws);
			if (!screen)
				sws->destroy(sws);
		}
	}
#endif

	if (!screen) {
		LOGW("failed to create screen for %s", pm->driver);
		return -EINVAL;
	}

	pm->screen = debug_screen_wrap(screen);

	return 0;
}
Beispiel #2
0
/* This is actually the entrypoint to the entire driver, called by the
 * libGL (or EGL, or ...) code via the drm_api_hooks table at the
 * bottom of the file.
 */
static struct pipe_screen *
vmw_drm_create_screen(struct drm_api *drm_api,
                      int fd,
                      struct drm_create_screen_arg *arg)
{
   struct vmw_winsys_screen *vws;
   struct pipe_screen *screen;
   struct dri1_create_screen_arg *dri1;

   if (arg != NULL) {
      switch (arg->mode) {
      case DRM_CREATE_NORMAL:
	 break;
      case DRM_CREATE_DRI1:
	 dri1 = (struct dri1_create_screen_arg *)arg;
	 if (!vmw_dri1_check_version(&dri1->ddx_version, &ddx_required,
				     &ddx_compat, "ddx - driver api"))
	    return NULL;
	 if (!vmw_dri1_check_version(&dri1->dri_version, &dri_required,
				     &dri_compat, "dri info"))
	    return NULL;
	 if (!vmw_dri1_check_version(&dri1->drm_version, &drm_required,
				     &drm_compat, "vmwgfx drm driver"))
	    return NULL;
	 dri1->api = &dri1_api_hooks;
	 break;
      default:
	 return NULL;
      }
   }

   vws = vmw_winsys_create( fd );
   if (!vws)
      goto out_no_vws;

   screen = svga_screen_create( &vws->base );
   if (!screen)
      goto out_no_screen;

   return screen;

   /* Failure cases:
    */
out_no_screen:
   vmw_winsys_destroy( vws );

out_no_vws:
   return NULL;
}
Beispiel #3
0
static struct pipe_screen *
create_screen(int fd)
{
   struct svga_winsys_screen *sws;
   struct pipe_screen *screen;

   sws = svga_drm_winsys_screen_create(fd);
   if (!sws)
      return NULL;

   screen = svga_screen_create(sws);
   if (!screen)
      return NULL;

   screen = debug_screen_wrap(screen);

   return screen;
}
Beispiel #4
0
static struct pipe_screen *
pipe_vmwgfx_create_screen(int fd)
{
#if _EGL_PIPE_VMWGFX
   struct svga_winsys_screen *sws;
   struct pipe_screen *screen;

   sws = svga_drm_winsys_screen_create(fd);
   if (!sws)
      return NULL;

   screen = svga_screen_create(sws);
   if (!screen)
      return NULL;

   screen = debug_screen_wrap(screen);

   return screen;
#else
   return NULL;
#endif
}