static struct pipe_context * xlib_create_softpipe_context( struct pipe_screen *screen, void *context_private ) { struct pipe_context *pipe; pipe = softpipe_create(screen); if (pipe == NULL) goto fail; pipe->priv = context_private; return pipe; fail: /* Free stuff here */ return NULL; }
/** * Called via eglCreateContext(), drv->API.CreateContext(). */ static EGLContext xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list) { struct xlib_egl_driver *xdrv = xlib_egl_driver(drv); _EGLConfig *conf = _eglLookupConfig(drv, dpy, config); struct xlib_egl_context *ctx; struct st_context *share_ctx = NULL; /* XXX fix */ __GLcontextModes visual; ctx = CALLOC_STRUCT(xlib_egl_context); if (!ctx) return EGL_NO_CONTEXT; /* let EGL lib init the common stuff */ if (!_eglInitContext(drv, dpy, &ctx->Base, config, attrib_list)) { free(ctx); return EGL_NO_CONTEXT; } /* API-dependent context creation */ switch (ctx->Base.ClientAPI) { case EGL_OPENVG_API: case EGL_OPENGL_ES_API: _eglLog(_EGL_DEBUG, "Create Context for ES version %d\n", ctx->Base.ClientVersion); /* fall-through */ case EGL_OPENGL_API: /* create a softpipe context */ ctx->pipe = softpipe_create(xdrv->screen, xdrv->winsys, NULL); /* Now do xlib / state tracker inits here */ _eglConfigToContextModesRec(conf, &visual); ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx); break; default: _eglError(EGL_BAD_MATCH, "eglCreateContext(unsupported API)"); free(ctx); return EGL_NO_CONTEXT; } _eglSaveContext(&ctx->Base); return _eglGetContextHandle(&ctx->Base); }
struct pipe_context * intel_be_create_context(struct pipe_screen *screen) { struct intel_be_context *intel; struct pipe_context *pipe; struct intel_be_device *device = intel_be_device(screen->winsys); intel = (struct intel_be_context *)malloc(sizeof(*intel)); memset(intel, 0, sizeof(*intel)); intel_be_init_context(intel, device); if (device->softpipe) pipe = softpipe_create(screen); else pipe = i915_create_context(screen, &device->base, &intel->base); if (pipe) pipe->priv = intel; return pipe; }
static struct pipe_context * st_softpipe_context_create(struct pipe_screen *screen) { return softpipe_create(screen); }