[Mesa-dev] [PATCH 7/8] i965: Implement the __DRI2_FLUSH_CONTROL extension

Neil Roberts neil at linux.intel.com
Wed Oct 1 12:00:50 PDT 2014


Implementing the extension just involves copying the release behaviour value
from the context config to the GL context's constants. The upper layers of
Mesa handles the actual flushing.
---
 src/mesa/drivers/dri/i965/brw_context.c  | 20 +++++++++++++++++++-
 src/mesa/drivers/dri/i965/intel_screen.c |  2 ++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index f9b2e9b..0d9a406 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -655,7 +655,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;
    }
@@ -664,6 +666,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", __FUNCTION__);
@@ -832,6 +848,8 @@ brwCreateContext(gl_api api,
    if ((ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) != 0)
       ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
 
+   ctx->Const.ContextReleaseBehavior = release_behavior;
+
    if (INTEL_DEBUG & DEBUG_SHADER_TIME)
       brw_init_shader_time(brw);
 
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 88b5b13..2683e32 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -895,6 +895,7 @@ static const __DRIextension *intelScreenExtensions[] = {
     &intelImageExtension.base,
     &intelRendererQueryExtension.base,
     &dri2ConfigQueryExtension.base,
+    &dri2FlushControlExtension.base,
     NULL
 };
 
@@ -904,6 +905,7 @@ static const __DRIextension *intelRobustScreenExtensions[] = {
     &intelImageExtension.base,
     &intelRendererQueryExtension.base,
     &dri2ConfigQueryExtension.base,
+    &dri2FlushControlExtension.base,
     &dri2Robustness.base,
     NULL
 };
-- 
1.9.3



More information about the mesa-dev mailing list