aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorAdam Jackson <[email protected]>2016-09-22 03:38:01 -0400
committerAdam Jackson <[email protected]>2017-11-06 16:08:58 -0500
commit9ef7158a0985d789958eb43cf08476d50af00f2a (patch)
tree48855f8ee1b2c9e570179deb73c695950367fdd4 /src/egl/drivers
parent96463614a30589d30c81eb33f559d633dc937eae (diff)
egl/dri2: Factor out context attribute initialization
Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 503450542e5..44cddfd0ed5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1247,6 +1247,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
const __DRIconfig *dri_config;
int api;
+ unsigned error;
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
(void) drv;
@@ -1339,15 +1342,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
else
dri_config = NULL;
- if (dri2_dpy->image_driver) {
- unsigned error;
- unsigned num_attribs = NUM_ATTRIBS;
- uint32_t ctx_attribs[NUM_ATTRIBS];
-
- if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
- &num_attribs))
- goto cleanup;
+ if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
+ &num_attribs))
+ goto cleanup;
+ if (dri2_dpy->image_driver) {
dri2_ctx->dri_context =
dri2_dpy->image_driver->createContextAttribs(dri2_dpy->dri_screen,
api,
@@ -1360,14 +1359,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
dri2_create_context_attribs_error(error);
} else if (dri2_dpy->dri2) {
if (dri2_dpy->dri2->base.version >= 3) {
- unsigned error;
- unsigned num_attribs = NUM_ATTRIBS;
- uint32_t ctx_attribs[NUM_ATTRIBS];
-
- if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
- &num_attribs))
- goto cleanup;
-
dri2_ctx->dri_context =
dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
api,
@@ -1389,14 +1380,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
} else {
assert(dri2_dpy->swrast);
if (dri2_dpy->swrast->base.version >= 3) {
- unsigned error;
- unsigned num_attribs = NUM_ATTRIBS;
- uint32_t ctx_attribs[NUM_ATTRIBS];
-
- if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
- &num_attribs))
- goto cleanup;
-
dri2_ctx->dri_context =
dri2_dpy->swrast->createContextAttribs(dri2_dpy->dri_screen,
api,