summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e18e05e4a99..503450542e5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -92,6 +92,8 @@
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
+#define NUM_ATTRIBS 10
+
static void
dri_set_background_context(void *loaderPrivate)
{
@@ -1166,7 +1168,7 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx,
{
int pos = 0;
- assert(*num_attribs >= 8);
+ assert(*num_attribs >= NUM_ATTRIBS);
ctx_attribs[pos++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[pos++] = dri2_ctx->base.ClientMajorVersion;
@@ -1203,6 +1205,28 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx,
ctx_attribs[pos++] = __DRI_CTX_RESET_LOSE_CONTEXT;
}
+ if (dri2_ctx->base.ContextPriority != EGL_CONTEXT_PRIORITY_MEDIUM_IMG) {
+ unsigned val;
+
+ switch (dri2_ctx->base.ContextPriority) {
+ case EGL_CONTEXT_PRIORITY_HIGH_IMG:
+ val = __DRI_CTX_PRIORITY_HIGH;
+ break;
+ case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
+ val = __DRI_CTX_PRIORITY_MEDIUM;
+ break;
+ case EGL_CONTEXT_PRIORITY_LOW_IMG:
+ val = __DRI_CTX_PRIORITY_LOW;
+ break;
+ default:
+ _eglError(EGL_BAD_CONFIG, "eglCreateContext");
+ return false;
+ }
+
+ ctx_attribs[pos++] = __DRI_CTX_ATTRIB_PRIORITY;
+ ctx_attribs[pos++] = val;
+ }
+
*num_attribs = pos;
return true;
@@ -1317,8 +1341,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
if (dri2_dpy->image_driver) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
@@ -1337,8 +1361,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
} else if (dri2_dpy->dri2) {
if (dri2_dpy->dri2->base.version >= 3) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
@@ -1366,8 +1390,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
assert(dri2_dpy->swrast);
if (dri2_dpy->swrast->base.version >= 3) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))