iris: share buffer managers accross screens
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 6 Mar 2020 11:34:23 +0000 (13:34 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 11 Apr 2020 19:04:25 +0000 (22:04 +0300)
commit7557f1605968c39d680545d5b8457d17eea3b922
treee91b1cef196d8398e6066fc628b443270008aa5b
parentbd3e50545339ffd4f258437d6282e2cfbf113725
iris: share buffer managers accross screens

St happilly uses pipe_resources created with one screen with other
screens. Unfortunately our resources have a single identifier that
related to a given screen and its associated DRM file descriptor.

To workaround this, let's share the buffer manager between screens for
a given DRM device. That way handles are always valid.

v2: Don't forget to close the fd that bufmgr now owns
    Take a copy of the fd to ensure it stays alive even if the dri
    layer closes it

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1373
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4086>
src/gallium/drivers/iris/iris_bufmgr.c
src/gallium/drivers/iris/iris_bufmgr.h
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_screen.h