dri/nouveau: Pass the API into _mesa_initialize_context
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 25 Jan 2014 15:23:41 +0000 (15:23 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 11 Feb 2014 19:00:09 +0000 (19:00 +0000)
Currently we create a OPENGL_COMPAT context regardless of
what was requested by the program. Correct that by retaining
the program's request and passing it into _mesa_initialize_context.

Based on a similar commit for radeon/r200 by Ian Romanick.

Cc: "9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/nouveau/nouveau_context.h
src/mesa/drivers/dri/nouveau/nouveau_driver.h
src/mesa/drivers/dri/nouveau/nv04_context.c
src/mesa/drivers/dri/nouveau/nv10_context.c
src/mesa/drivers/dri/nouveau/nv20_context.c

index b84205b..f8c8dc3 100644 (file)
@@ -72,7 +72,7 @@ nouveau_context_create(gl_api api,
                return false;
        }
 
-       ctx = screen->driver->context_create(screen, visual, share_ctx);
+       ctx = screen->driver->context_create(screen, api, visual, share_ctx);
        if (!ctx) {
                *error = __DRI_CTX_ERROR_NO_MEMORY;
                return GL_FALSE;
@@ -107,7 +107,8 @@ nouveau_context_create(gl_api api,
 }
 
 GLboolean
-nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+nouveau_context_init(struct gl_context *ctx, gl_api api,
+                    struct nouveau_screen *screen,
                     const struct gl_config *visual, struct gl_context *share_ctx)
 {
        struct nouveau_context *nctx = to_nouveau_context(ctx);
@@ -125,7 +126,7 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
        nouveau_fbo_functions_init(&functions);
 
        /* Initialize the mesa context. */
-       _mesa_initialize_context(ctx, API_OPENGL_COMPAT, visual,
+       _mesa_initialize_context(ctx, api, visual,
                                  share_ctx, &functions);
 
        nouveau_state_init(ctx);
index 07d9605..8ea431b 100644 (file)
@@ -115,7 +115,8 @@ nouveau_context_create(gl_api api,
                       void *share_ctx);
 
 GLboolean
-nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+nouveau_context_init(struct gl_context *ctx, gl_api api,
+                    struct nouveau_screen *screen,
                     const struct gl_config *visual, struct gl_context *share_ctx);
 
 void
index e03b2c1..b6a8276 100644 (file)
@@ -48,6 +48,7 @@
 
 struct nouveau_driver {
        struct gl_context *(*context_create)(struct nouveau_screen *screen,
+                                    gl_api api,
                                     const struct gl_config *visual,
                                     struct gl_context *share_ctx);
        void (*context_destroy)(struct gl_context *ctx);
index 93dcd87..cd6e876 100644 (file)
@@ -138,7 +138,8 @@ nv04_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv04_context_create(struct nouveau_screen *screen, gl_api api,
+                   const struct gl_config *visual,
                    struct gl_context *share_ctx)
 {
        struct nv04_context *nctx;
@@ -153,7 +154,7 @@ nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visua
        ctx = &nctx->base.base;
        hw = &nctx->base.hw;
 
-       if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+       if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
                goto fail;
 
        /* GL constants. */
index 8582cb2..904a410 100644 (file)
@@ -427,7 +427,8 @@ nv10_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv10_context_create(struct nouveau_screen *screen, gl_api api,
+                   const struct gl_config *visual,
                    struct gl_context *share_ctx)
 {
        struct nouveau_context *nctx;
@@ -441,7 +442,7 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 
        ctx = &nctx->base;
 
-       if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+       if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
                goto fail;
 
        ctx->Extensions.ARB_texture_env_crossbar = true;
index 618280f..14329a2 100644 (file)
@@ -438,7 +438,8 @@ nv20_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv20_context_create(struct nouveau_screen *screen, gl_api api,
+                   const struct gl_config *visual,
                    struct gl_context *share_ctx)
 {
        struct nouveau_context *nctx;
@@ -452,7 +453,7 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 
        ctx = &nctx->base;
 
-       if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+       if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
                goto fail;
 
        ctx->Extensions.ARB_texture_env_crossbar = true;