qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Cocoa front-end performance improvement


From: Riihimaki Juha
Subject: [Qemu-devel] [PATCH] Cocoa front-end performance improvement
Date: Mon, 9 Mar 2009 09:37:28 +0200

Current cocoa.m implementation is forcing a synchronized redraw operation on every display update callback. Fixing this to use the asynchronous method gives a 10x-100x performance boost on the QEMU console windows as the console drawing code is updating every character cell in the window separately. Linked to this, the window resize animation needs to be disabled (i.e. change to immediate resize) or the window contents will display incorrectly during the resize animation. Also, overriding default isOpaque method to return YES increases performance since the QEMU window does not contain transparent areas.


Signed-off-by: Juha Riihimäki <address@hidden>
---
diff --git a/cocoa.m b/cocoa.m
index 55ff2b4..f40067a 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -298,6 +298,11 @@ int cocoa_keycode_to_qemu(int keycode)
     [super dealloc];
 }

+- (BOOL) isOpaque
+{
+    return YES;
+}
+
 - (void) drawRect:(NSRect) rect
 {
     COCOA_DEBUG("QemuCocoaView: drawRect\n");
@@ -403,7 +408,7 @@ int cocoa_keycode_to_qemu(int keycode)
     } else {
         if (qemu_name)
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; - [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:YES]; + [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:NO];
     }
     screen.width = w;
     screen.height = h;
@@ -922,7 +927,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
             w * [cocoaView cdx],
             h * [cocoaView cdy]);
     }
-    [cocoaView displayRect:rect];
+    [cocoaView setNeedsDisplayInRect:rect];
 }

 static void cocoa_resize(DisplayState *ds)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]