summaryrefslogtreecommitdiff
path: root/hw/xwayland/xwayland-glamor-gbm.c
AgeCommit message (Collapse)AuthorFilesLines
36 hoursxwayland/glamor: Handle depth 15 in gbm_format_for_depthHEADmasterMichel Dänzer1-0/+2
Prevents Xwayland with glamor from logging unexpected depth: 15 to stderr many times when running rendercheck -t blend -o clear Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1507>
2024-04-11xwayland: avoid Linux-only headers on non-LinuxJan Beich1-0/+2
hw/xwayland/xwayland-glamor-gbm.c:38:10: fatal error: 'linux/dma-buf.h' file not found 38 | #include <linux/dma-buf.h> | ^~~~~~~~~~~~~~~~~ Fixes: 3df236a3d538 ("xwayland: add functions to import and export dma-buf implicit fences") Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1481>
2024-04-10xwayland: Add xwl_window::surface_windowMichel Dänzer1-1/+1
It may track a non-toplevel window which fully covers the area of the window pixmap / Wayland surface. It is now used instead of xwl_window::toplevel for updating the Wayland surface contents. The surface_window can now hit the Present page flip path while it's automatically redirected. v2: * Use "surface_window" instead of "surf_win". (Olivier Fourdan) * Add comment describing surface_window, and describe what surface_window/toplevel are useful for respectively. (Olivier Fourdan) * Use surface_window in xwl_realize_window. v3: * Backtrack up to the closest opaque ancestor in xwl_window_update_surface_window. (Olivier Fourdan) v4: * Clean up logic for determining the surface window in xwl_window_update_surface_window, and document it better. * Handle window_get_damage(xwl_window->surface_window) returning NULL in xwl_window_update_surface_window. * Call xwl_window_update_surface_window after xwl_window_buffers_init in ensure_surface_for_window, since the former may call xwl_window_buffers_dispose. * Rename surf/win_pix to surface/window_pixmap in xwl_window_update_surface_window. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10xwayland: Pass xwl_window to xwl_glamor_dri3_syncobj_passthroughMichel Dänzer1-2/+1
Preparation for later changes, no functional change intended. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-10xwayland: Rename xwl_window::window to ::toplevelMichel Dänzer1-1/+1
It's always the toplevel window, i.e. either the root window or a child of it. Preparation for later commits, no functional change. v2: (Olivier Fourdan) * Fix debug build. * Add comment describing ::toplevel. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
2024-04-09xwayland: add support for wp_linux_drm_syncobj_v1Erik Kurzinger1-0/+83
This protocol allows for explicit synchronization of GPU operations by Wayland clients and the compositor. Xwayland can make use of this to ensure any rendering it initiates has completed before the target image is accessed by the compositor, without having to rely on kernel-level implicit synchronization. Furthermore, for X11 clients that also support explicit synchronization using the mechanisms exposed in the DRI3 and Present extensions, this Wayland protocol allows us to simply forward the timeline, acquire, and release points directly to the compositor, ideally avoiding any premature stalls in the presentation pipeline. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
2024-04-09xwayland: support DRI3 1.4 and Present 1.4Erik Kurzinger1-1/+205
Together, DRI3 1.4 and Present 1.4 allow clients to explicitly synchronize GPU rendering with presentation using DRM syncobjs. Here we add the necessary support to Xwayland's glamor and Present infrastructure to enable this functionality. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
2024-04-09xwayland: add functions to import and export dma-buf implicit fencesErik Kurzinger1-0/+100
Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
2024-04-09xwayland: add detection for drivers that don't support implicit syncErik Kurzinger1-1/+18
Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
2024-03-18xwayland/glamor: Remove the backend pointersOlivier Fourdan1-1/+1
We have only one backend now. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Make xwl_glamor_init_gbm() return its statusOlivier Fourdan1-7/+5
This is a preliminary step to remove the backend's field "is_available". Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the backend_flagsOlivier Fourdan1-2/+0
We do not need these anymore, since we only have the GBM backend left. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the create_pixmap_for_window() hookOlivier Fourdan1-4/+7
And rename the function xwl_glamor_gbm_create_pixmap_for_window() as xwl_glamor_create_pixmap_for_window(). Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the get_main_device() hookOlivier Fourdan1-2/+1
Call xwl_gbm_get_main_device() directly from xwl_screen_get_main_dev(). Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the check_flip() hookOlivier Fourdan1-1/+0
The GBM backend never had a use for it. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the get_wl_buffer_for_pixmap() hookOlivier Fourdan1-3/+2
And rename the GLAMOR GBM xwl_glamor_gbm_get_wl_buffer_for_pixmap() function as xwl_glamor_pixmap_get_wl_buffer(). Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the init_screen() hookOlivier Fourdan1-2/+1
And call xwl_glamor_gbm_init_screen() directly instead. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop the init_egl() hook.Olivier Fourdan1-2/+1
And call xwl_glamor_gbm_init_egl() directly instead. Yet, keep the function separate rather than merging it back into xwl_glamor_init() for clarity of the code. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop xwl_glamor_gbm_has_wl_interfaces()Olivier Fourdan1-14/+9
And merge it back into xwl_glamor_has_wl_interfaces() Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop xwl_glamor_gbm_init_wl_registry()Olivier Fourdan1-19/+0
And merge it back into xwl_glamor_init_wl_registry(). Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-15xwayland/glamor/gbm: simplify render node checkSimon Ser1-12/+8
No need to call is_device_path_render_node() on each node, the index is the node type. Saves a couple of open()/close()/IOCTLs. Signed-off-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1237>
2024-03-06xwayland: Use border width in xwl_glamor_gbm_create_pixmap_for_windowMichel Dänzer1-4/+7
Otherwise the pixmap is too small for a window with non-0 border width. Fixes: 9730fb64ea05 ("xwayland: Add create_pixmap_for_window() to GBM backend") Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1314>
2024-03-03xwayland: drop duplicate _X_EXPORTEnrico Weigelt, metux IT consult1-3/+3
These are already defined in glamor.h Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1274>
2024-01-19xwayland/glamor/gbm: make wl_drm optionalSimon Ser1-5/+52
Build on top of [1] to use linux-dmabuf to grab the main device when wl_drm is unavailable. Fixes Xwayland glamor on top of latest wlroots commit which has dropped wl_drm support [2]. [1]: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/818 [2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4397 Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19xwayland/glamor/gbm: use Bool for true/false fieldsSimon Ser1-3/+3
This makes it more obvious what the values mean. Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-28xwayland: Avoid hardcoding the interface nameOlivier Fourdan1-2/+2
The Wayland interfaces have a "name" field that we can use instead of hardcoding their name. Change the code to use that name instead of the static strings. This was inspired by a similar change in mutter by Robert Mader <robert.mader@collabora.com>. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-11-02Xwayland: add "glamor" command line optionKonstantin1-1/+1
This will force Glamor run on GL or GL ES independently from GL version set. Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-02hw/Xwayland: add xwl_glamor_mode_flags enumKonstantin1-0/+6
This replaces int glamor parameter with a new enum to be more clean and prepare for more glamor options. No functional change. Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-10-30xwayland/glamor/gbm: use GBM_FORMAT_ARGB8888 for 24-bit on ESKonstantin1-4/+18
On Mesa, when we request GBM_FORMAT_XRGB8888, driver set surface storage format to GL_RGB8, which breaks GL ES rendering (on any GL ES version). If we force set gbm_format to GBM_FORMAT_ARGB8888, then rendering will happen and working. Fixes #1288 Fixes #1356
2023-10-04xwayland/glamor/gbm: Set GBM_BO_USE_LINEAR if only LINEAR modifier is supportedJosé Expósito1-3/+19
Some drivers might not support explicit format modifiers. On these drivers `gbm_bo_create_with_modifiers()` will fail and the `gbm_bo_create()` code path will be used instead. In this case, if the LINEAR modifier is advertised (and the INVALID modifier is not) add the `GBM_BO_USE_LINEAR` flag. Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1438 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Signed-off-by: José Expósito's avatarJosé Expósito <jexposit@redhat.com>
2023-06-21xwayland/glamor/gbm: Use EGL_NO_CONTEXT with EGL_NATIVE_PIXMAP_KHRMichel Dänzer1-1/+1
This is required per https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt . Mesa hasn't enforced it, but it will soon: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/454 Fixes: 2f113d68f6c1 ("xwayland: Add glamor and DRI3 support")
2023-04-12xwayland: Use the new API to set scanoutOlivier Fourdan1-3/+10
If the format and modifiers are from a tranche which supports scanout, we can set the corresponding flag to gbm_bo_create_with_modifiers2() to benefit from scanout buffers where applicable. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-12xwayland: use gbm_bo_create_with_modifiers2()Simon Ser1-1/+8
This allows us to pass flags to the function, avoiding the forced implicit GBM_BO_USE_SCANOUT which happens with the older version. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Create scanout capable BO with the fallback pathOlivier Fourdan1-8/+9
Before linux_dmabuf v4 support was added, the BO were created using gbm_bo_create_with_modifiers() which incidentally creates scanout capable buffers. We now need to replicate that explicitly when using the fallback path, with buffers window, otherwise direct scanout will not be possible in that case. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1535 Suggested-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Add create_pixmap_for_window() to GBM backendOlivier Fourdan1-8/+40
Add the implementation for create_pixmap_for_window() in the GBM glamor backend. To do so, we just rename the existing xwl_glamor_gbm_create_pixmap() as internal and add an optional drawable parameter, so that it can be used either from the regular CreatePixmap code path, or from the new direct Xwayland glamor's hook. v2: Fallback to xwl_glamor_get_modifiers() if xwl_glamor_get_drawable_modifiers() returned 0 modifiers. (Michel) Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-03-08xwayland/glamor: Track if a xwl_pixmap uses explicit modifiersJonas Ådahl1-20/+30
If we allocated with implicit modifiers, then we shouldn't use the modifier returned by gbm_bo when checking whether the modifier is supported or not, since it won't be if the compositor only advertises implicit modifiers, nor should we use the modifier when creating the Wayland buffer object, as it wasn't explicitly advertised. Fixes: c6f2598a4 ("xwayland: don't fall back to wl_drm with explicit modifier") Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-08xwayland/glamor/gbm: Use helper for implicit buffer params tooJonas Ådahl1-6/+26
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-08xwayland/glamor/gbm: Initialize explicit buffer params in helperJonas Ådahl1-31/+55
This is preparing for cleaning up the macro mess. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-08xwayland/glamor/gbm: Only use modifier gbm API if explicitJonas Ådahl1-2/+4
If we're using implicit modifiers, we'll pass NULL and zero modifiers. Lets just use the legacy API directly instead. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-03xwayland: use drmDevice to compare DRM devicesSimon Ser1-7/+6
The linux_dmabuf_v1 protocol doesn't guarantee any DRM node type: the compositor may send a primary node or a render node. Use drmDevice so that device comparisons are node-type-insensitive. Signed-off-by: Simon Ser <contact@emersion.fr> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1447
2023-03-03xwayland: don't fall back to wl_drm with explicit modifierSimon Ser1-1/+1
It's incorrect to strip an explicit modifier. Daniels' docs [1] states: > when importing a buffer, the user may supply `DRM_FORMAT_MOD_INVALID` as the > buffer modifier (or not supply a modifier) to indicate that the modifier is > unknown for whatever reason; this is only acceptable when the buffer has > not been allocated with an explicit modifier [1]: https://lore.kernel.org/dri-devel/20210905122742.86029-1-daniels@collabora.com/ Signed-off-by: Simon Ser <contact@emersion.fr>
2023-03-03xwayland: fix error path when modifier is not supportedSimon Ser1-2/+3
When the modifier is not supported by the compositor, and the DMA-BUF contains multiple planes, xwl_pixmap->buffer is NULL. Avoid crashing when calling wl_buffer_add_listener(). Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13xwayland: fix GBM on driver without explicit modifiersSimon Ser1-3/+2
Some drivers (e.g. AMD GFX8-) don't support explicit format modifiers. On these drivers, gbm_bo_create_with_modifiers() will fail. This results in "Error getting buffer" in the logs later on with all X11 windows staying invisible. Fallback to the modifier-less API gbm_bo_create() in that case. Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-20xwayland: Add get_drawable_modifiers implementationAustin Shafer1-1/+1
This reads from the format list, which is not yet filled in. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-01-20xwayland: Add get_main_device helper to GBMAustin Shafer1-0/+17
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-01-19glamor: Don't initialize on softpipeIvan A. Melnikov1-0/+4
There are systems where softpipe is the default renderer, e.g. when llvmpipe is not is not available. Using glamor on such systems is never a good idea. This mirrors what commit 0a9415cf793babed1f28c61f8047d51de04f1528 did for llvmpipe. Closes: #1417 Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
2022-11-30glamor: Only check for llvmpipe rendererCorentin Noël1-1/+1
The virgl driver exposes the name of the host renderer which might be llvmpipe. In this case we still need glamor to be initialized. Only check if the renderer starts with llvmpipe (which is what llvmpipe exposes). Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2022-10-28xwayland: properly get FDs from multiplanar GBM BOsLucas Stach1-9/+57
Multiplanar GBM buffers can point to different objects from each plane. Use the _for_plane API when possible to retrieve the correct prime FD for each plane. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Simon Ser <contact@emersion.fr> Tested-by: Guido Günther <agx@sigxcpu.org>
2022-10-28xwayland: handle fd export failure in glamor_egl_fds_from_pixmapLucas Stach1-0/+7
Check the fd for validity before giving a success return code. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Simon Ser <contact@emersion.fr> Tested-by: Guido Günther <agx@sigxcpu.org>
2021-12-01xwayland/glamor: Change errors to verbose messagesOlivier Fourdan1-1/+1
On a normal startup sequence, the Xwayland glamor backend would log an error whenever a required Wayland protocol is missing. Those are not really errors though, more informational messages along the glamor backend selection process. Demote those errors to verbose messages to reduce the verbosity of Xwayland at startup by default. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>