mesa/src
Feng Jiang 2926a1aa76 virgl: do not share virgl_screen between different drm_files
Now, only one instance of virgl_screen exists for a device
(/dev/dri/cardX), and it is shared by different frontends (eg GLX,
GBM, etc.). There is a problem with this, as follows:

  /* Init GLX */
  ...
  glXCreateContext(...);
  ...

  /* GBM */
  gbm_fd = open("/dev/dri/card0", O_RDWR);
  dev = gbm_create_device(gbm_fd);
  bo = gbm_bo_create(dev, ...);
  plane_handle = gbm_bo_get_handle_for_plane(bo, ...);
  drmPrimeHandleToFD(gbm_fd, handle.u32, flags, &plane_fd);

The above drmPrimeHandleToFD() call will fail with ENOENT.
The reason is that GBM and GLX share the same virgl_screen (file
descriptor), and it is not gbm_fd that is used to create gbm_bo,
but other fd (opened during GLX initialization). Since the scope
of prime handle is limited to drm_file, the above plane_handle is
invalid under gbm_fd.

By canceling the sharing of virgl_screen between different drm_files,
GBM can use the correct fd to create resources, thereby avoiding the
problem of invalid prime handle.

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16738>
2022-08-02 10:30:08 +00:00
..
amd util/list: rename LIST_ENTRY() to list_entry() 2022-07-28 10:10:44 +00:00
android_stub
asahi agx: Port minifloat tests to GTest 2022-08-01 18:34:11 +00:00
broadcom v3d/ci: enable ARB_texture_cube_map piglit tests 2022-08-01 16:53:46 +00:00
c11 c11: reinstate the original license and authorship 2022-06-27 11:46:22 +00:00
compiler nir/from_ssa: Ignore undef sources 2022-08-01 22:13:24 +00:00
drm-shim drm-shim: Cleanup on device file close 2022-05-02 19:50:33 +00:00
egl egl: Remove usage of USE_ELF_TLS macro 2022-07-29 23:59:11 +00:00
etnaviv util/list: rename LIST_ENTRY() to list_entry() 2022-07-28 10:10:44 +00:00
freedreno meson: add various generated header dependencies as order-only deps 2022-07-31 18:10:15 +00:00
gallium virgl: do not share virgl_screen between different drm_files 2022-08-02 10:30:08 +00:00
gbm gbm: add GBM_FORMAT_[AX]BGR16161616 2022-07-27 07:27:10 +00:00
getopt
glx glx: Remove usage of USE_ELF_TLS 2022-07-29 23:59:12 +00:00
gtest gtest: Fix maybe-uninitialized compiler warning 2022-06-29 21:02:18 +00:00
hgl
imagination pvr: Fix cdm shared reg usage reported to fw. 2022-07-29 11:37:06 +00:00
imgui
intel intel/compiler: use NIR_PASS more 2022-08-02 10:07:05 +00:00
loader loader: Remove usage of USE_ELF_TLS in loader.c 2022-07-29 23:59:12 +00:00
mapi mapi: Remove usage of USE_ELF_TLS 2022-07-29 23:59:11 +00:00
mesa mesa/st: disable unrestricted fragment depth values for GL/GLES 2022-07-28 10:35:04 +10:00
microsoft dzn: Retrieve validator version 2022-07-23 14:48:17 +00:00
nouveau nir: Split usub_sat lowering flag from uadd_sat. 2022-07-22 17:54:28 +00:00
panfrost pan/bi: Rename CLPER_V6.i32 to CLPER_OLD.i32 2022-08-01 18:42:57 +00:00
tool meson/pps: Check if libdrm exists to compile pps 2022-06-22 11:52:36 +03:00
util libsync: Fix compiler warning 2022-08-02 00:59:48 +00:00
virtio meson: add various generated header dependencies as order-only deps 2022-07-31 18:10:15 +00:00
vulkan vulkan: Include self-dep info in rendering continues 2022-07-26 17:47:20 +00:00
meson.build meson: Remove usage of use_elf_tls 2022-07-29 23:59:11 +00:00