/* * Copyright (c) 2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Kernel { class GenericDisplayConnector : public DisplayConnector { friend class DeviceManagement; public: static NonnullRefPtr must_create_with_preset_resolution(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch); protected: ErrorOr create_attached_framebuffer_console(); GenericDisplayConnector(PhysicalAddress framebuffer_address, size_t width, size_t height, size_t pitch); virtual bool mutable_mode_setting_capable() const override final { return false; } virtual bool double_framebuffering_capable() const override { return false; } virtual ErrorOr set_mode_setting(ModeSetting const&) override { return Error::from_errno(ENOTSUP); } virtual ErrorOr set_safe_mode_setting() override { return {}; } virtual ErrorOr set_y_offset(size_t) override { return Error::from_errno(ENOTSUP); } virtual ErrorOr unblank() override { return Error::from_errno(ENOTSUP); } virtual bool partial_flush_support() const override final { return false; } virtual bool flush_support() const override final { return false; } // Note: This is possibly a paravirtualized hardware, but since we don't know, we assume there's no refresh rate... virtual bool refresh_rate_support() const override final { return false; } virtual ErrorOr write_to_first_surface(u64 offset, UserOrKernelBuffer const&, size_t length) override final; virtual ErrorOr flush_first_surface() override final; virtual void enable_console() override final; virtual void disable_console() override final; const PhysicalAddress m_framebuffer_address; RefPtr m_framebuffer_console; OwnPtr m_framebuffer_region; u8* m_framebuffer_data {}; }; }