summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-09-10 17:31:24 +0300
committerIan Romanick <[email protected]>2013-11-07 17:40:05 -0800
commit7b140d1bdaf07badebdc5ac222ab4ff4d182ebec (patch)
tree90cb97e5013624b082fd6944a45453651ab78389 /src/mesa
parent17c94de33baf66ad5c264b7a046394c651bc6126 (diff)
mesa/dri: Move context flag validation down into the drivers
Soon some drivers will support a different set of flags than other drivers. If some flags have to be filtered in the driver, we might as well filter all of them in the driver. The changes in nouveau use tabs because nouveau seems to have it's own indentation rules. v2: Fix some rebase failures noticed by Ken (returning the wrong types, etc.). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c7
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c7
5 files changed, 22 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index a4b40b74dbb..9a1b3785374 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -917,6 +917,11 @@ intelCreateContext(gl_api api,
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct intel_screen *intelScreen = sPriv->driverPrivate;
+ if (flags & ~__DRI_CTX_FLAG_DEBUG) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
+ return false;
+ }
+
if (notify_reset) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 01fb9880422..3e6dade613d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -580,6 +580,11 @@ brwCreateContext(gl_api api,
struct dd_function_table functions;
struct gl_config visual;
+ if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
+ return false;
+ }
+
if (notify_reset) {
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index a7f14b518d1..d44864ca9a9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -62,9 +62,10 @@ nouveau_context_create(gl_api api,
struct nouveau_context *nctx;
struct gl_context *ctx;
- /* API and flag filtering is handled in dri2CreateContextAttribs.
- */
- (void) flags;
+ if (flags & ~__DRI_CTX_FLAG_DEBUG) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
+ return false;
+ }
if (notify_reset) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 58c300c3d60..d4e9ca8caca 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -213,9 +213,10 @@ GLboolean r200CreateContext( gl_api api,
int i;
int tcl_mode;
- /* Flag filtering is handled in dri2CreateContextAttribs.
- */
- (void) flags;
+ if (flags & ~__DRI_CTX_FLAG_DEBUG) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
+ return false;
+ }
if (notify_reset) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index c2200d70e45..76bfe55c0eb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -180,9 +180,10 @@ r100CreateContext( gl_api api,
int i;
int tcl_mode, fthrottle_mode;
- /* Flag filtering is handled in dri2CreateContextAttribs.
- */
- (void) flags;
+ if (flags & ~__DRI_CTX_FLAG_DEBUG) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
+ return false;
+ }
if (notify_reset) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;