[Mesa-dev] [PATCH] vulkan/wsi/x11: add support to detect if we can support rendering (v3)

Dave Airlie airlied at gmail.com
Mon Feb 20 01:46:17 UTC 2017


tic bool
> +wsi_x11_check_dri3_compatible(xcb_connection_t *conn, int local_fd)
> +{
> +   xcb_screen_iterator_t screen_iter =
> +      xcb_setup_roots_iterator(xcb_get_setup(conn));
> +   xcb_screen_t *screen = screen_iter.data;
> +
> +   int dri3_fd = wsi_dri3_open(conn, screen->root, None);
> +   if (dri3_fd != -1) {
> +      char *local_dev = drmGetRenderDeviceNameFromFd(local_fd);
> +      char *dri3_dev = drmGetRenderDeviceNameFromFd(dri3_fd);
>
>
> Pardon me for being pedantic about error checking but what if one of these
> returns NULL?

The impossible has happened and you'll duly crash in strcmp, I'm not sure
how it would happen the fd you get didn't come from opening a dri device.

Dave.


More information about the mesa-dev mailing list