summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2013-09-25 14:57:22 -0700
committerKristian Høgsberg <[email protected]>2013-10-15 22:07:52 -0700
commitdf479cffccbdc71d13596bee38cd6434adf5f229 (patch)
tree0aa347912ff5ef7eb80362eb2ff13e55e5cb3607 /src/egl/drivers/dri2
parent44e584a73af0ef78321d06a92f372d920b6ee8b7 (diff)
egl_dri2: Set NativeVisualID to the matching GBM config for the gbm platform
The EGLConfig doesn't have the rgba masks, only the rgba sizes. To make sure a config is usable with a given GBM/KMS format, we need a way to make sure the formats really match.
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/platform_drm.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index fb28bd91c0a..7b1e3a17797 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -476,9 +476,28 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
dri2_setup_screen(disp);
- for (i = 0; dri2_dpy->driver_configs[i]; i++)
+ for (i = 0; dri2_dpy->driver_configs[i]; i++) {
+ EGLint format, attr_list[3];
+ unsigned int mask;
+
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_RED_MASK, &mask);
+ if (mask == 0x3ff00000)
+ format = GBM_FORMAT_XRGB2101010;
+ else if (mask == 0x00ff0000)
+ format = GBM_FORMAT_XRGB8888;
+ else if (mask == 0xf800)
+ format = GBM_FORMAT_RGB565;
+ else
+ continue;
+
+ attr_list[0] = EGL_NATIVE_VISUAL_ID;
+ attr_list[1] = format;
+ attr_list[2] = EGL_NONE;
+
dri2_add_config(disp, dri2_dpy->driver_configs[i],
- i + 1, EGL_WINDOW_BIT, NULL, NULL);
+ i + 1, EGL_WINDOW_BIT, attr_list, NULL);
+ }
drv->API.CreateWindowSurface = dri2_create_window_surface;
drv->API.DestroySurface = dri2_destroy_surface;