summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-11-02 15:01:40 -0400
committerDylan Baker <dylan@pnwbakers.com>2017-11-02 15:09:07 -0700
commit3a79f96a1b7beeb83da9eafb00ee7bd1e51e19e2 (patch)
tree5e6db380078fb2440c948521ffc5e2649f3095e6
parent4ff6187b84d2b08ffbd75fa2c9fcd11b9628b8a7 (diff)
egl/dri2: Factor out context attribute initialization
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 503450542e..57226f60a7 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,16 +1359,8 @@ 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,
+ dri2_ctx->dri_context =
+ dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
api,
dri_config,
shared,
@@ -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,