glx: Implement GLX_ARB_context_flush_control
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:

committed by
Adam Jackson

parent
b89067c84f
commit
ba7679f48d
@@ -247,7 +247,8 @@ dri2_create_context_attribs(struct glx_screen *base,
|
|||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
unsigned api;
|
unsigned api;
|
||||||
int reset;
|
int reset;
|
||||||
uint32_t ctx_attribs[2 * 5];
|
int release;
|
||||||
|
uint32_t ctx_attribs[2 * 6];
|
||||||
unsigned num_ctx_attribs = 0;
|
unsigned num_ctx_attribs = 0;
|
||||||
|
|
||||||
if (psc->dri2->base.version < 3) {
|
if (psc->dri2->base.version < 3) {
|
||||||
@@ -259,7 +260,7 @@ dri2_create_context_attribs(struct glx_screen *base,
|
|||||||
*/
|
*/
|
||||||
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
||||||
&major_ver, &minor_ver, &renderType, &flags,
|
&major_ver, &minor_ver, &renderType, &flags,
|
||||||
&api, &reset, error))
|
&api, &reset, &release, error))
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
/* Check the renderType value */
|
/* Check the renderType value */
|
||||||
@@ -294,6 +295,11 @@ dri2_create_context_attribs(struct glx_screen *base,
|
|||||||
ctx_attribs[num_ctx_attribs++] = reset;
|
ctx_attribs[num_ctx_attribs++] = reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
|
||||||
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
|
||||||
|
ctx_attribs[num_ctx_attribs++] = release;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
||||||
|
|
||||||
@@ -1170,6 +1176,14 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
|
|||||||
|
|
||||||
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
|
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
|
||||||
psc->interop = (__DRI2interopExtension*)extensions[i];
|
psc->interop = (__DRI2interopExtension*)extensions[i];
|
||||||
|
|
||||||
|
/* DRI2 version 3 is also required because
|
||||||
|
* GLX_ARB_control_flush_control requires GLX_ARB_create_context.
|
||||||
|
*/
|
||||||
|
if (psc->dri2->base.version >= 3
|
||||||
|
&& strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
|
||||||
|
__glXEnableDirectExtension(&psc->base,
|
||||||
|
"GLX_ARB_context_flush_control");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -235,7 +235,8 @@ dri3_create_context_attribs(struct glx_screen *base,
|
|||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
unsigned api;
|
unsigned api;
|
||||||
int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
|
int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
|
||||||
uint32_t ctx_attribs[2 * 5];
|
int release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
|
||||||
|
uint32_t ctx_attribs[2 * 6];
|
||||||
unsigned num_ctx_attribs = 0;
|
unsigned num_ctx_attribs = 0;
|
||||||
uint32_t render_type;
|
uint32_t render_type;
|
||||||
|
|
||||||
@@ -244,7 +245,7 @@ dri3_create_context_attribs(struct glx_screen *base,
|
|||||||
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
||||||
&major_ver, &minor_ver,
|
&major_ver, &minor_ver,
|
||||||
&render_type, &flags, &api,
|
&render_type, &flags, &api,
|
||||||
&reset, error))
|
&reset, &release, error))
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
/* Check the renderType value */
|
/* Check the renderType value */
|
||||||
@@ -279,6 +280,11 @@ dri3_create_context_attribs(struct glx_screen *base,
|
|||||||
ctx_attribs[num_ctx_attribs++] = reset;
|
ctx_attribs[num_ctx_attribs++] = reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
|
||||||
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
|
||||||
|
ctx_attribs[num_ctx_attribs++] = release;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
||||||
|
|
||||||
@@ -755,6 +761,10 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
|
|||||||
|
|
||||||
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
|
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
|
||||||
psc->interop = (__DRI2interopExtension*)extensions[i];
|
psc->interop = (__DRI2interopExtension*)extensions[i];
|
||||||
|
|
||||||
|
if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
|
||||||
|
__glXEnableDirectExtension(&psc->base,
|
||||||
|
"GLX_ARB_context_flush_control");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -475,7 +475,7 @@ _X_HIDDEN bool
|
|||||||
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
||||||
unsigned *major_ver, unsigned *minor_ver,
|
unsigned *major_ver, unsigned *minor_ver,
|
||||||
uint32_t *render_type, uint32_t *flags, unsigned *api,
|
uint32_t *render_type, uint32_t *flags, unsigned *api,
|
||||||
int *reset, unsigned *error)
|
int *reset, int *release, unsigned *error)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
bool got_profile = false;
|
bool got_profile = false;
|
||||||
@@ -485,6 +485,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
|||||||
*minor_ver = 0;
|
*minor_ver = 0;
|
||||||
*render_type = GLX_RGBA_TYPE;
|
*render_type = GLX_RGBA_TYPE;
|
||||||
*reset = __DRI_CTX_RESET_NO_NOTIFICATION;
|
*reset = __DRI_CTX_RESET_NO_NOTIFICATION;
|
||||||
|
*release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
|
||||||
*flags = 0;
|
*flags = 0;
|
||||||
*api = __DRI_API_OPENGL;
|
*api = __DRI_API_OPENGL;
|
||||||
|
|
||||||
@@ -530,6 +531,19 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB:
|
||||||
|
switch (attribs[i * 2 + 1]) {
|
||||||
|
case GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB:
|
||||||
|
*release = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
|
||||||
|
break;
|
||||||
|
case GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB:
|
||||||
|
*release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* If an unknown attribute is received, fail.
|
/* If an unknown attribute is received, fail.
|
||||||
*/
|
*/
|
||||||
|
@@ -78,6 +78,6 @@ extern bool
|
|||||||
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
|
||||||
unsigned *major_ver, unsigned *minor_ver,
|
unsigned *major_ver, unsigned *minor_ver,
|
||||||
uint32_t *render_type, uint32_t *flags, unsigned *api,
|
uint32_t *render_type, uint32_t *flags, unsigned *api,
|
||||||
int *reset, unsigned *error);
|
int *reset, int *release, unsigned *error);
|
||||||
|
|
||||||
#endif /* _DRI_COMMON_H */
|
#endif /* _DRI_COMMON_H */
|
||||||
|
@@ -417,7 +417,8 @@ drisw_create_context_attribs(struct glx_screen *base,
|
|||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
unsigned api;
|
unsigned api;
|
||||||
int reset;
|
int reset;
|
||||||
uint32_t ctx_attribs[2 * 4];
|
int release;
|
||||||
|
uint32_t ctx_attribs[2 * 5];
|
||||||
unsigned num_ctx_attribs = 0;
|
unsigned num_ctx_attribs = 0;
|
||||||
|
|
||||||
if (!psc->base.driScreen)
|
if (!psc->base.driScreen)
|
||||||
@@ -430,7 +431,7 @@ drisw_create_context_attribs(struct glx_screen *base,
|
|||||||
*/
|
*/
|
||||||
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
if (!dri2_convert_glx_attribs(num_attribs, attribs,
|
||||||
&major_ver, &minor_ver, &renderType, &flags,
|
&major_ver, &minor_ver, &renderType, &flags,
|
||||||
&api, &reset, error))
|
&api, &reset, &release, error))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Check the renderType value */
|
/* Check the renderType value */
|
||||||
@@ -441,6 +442,10 @@ drisw_create_context_attribs(struct glx_screen *base,
|
|||||||
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION)
|
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH &&
|
||||||
|
release != __DRI_CTX_RELEASE_BEHAVIOR_NONE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (shareList) {
|
if (shareList) {
|
||||||
pcp_shared = (struct drisw_context *) shareList;
|
pcp_shared = (struct drisw_context *) shareList;
|
||||||
shared = pcp_shared->driContext;
|
shared = pcp_shared->driContext;
|
||||||
@@ -459,6 +464,10 @@ drisw_create_context_attribs(struct glx_screen *base,
|
|||||||
ctx_attribs[num_ctx_attribs++] = major_ver;
|
ctx_attribs[num_ctx_attribs++] = major_ver;
|
||||||
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
|
||||||
ctx_attribs[num_ctx_attribs++] = minor_ver;
|
ctx_attribs[num_ctx_attribs++] = minor_ver;
|
||||||
|
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
|
||||||
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
|
||||||
|
ctx_attribs[num_ctx_attribs++] = release;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
|
||||||
@@ -647,6 +656,10 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
|
|||||||
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
|
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
|
||||||
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
|
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
|
||||||
}
|
}
|
||||||
|
if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) {
|
||||||
|
__glXEnableDirectExtension(&psc->base,
|
||||||
|
"GLX_ARB_context_flush_control");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,6 +132,7 @@ struct extension_info
|
|||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const struct extension_info known_glx_extensions[] = {
|
static const struct extension_info known_glx_extensions[] = {
|
||||||
|
{ GLX(ARB_context_flush_control), VER(0,0), Y, N, N, N },
|
||||||
{ GLX(ARB_create_context), VER(0,0), Y, N, N, N },
|
{ GLX(ARB_create_context), VER(0,0), Y, N, N, N },
|
||||||
{ GLX(ARB_create_context_profile), VER(0,0), Y, N, N, N },
|
{ GLX(ARB_create_context_profile), VER(0,0), Y, N, N, N },
|
||||||
{ GLX(ARB_create_context_robustness), VER(0,0), Y, N, N, N },
|
{ GLX(ARB_create_context_robustness), VER(0,0), Y, N, N, N },
|
||||||
|
@@ -37,7 +37,8 @@ extern "C" {
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARB_create_context_bit = 0,
|
ARB_context_flush_control_bit = 0,
|
||||||
|
ARB_create_context_bit,
|
||||||
ARB_create_context_profile_bit,
|
ARB_create_context_profile_bit,
|
||||||
ARB_create_context_robustness_bit,
|
ARB_create_context_robustness_bit,
|
||||||
ARB_fbconfig_float_bit,
|
ARB_fbconfig_float_bit,
|
||||||
|
Reference in New Issue
Block a user