[PATCH xserver 3/4] dri2: refine dri2_probe_driver_name

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 10 17:00:43 UTC 2017


Hi Yu, Qiang,

Can I interest you in fixing your email client or using one that
supports inline quoting ?

On 10 January 2017 at 14:07, Yu, Qiang <Qiang.Yu at amd.com> wrote:
>
> Hi Emil,
>
>>      /* For non-PCI devices, just assume that the 3D driver is named
>>       * the same as the kernel driver.  This is currently true for vc4
>>       * and msm (freedreno).
>>       */
>> -    if (!pdev) {
>> +    if (drmGetDevice(info->fd, &dev)) {
> This does not align with the comment above. Bail out in the [very]
> unlikely case that the function fails.
> Then honour _drmDevice::bustype for the respective PCI vs other case(s).
> [yuq] Yes, seems drmGetDevice only support PCI devices, non-PCI device just return error.
> I can't separate the normal error and non-PCI device error here. So when normal error, just
> assume non-PCI device and use drmGetVersion.
>
On second thought - using drmGetVersion() in the case of any error is
reasonable. We need to make sure that we also use it in the
_drmDevice::bustype != DRM_BUS_PCI case.

>>          drmVersionPtr version = drmGetVersion(info->fd);
>> -        char *kernel_driver;
>>
>>          if (!version) {
>>              xf86DrvMsg(pScreen->myNum, X_ERROR,
>> @@ -1463,29 +1458,35 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
>>              return NULL;
>>          }
>>
>> -        kernel_driver = strndup(version->name, version->name_len);
>> +        driver = strndup(version->name, version->name_len);
>>          drmFreeVersion(version);
>> -        return kernel_driver;
>> +        return driver;
>>      }
>>
>>      for (i = 0; driver_map[i].driver; i++) {
>> -        if (pdev->vendor_id != driver_map[i].vendor_id)
>> +        if (dev->deviceinfo.pci->vendor_id != driver_map[i].vendor_id)
> ... or in other words.
> This will cause a _lot_ of grief as we merge Thierry's work to support
> !PCI devices.
> [yuq] Then Thierry's work is useful for the problem above. It's better to wait
> for his work upstream and bump the xserver libdrm depend version.
>
Retrieving device information (vendor/device id, other) is orthogonal
to how that is mapped to the "driver_name",
So I won't worry about that ... considering we correctly check the bustype.

Thanks
Emil


More information about the xorg-devel mailing list