summaryrefslogtreecommitdiff
path: root/WindowServer/WSWindowManager.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-16 17:47:18 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-16 17:47:18 +0100
commita2ec09bc205ecbf746f9cc245054c24c50b6832a (patch)
treed4c2cebc2c5f5d1283ecadb6b401f0b20eed141a /WindowServer/WSWindowManager.cpp
parent4fef895edab80cbe2d9f886f5b769973af93a040 (diff)
downloadserenity-a2ec09bc205ecbf746f9cc245054c24c50b6832a.zip
Allow the scheduler to unblock the current process.
It's a bit confusing that the "current" process is not actually running while we're inside the scheduler. Perhaps the scheduler should redirect "current" to its own dummy Process. I'm not sure. Regardless, this patch improves responsiveness by allowing the scheduler to unblock a process right after it calls select() in case it already has a pending wakeup request.
Diffstat (limited to 'WindowServer/WSWindowManager.cpp')
-rw-r--r--WindowServer/WSWindowManager.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp
index 710eefea55..1f0162e20b 100644
--- a/WindowServer/WSWindowManager.cpp
+++ b/WindowServer/WSWindowManager.cpp
@@ -10,6 +10,7 @@
#include <AK/StdLibExtras.h>
//#define DEBUG_FLUSH_YELLOW
+//#define DEBUG_COUNTERS
static const int windowTitleBarHeight = 16;
@@ -109,6 +110,10 @@ WSWindowManager::WSWindowManager()
: m_framebuffer(WSFrameBuffer::the())
, m_screen_rect(m_framebuffer.rect())
{
+#ifndef DEBUG_COUNTERS
+ (void)m_recompose_count;
+ (void)m_flush_count;
+#endif
auto size = m_screen_rect.size();
m_front_bitmap = GraphicsBitmap::create_wrapper(size, m_framebuffer.scanline(0));
auto* region = current->allocate_region(LinearAddress(), size.width() * size.height() * sizeof(RGBA32), "BackBitmap", true, true, true);
@@ -266,9 +271,10 @@ void WSWindowManager::processMouseEvent(MouseEvent& event)
void WSWindowManager::compose()
{
auto invalidated_rects = move(m_invalidated_rects);
- printf("[WM] compose #%u (%u rects)\n", ++m_recompose_count, invalidated_rects.size());
-
+#ifdef DEBUG_COUNTERS
+ dbgprintf("[WM] compose #%u (%u rects)\n", ++m_recompose_count, invalidated_rects.size());
dbgprintf("kmalloc stats: alloc:%u free:%u eternal:%u\n", sum_alloc, sum_free, kmalloc_sum_eternal);
+#endif
auto any_window_contains_rect = [this] (const Rect& r) {
for (auto* window = m_windows_in_order.head(); window; window = window->next()) {
@@ -387,6 +393,10 @@ void WSWindowManager::flush(const Rect& a_rect)
{
auto rect = Rect::intersection(a_rect, m_screen_rect);
+#ifdef DEBUG_COUNTERS
+ dbgprintf("[WM] flush #%u (%d,%d %dx%d)\n", ++m_flush_count, rect.x(), rect.y(), rect.width(), rect.height());
+#endif
+
RGBA32* front_ptr = m_front_bitmap->scanline(rect.y()) + rect.x();
const RGBA32* back_ptr = m_back_bitmap->scanline(rect.y()) + rect.x();
size_t pitch = m_back_bitmap->pitch();