kms-dri-sw: Report linear modifiers in get_handle()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Dumb-buffers or imported dmabufs are always linear - otherwise they
couldn't be used by llvmpipe/lavapipe. So far, however, they have been
implicitly reported as DRM_FORMAT_MOD_INVALID when queried through e.g.
`gbm_bo_get_modifier()`.

That is a problem for lavapipe, which requires explicit modifiers. Thus
report modifiers as linear, fixing clients like Westons Vulkan backend
on CI (vkms+lavapipe).

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37374>
This commit is contained in:
Robert Mader 2025-09-12 17:08:15 +02:00 committed by Marge Bot
parent b0528bcab1
commit 45dc8b4d97

View file

@ -42,6 +42,7 @@
#include <fcntl.h>
#include <xf86drm.h>
#include "drm-uapi/drm_fourcc.h"
#include "util/compiler.h"
#include "util/format/u_formats.h"
#include "pipe/p_state.h"
@ -514,12 +515,14 @@ kms_sw_displaytarget_get_handle(struct sw_winsys *winsys,
whandle->handle = kms_sw_dt->handle;
whandle->stride = plane->stride;
whandle->offset = plane->offset;
whandle->modifier = DRM_FORMAT_MOD_LINEAR;
return true;
case WINSYS_HANDLE_TYPE_FD:
if (!drmPrimeHandleToFD(kms_sw->fd, kms_sw_dt->handle,
DRM_CLOEXEC | DRM_RDWR, (int*)&whandle->handle)) {
whandle->stride = plane->stride;
whandle->offset = plane->offset;
whandle->modifier = DRM_FORMAT_MOD_LINEAR;
return true;
}
FALLTHROUGH;