Revert "winsys/amdgpu: fix FD mismatch"

This reverts commit 9223528059.

Not needed. (The amdgpu_screen_winsys::input_fd reference in the comment
didn't make sense, there was no such thing)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32377>
This commit is contained in:
Michel Dänzer
2024-11-27 15:49:42 +01:00
committed by Marge Bot
parent fd19ff0b9e
commit f873ee506f
3 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -1652,7 +1652,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
type = amdgpu_bo_handle_type_gem_flink_name;
break;
case WINSYS_HANDLE_TYPE_KMS:
if (sws->fd == aws->input_fd) {
if (sws->fd == aws->fd) {
whandle->handle = bo->kms_handle;
if (bo->is_shared)
@@ -427,14 +427,13 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
goto fail;
aws->dev = dev;
aws->fd = amdgpu_device_get_fd(dev);
/* The device fd might be different from the one we passed because of
* libdrm_amdgpu device dedup logic. This can happen if radv is initialized
* first.
* Get the correct fd or the buffer sharing will not work (see #3424).
*/
if (!are_file_descriptions_equal(aws->fd, fd)) {
int device_fd = amdgpu_device_get_fd(dev);
if (!are_file_descriptions_equal(device_fd, fd)) {
sws->kms_handles = _mesa_hash_table_create(NULL, kms_handle_hash,
kms_handle_equals);
if (!sws->kms_handles)
@@ -443,9 +442,9 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
* we need it but we'd have to use os_same_file_description() to
* compare the fds.
*/
aws->input_fd = aws->fd;
aws->fd = device_fd;
} else {
aws->input_fd = sws->fd;
aws->fd = sws->fd;
}
aws->info.drm_major = drm_major;
aws->info.drm_minor = drm_minor;
@@ -50,7 +50,7 @@ struct amdgpu_cs;
*
* This fd tracking is useful for buffer sharing. As an example, if an app
* wants to use drmModeAddFB it'll need a KMS handle valid for its
* fd (== amdgpu_screen_winsys::input_fd). If both fds are identical, there's
* fd (== amdgpu_screen_winsys::fd). If both fds are identical, there's
* nothing to do: bo->u.real.kms_handle can be used directly
* (see amdgpu_bo_get_handle). If they're different, the BO has to be exported
* from the device fd as a dma-buf, then imported to the app fd to get the
@@ -188,10 +188,8 @@ static_assert(sizeof(((struct amdgpu_seq_no_fences*)NULL)->valid_fence_mask) * 8
/* One struct amdgpu_winsys is created for one gpu in amdgpu_winsys_create(). */
struct amdgpu_winsys {
struct pipe_reference reference;
/* Returned by amdgpu_device_get_fd. */
int fd;
/* See comment above */
int input_fd;
int fd;
/* Protected by bo_fence_lock. */
struct amdgpu_queue queues[AMDGPU_MAX_QUEUES];