Everywhere: Rename FB prefix structure names => Graphics

This commit is contained in:
Liav A 2022-04-30 14:54:46 +03:00 committed by Andreas Kling
parent d2e93ec50a
commit 10adc27eda
Notes: sideshowbarker 2024-07-17 11:16:47 +09:00
7 changed files with 40 additions and 40 deletions

View file

@ -13,7 +13,7 @@
__BEGIN_DECLS __BEGIN_DECLS
ALWAYS_INLINE int fb_get_properties(int fd, FBProperties* info) ALWAYS_INLINE int fb_get_properties(int fd, GraphicsConnectorProperties* info)
{ {
return ioctl(fd, GRAPHICS_IOCTL_GET_PROPERTIES, info); return ioctl(fd, GRAPHICS_IOCTL_GET_PROPERTIES, info);
} }
@ -44,22 +44,22 @@ ALWAYS_INLINE int fb_set_resolution(int fd, FBHeadResolution* info)
return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_RESOLUTION, info); return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_RESOLUTION, info);
} }
ALWAYS_INLINE int fb_get_head_edid(int fd, FBHeadEDID* info) ALWAYS_INLINE int fb_get_head_edid(int fd, GraphicsHeadEDID* info)
{ {
return ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_EDID, info); return ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_EDID, info);
} }
ALWAYS_INLINE int fb_get_head_vertical_offset_buffer(int fd, FBHeadVerticalOffset* vertical_offset) ALWAYS_INLINE int fb_get_head_vertical_offset_buffer(int fd, GraphicsHeadVerticalOffset* vertical_offset)
{ {
return ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER, vertical_offset); return ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER, vertical_offset);
} }
ALWAYS_INLINE int fb_set_head_vertical_offset_buffer(int fd, FBHeadVerticalOffset* vertical_offset) ALWAYS_INLINE int fb_set_head_vertical_offset_buffer(int fd, GraphicsHeadVerticalOffset* vertical_offset)
{ {
return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER, vertical_offset); return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER, vertical_offset);
} }
ALWAYS_INLINE int fb_set_head_mode_setting(int fd, FBHeadModeSetting* mode_setting) ALWAYS_INLINE int fb_set_head_mode_setting(int fd, GraphicsHeadModeSetting* mode_setting)
{ {
return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_MODE_SETTING, mode_setting); return ioctl(fd, GRAPHICS_IOCTL_SET_HEAD_MODE_SETTING, mode_setting);
} }
@ -69,9 +69,9 @@ ALWAYS_INLINE int fb_set_safe_head_mode_setting(int fd)
return ioctl(fd, GRAPHICS_IOCTL_SET_SAFE_HEAD_MODE_SETTING, nullptr); return ioctl(fd, GRAPHICS_IOCTL_SET_SAFE_HEAD_MODE_SETTING, nullptr);
} }
ALWAYS_INLINE int fb_get_head_mode_setting(int fd, FBHeadModeSetting* mode_setting) ALWAYS_INLINE int fb_get_head_mode_setting(int fd, GraphicsHeadModeSetting* mode_setting)
{ {
FBHeadModeSetting head_mode_setting; GraphicsHeadModeSetting head_mode_setting;
if (auto rc = ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_MODE_SETTING, &head_mode_setting); rc < 0) if (auto rc = ioctl(fd, GRAPHICS_IOCTL_GET_HEAD_MODE_SETTING, &head_mode_setting); rc < 0)
return rc; return rc;
mode_setting->horizontal_stride = head_mode_setting.horizontal_stride; mode_setting->horizontal_stride = head_mode_setting.horizontal_stride;

View file

@ -158,8 +158,8 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
// TODO: We really should have ioctls for destroying resources as well // TODO: We really should have ioctls for destroying resources as well
switch (request) { switch (request) {
case GRAPHICS_IOCTL_GET_PROPERTIES: { case GRAPHICS_IOCTL_GET_PROPERTIES: {
auto user_properties = static_ptr_cast<FBProperties*>(arg); auto user_properties = static_ptr_cast<GraphicsConnectorProperties*>(arg);
FBProperties properties {}; GraphicsConnectorProperties properties {};
properties.flushing_support = flush_support(); properties.flushing_support = flush_support();
properties.doublebuffer_support = double_framebuffering_capable(); properties.doublebuffer_support = double_framebuffering_capable();
properties.partial_flushing_support = partial_flush_support(); properties.partial_flushing_support = partial_flush_support();
@ -168,8 +168,8 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
return copy_to_user(user_properties, &properties); return copy_to_user(user_properties, &properties);
} }
case GRAPHICS_IOCTL_GET_HEAD_MODE_SETTING: { case GRAPHICS_IOCTL_GET_HEAD_MODE_SETTING: {
auto user_head_mode_setting = static_ptr_cast<FBHeadModeSetting*>(arg); auto user_head_mode_setting = static_ptr_cast<GraphicsHeadModeSetting*>(arg);
FBHeadModeSetting head_mode_setting {}; GraphicsHeadModeSetting head_mode_setting {};
TRY(copy_from_user(&head_mode_setting, user_head_mode_setting)); TRY(copy_from_user(&head_mode_setting, user_head_mode_setting));
{ {
SpinlockLocker control_locker(m_control_lock); SpinlockLocker control_locker(m_control_lock);
@ -189,8 +189,8 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
return copy_to_user(user_head_mode_setting, &head_mode_setting); return copy_to_user(user_head_mode_setting, &head_mode_setting);
} }
case GRAPHICS_IOCTL_GET_HEAD_EDID: { case GRAPHICS_IOCTL_GET_HEAD_EDID: {
auto user_head_edid = static_ptr_cast<FBHeadEDID*>(arg); auto user_head_edid = static_ptr_cast<GraphicsHeadEDID*>(arg);
FBHeadEDID head_edid {}; GraphicsHeadEDID head_edid {};
TRY(copy_from_user(&head_edid, user_head_edid)); TRY(copy_from_user(&head_edid, user_head_edid));
auto edid_bytes = TRY(get_edid()); auto edid_bytes = TRY(get_edid());
@ -208,7 +208,7 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
return copy_to_user(user_head_edid, &head_edid); return copy_to_user(user_head_edid, &head_edid);
} }
case GRAPHICS_IOCTL_SET_HEAD_MODE_SETTING: { case GRAPHICS_IOCTL_SET_HEAD_MODE_SETTING: {
auto user_mode_setting = static_ptr_cast<FBHeadModeSetting const*>(arg); auto user_mode_setting = static_ptr_cast<GraphicsHeadModeSetting const*>(arg);
auto head_mode_setting = TRY(copy_typed_from_user(user_mode_setting)); auto head_mode_setting = TRY(copy_typed_from_user(user_mode_setting));
if (head_mode_setting.horizontal_stride < 0) if (head_mode_setting.horizontal_stride < 0)
@ -270,7 +270,7 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
return {}; return {};
} }
auto user_head_vertical_buffer_offset = static_ptr_cast<FBHeadVerticalOffset const*>(arg); auto user_head_vertical_buffer_offset = static_ptr_cast<GraphicsHeadVerticalOffset const*>(arg);
auto head_vertical_buffer_offset = TRY(copy_typed_from_user(user_head_vertical_buffer_offset)); auto head_vertical_buffer_offset = TRY(copy_typed_from_user(user_head_vertical_buffer_offset));
SpinlockLocker locker(m_modeset_lock); SpinlockLocker locker(m_modeset_lock);
@ -285,8 +285,8 @@ ErrorOr<void> DisplayConnector::ioctl(OpenFileDescription&, unsigned request, Us
return {}; return {};
} }
case GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER: { case GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER: {
auto user_head_vertical_buffer_offset = static_ptr_cast<FBHeadVerticalOffset*>(arg); auto user_head_vertical_buffer_offset = static_ptr_cast<GraphicsHeadVerticalOffset*>(arg);
FBHeadVerticalOffset head_vertical_buffer_offset {}; GraphicsHeadVerticalOffset head_vertical_buffer_offset {};
TRY(copy_from_user(&head_vertical_buffer_offset, user_head_vertical_buffer_offset)); TRY(copy_from_user(&head_vertical_buffer_offset, user_head_vertical_buffer_offset));
head_vertical_buffer_offset.offsetted = m_vertical_offsetted; head_vertical_buffer_offset.offsetted = m_vertical_offsetted;

View file

@ -40,8 +40,8 @@ ErrorOr<void> GenericFramebufferDevice::ioctl(OpenFileDescription&, unsigned req
} }
switch (request) { switch (request) {
case GRAPHICS_IOCTL_GET_PROPERTIES: { case GRAPHICS_IOCTL_GET_PROPERTIES: {
auto user_properties = static_ptr_cast<FBProperties*>(arg); auto user_properties = static_ptr_cast<GraphicsConnectorProperties*>(arg);
FBProperties properties {}; GraphicsConnectorProperties properties {};
auto adapter = m_graphics_adapter.strong_ref(); auto adapter = m_graphics_adapter.strong_ref();
if (!adapter) if (!adapter)
return Error::from_errno(EIO); return Error::from_errno(EIO);
@ -65,8 +65,8 @@ ErrorOr<void> GenericFramebufferDevice::ioctl(OpenFileDescription&, unsigned req
return copy_to_user(user_head_properties, &head_properties); return copy_to_user(user_head_properties, &head_properties);
} }
case GRAPHICS_IOCTL_GET_HEAD_EDID: { case GRAPHICS_IOCTL_GET_HEAD_EDID: {
auto user_head_edid = static_ptr_cast<FBHeadEDID*>(arg); auto user_head_edid = static_ptr_cast<GraphicsHeadEDID*>(arg);
FBHeadEDID head_edid {}; GraphicsHeadEDID head_edid {};
TRY(copy_from_user(&head_edid, user_head_edid)); TRY(copy_from_user(&head_edid, user_head_edid));
TRY(verify_head_index(head_edid.head_index)); TRY(verify_head_index(head_edid.head_index));
@ -99,7 +99,7 @@ ErrorOr<void> GenericFramebufferDevice::ioctl(OpenFileDescription&, unsigned req
return {}; return {};
} }
case GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER: { case GRAPHICS_IOCTL_SET_HEAD_VERTICAL_OFFSET_BUFFER: {
auto user_head_vertical_buffer_offset = static_ptr_cast<FBHeadVerticalOffset const*>(arg); auto user_head_vertical_buffer_offset = static_ptr_cast<GraphicsHeadVerticalOffset const*>(arg);
auto head_vertical_buffer_offset = TRY(copy_typed_from_user(user_head_vertical_buffer_offset)); auto head_vertical_buffer_offset = TRY(copy_typed_from_user(user_head_vertical_buffer_offset));
TRY(verify_head_index(head_vertical_buffer_offset.head_index)); TRY(verify_head_index(head_vertical_buffer_offset.head_index));
@ -109,8 +109,8 @@ ErrorOr<void> GenericFramebufferDevice::ioctl(OpenFileDescription&, unsigned req
return {}; return {};
} }
case GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER: { case GRAPHICS_IOCTL_GET_HEAD_VERTICAL_OFFSET_BUFFER: {
auto user_head_vertical_buffer_offset = static_ptr_cast<FBHeadVerticalOffset*>(arg); auto user_head_vertical_buffer_offset = static_ptr_cast<GraphicsHeadVerticalOffset*>(arg);
FBHeadVerticalOffset head_vertical_buffer_offset {}; GraphicsHeadVerticalOffset head_vertical_buffer_offset {};
TRY(copy_from_user(&head_vertical_buffer_offset, user_head_vertical_buffer_offset)); TRY(copy_from_user(&head_vertical_buffer_offset, user_head_vertical_buffer_offset));
TRY(verify_head_index(head_vertical_buffer_offset.head_index)); TRY(verify_head_index(head_vertical_buffer_offset.head_index));

View file

@ -18,7 +18,7 @@ struct winsize {
unsigned short ws_ypixel; unsigned short ws_ypixel;
}; };
struct FBProperties { struct GraphicsConnectorProperties {
unsigned char multihead_support; unsigned char multihead_support;
unsigned char doublebuffer_support; unsigned char doublebuffer_support;
unsigned char flushing_support; unsigned char flushing_support;
@ -38,7 +38,7 @@ struct FBHeadProperties {
unsigned buffer_length; unsigned buffer_length;
}; };
struct FBHeadModeSetting { struct GraphicsHeadModeSetting {
int horizontal_stride; int horizontal_stride;
int pixel_clock_in_khz; int pixel_clock_in_khz;
int horizontal_active; int horizontal_active;
@ -61,14 +61,14 @@ struct FBHeadResolution {
int height; int height;
}; };
struct FBHeadEDID { struct GraphicsHeadEDID {
int head_index; int head_index;
unsigned char* bytes; unsigned char* bytes;
unsigned bytes_size; unsigned bytes_size;
}; };
struct FBHeadVerticalOffset { struct GraphicsHeadVerticalOffset {
int head_index; int head_index;
int offsetted; int offsetted;
}; };

View file

@ -204,7 +204,7 @@ ErrorOr<Parser> Parser::from_bytes(ByteBuffer&& bytes)
ErrorOr<Parser> Parser::from_framebuffer_device(int framebuffer_fd, size_t head) ErrorOr<Parser> Parser::from_framebuffer_device(int framebuffer_fd, size_t head)
{ {
RawBytes edid_bytes; RawBytes edid_bytes;
FBHeadEDID edid_info {}; GraphicsHeadEDID edid_info {};
edid_info.head_index = head; edid_info.head_index = head;
edid_info.bytes = &edid_bytes[0]; edid_info.bytes = &edid_bytes[0];
edid_info.bytes_size = sizeof(edid_bytes); edid_info.bytes_size = sizeof(edid_bytes);

View file

@ -27,7 +27,7 @@ ErrorOr<void> HardwareScreenBackend::open()
{ {
m_framebuffer_fd = TRY(Core::System::open(m_device.characters(), O_RDWR | O_CLOEXEC)); m_framebuffer_fd = TRY(Core::System::open(m_device.characters(), O_RDWR | O_CLOEXEC));
FBProperties properties; GraphicsConnectorProperties properties;
if (fb_get_properties(m_framebuffer_fd, &properties) < 0) if (fb_get_properties(m_framebuffer_fd, &properties) < 0)
return Error::from_syscall(String::formatted("failed to ioctl {}", m_device), errno); return Error::from_syscall(String::formatted("failed to ioctl {}", m_device), errno);
@ -61,8 +61,8 @@ ErrorOr<void> HardwareScreenBackend::set_head_resolution(FBHeadResolution resolu
if (rc != 0) if (rc != 0)
return Error::from_syscall("fb_set_resolution", rc); return Error::from_syscall("fb_set_resolution", rc);
} else { } else {
FBHeadModeSetting mode_setting; GraphicsHeadModeSetting mode_setting;
memset(&mode_setting, 0, sizeof(FBHeadModeSetting)); memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting));
mode_setting.horizontal_active = resolution.width; mode_setting.horizontal_active = resolution.width;
mode_setting.vertical_active = resolution.height; mode_setting.vertical_active = resolution.height;
mode_setting.horizontal_stride = resolution.pitch; mode_setting.horizontal_stride = resolution.pitch;
@ -134,8 +134,8 @@ ErrorOr<void> HardwareScreenBackend::map_framebuffer()
m_back_buffer_offset = 0; m_back_buffer_offset = 0;
} }
} else { } else {
FBHeadModeSetting mode_setting {}; GraphicsHeadModeSetting mode_setting {};
memset(&mode_setting, 0, sizeof(FBHeadModeSetting)); memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting));
int rc = fb_get_head_mode_setting(m_framebuffer_fd, &mode_setting); int rc = fb_get_head_mode_setting(m_framebuffer_fd, &mode_setting);
if (rc != 0) { if (rc != 0) {
return Error::from_syscall("fb_get_head_mode_setting", rc); return Error::from_syscall("fb_get_head_mode_setting", rc);
@ -168,14 +168,14 @@ ErrorOr<FBHeadProperties> HardwareScreenBackend::get_head_properties()
m_pitch = static_cast<int>(properties.pitch); m_pitch = static_cast<int>(properties.pitch);
return properties; return properties;
} else { } else {
FBHeadModeSetting mode_setting {}; GraphicsHeadModeSetting mode_setting {};
memset(&mode_setting, 0, sizeof(FBHeadModeSetting)); memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting));
int rc = fb_get_head_mode_setting(m_framebuffer_fd, &mode_setting); int rc = fb_get_head_mode_setting(m_framebuffer_fd, &mode_setting);
if (rc != 0) { if (rc != 0) {
return Error::from_syscall("fb_get_head_mode_setting", rc); return Error::from_syscall("fb_get_head_mode_setting", rc);
} }
m_pitch = mode_setting.horizontal_stride; m_pitch = mode_setting.horizontal_stride;
// Note: We translate (for now, until Framebuffer devices are removed) the FBHeadModeSetting // Note: We translate (for now, until Framebuffer devices are removed) the GraphicsHeadModeSetting
// structure to FBHeadProperties. // structure to FBHeadProperties.
FBHeadProperties properties; FBHeadProperties properties;
properties.head_index = 0; properties.head_index = 0;
@ -193,7 +193,7 @@ void HardwareScreenBackend::set_head_buffer(int head_index)
{ {
VERIFY(m_can_set_head_buffer); VERIFY(m_can_set_head_buffer);
VERIFY(head_index <= 1 && head_index >= 0); VERIFY(head_index <= 1 && head_index >= 0);
FBHeadVerticalOffset offset { 0, 0 }; GraphicsHeadVerticalOffset offset { 0, 0 };
if (head_index == 1) if (head_index == 1)
offset.offsetted = 1; offset.offsetted = 1;
int rc = fb_set_head_vertical_offset_buffer(m_framebuffer_fd, &offset); int rc = fb_set_head_vertical_offset_buffer(m_framebuffer_fd, &offset);

View file

@ -321,8 +321,8 @@ bool ScreenLayout::try_auto_add_display_connector(String const& device_path)
close(display_connector_fd); close(display_connector_fd);
}); });
FBHeadModeSetting mode_setting {}; GraphicsHeadModeSetting mode_setting {};
memset(&mode_setting, 0, sizeof(FBHeadModeSetting)); memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting));
if (fb_get_head_mode_setting(display_connector_fd, &mode_setting) < 0) { if (fb_get_head_mode_setting(display_connector_fd, &mode_setting) < 0) {
int err = errno; int err = errno;
dbgln("Error ({}) querying resolution from display connector device {}", err, device_path); dbgln("Error ({}) querying resolution from display connector device {}", err, device_path);