pan/kmod: Explicitly set the user MMIO offset when the KMD supports it

FEX is a 64-bit process potentially running x86 (32-bit) binary, in
which case the automatic user MMIO offset detection doesn't work, so
let's explicitly set the user MMIO offset when we can.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34573>
This commit is contained in:
Boris Brezillon 2025-04-14 19:03:34 +02:00 committed by Marge Bot
parent 465cda8237
commit 25536c7d4d

View file

@ -153,6 +153,18 @@ panthor_kmod_dev_create(int fd, uint32_t flags, drmVersionPtr version,
}
/* Map the LATEST_FLUSH_ID register at device creation time. */
if (version->version_major > 1 || version->version_minor >= 5) {
struct drm_panthor_set_user_mmio_offset user_mmio_offset = {
.offset = DRM_PANTHOR_USER_MMIO_OFFSET,
};
ret = drmIoctl(fd, DRM_IOCTL_PANTHOR_SET_USER_MMIO_OFFSET, &user_mmio_offset);
if (ret) {
mesa_loge("DRM_IOCTL_PANTHOR_SET_USER_MMIO_OFFSET, failed (err=%d)", errno);
goto err_free_dev;
}
}
panthor_dev->flush_id = os_mmap(0, getpagesize(), PROT_READ, MAP_SHARED, fd,
DRM_PANTHOR_USER_FLUSH_ID_MMIO_OFFSET);
if (panthor_dev->flush_id == MAP_FAILED) {