mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel+Userland: Remove GRAPHICS_IOCTL_GET_HEAD_EDID ioctl
We are able to read the EDID from SysFS, therefore there's no need to provide this ioctl on a DisplayConnector anymore. Also, now we can simply require the video pledge to be set before doing any ioctl on a DisplayConnector.
This commit is contained in:
parent
ecf015e6ee
commit
412a5999d0
Notes:
sideshowbarker
2024-07-17 08:47:26 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/412a5999d0 Pull-request: https://github.com/SerenityOS/serenity/pull/14597
2 changed files with 1 additions and 26 deletions
|
@ -233,11 +233,7 @@ ErrorOr<ByteBuffer> DisplayConnector::get_edid() const
|
|||
|
||||
ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg)
|
||||
{
|
||||
if (request != GRAPHICS_IOCTL_GET_HEAD_EDID) {
|
||||
// Allow anyone to query the EDID. Eventually we'll publish the current EDID on /sys
|
||||
// so it doesn't really make sense to require the video pledge to query it.
|
||||
TRY(Process::current().require_promise(Pledge::video));
|
||||
}
|
||||
TRY(Process::current().require_promise(Pledge::video));
|
||||
|
||||
// TODO: We really should have ioctls for destroying resources as well
|
||||
switch (request) {
|
||||
|
@ -272,25 +268,6 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
|
|||
}
|
||||
return copy_to_user(user_head_mode_setting, &head_mode_setting);
|
||||
}
|
||||
case GRAPHICS_IOCTL_GET_HEAD_EDID: {
|
||||
auto user_head_edid = static_ptr_cast<GraphicsHeadEDID*>(arg);
|
||||
GraphicsHeadEDID head_edid {};
|
||||
TRY(copy_from_user(&head_edid, user_head_edid));
|
||||
|
||||
auto edid_bytes = TRY(get_edid());
|
||||
if (head_edid.bytes != nullptr) {
|
||||
// Only return the EDID if a buffer was provided. Either way,
|
||||
// we'll write back the bytes_size with the actual size
|
||||
if (head_edid.bytes_size < edid_bytes.size()) {
|
||||
head_edid.bytes_size = edid_bytes.size();
|
||||
TRY(copy_to_user(user_head_edid, &head_edid));
|
||||
return Error::from_errno(EOVERFLOW);
|
||||
}
|
||||
TRY(copy_to_user(head_edid.bytes, (void const*)edid_bytes.data(), edid_bytes.size()));
|
||||
}
|
||||
head_edid.bytes_size = edid_bytes.size();
|
||||
return copy_to_user(user_head_edid, &head_edid);
|
||||
}
|
||||
case GRAPHICS_IOCTL_SET_HEAD_MODE_SETTING: {
|
||||
auto user_mode_setting = static_ptr_cast<GraphicsHeadModeSetting const*>(arg);
|
||||
auto head_mode_setting = TRY(copy_typed_from_user(user_mode_setting));
|
||||
|
|
|
@ -94,7 +94,6 @@ enum IOCtlNumber {
|
|||
TIOCSWINSZ,
|
||||
TIOCGPTN,
|
||||
GRAPHICS_IOCTL_GET_PROPERTIES,
|
||||
GRAPHICS_IOCTL_GET_HEAD_EDID,
|
||||
GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER,
|
||||
GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER,
|
||||
GRAPHICS_IOCTL_FLUSH_HEAD_BUFFERS,
|
||||
|
@ -154,7 +153,6 @@ enum IOCtlNumber {
|
|||
#define TIOCSWINSZ TIOCSWINSZ
|
||||
#define TIOCGPTN TIOCGPTN
|
||||
#define GRAPHICS_IOCTL_GET_PROPERTIES GRAPHICS_IOCTL_GET_PROPERTIES
|
||||
#define GRAPHICS_IOCTL_GET_HEAD_EDID GRAPHICS_IOCTL_GET_HEAD_EDID
|
||||
#define GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER
|
||||
#define GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER
|
||||
#define GRAPHICS_IOCTL_FLUSH_HEAD_BUFFERS GRAPHICS_IOCTL_FLUSH_HEAD_BUFFERS
|
||||
|
|
Loading…
Reference in a new issue