On Thursday, 13 October 2016, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12 October 2016 at 18:59, Axel Davy <<a href="javascript:;" onclick="_e(event, 'cvml', 'axel.davy@ens.fr')">axel.davy@ens.fr</a>> wrote:<br>
> On 12/10/2016 19:15, Emil Velikov wrote:<br>
>><br>
>> On 11 October 2016 at 19:54, Axel Davy <<a href="javascript:;" onclick="_e(event, 'cvml', 'axel.davy@ens.fr')">axel.davy@ens.fr</a>> wrote:<br>
>>><br>
>>> On 11/10/2016 20:31, Emil Velikov wrote:<br>
>>>><br>
>>>> - udev = udev_new();<br>
>>>> - if (!udev)<br>
>>>> - goto prime_clean;<br>
>>>> + if (drmGetDevice(default_fd, &device) != 0)<br>
>>>> + goto err;<br>
>>>> - default_device_id_path_tag = get_id_path_tag_from_fd(udev,<br>
>>>> default_fd);<br>
>>>> - if (!default_device_id_path_tag)<br>
>>>> - goto udev_clean;<br>
>>>> -<br>
>>>> - is_different_device = 1;<br>
>>>> /* two format are supported:<br>
>>>> * "1": choose any other card than the card used by default.<br>
>>>> * id_path_tag: (for example "pci-0000_02_00_0") choose the card<br>
>>>> * with this id_path_tag.<br>
>>>> */<br>
>>>> if (!strcmp(prime,"1")) {<br>
>>>> - free(prime);<br>
>>>> - prime = strdup(default_device_id_path_<wbr>tag);<br>
>>>> - /* request a card with a different card than the default card */<br>
>>>> - another_tag = 1;<br>
>>>> - } else if (!strcmp(default_device_id_<wbr>path_tag, prime))<br>
>>>> - /* we are to get a new fd (render-node) of the same device */<br>
>>>> - is_different_device = 0;<br>
>>>> + /* Hmm... detection for 2-7 seems to be broken. Nicely done. */<br>
>>><br>
>>> For DRI2, DRI_PRIME takes a number corresponding to the device number as<br>
>>> configured in xorg (and you have xrandr commands to configure the<br>
>>> behaviour). This doesn't work with the DRI3 scheme. However for<br>
>>> retrocompatibility, after several discussions, we decided to let DRI2's<br>
>>> most<br>
>>> used command 'DRI_PRIME=1' to still sorta work on DRI3, but the meaning<br>
>>> changed: DRI_PRIME=1 => 'give me any device that is not the<br>
>>> compositor/xorg<br>
>>> device'<br>
>><br>
>> No argument/objection against DRI_PRIME with DRI3, yet the current<br>
>> hard coded DRI_PRIME=1 _only_ check is iffy. As per the spec there can<br>
>> be 8 devices (0-8) with 0 always being the xorg/compositor one and 1-7<br>
>> as 'other' devices. Yet here we only consider 1 and ignore everything<br>
>> else :-\<br>
><br>
> Do you suggest to have DRI_PRIME=2 (up to 8) be the same than DRI_PRIME=1 ?<br>
><br>
Where/how did you read that ? It sounds like you've not read through<br>
the spec, have you ?<br>
<br>
I'm saying that the DRI2(DriverPrime) spec allows for 8 devices in<br>
total. The 0 one is always the xserver one and you have 7 "others".<br>
Atm things are completely bonkers, since you have this half a**ed<br>
broken heuristics which ignores anything but 1. Admittedly there<br>
aren't many users with 3 or more GPUs but if they were things just<br>
won't work :-\<br>
<br>
Furthermore atm you get a walk over the renderD* (missing D in the<br>
libudev pattern ;-) devices which does not relate to what you get as<br>
the 1 device in any other DRI_PRIME use case.<br>
<br>
Or in other words, if you use DRI_PRIME=1 with libGL/EGL/gbm you can<br>
get different result than when doing the same with the<br>
vdpau/xvmc/omx/vaapi drivers.<br>
<br>
Even within libGL (DRI2) things are quite magical , fortunately you<br>
get the same device if the loader fails.<br>
<br></blockquote><div>Or it's likely just me being weird in expect IMG different components of mesa to behave identically when DRI_PRIME is set ;-)</div><div><br></div><div>Either way I'll drop the lovely comments.</div><div><br></div><div>Emil</div>