[Mesa-dev] [PATCH 16/30] egl/x11: don't populate dri2_dpy->dri2_loader_extension
Kristian Høgsberg
hoegsberg at gmail.com
Thu Aug 25 16:49:42 UTC 2016
On Thu, Aug 25, 2016 at 9:18 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> 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.
No, in this case we don't want to offer v2 to the driver if we don't
have the corresponding DRI2 protocol to back it up. Specifically, we
don't want the driver calling getBuffersWithFormat() if the protocol
version is less than 1.1.
Kristian
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Let me know if you'd want the dri2_minor change split into separate
> patch.
> ---
> src/egl/drivers/dri2/platform_x11.c | 25 +++++++++----------------
> 1 file changed, 9 insertions(+), 16 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index 14bb19b..1c9cf1d 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -1374,6 +1374,14 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
> }
> #endif
>
> +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 +1413,7 @@ 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;
> + dri2_dpy->extensions[0] = &dri2_loader_extension.base;
> dri2_dpy->extensions[1] = &image_lookup_extension.base;
> dri2_dpy->extensions[2] = NULL;
>
> --
> 2.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list