From patchwork Tue May 1 05:53:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 156009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4E781B6EE6 for ; Tue, 1 May 2012 15:53:23 +1000 (EST) Received: from localhost ([::1]:59841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP61Y-0003zo-FB for incoming@patchwork.ozlabs.org; Tue, 01 May 2012 01:53:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP61S-0003ze-79 for qemu-devel@nongnu.org; Tue, 01 May 2012 01:53:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SP61Q-0005eK-GP for qemu-devel@nongnu.org; Tue, 01 May 2012 01:53:13 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:35937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SP61Q-0005dP-AK for qemu-devel@nongnu.org; Tue, 01 May 2012 01:53:12 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id CEFD572800B0; Tue, 1 May 2012 07:53:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nwOk52oSKcGr; Tue, 1 May 2012 07:53:09 +0200 (CEST) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id 5BDBE72800BC; Tue, 1 May 2012 07:53:09 +0200 (CEST) From: Stefan Weil To: qemu-devel@nongnu.org Date: Tue, 1 May 2012 07:53:08 +0200 Message-Id: <1335851588-21011-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.9 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.47.199.172 Cc: Paolo Bonzini , Anthony Liguori , Stefan Weil Subject: [Qemu-devel] [PATCH] sdl: Avoid unnecessary resizing of the display surface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If neither width nor height changes, nothing has to be done. Cc: Anthony Liguori Signed-off-by: Stefan Weil --- This patch improves SDL for any host (for example with remote X displays), but the main reason why I wrote it was another problem: On w32 / w64 hosts, qemu-system-arm has a deadlock when it calls sdl_resize_displaysurface during Linux boot. One thread waits for a critical region, another thread waits inside SDL_SetVideoMode. The patch avoids this problem. Paolo, maybe you have an idea what could cause the deadlock. Debugging on wxx is terrible - up to now, I did not succeed in analysing the lock situation with gdb. Regards, Stefan W. ui/sdl.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index 8700b7a..8c1c71c 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -224,8 +224,11 @@ static void sdl_free_displaysurface(DisplaySurface *surface) static DisplaySurface* sdl_resize_displaysurface(DisplaySurface *surface, int width, int height) { - sdl_free_displaysurface(surface); - return sdl_create_displaysurface(width, height); + if (surface->width != width || surface->height != height) { + sdl_free_displaysurface(surface); + surface = sdl_create_displaysurface(width, height); + } + return surface; } /* generic keyboard conversion */