[Mesa-dev] [PATCH v2 6/6] anv: do not open random render node(s)

Emil Velikov emil.l.velikov at gmail.com
Wed Feb 15 16:45:14 UTC 2017


On 15 February 2017 at 16:38, Ilia Mirkin <imirkin at alum.mit.edu> wrote:

>> +anv_enumerate_devices(struct anv_instance *instance)
>> +{
>> +   /* TODO: Check for more devices ? */
>> +   drmDevicePtr devices[8];
>> +   VkResult result = VK_SUCCESS;
Should read

   VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER;

>> +   int max_devices;
>> +
>> +   instance->physicalDeviceCount = 0;
>> +
>> +   max_devices = drmGetDevices2(0, devices, sizeof(devices));
>> +   if (max_devices < 1)
>> +      return VK_ERROR_INCOMPATIBLE_DRIVER;
>
> so result = VK_SUCCESS
>
>> +
>> +   for (unsigned i = 0; i < (unsigned)max_devices; i++) {
>> +      if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER &&
>> +          devices[i]->bustype == DRM_BUS_PCI &&
>> +          devices[i]->deviceinfo.pci->vendor_id == 0x8086) {
>
> let's say this never triggers
>
>> +
>> +         result = anv_physical_device_init(&instance->physicalDevice,
>> +                        instance,
>> +                        devices[i]->nodes[DRM_NODE_RENDER]);
>> +         if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
>> +            break;
>> +      }
>> +   }
>
> result is still VK_SUCCESS. Seems like it should default to
> VK_ERROR_INCOMPATIBLE_DRIVER instead?
>
You're spot on - VK_ERROR_INCOMPATIBLE_DRIVER is what we want.

Thanks !
Emil


More information about the mesa-dev mailing list