Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lglq2-0002fF-3o for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:12:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lglpz-0002ck-KT for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:12:37 -0400 Received: from [199.232.76.173] (port=57436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lglpz-0002cJ-95 for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:12:35 -0400 Received: from mx20.gnu.org ([199.232.41.8]:2739) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lglpy-0007Lg-Sc for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:12:35 -0400 Received: from smtp.nokia.com ([192.100.105.134] helo=mgw-mx09.nokia.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LgaA9-0005Qu-Ki for qemu-devel@nongnu.org; Mon, 09 Mar 2009 03:44:38 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n297Zv9V006478 for ; Mon, 9 Mar 2009 02:38:16 -0500 Received: from esdhcp03557.research.nokia.com (esdhcp03557.research.nokia.com [172.21.35.57]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n297bPcZ016320 for ; Mon, 9 Mar 2009 09:37:25 +0200 Message-Id: From: Riihimaki Juha Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Date: Mon, 9 Mar 2009 09:37:28 +0200 Subject: [Qemu-devel] [PATCH] Cocoa front-end performance improvement Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Current cocoa.m implementation is forcing a synchronized redraw =20 operation on every display update callback. Fixing this to use the =20 asynchronous method gives a 10x-100x performance boost on the QEMU =20 console windows as the console drawing code is updating every =20 character cell in the window separately. Linked to this, the window =20 resize animation needs to be disabled (i.e. change to immediate =20 resize) or the window contents will display incorrectly during the =20 resize animation. Also, overriding default isOpaque method to return =20 YES increases performance since the QEMU window does not contain =20 transparent areas. Signed-off-by: Juha Riihim=E4ki --- 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 =20= %s", qemu_name]]; - [normalWindow setFrame:NSMakeRect([normalWindow =20 frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, =20= h + [normalWindow frame].size.height - screen.height) display:YES =20 animate:YES]; + [normalWindow setFrame:NSMakeRect([normalWindow =20 frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, =20= h + [normalWindow frame].size.height - screen.height) display:YES =20 animate:NO]; } screen.width =3D w; screen.height =3D h; @@ -922,7 +927,7 @@ static void cocoa_update(DisplayState *ds, int x, =20= int y, int w, int h) w * [cocoaView cdx], h * [cocoaView cdy]); } - [cocoaView displayRect:rect]; + [cocoaView setNeedsDisplayInRect:rect]; } static void cocoa_resize(DisplayState *ds)