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/r200 | |
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/r200')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.h | 4 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 90cccf56119..d7a648981f6 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/extensions.h" #include "main/mfeatures.h" +#include "main/version.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -196,6 +197,10 @@ static void r200_init_vtbl(radeonContextPtr radeon) GLboolean r200CreateContext( gl_api api, const struct gl_config *glVisual, __DRIcontext *driContextPriv, + unsigned major_version, + unsigned minor_version, + uint32_t flags, + unsigned *error, void *sharedContextPrivate) { __DRIscreen *sPriv = driContextPriv->driScreenPriv; @@ -206,14 +211,21 @@ GLboolean r200CreateContext( gl_api api, int i; int tcl_mode; + /* API and flag filtering is handled in dri2CreateContextAttribs. + */ + (void) api; + (void) flags; + assert(glVisual); assert(driContextPriv); assert(screen); /* Allocate the R200 context */ rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) ); - if ( !rmesa ) + if ( !rmesa ) { + *error = __DRI_CTX_ERROR_NO_MEMORY; return GL_FALSE; + } rmesa->radeon.radeonScreen = screen; r200_init_vtbl(&rmesa->radeon); @@ -256,6 +268,7 @@ GLboolean r200CreateContext( gl_api api, glVisual, driContextPriv, sharedContextPrivate)) { FREE(rmesa); + *error = __DRI_CTX_ERROR_NO_MEMORY; return GL_FALSE; } @@ -439,6 +452,16 @@ GLboolean r200CreateContext( gl_api api, TCL_FALLBACK(rmesa->radeon.glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1); } + _mesa_compute_version(ctx); + if (ctx->VersionMajor < major_version + || (ctx->VersionMajor == major_version + && ctx->VersionMinor < minor_version)) { + r200DestroyContext(driContextPriv); + *error = __DRI_CTX_ERROR_BAD_VERSION; + return GL_FALSE; + } + + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 720219fc530..e0d56932a57 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -635,6 +635,10 @@ extern void r200DestroyContext( __DRIcontext *driContextPriv ); extern GLboolean r200CreateContext( gl_api api, const struct gl_config *glVisual, __DRIcontext *driContextPriv, + unsigned major_version, + unsigned minor_version, + uint32_t flags, + unsigned *error, void *sharedContextPrivate); extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv, __DRIdrawable *driDrawPriv, |