Remove the error prone fixed size array.
While we're here also rename to loader_extensions like in the GLX code.
v2: Rebase. Keep image_loader_extension within the wayland_drm
dri2_loader_extensions list.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
if (dri2_dpy->image_driver) {
dri2_dpy->dri_screen =
dri2_dpy->image_driver->createNewScreen2(0, dri2_dpy->fd,
- dri2_dpy->extensions,
+ dri2_dpy->loader_extensions,
dri2_dpy->driver_extensions,
&dri2_dpy->driver_configs,
disp);
if (dri2_dpy->dri2->base.version >= 4) {
dri2_dpy->dri_screen =
dri2_dpy->dri2->createNewScreen2(0, dri2_dpy->fd,
- dri2_dpy->extensions,
+ dri2_dpy->loader_extensions,
dri2_dpy->driver_extensions,
&dri2_dpy->driver_configs, disp);
} else {
dri2_dpy->dri_screen =
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd,
- dri2_dpy->extensions,
+ dri2_dpy->loader_extensions,
&dri2_dpy->driver_configs, disp);
}
} else {
assert(dri2_dpy->swrast);
if (dri2_dpy->swrast->base.version >= 4) {
dri2_dpy->dri_screen =
- dri2_dpy->swrast->createNewScreen2(0, dri2_dpy->extensions,
+ dri2_dpy->swrast->createNewScreen2(0, dri2_dpy->loader_extensions,
dri2_dpy->driver_extensions,
&dri2_dpy->driver_configs, disp);
} else {
dri2_dpy->dri_screen =
- dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions,
+ dri2_dpy->swrast->createNewScreen(0, dri2_dpy->loader_extensions,
&dri2_dpy->driver_configs, disp);
}
}
char *driver_name;
- const __DRIextension *extensions[5];
+ const __DRIextension **loader_extensions;
const __DRIextension **driver_extensions;
#ifdef HAVE_X11_PLATFORM
.flushFrontBuffer = droid_flush_front_buffer,
};
+static const __DRIextension *droid_dri2_loader_extensions[] = {
+ &droid_dri2_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
+static const __DRIextension *droid_image_loader_extensions[] = {
+ &droid_image_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
EGLBoolean
dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
{
/* render nodes cannot use Gem names, and thus do not support
* the __DRI_DRI2_LOADER extension */
- if (!dri2_dpy->is_render_node) {
- dri2_dpy->extensions[0] = &droid_dri2_loader_extension.base;
- } else {
- dri2_dpy->extensions[0] = &droid_image_loader_extension.base;
- }
- dri2_dpy->extensions[1] = &use_invalidate.base;
- dri2_dpy->extensions[2] = &image_lookup_extension.base;
- dri2_dpy->extensions[3] = NULL;
-
+ if (!dri2_dpy->is_render_node)
+ dri2_dpy->loader_extensions = droid_dri2_loader_extensions;
+ else
+ dri2_dpy->loader_extensions = droid_image_loader_extensions;
if (!dri2_create_screen(dpy)) {
err = "DRI2: failed to create screen";
#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";
.get_dri_drawable = dri2_surface_get_dri_drawable,
};
+static const __DRIextension *dri2_loader_extensions[] = {
+ &dri2_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
+static const __DRIextension *image_loader_extensions[] = {
+ &image_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
static EGLBoolean
dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp)
{
if (!dri2_load_driver(disp))
goto cleanup_driver_name;
- dri2_dpy->extensions[0] = &image_loader_extension.base;
- dri2_dpy->extensions[1] = &image_lookup_extension.base;
- dri2_dpy->extensions[2] = &use_invalidate.base;
-
/* render nodes cannot use Gem names, and thus do not support
* the __DRI_DRI2_LOADER extension */
- if (!dri2_dpy->is_render_node) {
- dri2_dpy->extensions[3] = &dri2_loader_extension.base;
- dri2_dpy->extensions[4] = NULL;
- } else
- dri2_dpy->extensions[3] = NULL;
+ if (!dri2_dpy->is_render_node)
+ dri2_dpy->loader_extensions = dri2_loader_extensions;
+ else
+ dri2_dpy->loader_extensions = image_loader_extensions;
if (!dri2_create_screen(disp))
goto cleanup_driver;
.putImage2 = dri2_wl_swrast_put_image2,
};
+static const __DRIextension *swrast_loader_extensions[] = {
+ &swrast_loader_extension.base,
+ NULL,
+};
+
static EGLBoolean
dri2_initialize_wayland_swrast(_EGLDriver *drv, _EGLDisplay *disp)
{
if (!dri2_load_driver_swrast(disp))
goto cleanup_shm;
- dri2_dpy->extensions[0] = &swrast_loader_extension.base;
- dri2_dpy->extensions[1] = NULL;
+ dri2_dpy->loader_extensions = swrast_loader_extensions;
if (!dri2_create_screen(disp))
goto cleanup_driver;
.getImage = swrastGetImage,
};
+static const __DRIextension *swrast_loader_extensions[] = {
+ &swrast_loader_extension.base,
+ NULL,
+};
+
static EGLBoolean
dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
{
if (!dri2_load_driver_swrast(disp))
goto cleanup_conn;
- dri2_dpy->extensions[0] = &swrast_loader_extension.base;
- dri2_dpy->extensions[1] = NULL;
+ dri2_dpy->loader_extensions = swrast_loader_extensions;
if (!dri2_create_screen(disp))
goto cleanup_driver;
}
#ifdef HAVE_DRI3
+
+static const __DRIextension *dri3_image_loader_extensions[] = {
+ &dri3_image_loader_extension.base,
+ &image_lookup_extension.base,
+ &use_invalidate.base,
+ NULL,
+};
+
static EGLBoolean
dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
{
if (!dri2_load_driver_dri3(disp))
goto cleanup_conn;
- dri2_dpy->extensions[0] = &dri3_image_loader_extension.base;
- dri2_dpy->extensions[1] = &use_invalidate.base;
- dri2_dpy->extensions[2] = &image_lookup_extension.base;
- dri2_dpy->extensions[3] = NULL;
+ dri2_dpy->loader_extensions = dri3_image_loader_extensions;
dri2_dpy->swap_available = true;
dri2_dpy->invalidate_available = true;
.getBuffersWithFormat = dri2_x11_get_buffers_with_format,
};
+static const __DRIextension *dri2_loader_extensions_old[] = {
+ &dri2_loader_extension_old.base,
+ &image_lookup_extension.base,
+ NULL,
+};
+
+static const __DRIextension *dri2_loader_extensions[] = {
+ &dri2_loader_extension.base,
+ &image_lookup_extension.base,
+ NULL,
+};
+
static EGLBoolean
dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
{
goto cleanup_fd;
if (dri2_dpy->dri2_minor >= 1)
- dri2_dpy->extensions[0] = &dri2_loader_extension.base;
+ dri2_dpy->loader_extensions = dri2_loader_extensions;
else
- dri2_dpy->extensions[0] = &dri2_loader_extension_old.base;
-
- dri2_dpy->extensions[1] = &image_lookup_extension.base;
- dri2_dpy->extensions[2] = NULL;
+ dri2_dpy->loader_extensions = dri2_loader_extensions_old;
dri2_dpy->swap_available = (dri2_dpy->dri2_minor >= 2);
dri2_dpy->invalidate_available = (dri2_dpy->dri2_minor >= 3);