From patchwork Wed Jun 3 21:03:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 480218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6D5E01401DE for ; Thu, 4 Jun 2015 07:12:18 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=onmQEz/T; dkim-atps=neutral Received: from localhost ([::1]:38208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FxQ-00053M-He for incoming@patchwork.ozlabs.org; Wed, 03 Jun 2015 17:12:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FpP-0007j2-T9 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 17:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0FpP-0005jO-01 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 17:03:59 -0400 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:35931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FpO-0005j4-QC for qemu-devel@nongnu.org; Wed, 03 Jun 2015 17:03:58 -0400 Received: by wgbgq6 with SMTP id gq6so19145443wgb.3 for ; Wed, 03 Jun 2015 14:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=xbwp6LMC+HN5ouvX6EKtfB0dxia/mDC961c1Z1Xn4dA=; b=onmQEz/TDIMYRvBezsr51BVs8nNEpptDYkMtus7zStw18XGFmtv8RDkbG8apCf5OCy Z/9r/kaMlYbo4U57ImtyU7CmE1ZmYODBfulQPhabX6KX5Au84qFbRNGam0c0yXmXtyij CRH0Ylxas1HzM/jqibcpe0BhFH7llZKpW7ZlCb67tN9LhbanMqS4SeotsiRxxILw2k7s dZfuaNeUmkVntkEdRCikQ2QSFWsnzV4jnMOLU9HJsGpna5kc6Mfxaa6evLvQZSrl7Wyr ga15ksWe30rXbldi7wLiKAn4FYbqlRfqZZV2xNPqvjW+pbAieNj7RQuKEtid0gkwNg3W 4/iw== X-Received: by 10.180.95.101 with SMTP id dj5mr1173407wib.16.1433365438316; Wed, 03 Jun 2015 14:03:58 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (94-21-43-102.pool.digikabel.hu. [94.21.43.102]) by mx.google.com with ESMTPSA id l6sm2727050wjz.4.2015.06.03.14.03.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jun 2015 14:03:57 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Wed, 3 Jun 2015 23:03:55 +0200 Message-Id: X-Mailer: git-send-email 2.4.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::236 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v3 12/12] sdlaudio: do not allow multiple instances 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 Since SDL uses a lot of global data, we can't create independent instances of sdl audio backend. Signed-off-by: Kővágó, Zoltán --- audio/sdlaudio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index b95a7e0..1140f2e 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -55,6 +55,7 @@ static struct SDLAudioState { SDL_mutex *mutex; SDL_sem *sem; int initialized; + bool driver_created; } glob_sdl; typedef struct SDLAudioState SDLAudioState; @@ -393,6 +394,10 @@ static int sdl_ctl_out (HWVoiceOut *hw, int cmd, ...) static void *sdl_audio_init (void) { SDLAudioState *s = &glob_sdl; + if (s->driver_created) { + sdl_logerr("Can't create multiple sdl backends\n"); + return NULL; + } if (SDL_InitSubSystem (SDL_INIT_AUDIO)) { sdl_logerr ("SDL failed to initialize audio subsystem\n"); @@ -414,6 +419,7 @@ static void *sdl_audio_init (void) return NULL; } + s->driver_created = true; return s; } @@ -424,6 +430,7 @@ static void sdl_audio_fini (void *opaque) SDL_DestroySemaphore (s->sem); SDL_DestroyMutex (s->mutex); SDL_QuitSubSystem (SDL_INIT_AUDIO); + s->driver_created = false; } static struct audio_option sdl_options[] = {