mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 22:00:16 +02:00
Linux: Implements virtio ioctls for 32-bit
This makes running Steam under parallels more sane
This commit is contained in:
1 parent
7e9201cf0d
commit
33151e16a2
3 files changed
+39
No files matched your search
@@ -16,6 +16,7 @@
|
||||
#include <drm/nouveau_drm.h>
|
||||
#include <drm/vc4_drm.h>
|
||||
#include <drm/v3d_drm.h>
|
||||
#include <drm/virtgpu_drm.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define CPYT(x) val.x = x
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_MAP)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_EXECBUFFER)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_GETPARAM)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_RESOURCE_CREATE)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_RESOURCE_INFO)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_WAIT)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_GET_CAPS)
|
||||
@@ -409,6 +409,31 @@ namespace FEX::HLE::x32 {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
uint32_t Virtio_Handler(int fd, uint32_t cmd, uint32_t args) {
|
||||
switch (_IOC_NR(cmd)) {
|
||||
#define _BASIC_META(x) case _IOC_NR(x):
|
||||
#define _BASIC_META_VAR(x, args...) case _IOC_NR(x):
|
||||
#define _CUSTOM_META(name, ioctl_num)
|
||||
#define _CUSTOM_META_OFFSET(name, ioctl_num, offset)
|
||||
// DRM
|
||||
#include "Tests/LinuxSyscalls/x32/Ioctl/virtio_drm.inl"
|
||||
{
|
||||
uint64_t Result = ::ioctl(fd, cmd, args);
|
||||
SYSCALL_ERRNO();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UnhandledIoctl("Virtio", fd, cmd, args);
|
||||
return -EPERM;
|
||||
break;
|
||||
}
|
||||
#undef _BASIC_META
|
||||
#undef _BASIC_META_VAR
|
||||
#undef _CUSTOM_META
|
||||
#undef _CUSTOM_META_OFFSET
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
void AssignDeviceTypeToFD(int fd, drm_version const &Version) {
|
||||
if (Version.name) {
|
||||
if (strcmp(Version.name, "amdgpu") == 0) {
|
||||
@@ -435,6 +460,9 @@ namespace FEX::HLE::x32 {
|
||||
else if (strcmp(Version.name, "v3d") == 0) {
|
||||
FDToHandler.SetFDHandler(fd, V3D_Handler);
|
||||
}
|
||||
else if (strcmp(Version.name, "virtio_gpu") == 0) {
|
||||
FDToHandler.SetFDHandler(fd, Virtio_Handler);
|
||||
}
|
||||
else {
|
||||
LogMan::Msg::E("Unknown DRM device: '%s'", Version.name);
|
||||
}
|
||||
@@ -589,6 +617,7 @@ namespace FEX::HLE::x32 {
|
||||
#include "Tests/LinuxSyscalls/x32/Ioctl/nouveau_drm.inl"
|
||||
#include "Tests/LinuxSyscalls/x32/Ioctl/vc4_drm.inl"
|
||||
#include "Tests/LinuxSyscalls/x32/Ioctl/v3d_drm.inl"
|
||||
#include "Tests/LinuxSyscalls/x32/Ioctl/virtio_drm.inl"
|
||||
|
||||
#undef _BASIC_META
|
||||
#undef _BASIC_META_VAR
|
||||
|
||||
Reference in new issue
Block a user