summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-09-22 17:13:12 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-10-27 07:57:44 +0300
commit8554952690e469cc9481ea7bc8d81039a4db55a1 (patch)
tree4fe30bd4af508031d8e61c9a0efdaa9ea9e22219 /Tests
parent78e724a899be13b54a08e24184283d2d18ec76bf (diff)
downloadserenity-8554952690e469cc9481ea7bc8d81039a4db55a1.zip
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.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp b/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp
index 43df0bb34a..3dc0f566d2 100644
--- a/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp
+++ b/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp
@@ -25,18 +25,20 @@ int main()
size_t pitch = width * 4;
size_t framebuffer_size_in_bytes = pitch * height * 2;
- FBResolution original_resolution;
- if (ioctl(fd, FB_IOCTL_GET_RESOLUTION, &original_resolution) < 0) {
+ FBHeadProperties original_properties;
+ original_properties.head_index = 0;
+ if (ioctl(fd, FB_IOCTL_GET_HEAD_PROPERTIES, &original_properties) < 0) {
perror("ioctl");
return 1;
}
- FBResolution resolution;
+ FBHeadResolution resolution;
+ resolution.head_index = 0;
resolution.width = width;
resolution.height = height;
resolution.pitch = pitch;
- if (ioctl(fd, FB_IOCTL_SET_RESOLUTION, &resolution) < 0) {
+ if (ioctl(fd, FB_IOCTL_SET_HEAD_RESOLUTION, &resolution) < 0) {
perror("ioctl");
return 1;
}
@@ -87,7 +89,12 @@ int main()
process->uid = 0;
}
- if (ioctl(fd, FB_IOCTL_SET_RESOLUTION, &original_resolution) < 0) {
+ FBHeadResolution original_resolution;
+ original_resolution.head_index = 0;
+ original_resolution.width = original_properties.width;
+ original_resolution.height = original_properties.height;
+ original_resolution.pitch = original_properties.pitch;
+ if (ioctl(fd, FB_IOCTL_SET_HEAD_RESOLUTION, &original_resolution) < 0) {
perror("ioctl");
return 1;
}