st/xorg: adjust enums in preperation for gradients
[mesa.git] / src / gallium / state_trackers / egl / egl_context.c
index 8564972b91e2c0e015e4db5258ed79437bcaf6c0..c4f7361ca0b1f32c4b92d75095585de8836a5388 100644 (file)
@@ -83,23 +83,16 @@ const struct dri_extension card_extensions[] = {
        {NULL, NULL}
 };
 
-EGLContext
-drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
+_EGLContext *
+drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list)
 {
-       struct drm_device *dev = (struct drm_device *)drv;
+       struct drm_device *dev = lookup_drm_device(dpy);
        struct drm_context *ctx;
        struct drm_context *share = NULL;
        struct st_context *st_share = NULL;
-       _EGLConfig *conf;
        int i;
        __GLcontextModes *visual;
 
-       conf = _eglLookupConfig(drv, dpy, config);
-       if (!conf) {
-               _eglError(EGL_BAD_CONFIG, "eglCreateContext");
-               return EGL_NO_CONTEXT;
-       }
-
        for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
                switch (attrib_list[i]) {
                        /* no attribs defined for now */
@@ -113,9 +106,9 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
        if (!ctx)
                goto err_c;
 
-       _eglInitContext(drv, dpy, &ctx->base, config, attrib_list);
+       _eglInitContext(drv, &ctx->base, conf, attrib_list);
 
-       ctx->pipe = drm_api_hocks.create_context(dev->screen);
+       ctx->pipe = dev->api->create_context(dev->api, dev->screen);
        if (!ctx->pipe)
                goto err_pipe;
 
@@ -129,28 +122,21 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
        if (!ctx->st)
                goto err_gl;
 
-       /* generate handle and insert into hash table */
-       _eglSaveContext(&ctx->base);
-       assert(_eglGetContextHandle(&ctx->base));
-
-       return _eglGetContextHandle(&ctx->base);
+       return &ctx->base;
 
 err_gl:
        ctx->pipe->destroy(ctx->pipe);
 err_pipe:
        free(ctx);
 err_c:
-       return EGL_NO_CONTEXT;
+       return NULL;
 }
 
 EGLBoolean
-drm_destroy_context(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
+drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context)
 {
        struct drm_context *c = lookup_drm_context(context);
-       _eglRemoveContext(&c->base);
-       if (c->base.IsBound) {
-               c->base.DeletePending = EGL_TRUE;
-       } else {
+       if (!_eglIsContextBound(&c->base)) {
                st_destroy_context(c->st);
                c->pipe->destroy(c->pipe);
                free(c);
@@ -159,7 +145,7 @@ drm_destroy_context(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
 }
 
 EGLBoolean
-drm_make_current(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
+drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context)
 {
        struct drm_surface *readSurf = lookup_drm_surface(read);
        struct drm_surface *drawSurf = lookup_drm_surface(draw);