diff options
author | Ian Romanick <[email protected]> | 2011-12-01 14:06:58 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-01-02 12:41:45 -0800 |
commit | e532b6288f01b63d8d8ba8c8dc08292967e65490 (patch) | |
tree | 03a7f53f966be06796251869d964cb341fa9a213 /src/mesa/drivers/dri/nouveau | |
parent | 296fe21ae5be838268e51fdd9a4a3009ab961265 (diff) |
dri2: Add plumbing to get context version requirements and flags to drivers
This adds support for DRI_DRI2 version 3 to all of the DRI2 drivers.
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.c | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.h | 3 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 0e3321e96f4..0cb918e4111 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -34,6 +34,7 @@ #include "main/framebuffer.h" #include "main/light.h" #include "main/state.h" +#include "main/version.h" #include "drivers/common/meta.h" #include "drivers/common/driverfuncs.h" #include "swrast/swrast.h" @@ -55,6 +56,10 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan) GLboolean nouveau_context_create(gl_api api, const struct gl_config *visual, __DRIcontext *dri_ctx, + unsigned major_version, + unsigned minor_version, + uint32_t flags, + unsigned *error, void *share_ctx) { __DRIscreen *dri_screen = dri_ctx->driScreenPriv; @@ -62,14 +67,31 @@ nouveau_context_create(gl_api api, struct nouveau_context *nctx; struct gl_context *ctx; + /* API and flag filtering is handled in dri2CreateContextAttribs. + */ + (void) api; + (void) flags; + ctx = screen->driver->context_create(screen, visual, share_ctx); - if (!ctx) + if (!ctx) { + *error = __DRI_CTX_ERROR_NO_MEMORY; return GL_FALSE; + } nctx = to_nouveau_context(ctx); nctx->dri_context = dri_ctx; dri_ctx->driverPrivate = ctx; + _mesa_compute_version(ctx); + if (ctx->VersionMajor < major_version + || (ctx->VersionMajor == major_version + && ctx->VersionMinor < minor_version)) { + nouveau_context_destroy(dri_ctx); + *error = __DRI_CTX_ERROR_BAD_VERSION; + return GL_FALSE; + } + + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 7ebc676379e..cd4a9fbc0ff 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -98,7 +98,8 @@ struct nouveau_context { GLboolean nouveau_context_create(gl_api api, const struct gl_config *visual, __DRIcontext *dri_ctx, - void *share_ctx); + unsigned major_version, unsigned minor_version, + uint32_t flags, unsigned *error, void *share_ctx); GLboolean nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, |