1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Add mechanism to expose kernel variables to userspace via ProcFS.

Only booleans are supported at first. More types can be added easily.
Use this to add /proc/sys/wm_flash_flush which when enabled flashes pending
screen flush rects in yellow before they happen.
This commit is contained in:
Andreas Kling 2019-01-18 15:01:40 +01:00
parent 9454c5dd52
commit f7cc454162
8 changed files with 121 additions and 29 deletions

View file

@ -4,11 +4,11 @@
#include "WSEventLoop.h"
#include "Process.h"
#include "MemoryManager.h"
#include <Kernel/ProcFileSystem.h>
#include <Widgets/Painter.h>
#include <Widgets/CharacterBitmap.h>
#include <AK/StdLibExtras.h>
//#define DEBUG_FLUSH_YELLOW
//#define DEBUG_COUNTERS
static const int windowTitleBarHeight = 16;
@ -130,6 +130,8 @@ WSWindowManager::WSWindowManager()
m_cursor_bitmap_inner = CharacterBitmap::create_from_ascii(cursor_bitmap_inner_ascii, 12, 17);
m_cursor_bitmap_outer = CharacterBitmap::create_from_ascii(cursor_bitmap_outer_ascii, 12, 17);
ProcFS::the().add_sys_bool("wm_flash_flush", &m_flash_flush);
invalidate();
compose();
}
@ -444,9 +446,8 @@ void WSWindowManager::flush(const Rect& a_rect)
const RGBA32* back_ptr = m_back_bitmap->scanline(rect.y()) + rect.x();
size_t pitch = m_back_bitmap->pitch();
#ifdef DEBUG_FLUSH_YELLOW
m_front_painter->fill_rect(rect, Color::Yellow);
#endif
if (m_flash_flush)
m_front_painter->fill_rect(rect, Color::Yellow);
for (int y = 0; y < rect.height(); ++y) {
fast_dword_copy(front_ptr, back_ptr, rect.width());