[Mesa-dev] [PATCH] pipe_loader: Try to make a connection with the X server before probing pciids

Michel Dänzer michel at daenzer.net
Tue Jul 17 23:55:52 PDT 2012


On Die, 2012-07-17 at 19:22 +0000, Tom Stellard wrote: 
> When X is running it is neccesary for pipe_loader to authenticate with
> DRM, in order to be able to use the device.
> 
> This makes it possible to run OpenCL programs while X is running.

[...]

> @@ -132,6 +139,56 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
>  {
>     struct pipe_loader_drm_device *ddev = CALLOC_STRUCT(pipe_loader_drm_device);
>  
> +#if PIPE_LOADER_HAVE_XCB
> +   // Try authenticate with the X server to give us access to devices that X
> +   // is running on.

I think /**/ style comments are generally preferred in C code.


> +   disp = XOpenDisplay(NULL);
> +
> +   if (!disp)
> +      goto done;
> +
> +   xcb_conn = XGetXCBConnection(disp);

Does this code really need Xlib-xcb, as opposed to pure XCB? I think the
former should only be needed for using XCB with an existing Xlib
Display.

Also, does the X connection need to stay open?


Looks good to me otherwise.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list