mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 04:50:11 +01:00
asahi: Set PIPE_BIND_SCANOUT in agx_resource_from_handle().
Commit534a04d557optimized agx_resource_from_handle() to lazily defer assignment of a kms-ro renderonly_scanout object to an imported resource until its kms winsys handle is actually queried by a caller via agx_resource_get_handle(), to avoid unnecessary import into the DCP display controller. Only resources with bind flag PIPE_BIND_SCANOUT will get a renderonly_scanout object assigned during such queries. Problem: This prevents Mesa GBM's gbm_bo_import() function from properly importing dmabufs for direct scanout use by some Wayland compositors, e.g., GNOME mutter. gbm_bo_import() of dmabuf fd's (GBM_BO_IMPORT_FD / GBM_BO_IMPORT_FD_MODIFIER), even with GBM_BO_USE_SCANOUT flag, will not mark an imported bo with the PIPE_BIND_SCANOUT bind flag before internally assigning its KMS winsys handle via screen->resource_get_handle() -> agx_resource_get_handle(), causing silent failure of that query. Therefore gbm_bo_import() seems to return a successfully created gbm_bo with all proper properties, but gbm_bo_get_handle() and gbm_bo_get_handle_for_plane() will return invalid handles. These invalid handles cause drmAddFbXXX ioctl calls to fail, and therefore failure of direct scanout of wl_buffers. Setting PIPE_BIND_SCANOUT for a resource in agx_resource_from_handle() may retain the optimization and makes gbm_bo_get_handle[_for_plane]() work. This fixes direct scanout of fullscreen wl_surface / wl_buffers under at least GNOME mutter 48. Fixes:534a04d557("asahi: Flip kmsro around to allocate on the GPU") Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37538>
This commit is contained in:
parent
3c01205e32
commit
fc44e708d7
1 changed files with 5 additions and 1 deletions
|
|
@ -191,7 +191,11 @@ agx_resource_from_handle(struct pipe_screen *pscreen,
|
|||
pipe_reference_init(&prsc->reference, 1);
|
||||
prsc->screen = pscreen;
|
||||
|
||||
prsc->bind |= PIPE_BIND_SHARED;
|
||||
/* Set PIPE_BIND_SCANOUT for lazy on-demand creation of renderonly
|
||||
* scanout resource if agx_resource_get_handle is called for
|
||||
* WINSYS_HANDLE_TYPE_KMS on a kms-ro screen.
|
||||
*/
|
||||
prsc->bind |= PIPE_BIND_SHARED | PIPE_BIND_SCANOUT;
|
||||
|
||||
rsc->bo = agx_bo_import(dev, whandle->handle);
|
||||
/* Sometimes an import can fail e.g. on an invalid buffer fd, out of
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue