diff options
author | Neil Roberts <neil@linux.intel.com> | 2017-11-02 15:01:43 -0400 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-11-02 15:09:11 -0700 |
commit | deffa78789cdb0d5259c38285fb7d12936c4be16 (patch) | |
tree | df8d921a68e6d7243eb6a425d2d7444e5c9a7e14 | |
parent | d6dde18496c7fe3910d5e3b59e2277ba4fd9eebc (diff) |
dri: Add a flush control extension
This advertises that the driver can accept a new context attribute
__DRI_CTX_ATTRIB_RELEASE_BEHAVIOR.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
-rw-r--r-- | include/GL/internal/dri_interface.h | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_util.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_util.h | 9 |
3 files changed, 46 insertions, 2 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 98402eae05..b47947380c 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1107,6 +1107,16 @@ struct __DRIdri2LoaderExtensionRec { #define __DRI_CTX_PRIORITY_HIGH 2 /** + * \name Context release behaviors. + */ +/*@{*/ +#define __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR 5 + +#define __DRI_CTX_RELEASE_BEHAVIOR_NONE 0 +#define __DRI_CTX_RELEASE_BEHAVIOR_FLUSH 1 +/*@}*/ + +/** * \name Reasons that __DRIdri2Extension::createContextAttribs might fail */ /*@{*/ @@ -1715,6 +1725,21 @@ typedef struct __DRInoErrorExtensionRec { __DRIextension base; } __DRInoErrorExtension; +/* + * Flush control driver extension. + * + * Existence of this extension means the driver can accept the + * \c __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR attribute in + * \c __DRIdri2ExtensionRec::createContextAttribs. + */ +#define __DRI2_FLUSH_CONTROL "DRI_FlushControl" +#define __DRI2_FLUSH_CONTROL_VERSION 1 + +typedef struct __DRI2flushControlExtensionRec __DRI2flushControlExtension; +struct __DRI2flushControlExtensionRec { + __DRIextension base; +}; + /** * DRI config options extension. * diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index dc5260ca5b..d504751c39 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -361,6 +361,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ctx_config.attribute_mask |= __DRIVER_CONTEXT_ATTRIB_PRIORITY; ctx_config.priority = attribs[i * 2 + 1]; break; + case __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR: + if (attribs[i * 2 + 1] != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) { + ctx_config.attribute_mask |= + __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR; + ctx_config.release_behavior = attribs[i * 2 + 1]; + } else { + ctx_config.attribute_mask &= + ~__DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR; + } + break; default: /* We can't create a context that satisfies the requirements of an * attribute that we don't understand. Return failure. @@ -833,6 +843,10 @@ const __DRI2configQueryExtension dri2ConfigQueryExtension = { .configQueryf = dri2ConfigQueryf, }; +const __DRI2flushControlExtension dri2FlushControlExtension = { + .base = { __DRI2_FLUSH_CONTROL, 1 } +}; + void dri2InvalidateDrawable(__DRIdrawable *drawable) { diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 3d9ec9d072..1881e3d0a7 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -67,6 +67,7 @@ extern const __DRIswrastExtension driSWRastExtension; extern const __DRIdri2Extension driDRI2Extension; extern const __DRI2configQueryExtension dri2ConfigQueryExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRI2flushControlExtension dri2FlushControlExtension; /** * Description of the attributes used to create a config. @@ -93,10 +94,14 @@ struct __DriverContextConfig { /* Only valid if __DRIVER_CONTEXT_PRIORITY is set */ unsigned priority; + + /* Only valid if __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR is set */ + int release_behavior; }; -#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY (1 << 0) -#define __DRIVER_CONTEXT_ATTRIB_PRIORITY (1 << 1) +#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY (1 << 0) +#define __DRIVER_CONTEXT_ATTRIB_PRIORITY (1 << 1) +#define __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR (1 << 2) /** * Driver callback functions. |