[Mesa-stable] [PATCH] radeon: Use dup fd as key in drm-winsys hash table to fix ZaphodHeads.

Mario Kleiner mario.kleiner.de at gmail.com
Sat Jun 27 22:49:53 PDT 2015


Thanks for the review Ilia. Just saw that the new amdgpu winsys driver 
will need the same fix, once this one is confirmed to be ok.

thanks,
-mario

On 06/28/2015 07:23 AM, Ilia Mirkin wrote:
> Without being intimately familiar with the radeon winsys code, this
> seems sane (esp after re-reviewing the situation for nouveau).
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>. But one of the radeon
> people definitely needs to look at this before pushing.
>
> On Sat, Jun 27, 2015 at 9:02 PM, Mario Kleiner
> <mario.kleiner.de at gmail.com> wrote:
>> Same problem and fix as for nouveau's ZaphodHeads trouble.
>>
>> See patch ...
>>
>> "nouveau: Use dup fd as key in drm-winsys hash table to fix ZaphodHeads."
>>
>> ... for reference.
>>
>> Cc: "10.3 10.4 10.5 10.6" <mesa-stable at lists.freedesktop.org>
>>
>> Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
>> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>   src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 13 ++++++++++---
>>   1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> index ba8d143..ebdb19e 100644
>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> @@ -484,6 +484,10 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
>>       if (ws->gen >= DRV_R600) {
>>           radeon_surface_manager_free(ws->surf_man);
>>       }
>> +
>> +    if (ws->fd)
>> +        close(ws->fd);
>> +
>>       FREE(rws);
>>   }
>>
>> @@ -696,7 +700,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
>>           return NULL;
>>       }
>>
>> -    ws->fd = fd;
>> +    ws->fd = dup(fd);
>>
>>       if (!do_winsys_init(ws))
>>           goto fail;
>> @@ -712,7 +716,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
>>           goto fail;
>>
>>       if (ws->gen >= DRV_R600) {
>> -        ws->surf_man = radeon_surface_manager_new(fd);
>> +        ws->surf_man = radeon_surface_manager_new(ws->fd);
>>           if (!ws->surf_man)
>>               goto fail;
>>       }
>> @@ -753,7 +757,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
>>           return NULL;
>>       }
>>
>> -    util_hash_table_set(fd_tab, intptr_to_pointer(fd), ws);
>> +    util_hash_table_set(fd_tab, intptr_to_pointer(ws->fd), ws);
>>
>>       /* We must unlock the mutex once the winsys is fully initialized, so that
>>        * other threads attempting to create the winsys from the same fd will
>> @@ -770,6 +774,9 @@ fail:
>>           ws->kman->destroy(ws->kman);
>>       if (ws->surf_man)
>>           radeon_surface_manager_free(ws->surf_man);
>> +    if (ws->fd)
>> +        close(ws->fd);
>> +
>>       FREE(ws);
>>       return NULL;
>>   }
>> --
>> 2.1.4
>>


More information about the mesa-stable mailing list