winsys/amdgpu: Make KMS handles valid for original DRM file descriptor
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 28 Jun 2019 16:35:56 +0000 (18:35 +0200)
committerMichel Dänzer <michel@daenzer.net>
Wed, 3 Jul 2019 09:19:07 +0000 (09:19 +0000)
commit11a3679e3aba3524cf987f1f808d92c25f16e080
tree9a55d792a74018d6cbe2ef766e5d8da85802bb01
parentcb446dc0fa5c68f681108f4613560543aa4cf553
winsys/amdgpu: Make KMS handles valid for original DRM file descriptor

Getting a DMA-buf fd and converting that to a handle using our duplicate
of that file descriptor (getting at which requires passing a
radeon_winsys pointer to the buffer_get_handle hook) makes sure of this,
since duplicated file descriptors reference the same file description
and therefore the same GEM handle namespace.

This is necessary because libdrm_amdgpu may use a different DRM file
descriptor with a separate handle namespace internally, e.g. because it
always reuses any existing amdgpu_device_handle for the same device.
amdgpu_bo_export returns a handle which is valid for that internal
file descriptor.

Bugzilla: https://bugs.freedesktop.org/110903
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/drivers/radeonsi/si_texture.c
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.c