kernel+libc: Add framebuffer ioctls
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-04-21 18:25:53 +02:00
parent 841fc25137
commit 4f6e020196
Signed by: apio
GPG Key ID: B8A7D06E42258954
3 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#include "fs/devices/FramebufferDevice.h" #include "fs/devices/FramebufferDevice.h"
#include "video/Framebuffer.h" #include "video/Framebuffer.h"
#include <bits/ioctl-defs.h>
#include <luna/CString.h> #include <luna/CString.h>
Result<SharedPtr<Device>> FramebufferDevice::create() Result<SharedPtr<Device>> FramebufferDevice::create()
@ -31,7 +32,13 @@ bool FramebufferDevice::blocking() const
return false; return false;
} }
Result<u64> FramebufferDevice::ioctl(int, void*) Result<u64> FramebufferDevice::ioctl(int request, void*)
{ {
return err(EINVAL); switch (request)
{
case FB_GET_WIDTH: return (u64)Framebuffer::width();
case FB_GET_HEIGHT: return (u64)Framebuffer::height();
case FB_GET_SCANLINE: return (u64)Framebuffer::scanline();
default: return err(EINVAL);
}
} }

View File

@ -0,0 +1,11 @@
/* bits/ioctl-defs.h: IO device control requests. */
#ifndef _BITS_IOCTL_DEFS_H
#define _BITS_IOCTL_DEFS_H
/* Framebuffer requests. */
#define FB_GET_WIDTH 0
#define FB_GET_HEIGHT 1
#define FB_GET_SCANLINE 2
#endif

View File

@ -3,6 +3,8 @@
#ifndef _SYS_IOCTL_H #ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H #define _SYS_IOCTL_H
#include <bits/ioctl-defs.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {