[Mesa-dev] [PATCH RFC] egl/dri2: Add dri3 support to x11 platform

Boyan Ding boyan.j.ding at gmail.com
Sat Jul 4 02:53:38 PDT 2015



On 07/04/2015 04:17 PM, Axel Davy wrote:
> On 04/07/2015 05:18, Boyan Ding wrote :
>> Hi Emil,
>>
>>
>> On 07/03/2015 10:36 PM, Emil Velikov wrote:
>>
>>>> [snip]
>>>>
>>>> +/* FIXME: Is this right? Seems problematic for WL_bind_wayland_display */
>>> What seems to be the problem ?
>>>
>>> Afaik xcb_dri3_open_reply_fds should return an FD which is ok (be that a
>>> render_node device, or a master one with explicit auth).
>> The problem is that WL_bind_wayland_display don't work under dri3 on
>> x11. I only found it yesterday that to get it work, we'll need to add a
>> mechanism to pass fd instead of name of dri device in wl_drm protocol.
>>
>> Previously, if a wayland client wants to use hardware accelerated EGL,
>> it (with the help of libEGL in mesa) will bind to wl_drm object, and
>> wl_drm will immediately send the name of dri device to the wayland
>> client (actually also libEGL in mesa). After wayland platform code
>> opens the device, it has to send the fd to the X server or drm to
>> get authentication. Things are different with dri3, where a fd is
>> directly sent to the client without the need to authenticate.
>>
>> I propose the following addition in wl_drm protocol:
>>
>> There are two kinds of wl_drm implementation. One is the current form.
>> The other one, called "dri3-capable" (or whatever name), include wl_drm
>> object built on dri3 directly or indirectly through wayland platform.
>>
>> If a client binds to a "dri3-capable" wl_drm object, it will send a "device"
>> event to the client with NULL or empty string (so a client who knows
>> nothing about it can safely fail). If the client knows about dri3-capable
>> wl_drm object, it will send a request named get_fd and wl_drm will
>> respond it with an fd acquired with dri3. If the wl_drm object is not
>> "dri3-capable" it will raise an error if it receives a get_fd request,
>> so will a "dri3-capable" wl_drm object if it receives authenticate
>> request.
>>
>> So the following dri3_authenticate function is not needed. Let's not
>> expose WL_bind_wayland_display for now, and its enablement
>> should be separate patches.
>>
>>
> Hi,
>
> Both XWayland DRI3 and EGL Wayland are able to handle render-nodes, and render-nodes have been available for quite some time now. In fact there has been several times discussions on wayland irc channel to only advertise render-nodes via wl_drm.
> Instead of adding a function to wl_drm to get an fd directly, I advocate just advertising the render node name (if your device is not a render node, it is possible to get the render node name), and then you don't have to authenticate.
> In case render-nodes are not available, then it's ok not to advertise the extension.
>
> Yours,
>
> Axel Davy
Hi,

You are right. Sending name of the render node is much easier and
doesn't need to touch the protocol. drmGetRenderDeviceNameFromFd from
libdrm can do this. I gave it a try locally and it works. I think
advertising render node device when available is reasonable.

Thanks,
Boyan Ding


More information about the mesa-dev mailing list