diff options
author | Emil Velikov <emil.velikov@collabora.com> | 2016-08-16 18:29:34 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-10-14 12:41:56 +0100 |
commit | 3963a5fc941b00ea8c6491599d4db6bc82c2d647 (patch) | |
tree | 0ecc960eeccdd515df84af0a92090ef71dfdc809 /src | |
parent | d2d579da7e1ebd7bc33e7c84921eedc8b8208cda (diff) |
egl/x11: don't populate dri2_dpy->dri2_loader_extension
Analogous to the earlier android and wayland patches. As we're here we
can drop exposing the old version of the extension.
Any dri loader/driver interface use lower bound checking thus exposing
dri2 loader v3 to a v2 capable driver is perfectly normal.
v2: Preserve compat with dri2_minor < 1. The driver does not know if
there is a protocol to manage getBuffersWithFormat(). It's up-to the
loader to expose the vfunc if there is one. (Kristian)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 06b8e1b35b1..7d921f84ef9 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1374,6 +1374,22 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp) } #endif +static const __DRIdri2LoaderExtension dri2_loader_extension_old = { + .base = { __DRI_DRI2_LOADER, 2 }, + + .getBuffers = dri2_x11_get_buffers, + .flushFrontBuffer = dri2_x11_flush_front_buffer, + .getBuffersWithFormat = NULL, +}; + +static const __DRIdri2LoaderExtension dri2_loader_extension = { + .base = { __DRI_DRI2_LOADER, 3 }, + + .getBuffers = dri2_x11_get_buffers, + .flushFrontBuffer = dri2_x11_flush_front_buffer, + .getBuffersWithFormat = dri2_x11_get_buffers_with_format, +}; + static EGLBoolean dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) { @@ -1405,22 +1421,11 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) if (!dri2_load_driver(disp)) goto cleanup_fd; - if (dri2_dpy->dri2_minor >= 1) { - dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; - dri2_dpy->dri2_loader_extension.base.version = 3; - dri2_dpy->dri2_loader_extension.getBuffers = dri2_x11_get_buffers; - dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_x11_flush_front_buffer; - dri2_dpy->dri2_loader_extension.getBuffersWithFormat = - dri2_x11_get_buffers_with_format; - } else { - dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; - dri2_dpy->dri2_loader_extension.base.version = 2; - dri2_dpy->dri2_loader_extension.getBuffers = dri2_x11_get_buffers; - dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_x11_flush_front_buffer; - dri2_dpy->dri2_loader_extension.getBuffersWithFormat = NULL; - } - - dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base; + if (dri2_dpy->dri2_minor >= 1) + dri2_dpy->extensions[0] = &dri2_loader_extension.base; + else + dri2_dpy->extensions[0] = &dri2_loader_extension_old.base; + dri2_dpy->extensions[1] = &image_lookup_extension.base; dri2_dpy->extensions[2] = NULL; |