surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
- static const unsigned int visuals[3][4] = {
- { 0xff0000, 0xff00, 0xff, 0xff000000 }, // ARGB8888
- { 0xff0000, 0xff00, 0xff, 0x0 }, // RGB888
- { 0xf800, 0x7e0, 0x1f, 0x0 }, // RGB565
+ static const struct {
+ const char *format_name;
+ unsigned int rgba_masks[4];
+ } visuals[] = {
+ { "ARGB8888", { 0xff0000, 0xff00, 0xff, 0xff000000 } },
+ { "RGB888", { 0xff0000, 0xff00, 0xff, 0x0 } },
+ { "RGB565", { 0x00f800, 0x07e0, 0x1f, 0x0 } },
};
+ unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
unsigned int count, i, j;
count = 0;
- for (i = 0; i < ARRAY_SIZE(visuals); i++) {
- for (j = 0; dri2_dpy->driver_configs[j]; j++) {
+ for (i = 0; i < dri2_dpy->driver_configs[i]; i++) {
+ for (j = 0; j < ARRAY_SIZE(visuals); j++) {
struct dri2_egl_config *dri2_conf;
- dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
- count + 1, EGL_PBUFFER_BIT, NULL, visuals[i]);
+ dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
+ count + 1, EGL_PBUFFER_BIT, NULL, visuals[i].rgba_masks);
- if (dri2_conf)
+ if (dri2_conf) {
count++;
+ format_count[j]++;
+ }
}
}
- if (!count)
- _eglLog(_EGL_DEBUG, "Can't create surfaceless visuals");
+ for (i = 0; i < ARRAY_SIZE(format_count); i++) {
+ if (!format_count[i]) {
+ _eglLog(_EGL_DEBUG, "No DRI config supports native format %s",
+ visuals[i].format_name);
+ }
+ }
return (count != 0);
}
#define DRM_RENDER_DEV_NAME "%s/renderD%d"
+static const __DRIextension *image_loader_extensions[] = {
+ &image_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
EGLBoolean
dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
{
goto cleanup_display;
}
- dri2_dpy->extensions[0] = &image_loader_extension.base;
- dri2_dpy->extensions[1] = &image_lookup_extension.base;
- dri2_dpy->extensions[2] = &use_invalidate.base;
- dri2_dpy->extensions[3] = NULL;
+ dri2_dpy->loader_extensions = image_loader_extensions;
if (!dri2_create_screen(disp)) {
err = "DRI2: failed to create screen";