mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:27:45 +00:00
WindowServer: Add initial support for rendering on multiple screens
This allows WindowServer to use multiple framebuffer devices and compose the desktop with any arbitrary layout. Currently, it is assumed that it is configured contiguous and non-overlapping, but this should eventually be enforced. To make rendering efficient, each window now also tracks on which screens it needs to be rendered. This way we don't have to iterate all the windows for each screen but instead use the same rendering loop and then only render to the screen (or screens) that the window actually uses.
This commit is contained in:
parent
499c33ae0c
commit
4392da970a
42 changed files with 1127 additions and 563 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/Object.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/DisjointRectSet.h>
|
||||
#include <WindowServer/Screen.h>
|
||||
|
||||
namespace WindowServer {
|
||||
|
||||
|
@ -36,7 +37,7 @@ public:
|
|||
void invalidate_screen();
|
||||
void invalidate_screen(const Gfx::IntRect&);
|
||||
|
||||
bool set_resolution(int desired_width, int desired_height, int scale_factor);
|
||||
void screen_resolution_changed();
|
||||
|
||||
bool set_background_color(const String& background_color);
|
||||
|
||||
|
@ -55,46 +56,58 @@ public:
|
|||
|
||||
void did_construct_window_manager(Badge<WindowManager>);
|
||||
|
||||
const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>) const { return *m_front_bitmap; }
|
||||
const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
|
||||
|
||||
private:
|
||||
Compositor();
|
||||
void init_bitmaps();
|
||||
void flip_buffers();
|
||||
void flush(const Gfx::IntRect&);
|
||||
void run_animations(Gfx::DisjointRectSet&);
|
||||
bool render_animation_frame(Screen&, Gfx::DisjointRectSet&);
|
||||
void step_animations();
|
||||
void notify_display_links();
|
||||
void start_compose_async_timer();
|
||||
void recompute_occlusions();
|
||||
bool any_opaque_window_above_this_one_contains_rect(const Window&, const Gfx::IntRect&);
|
||||
void change_cursor(const Cursor*);
|
||||
void draw_cursor(const Gfx::IntRect&);
|
||||
void restore_cursor_back();
|
||||
bool draw_geometry_label(Gfx::IntRect&);
|
||||
void draw_geometry_label(Screen&);
|
||||
void flush(Screen&);
|
||||
|
||||
RefPtr<Core::Timer> m_compose_timer;
|
||||
RefPtr<Core::Timer> m_immediate_compose_timer;
|
||||
bool m_flash_flush { false };
|
||||
bool m_buffers_are_flipped { false };
|
||||
bool m_screen_can_set_buffer { false };
|
||||
bool m_occlusions_dirty { true };
|
||||
bool m_invalidated_any { true };
|
||||
bool m_invalidated_window { false };
|
||||
bool m_invalidated_cursor { false };
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_temp_bitmap;
|
||||
OwnPtr<Gfx::Painter> m_back_painter;
|
||||
OwnPtr<Gfx::Painter> m_front_painter;
|
||||
OwnPtr<Gfx::Painter> m_temp_painter;
|
||||
struct ScreenData {
|
||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_temp_bitmap;
|
||||
OwnPtr<Gfx::Painter> m_back_painter;
|
||||
OwnPtr<Gfx::Painter> m_front_painter;
|
||||
OwnPtr<Gfx::Painter> m_temp_painter;
|
||||
RefPtr<Gfx::Bitmap> m_cursor_back_bitmap;
|
||||
OwnPtr<Gfx::Painter> m_cursor_back_painter;
|
||||
Gfx::IntRect m_last_cursor_rect;
|
||||
bool m_buffers_are_flipped { false };
|
||||
bool m_screen_can_set_buffer { false };
|
||||
bool m_cursor_back_is_valid { false };
|
||||
|
||||
Gfx::DisjointRectSet m_flush_rects;
|
||||
Gfx::DisjointRectSet m_flush_transparent_rects;
|
||||
Gfx::DisjointRectSet m_flush_special_rects;
|
||||
|
||||
void init_bitmaps(Screen&);
|
||||
void flip_buffers(Screen&);
|
||||
void draw_cursor(Screen&, const Gfx::IntRect&);
|
||||
bool restore_cursor_back(Screen&, Gfx::IntRect&);
|
||||
};
|
||||
friend class ScreenData;
|
||||
Vector<ScreenData, default_screen_count> m_screen_data;
|
||||
|
||||
Gfx::DisjointRectSet m_dirty_screen_rects;
|
||||
Gfx::DisjointRectSet m_opaque_wallpaper_rects;
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_cursor_back_bitmap;
|
||||
OwnPtr<Gfx::Painter> m_cursor_back_painter;
|
||||
Gfx::IntRect m_last_cursor_rect;
|
||||
Gfx::IntRect m_last_dnd_rect;
|
||||
Gfx::IntRect m_last_geometry_label_damage_rect;
|
||||
|
||||
|
@ -103,6 +116,7 @@ private:
|
|||
RefPtr<Gfx::Bitmap> m_wallpaper;
|
||||
|
||||
const Cursor* m_current_cursor { nullptr };
|
||||
Screen* m_current_cursor_screen { nullptr };
|
||||
unsigned m_current_cursor_frame { 0 };
|
||||
RefPtr<Core::Timer> m_cursor_timer;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue