i965: Enable flush control
authorNeil Roberts <neil@linux.intel.com>
Wed, 1 Oct 2014 19:00:50 +0000 (20:00 +0100)
committerAdam Jackson <ajax@redhat.com>
Mon, 6 Nov 2017 21:09:03 +0000 (16:09 -0500)
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_screen.c

index bb8b755cb5588f5f54e2a1cb8a941aec346c11b2..879daae774800eb5a21212bc4d4cf8f6198e2540 100644 (file)
@@ -850,7 +850,9 @@ brwCreateContext(gl_api api,
       return false;
    }
 
-   if (ctx_config->attribute_mask & ~__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) {
+   if (ctx_config->attribute_mask &
+       ~(__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY |
+         __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR)) {
       *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
       return false;
    }
@@ -859,6 +861,20 @@ brwCreateContext(gl_api api,
       ((ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) &&
        ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION);
 
+   GLenum release_behavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
+   if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR) {
+      switch (ctx_config->release_behavior) {
+      case __DRI_CTX_RELEASE_BEHAVIOR_NONE:
+         release_behavior = GL_NONE;
+         break;
+      case __DRI_CTX_RELEASE_BEHAVIOR_FLUSH:
+         break;
+      default:
+         *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+         return false;
+      }
+   }
+
    struct brw_context *brw = rzalloc(NULL, struct brw_context);
    if (!brw) {
       fprintf(stderr, "%s: failed to alloc context\n", __func__);
@@ -1030,6 +1046,8 @@ brwCreateContext(gl_api api,
       ctx->Const.RobustAccess = GL_TRUE;
    }
 
+   ctx->Const.ContextReleaseBehavior = release_behavior;
+
    if (INTEL_DEBUG & DEBUG_SHADER_TIME)
       brw_init_shader_time(brw);
 
index cdc36adc78761b378ef0bbf1b30600d06fba96fa..4bfb6636c3c48cbaa652313a41f03310d9718a1c 100644 (file)
@@ -1431,6 +1431,7 @@ static const __DRIextension *screenExtensions[] = {
     &intelRendererQueryExtension.base,
     &dri2ConfigQueryExtension.base,
     &dri2NoErrorExtension.base,
+    &dri2FlushControlExtension.base,
     NULL
 };
 
@@ -1441,6 +1442,7 @@ static const __DRIextension *intelRobustScreenExtensions[] = {
     &intelImageExtension.base,
     &intelRendererQueryExtension.base,
     &dri2ConfigQueryExtension.base,
+    &dri2FlushControlExtension.base,
     &dri2Robustness.base,
     &dri2NoErrorExtension.base,
     NULL