iris: export GEM handle with RDWR access rights
authorMaksim Sisov <msisov@igalia.com>
Tue, 18 May 2021 05:23:56 +0000 (08:23 +0300)
committerMarge Bot <eric+marge@anholt.net>
Tue, 18 May 2021 08:46:06 +0000 (08:46 +0000)
commitb74898ef699486d0513fcd3af2587a831df99dff
tree3a8639bfb361727ca6cd34d192160aa9ee5832dd
parent1b1c726ca91dff781363b1b0980b47ca18f86a76
iris: export GEM handle with RDWR access rights

There is a regression that made it impossible to export gem
handles with write access.

That is, a client may export gem handles of each buffer plane, then
export dmabuf fds using these handles, and mmap these dmabuf in
a different process (this is what Chromium does).

After https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861,
it became impossible as mmap resulted in EACCESS error as slightly
different approach was taken for exporting these gem handles.

This CL fixes exporting gem handles (which are exported from dmabuf
fds) by adding the DRM_RDWR flag.

Cc: mesa-stable
Fixes #3119

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10851>
src/gallium/drivers/iris/iris_bufmgr.c