On 13 August 2018 at 16:37, Frank Binns <[email protected]> wrote:
> Hi Emil,
>
> Emil Velikov <[email protected]> writes:
>
>> From: Emil Velikov <[email protected]>
>>
>> Replace the manual handling of /dev/dri in famour of the drmDevice API.
>
> s/famour/favour/
>
>> The latter provides a consistent way of enumerating the devices,
>> providing device details as needed.
>>
>> Cc: Robert Foss <[email protected]>
>> Cc: Tomasz Figa <[email protected]>
>> Signed-off-by: Emil Velikov <[email protected]>
>> ---
>> If using VGEM the following patch is needed [1]. It's been on the list
>> for ages - will double-check and commmit it to drm-misc.
>>
>> [1] https://lists.freedesktop.org/archives/dri-devel/2018-March/170944.html
>> ---
>>  src/egl/drivers/dri2/platform_android.c | 23 +++++++++--------------
>>  1 file changed, 9 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c 
>> b/src/egl/drivers/dri2/platform_android.c
>> index cc16fd8118f..685851acfc2 100644
>> --- a/src/egl/drivers/dri2/platform_android.c
>> +++ b/src/egl/drivers/dri2/platform_android.c
>> @@ -1290,6 +1290,7 @@ static int
>>  droid_open_device(_EGLDisplay *disp)
>>  {
>>     const int MAX_DRM_DEVICES = 32;
>> +   drmDevicePtr device, devices[MAX_DRM_DEVICES] = { NULL };
>>     int prop_set, num_devices;
>>     int fd = -1, fallback_fd = -1;
>>
>> @@ -1299,23 +1300,17 @@ droid_open_device(_EGLDisplay *disp)
>>     if (property_get("drm.gpu.vendor_name", vendor_buf, NULL) > 0)
>>        vendor_name = vendor_buf;
>>
>> -   const char *drm_dir_name = "/dev/dri";
>> -   DIR *sysdir = opendir(drm_dir_name);
>> +   num_devices = drmGetDevices2(0, devices, MAX_DRM_DEVICES);
>
> It would be more robust to use ARRAY_SIZE here instead of
> MAX_DRM_DEVICES.
>
Thanks Frank - fixed both locally.

-Emil
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to