diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2020-05-02 16:46:47 +0300 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-06-04 07:31:38 +0000 |
commit | aba3aed96e4394a213e188f2f71ef045803a27c5 (patch) | |
tree | c4da124a75f72a7ed505fcd88da51211a15970ca /src/gallium/drivers/iris/iris_screen.c | |
parent | e41e820648b1cb662cbe938c73d755331d48c6db (diff) |
iris: fix export of GEM handles
We reuse DRM file descriptors internally. Therefore when we export a
GEM handle we must do so in the file descriptor used externally.
This change also fixes a file descriptor leak of the FD given at
screen creation.
v2: Don't bother checking fd equals, they're always different
Fix dmabuf leak
Fix GEM handle leaks by tracking exported handles
v3: Check os_same_file_description error (Michel)
Don't create multiple exports for a given GEM table
v4: Add WARN_ONCE (Ken)
Rename external_fd to winsys_fd
v5: Remove export lock in favor of bufmgr's
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2882
Fixes: 7557f1605968 ("iris: share buffer managers accross screens")
Tested-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>
Diffstat (limited to 'src/gallium/drivers/iris/iris_screen.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_screen.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 73ce8288724..374713cdcb2 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -527,6 +527,7 @@ iris_screen_destroy(struct iris_screen *screen) u_transfer_helper_destroy(screen->base.transfer_helper); iris_bufmgr_unref(screen->bufmgr); disk_cache_destroy(screen->disk_cache); + close(screen->winsys_fd); ralloc_free(screen); } @@ -706,6 +707,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) return NULL; screen->fd = iris_bufmgr_get_fd(screen->bufmgr); + screen->winsys_fd = fd; if (getenv("INTEL_NO_HW") != NULL) screen->no_hw = true; |