From 8554952690e469cc9481ea7bc8d81039a4db55a1 Mon Sep 17 00:00:00 2001 From: Liav A Date: Wed, 22 Sep 2021 17:13:12 +0300 Subject: Kernel + WindowServer: Re-define the interface to framebuffer devices We create a base class called GenericFramebufferDevice, which defines all the virtual functions that must be implemented by a FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other FramebufferDevice implementations inherit from it. The most important consequence of rearranging the classes is that we now have one IOCTL method, so all drivers should be committed to not override the IOCTL method or make their own IOCTLs of FramebufferDevice. All graphical IOCTLs are known to all FramebufferDevices, and it's up to the specific implementation whether to support them or discard them (so we require extensive usage of KResult and KResultOr, together with virtual characteristic functions). As a result, the interface is much cleaner and understandable to read. --- Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Userland/DevTools') diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index 4fd60b2f2c..a3f65e10c0 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -1155,20 +1155,20 @@ int Emulator::virt$ioctl([[maybe_unused]] int fd, unsigned request, [[maybe_unus if (request == TIOCNOTTY || request == TIOCSCTTY) { return syscall(SC_ioctl, fd, request, 0); } - if (request == FB_IOCTL_GET_SIZE_IN_BYTES) { + if (request == FB_IOCTL_GET_PROPERTIES) { size_t size = 0; auto rc = syscall(SC_ioctl, fd, request, &size); mmu().copy_to_vm(arg, &size, sizeof(size)); return rc; } - if (request == FB_IOCTL_SET_RESOLUTION) { - FBResolution user_resolution; + if (request == FB_IOCTL_SET_HEAD_RESOLUTION) { + FBHeadResolution user_resolution; mmu().copy_from_vm(&user_resolution, arg, sizeof(user_resolution)); auto rc = syscall(SC_ioctl, fd, request, &user_resolution); mmu().copy_to_vm(arg, &user_resolution, sizeof(user_resolution)); return rc; } - if (request == FB_IOCTL_SET_BUFFER) { + if (request == FB_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER) { return syscall(SC_ioctl, fd, request, arg); } reportln("Unsupported ioctl: {}", request); -- cgit v1.2.3