qemu-devel
[Top][All Lists]
Advanced

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

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


From: Juha Riihimäki
Subject: Re: [Qemu-devel] [PATCH] Cocoa front-end performance improvement
Date: Fri, 27 Mar 2009 20:47:09 +0200

Any comments on this patch? I'm surprised that nobody else has noticed how horribly slow the qemu monitor or any qemu console window is when using Cocoa. And the reason is simple, current implementation is forcing asynchronous updates to be done synchronously. Fixing this also removes the slowness.


Juha

On Mar 9, 2009, at 09:37, Riihimaki Juha (Nokia-D/Helsinki) wrote:

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)




Attachment: cocoa.m.diff
Description: Binary data



reply via email to

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