summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/radeon
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-12-01 14:06:58 -0800
committerIan Romanick <[email protected]>2012-01-02 12:41:45 -0800
commite532b6288f01b63d8d8ba8c8dc08292967e65490 (patch)
tree03a7f53f966be06796251869d964cb341fa9a213 /src/mesa/drivers/dri/radeon
parent296fe21ae5be838268e51fdd9a4a3009ab961265 (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/radeon')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c26
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.h4
2 files changed, 29 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index e7d461f8d06..40fd4dcd275 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -42,6 +42,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"
@@ -162,6 +163,10 @@ GLboolean
r100CreateContext( 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;
@@ -172,14 +177,21 @@ r100CreateContext( gl_api api,
int i;
int tcl_mode, fthrottle_mode;
+ /* API and flag filtering is handled in dri2CreateContextAttribs.
+ */
+ (void) api;
+ (void) flags;
+
assert(glVisual);
assert(driContextPriv);
assert(screen);
/* Allocate the Radeon context */
rmesa = (r100ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
+ if ( !rmesa ) {
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
+ }
rmesa->radeon.radeonScreen = screen;
r100_init_vtbl(&rmesa->radeon);
@@ -218,6 +230,7 @@ r100CreateContext( gl_api api,
glVisual, driContextPriv,
sharedContextPrivate)) {
FREE(rmesa);
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
}
@@ -386,5 +399,16 @@ r100CreateContext( gl_api api,
if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) {
/* _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); */
}
+
+ _mesa_compute_version(ctx);
+ if (ctx->VersionMajor < major_version
+ || (ctx->VersionMajor == major_version
+ && ctx->VersionMinor < minor_version)) {
+ radeonDestroyContext(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/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h
index e7d51efca86..cb036cd6570 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_context.h
@@ -450,6 +450,10 @@ struct r100_context {
extern GLboolean r100CreateContext( gl_api api,
const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
+ unsigned *error,
void *sharedContextPrivate);