summaryrefslogtreecommitdiff
path: root/hw/xwayland/xwayland-glamor.c
AgeCommit message (Collapse)AuthorFilesLines
7 daysRevert "xwayland/glamor: Avoid implicit redirection with depth 32 parent ↵Olivier Fourdan1-110/+0
windows" There are a number of regressions and hard to reproduce issues that find their roots in this change, so revert it until those can be ironed out some more. This reverts commit 4bb1f976d5397949be06510524bede5ae3bbfe0a. Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1655 Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1656 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1457>
8 daysxwayland/present: Redirect surface window as needed for page flipsMichel Dänzer1-2/+7
It's needed when the surface window is a depth 24 descendant of a depth 32 toplevel window. xwl_source_validate ensures the toplevel window pixmap has valid contents when a client reads from it, or when the window hierarchy / geometry changes. It's never called in the normal fullscreen application case, so there's no GPU copy overhead with that. v2: * Don't try to redirect a depth 32 descendant of different-depth ancestors, the alpha channel wouldn't be handled correctly. (Olivier Fourdan) Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
9 daysxwayland: add support for wp_linux_drm_syncobj_v1Erik Kurzinger1-0/+24
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>
9 daysxwayland: support DRI3 1.4 and Present 1.4Erik Kurzinger1-0/+24
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-03-18xwayland/glamor: Drop xwl_glamor_needs_n_buffering()Olivier Fourdan1-6/+0
This function always return TRUE now that EGLSTream is gone, so we can remove 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 xwl_glamor_needs_buffer_flush()Olivier Fourdan1-9/+0
GLAMOR needs that, and the function returns TRUE unless GLAMOR is not used. Drop the function xwl_glamor_needs_buffer_flush() and call glamor_block_handler() when glamor is used. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Drop init_backend() and select_backend()Olivier Fourdan1-31/+5
Now that we have only one backend, there is no need to initialize or select between different backends. Drop the corresponding functions. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Remove the backend pointersOlivier Fourdan1-5/+3
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_has_wl_interfaces() privateOlivier Fourdan1-1/+1
It's not used outside of Xwayland GLAMOR code itself, no need to keep it public. 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 allow_commit() hookOlivier Fourdan1-11/+0
That was used only by the EGLStream backend, we can remove 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 post_damage() hookOlivier Fourdan1-13/+0
That was used only with the EGLStream backend, we can remove it. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-18xwayland/glamor: Remove the flag "is_available"Olivier Fourdan1-4/+2
Now that we have only one GBM backend, either it is available and usable, or we cannot use GLAMOR. Therefore we can drop the flag "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-8/+2
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-14/+0
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 check_flip() hookOlivier Fourdan1-4/+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-11/+0
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-1/+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-1/+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-1/+7
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-8/+5
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-18xwayland/glamor: Add a GLAMOR GBM headerOlivier Fourdan1-0/+1
That will be used between the generic Xwayland GLAMOR functions and the GBM implementation. Move the definition of xwl_glamor_init_gbm() to that new header rather than in the generic Xwayland GLAMOR header. This is preparation work to eventually replace the xwl_egl_backend now that we have only one 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 EGLStream backendOlivier Fourdan1-38/+5
Now that the NVIDIA proprietary driver has grown support for GBM, the EGLStream backend for NVIDIA GPUs is now superseded by the standard GBM backend in Xwayland. This code path is therefore not used and hardly ever tested. Remove support for EGLStream in Xwayland. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1386>
2024-03-14xwayland: Move dmabuf code to its own source fileOlivier Fourdan1-729/+1
The dmabuf support code is scattered across different source files, making it hard to follow and bloating unrelated sources. Move the dmabuf related source code to its own source files. This is just a cleanup aimed at helping with code readability, no functional change intended. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1111>
2024-03-06xwayland: Rename xwl_window_recycle_pixmap to xwl_window_realloc_pixmapMichel Dänzer1-1/+1
It doesn't recycle anything but allocates a new pixmap from scratch. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1314>
2024-03-06xwayland: Do not plumb damage region through function parametersMichel Dänzer1-1/+2
Each function can get the damage region from the xwl_window instead. Add xwl_window_get_damage_region helper for this. v2: * Use xwl_window_get_damage_region in xwl_window_attach_buffer as well (Olivier Fourdan) Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1314>
2024-03-03composite: move out unexported CompositeIsImplicitRedirectException()Enrico Weigelt, metux IT consult1-0/+1
Move out non-exported stuff from public module header compositeext.h, into compositeext_priv.h Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1284>
2024-02-02xwayland: Use correct pointer types on i386Florian Weimer1-3/+3
And other 32-bit architectures, where uint32_t and CARD32 are not the same type. Otherwise the build will fail with GCC 14 with errors like: ../hw/xwayland/xwayland-glamor.c: In function ‘xwl_glamor_get_formats’: ../hw/xwayland/xwayland-glamor.c:291:43: error: passing argument 3 of ‘xwl_get_formats_for_device’ from incompatible pointer type [-Wincompatible-pointer-types] 291 | num_formats, formats); | ^~~~~~~~~~~ | | | CARD32 * {aka long unsigned int *} ../hw/xwayland/xwayland-glamor.c:238:38: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘CARD32 *’ {aka ‘long unsigned int *’} 238 | uint32_t *num_formats, uint32_t **formats) | ~~~~~~~~~~^~~~~~~~~~~ ../hw/xwayland/xwayland-glamor.c:291:56: error: passing argument 4 of ‘xwl_get_formats_for_device’ from incompatible pointer type [-Wincompatible-pointer-types] 291 | num_formats, formats); | ^~~~~~~ | | | CARD32 ** {aka long unsigned int **} ../hw/xwayland/xwayland-glamor.c:238:62: note: expected ‘uint32_t **’ {aka ‘unsigned int **’} but argument is of type ‘CARD32 **’ {aka ‘long unsigned int **’} 238 | uint32_t *num_formats, uint32_t **formats) | ~~~~~~~~~~~^~~~~~~ ../hw/xwayland/xwayland-glamor.c:295:28: error: passing argument 3 of ‘xwl_get_formats’ from incompatible pointer type [-Wincompatible-pointer-types] 295 | num_formats, formats); | ^~~~~~~~~~~ | | | CARD32 * {aka long unsigned int *} ../hw/xwayland/xwayland-glamor.c:217:26: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘CARD32 *’ {aka ‘long unsigned int *’} 217 | uint32_t *num_formats, uint32_t **formats) | ~~~~~~~~~~^~~~~~~~~~~ ../hw/xwayland/xwayland-glamor.c:295:41: error: passing argument 4 of ‘xwl_get_formats’ from incompatible pointer type [-Wincompatible-pointer-types] 295 | num_formats, formats); | ^~~~~~~ | | | CARD32 ** {aka long unsigned int **} ../hw/xwayland/xwayland-glamor.c:217:50: note: expected ‘uint32_t **’ {aka ‘unsigned int **’} but argument is of type ‘CARD32 **’ {aka ‘long unsigned int **’} 217 | uint32_t *num_formats, uint32_t **formats) | ~~~~~~~~~~~^~~~~~~
2024-01-22xwayland: Enable Present extension support also without glamorMichel Dänzer1-3/+0
This allows e.g. xfwm4 --vblank=xpresent to hit the page flip path instead of copies. In the future, Mesa might also use the Present extension with software rendering.
2024-01-10xwayland: Use window pixmap as a window bufferMichel Dänzer1-2/+3
Assuming the same number of window buffers, this results in one less pixmap per toplevel window, saving pixmap storage. v2: * Preserve xwl_window_buffer_get_available behaviour (Olivier Fourdan) v3: * Leave RegionEmpty call where it was in xwl_window_buffers_get_pixmap, so it takes effect for a newly allocated struct xwl_window_buffer. * Consolidate xwl_window_buffer->pixmap assignment in the same place.
2024-01-10xwayland: Drop xwl_window_buffers_recycleMichel Dänzer1-2/+2
Use xwl_window_buffers_dispose instead. The pixmaps will need to be re-created anyway, so keeping around the xwl_window_buffers doesn't buy much. And dropping this makes the next commit simpler. Also fold xwl_window_buffer_destroy_pixmap into its only remaining caller, xwl_window_buffer_maybe_dispose. v2: (Olivier Fourdan) * Fix up indentation in xwl_window_set_window_pixmap * Leave xwl_window_buffer_destroy_pixmap helper
2023-11-07glamor: Lift the GLX EGL backend from XwaylandAdam Jackson1-1/+1
This code is almost entirely ddx-agnostic already, and I'd like to use it from the other EGL glamor consumers. Which, right now that's just Xorg, but soon it'll be Xephyr too.
2023-11-07glamor: add glvnd_vendor privateKonstantin Pugin1-0/+1
This commit adds an ability to store a glvnd vendor in Glamor structures, which can be used for initialize some vendor-based values without hooking into DDX internals. Also this adds setting this value into Xorg and Xwayland Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Emma Anholt <emma@anholt.net>
2023-07-20xwayland/glamor: Avoid implicit redirection with depth 32 parent windowsMichel Dänzer1-0/+109
glamor ensures that a depth 32 pixmap backing a depth 24 window contains fully opaque alpha channel values for the window's pixels, so we can allow this without implicit redirection, saving pixmap storage and intermediate copies. Second attempt, after fixing a few regressions from the first attempt.
2023-07-19Revert "xwayland/glamor: Avoid implicit redirection with depth 32 parent ↵Olivier Fourdan1-109/+0
windows" This commit is meant as an optimization, but has been identified as the cause of multiple regressions reported in issues xorg/xserver#1564 and xorg/xserver#1565. Reverting that commit alone fixes the aforementioned issues, the rest of the commits from xorg/xserver!1131 seem harmless and do not need reverting. This reverts commit d6c5999e943e43e800f976a48e774fbef77f5ef2. See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1564 See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1565
2023-07-18xwayland/glamor: Avoid implicit redirection with depth 32 parent windowsMichel Dänzer1-0/+109
glamor ensures that a depth 32 pixmap backing a depth 24 window contains fully opaque alpha channel values for the window's pixels, so we can allow this without implicit redirection, saving pixmap storage and intermediate copies.
2023-07-18xwayland/glamor: Require equal pixmap depths in xwl_glamor_check_flipMichel Dänzer1-2/+7
This will be needed with the next commit: If a child window completely obscures a toplevel ancestor of different depth, the child window can use page flipping only if the depth of the presented pixmap matches that of the window's backing pixmap, or the former may contain pixel values which are not suitable for the toplevel window's depth.
2023-04-12xwayland: Add xwl_glamor_get_drawable_modifiers_and_scanout()Olivier Fourdan1-6/+27
Add a new API similar to xwl_glamor_get_drawable_modifiers() but also returning whether the format and modifiers are from a tranche which supports scanout. This is preparation work for adding scanout support with gbm_bo_create_with_modifiers2() when supported. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Recycle buffers when dmabuf feedback changesOlivier Fourdan1-0/+6
Whenever the linux-dmabuf v4 feedback changes, we need to recreate the existing buffers so they use the current linux-dmabuf v4 feedback. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Add a direct hook to create pixmaps with glamorOlivier Fourdan1-0/+14
With linux dmabuf v4 support, for direct scanout support, we need more context that just what CreatePixmap() provides, as we need the actual drawable to invoke xwl_glamor_get_drawable_modifiers(). Add a specific hook in Xwayland's glamor implementation that we can use for that purpose. This is preparation work for the direct scanout fixes. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Check for implicit scanout availabilityOlivier Fourdan1-0/+8
With implicit modifiers, DRM_FORMAT_MOD_INVALID is an allowed modifier, to indicate that the server can support the format. When looking for a scanout capable tranche with implicit modifiers, we ought to check for the availability of a tranche with an invalid modifier for the given format. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Check for scanout support in tranchesOlivier Fourdan1-3/+7
The helper function xwl_feedback_is_modifier_supported() walks all the formats of a feeedback tranche and checks for format/modifier support availability. Add scanout support to that so that a caller can easily restrict the tranches to those which support scanout. This is preparation work for the implicit scanout support, no functional change. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-04-03xwayland: Use a dedicated feedback callback for windowsOlivier Fourdan1-18/+96
Separate the callbacks for the default's feedback from the one for regular windows. This is preparation work to recreate the window buffer of feedback updates, no functional change. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-03-03xwayland: use drmDevice to compare DRM devicesSimon Ser1-10/+24
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-02-13xwayland: Spell Xwayland consistently in error messagesMichel Dänzer1-2/+2
2023-01-20xwayland: Send PresentCompleteModeSuboptimalCopy if dmabuf feedback was resentAustin Shafer1-0/+1
If the dmabuf protocol's feedback object gave us a new list of modifiers, send PresentCompleteModeSuboptimalCopy to the client to inform them that they need to call GetSupportedModifiers. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-01-20xwayland: Add proper support for telling if a format/mod is supportedAustin Shafer1-6/+52
This adds to xwl_glamor_is_modifier_supported, where if feedback is in use we will check that the format/mod is allowed in any device advertised by the compositor. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Move dev_formats declaration to where it's used in xwl_feedback_is_modifier_supported * Add curly braces around multi-line statement in xwl_glamor_is_modifier_supported ]
2023-01-20xwayland: Return default feedback in xwl_screenAustin Shafer1-9/+65
If protocol version 4 of linux_dmabuf is in use, then the compositor may not return anything with the modifiers event. We instead will return the formats/mods reported for the main device. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Move main_dev declaration to where it's used in xwl_glamor_get_formats * Add empty line between variable declaration and comment ]
2023-01-20xwayland: Make helper for returning a list of formatsAustin Shafer1-13/+23
This adds xwl_get_formats Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Remove unused variable i from xwl_glamor_get_formats ]
2023-01-20xwayland: Add get_drawable_modifiers implementationAustin Shafer1-12/+97
This reads from the format list, which is not yet filled in. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2023-01-20xwayland: Implement linux_dmabuf_feedback event handlersAustin Shafer1-1/+216
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Sort protocol #includes lexically. * memcpy to &xwl_feedback->main_dev directly in xwl_dmabuf_feedback_main_device. ]