OSDN Git Service

winsys/amdgpu: Keep track of retrieved KMS handles using hash tables
authorMichel Dänzer <mdaenzer@redhat.com>
Mon, 30 Sep 2019 16:00:50 +0000 (18:00 +0200)
committerMichel Dänzer <michel@daenzer.net>
Thu, 23 Jan 2020 16:24:00 +0000 (17:24 +0100)
commit24075ac60fcc09dad173cb792e8f186c6379c086
tree5b47a8c72923eebf195d18d70a6caf8c236bbce5
parentf4010a6da9720b1593ca34faf0d8722ca85ed6c2
winsys/amdgpu: Keep track of retrieved KMS handles using hash tables

The assumption being that KMS handles are only retrieved for relatively
few BOs, so hash tables should be efficient both in terms of performance
and memory consumption.

We use the address of struct amdgpu_winsys_bo as the key and its
kms_handle field (the KMS handle valid for the DRM file descriptor
passed to amdgpu_device_initialize) as the hash value.

v2:
* Add comment above amdgpu_screen_winsys::kms_handles (Pierre-Eric
  Pelloux-Prayer)
v3:
* Protect kms_handles hash table with amdgpu_winsys::sws_list_lock
  mutex.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3202>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h