From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768028; cv=none; d=zohomail.com; s=zohoarc; b=gRyuyu6ipGQ8RxuFsetQ5ocXhrkd8p0AM9zM9rWbelALiT7mdNysSqsvsOMDbI8Bv6amDPorEAU5B+wOpc9Bu31dB7xq9il7SEnnn6JtkrWTLj8v/LFi1y1d0BERONwfKwq6TpsRQGLQsYFpqfxvgrnWzrvzyDlLOjMCHhop9VE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768028; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/jwjbnZfneyuS47K5UgB28gPESk+hfwcI/YIkd3iASs=; b=J5ObeqeeWOXMpwP0UigLZzeFT6le2yIzhKsNohSYHAo+75MhzVXWpqXh5hsJVclqvttfcxa0Yd1h4IwUOpNTazPDPKVTf6tvshqauqDAPSU9tJx4fEPeE57wIHOaYFEaNnoT5eoj+kZ6w9qu+NnUj8lSauoxCmhbUshuQf7s2Xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768028620691.5627594239315; Tue, 17 Mar 2026 10:20:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y59-0001xs-B5; Tue, 17 Mar 2026 13:19:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y4w-0001wA-N3 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y4v-0005Jm-E3 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:38 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-0Y-LYJbhOFmwI6xWB3RS2Q-1; Tue, 17 Mar 2026 13:19:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E8412180047F; Tue, 17 Mar 2026 17:19:29 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A15CE30001A1; Tue, 17 Mar 2026 17:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773767976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/jwjbnZfneyuS47K5UgB28gPESk+hfwcI/YIkd3iASs=; b=PGbvUfXWugI2F0IRQSb4EnNZ5e3S++KW/7HSBCkRD+qvHS2izaRA0Snjpp1NXdOj/Yzck7 YSzPMasDmqPgXRF/1V9aMFhJP9lamRQHBLZDVPpEZcSaPunZGNZzUbfpAZOdQuJyE2IcBW Dwh4+wle+6FBghhQgLb9s5echYRqUjg= X-MC-Unique: 0Y-LYJbhOFmwI6xWB3RS2Q-1 X-Mimecast-MFC-AGG-ID: 0Y-LYJbhOFmwI6xWB3RS2Q_1773767970 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 01/16] audio/mixeng: drop some needless checks Date: Tue, 17 Mar 2026 21:19:01 +0400 Message-ID: <20260317171916.438575-2-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768031353158500 From: Marc-Andr=C3=A9 Lureau The NULL checks for be, name, callback_fn, and as in audio_mixeng_backend_open_{in,out} are redundant: the callers audio_be_open_{in,out} already assert that name, callback_fn, and as are non-NULL, and dereference be unconditionally via AUDIO_BACKEND_GET_CLASS(be) before the call. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Message-Id: <20260224163229.2918858-1-marcandre.lureau@redhat.com> --- audio/audio_template.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 228369cf9a1..fe769cde667 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -497,12 +497,6 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( AudioMixengBackendClass *k; AudiodevPerDirectionOptions *pdo; =20 - if (!be || !name || !callback_fn || !as) { - audio_bug("backend=3D%p name=3D%p callback_fn=3D%p as=3D%p", - be, name, callback_fn, as); - goto fail; - } - k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(s); pdo =3D glue(audio_get_pdo_, TYPE)(s->dev); =20 --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768029; cv=none; d=zohomail.com; s=zohoarc; b=Of92Aepo+TsMfifGDO/s78ai7fp/EfVb4n8QDz+hL98erR1HTxMjsO/b5tmgMUaMMeZLvSGDv0xkxsDKjhs+Sg8rH24A5ZLNkl6qqzlMwcr8xh6ND4UpIaCXuW1J16as6z+q9AfVQGI/x5r+IUokwMu0aD8l39wJRtei4W2AHR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768029; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QsMnLGi/PISBgtSi+2udu6nlOMSdXWd4W1sADkglRYo=; b=HICuRLljg2aGuDYeyqN90wxIBQeRKTsbFOQYfOA0oFDwSBTL0m+etLKLzV3ftoVHALcH8XvQIt+9fAWhkzTXPRtx8VvcYM0aVnCQFqUsovxO3KXhbzCaLTqabqxIOu8VsLuRu3RaneLrDnAlgesUW0pJjKJh8c8OjW0LaMbttLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768029352126.52573011862398; Tue, 17 Mar 2026 10:20:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5F-0001yY-Vo; Tue, 17 Mar 2026 13:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y53-0001wd-03 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y51-0005KL-DN for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:44 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-_bpdVQ03PSiFgY2hUR5mAA-1; Tue, 17 Mar 2026 13:19:39 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0E4FB19560B4; Tue, 17 Mar 2026 17:19:37 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C8829180075B; Tue, 17 Mar 2026 17:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773767982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QsMnLGi/PISBgtSi+2udu6nlOMSdXWd4W1sADkglRYo=; b=QVnmkz2xJ0B13Z1cuXMb/EBYXzm6yd3RV+mYA/8NzQwi0eu21yATbQoP2jvIzgfFN+v0w/ Px+74nrHHWnjlCz+bUDRSPr5M0SDDk2UvSgBhr1PZ7k4sX7r17Ei7iu6xtSXxtQqctc0Ly kmnouXjKbGd0qxM/ahfeDG7RkEy9AhY= X-MC-Unique: _bpdVQ03PSiFgY2hUR5mAA-1 X-Mimecast-MFC-AGG-ID: _bpdVQ03PSiFgY2hUR5mAA_1773767977 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 02/16] rutabaga: improve error handling, fix potential crash during init Date: Tue, 17 Mar 2026 21:19:02 +0400 Message-ID: <20260317171916.438575-3-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768031386158500 From: Marc-Andr=C3=A9 Lureau When virtio_gpu_rutabaga_get_num_capsets() returns 0, virtio_init() isn't called and the device later crashes during realize. =3D=3D72545=3D=3DERROR: AddressSanitizer: SEGV on unknown address 0x0000000= 00000 (pc 0x556ad6f7ba9e bp 0x7ffe6958f810 sp 0x7ffe6958f7e0 T0) =3D=3D72545=3D=3DThe signal is caused by a READ memory access. =3D=3D72545=3D=3DHint: address points to the zero page. #0 0x556ad6f7ba9e in virtio_memory_listener_commit ../hw/virtio/virtio.c:40= 34 #1 0x556ad6a24c96 in listener_add_address_space ../system/memory.c:3128 #2 0x556ad6a25d15 in memory_listener_register ../system/memory.c:3216 #3 0x556ad6f7bf11 in virtio_device_realize ../hw/virtio/virtio.c:4075 Rework error handling of the function to set Error appropriately. 0 capset may be ok now. Reviewed-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/virtio-gpu-rutabaga.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutab= aga.c index ed5ae52acbe..ebb6c783fb0 100644 --- a/hw/display/virtio-gpu-rutabaga.c +++ b/hw/display/virtio-gpu-rutabaga.c @@ -1032,19 +1032,19 @@ static bool virtio_gpu_rutabaga_init(VirtIOGPU *g, = Error **errp) return true; } =20 -static int virtio_gpu_rutabaga_get_num_capsets(VirtIOGPU *g) +static bool +virtio_gpu_rutabaga_get_num_capsets(VirtIOGPU *g, uint32_t *num_capsets, E= rror **errp) { int result; - uint32_t num_capsets; VirtIOGPURutabaga *vr =3D VIRTIO_GPU_RUTABAGA(g); =20 - result =3D rutabaga_get_num_capsets(vr->rutabaga, &num_capsets); + result =3D rutabaga_get_num_capsets(vr->rutabaga, num_capsets); if (result) { - error_report("Failed to get capsets"); - return 0; + error_setg_errno(errp, -result, "Failed to get num_capsets"); + return false; } - vr->num_capsets =3D num_capsets; - return num_capsets; + vr->num_capsets =3D *num_capsets; + return true; } =20 static void virtio_gpu_rutabaga_handle_ctrl(VirtIODevice *vdev, VirtQueue = *vq) @@ -1070,7 +1070,7 @@ static void virtio_gpu_rutabaga_handle_ctrl(VirtIODev= ice *vdev, VirtQueue *vq) =20 static void virtio_gpu_rutabaga_realize(DeviceState *qdev, Error **errp) { - int num_capsets; + uint32_t num_capsets; VirtIOGPUBase *bdev =3D VIRTIO_GPU_BASE(qdev); VirtIOGPU *gpudev =3D VIRTIO_GPU(qdev); =20 @@ -1083,8 +1083,7 @@ static void virtio_gpu_rutabaga_realize(DeviceState *= qdev, Error **errp) return; } =20 - num_capsets =3D virtio_gpu_rutabaga_get_num_capsets(gpudev); - if (!num_capsets) { + if (!virtio_gpu_rutabaga_get_num_capsets(gpudev, &num_capsets, errp)) { return; } =20 --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768065; cv=none; d=zohomail.com; s=zohoarc; b=gzvlnOBASzs3go7h+l/L5Fye3opMhpdKq1ZoQVEpdNNCet2VdS8hQBYZ4jzxb9S6jGzjuVtXVVUSZpBUWEuzcSZhWst/r9LCTiYNdtIUepyD7dK3qESqR8cGmbNQ1iaA6bobgwBZBN5TH5ogJ0jVI+k7TFpLmok94EAaqaTG9ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768065; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=d2oa4jNZrM8nxVU60xxjphplTABbIomDVBGu/FAbo40=; b=cf2P9nLpDuDJY6trM7BjIuSqYqMuhhHouiftxqGPShjjtY5AXm++/F4EHA86PQaAcdXcyI5trN14iZJ/zpPLLSuu+A3G4GsRT6d8BZ1MX1xkTkyY7j+yuqZ+zDy7E3SwkYTypLSDOCRt/fgolVCQiMqbJ3XTrsGjMyZEfp76K1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768065740872.2906281133353; Tue, 17 Mar 2026 10:21:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5I-0001zV-9E; Tue, 17 Mar 2026 13:20:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5A-0001y1-Os for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y59-0005LY-57 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:52 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-PY3LEd9IMpmzPbuOeaL1xw-1; Tue, 17 Mar 2026 13:19:46 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2B57F1956089; Tue, 17 Mar 2026 17:19:44 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 70F3530002C3; Tue, 17 Mar 2026 17:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773767987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d2oa4jNZrM8nxVU60xxjphplTABbIomDVBGu/FAbo40=; b=aqP5hPl2achjGCveQA0/3264oZSijZs6DZPCVx1p60w/j2OnXcthvIB280tHDjk1Dz26bT 8dY0WkvWvLK1hhZg4946IMcLU4vasJSKRxETC+qEYF2qllIyg/V0YHOp1yclM7Ipwu2/eH vyRzfBXhhpepMTBtaiYrGowRqQLpN4I= X-MC-Unique: PY3LEd9IMpmzPbuOeaL1xw-1 X-Mimecast-MFC-AGG-ID: PY3LEd9IMpmzPbuOeaL1xw_1773767984 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki , Fiona Ebner , qemu-stable@nongnu.org Subject: [PULL 03/16] ui/vdagent: add migration blocker when machine version < 10.1 Date: Tue, 17 Mar 2026 21:19:03 +0400 Message-ID: <20260317171916.438575-4-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768068356154100 From: Fiona Ebner In QEMU 10.1, commit 5d56bff11e ("ui/vdagent: add migration support") added migration support for the vdagent chardev and commit 42000e0013 ("ui/vdagent: remove migration blocker") removed the migration blocker. No compat for older machine versions was added, so migration with pre-10.1 machine version, from a 10.1 binary to a pre-10.1 binary will result in a failure when loading the VM state in the target instance: > Unknown savevm section or instance 'vdagent' 0. Make sure that your > current VM setup matches your saved VM setup, including any > hotplugged devices Add a compat flag to block migration when the machine version is less than 10.1 to avoid this. Cc: qemu-stable@nongnu.org Fixes: 42000e0013 ("ui/vdagent: remove migration blocker") Signed-off-by: Fiona Ebner Reviewed-by: Fabiano Rosas Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260310142552.240877-1-f.ebner@proxmox.com> --- hw/core/machine.c | 1 + ui/vdagent.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index a14ad05b9a6..6cf0e2f404e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -57,6 +57,7 @@ GlobalProperty hw_compat_10_0[] =3D { { "vfio-pci", "x-migration-load-config-after-iter", "off" }, { "ramfb", "use-legacy-x86-rom", "true"}, { "vfio-pci-nohotplug", "use-legacy-x86-rom", "true" }, + { "chardev-qemu-vdagent", "x-migration-blocked", "true" }, }; const size_t hw_compat_10_0_len =3D G_N_ELEMENTS(hw_compat_10_0); =20 diff --git a/ui/vdagent.c b/ui/vdagent.c index 5a5e4bf6818..bb0c4aa14ca 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -6,6 +6,8 @@ #include "qemu/option.h" #include "qemu/units.h" #include "hw/core/qdev.h" +#include "hw/core/qdev-properties.h" +#include "migration/blocker.h" #include "ui/clipboard.h" #include "ui/console.h" #include "ui/input.h" @@ -24,6 +26,10 @@ struct VDAgentChardev { Chardev parent; =20 + /* needed for machine versions < 10.1 when migration was not supported= */ + Error *migration_blocker; + bool migration_blocked; + /* config */ bool mouse; bool clipboard; @@ -657,6 +663,12 @@ static bool vdagent_chr_open(Chardev *chr, ChardevBack= end *backend, return false; #endif =20 + if (vd->migration_blocked) { + if (migrate_add_blocker(&vd->migration_blocker, errp) !=3D 0) { + return false; + } + } + vd->mouse =3D VDAGENT_MOUSE_DEFAULT; if (cfg->has_mouse) { vd->mouse =3D cfg->mouse; @@ -901,6 +913,19 @@ static void vdagent_chr_parse(QemuOpts *opts, ChardevB= ackend *backend, =20 /* ------------------------------------------------------------------ */ =20 +static bool get_migration_blocked(Object *o, Error **errp) +{ + VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(o); + return vd->migration_blocked; +} + +static void set_migration_blocked(Object *o, bool migration_blocked, + Error **errp) +{ + VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(o); + vd->migration_blocked =3D migration_blocked; +} + static void vdagent_chr_class_init(ObjectClass *oc, const void *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); @@ -910,6 +935,10 @@ static void vdagent_chr_class_init(ObjectClass *oc, co= nst void *data) cc->chr_write =3D vdagent_chr_write; cc->chr_set_fe_open =3D vdagent_chr_set_fe_open; cc->chr_accept_input =3D vdagent_chr_accept_input; + + object_class_property_add_bool(oc, "x-migration-blocked", + get_migration_blocked, + set_migration_blocked); } =20 static int post_load(void *opaque, int version_id) @@ -1064,10 +1093,26 @@ static void vdagent_chr_instance_init(Object *obj) vmstate_register_any(NULL, &vmstate_vdagent, vd); } =20 +static void vdagent_post_init(Object *obj) +{ + VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); + + object_apply_compat_props(obj); + + if (vd->migration_blocked) { + error_setg(&vd->migration_blocker, + "The vdagent chardev doesn't support migration with mac= hine" + " version less than 10.1"); + } +} + static void vdagent_chr_fini(Object *obj) { VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(obj); =20 + if (vd->migration_blocked) { + migrate_del_blocker(&vd->migration_blocker); + } vdagent_disconnect(vd); if (vd->mouse_hs) { qemu_input_handler_unregister(vd->mouse_hs); @@ -1080,6 +1125,7 @@ static const TypeInfo vdagent_chr_type_info =3D { .parent =3D TYPE_CHARDEV, .instance_size =3D sizeof(VDAgentChardev), .instance_init =3D vdagent_chr_instance_init, + .instance_post_init =3D vdagent_post_init, .instance_finalize =3D vdagent_chr_fini, .class_init =3D vdagent_chr_class_init, }; --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768088; cv=none; d=zohomail.com; s=zohoarc; b=MMQEwX84lIj65Ch9JPhKxZdnOiNa13lTothsDU+D4Eh9rYukIuTqnFxK53ntu0Ed6NBOmMJuWbi/qTGWxd9JlrUstOUW/Ilu5wWyhbZyGxWUuNpD/8SUZkUSe2/r4htPHy2svotm3XlM2cXk3fvC+kS0OtBvl/arvAfxjSxhFDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768088; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8h0sizqDRrWh4i0kVqCLWnQ1yrxi4rvEkqw6RMr/1k4=; b=VK/2ckrVnBMpSvjosWQ5YV3A+AsnDjxdz5/1O4h4vM6xRozqDJ+n3TzhDsWbypGfQgtJXtbJEI2EQF2F9v3wyOT/UlXSzilN0qOIxLhjYeR3nWZAX62yC1EKMqO+LsgkSfXKvssV0WKOcvVhunOAOzwCB8JfA8cPs1m/mJ0XzrQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768088930817.2490006092911; Tue, 17 Mar 2026 10:21:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5K-00020J-Pm; Tue, 17 Mar 2026 13:20:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5F-0001yd-Px for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5E-0005MF-Be for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:19:57 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-BMVKYw-lP2yzcljQnT6FrA-1; Tue, 17 Mar 2026 13:19:52 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DECE118005BD; Tue, 17 Mar 2026 17:19:50 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B6721800576; Tue, 17 Mar 2026 17:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773767994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8h0sizqDRrWh4i0kVqCLWnQ1yrxi4rvEkqw6RMr/1k4=; b=ekEYlOU6GhXU888HtJ//HzJOYZaw2QMwif5Rm+MzvdTJBUu1nOYZurH8ePRaceJhO8Zd81 /5+nNHnO2f8j6vFj9Qg5iRyXPG0+ltjGNVLCPTmHxd4AfTPSkBBG4rAp+dm5/QIpSTn7Gq WRhI2lRC+4gHm0Y/YIiJS5lCu3AWrtg= X-MC-Unique: BMVKYw-lP2yzcljQnT6FrA-1 X-Mimecast-MFC-AGG-ID: BMVKYw-lP2yzcljQnT6FrA_1773767991 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 04/16] virtio-gpu: fix overflow check when allocating 2d image Date: Tue, 17 Mar 2026 21:19:04 +0400 Message-ID: <20260317171916.438575-5-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768091039158500 From: Marc-Andr=C3=A9 Lureau The calc_image_hostmem() comment says pixman_image_create_bits() checks for overflow. However, this relied on the facts that "bits" was NULL and it performed it when it was introduced. Since commit 9462ff4695aa, the "bits" argument can be provided and the check is no longer applied. Promotes the computation to uint64_t and adds an explicit overflow check to avoid potential later OOB read/write on the image data. Fixes: CVE-2026-3886 Fixes: ZDI-CAN-27578 Fixes: 9462ff4695aa ("virtio-gpu/win32: allocate shareable 2d resources/ima= ges") Reported-by: Zero Day Initiative Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Message-Id: <20260311-cve-v1-1-f72b4c7c1ab2@redhat.com> --- hw/display/virtio-gpu.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index de7a86a73d2..468ea6ab0fb 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -227,16 +227,20 @@ void virtio_gpu_get_edid(VirtIOGPU *g, virtio_gpu_ctrl_response(g, cmd, &edid.hdr, sizeof(edid)); } =20 -static uint32_t calc_image_hostmem(pixman_format_code_t pformat, - uint32_t width, uint32_t height) +static bool calc_image_hostmem(pixman_format_code_t pformat, + uint32_t width, uint32_t height, + uint32_t *hostmem) { - /* Copied from pixman/pixman-bits-image.c, skip integer overflow check. - * pixman_image_create_bits will fail in case it overflow. - */ + uint64_t bpp =3D PIXMAN_FORMAT_BPP(pformat); + uint64_t stride =3D (((uint64_t)width * bpp + 0x1f) >> 5) * sizeof(uin= t32_t); + uint64_t size =3D (uint64_t)height * stride; =20 - int bpp =3D PIXMAN_FORMAT_BPP(pformat); - int stride =3D ((width * bpp + 0x1f) >> 5) * sizeof(uint32_t); - return height * stride; + if (size > UINT32_MAX) { + return false; + } + + *hostmem =3D size; + return true; } =20 static void virtio_gpu_resource_create_2d(VirtIOGPU *g, @@ -246,6 +250,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, pixman_format_code_t pformat; struct virtio_gpu_simple_resource *res; struct virtio_gpu_resource_create_2d c2d; + uint32_t hostmem; =20 VIRTIO_GPU_FILL_CMD(c2d); virtio_gpu_bswap_32(&c2d, sizeof(c2d)); @@ -284,7 +289,12 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, return; } =20 - res->hostmem =3D calc_image_hostmem(pformat, c2d.width, c2d.height); + if (!calc_image_hostmem(pformat, c2d.width, c2d.height, &hostmem)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: image dimensions overflow\n", + __func__); + goto end; + } + res->hostmem =3D hostmem; if (res->hostmem + g->hostmem < g->conf_max_hostmem) { if (!qemu_pixman_image_new_shareable( &res->image, @@ -1292,7 +1302,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, VirtIOGPU *g =3D opaque; Error *err =3D NULL; struct virtio_gpu_simple_resource *res; - uint32_t resource_id, pformat; + uint32_t resource_id, pformat, hostmem; int i, ret; =20 g->hostmem =3D 0; @@ -1318,7 +1328,11 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque= , size_t size, return -EINVAL; } =20 - res->hostmem =3D calc_image_hostmem(pformat, res->width, res->heig= ht); + if (!calc_image_hostmem(pformat, res->width, res->height, &hostmem= )) { + g_free(res); + return -EINVAL; + } + res->hostmem =3D hostmem; if (!qemu_pixman_image_new_shareable(&res->image, &res->share_handle, "virtio-gpu res", --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768042; cv=none; d=zohomail.com; s=zohoarc; b=OhE9mhqNlZKGlEJyTrxVtCEJ8hdssa146zeNLQ04eaSuwZfGURmfj4mjb/U8UYyU7JRiPjt9lN97BlFtdebXBkBdHnYVFtKAGEdyCADv+65dpnlSBDq5ClhxWswQhE5Vy4IBp7t+71SqGFHoyFxwJPlQUPDWMNxuUVVP3UxKVeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768042; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QK4arTFAt+/iC6WBUuTOJKFd3Oz0W2dHfZqKVMJNBFI=; b=jOiLbVAPueZLnTx07wp2svxOTg+B3Xu/kmTNRo912gmLnBOOOx1KSlQnY86M3uEGUKtoQA6uREkosc3o2qFgsKqfHr3EKJOxJXV6JYegFPBC9scpk6R4i6rIO63Q/6zDIU6D5t4CTjbNR3RJAkbaW6OYueCqWpsgSKkWw8g+dTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768042748702.4743798475171; Tue, 17 Mar 2026 10:20:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5O-000218-Mr; Tue, 17 Mar 2026 13:20:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5M-00020m-UF for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5L-0005Nx-Bs for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:04 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-bVvGmpscPqyNfpP8IA2nlA-1; Tue, 17 Mar 2026 13:19:59 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5F72A19560AE; Tue, 17 Mar 2026 17:19:57 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D5E11955F19; Tue, 17 Mar 2026 17:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QK4arTFAt+/iC6WBUuTOJKFd3Oz0W2dHfZqKVMJNBFI=; b=DFEo1For+QiMf0fPZ6JN/ZfQZiWKmrHbDb2/9NyV1pilIR4PrgxomZhq7lGNoIAcGFXZ+e T5JH477Oo6w3Vg8syrtGTpcOTxZmWBkslWddOKppsuaNgCcic8S6Raq1/+bQbkFPZ3L6d0 SXJOwCwv0/efjhTspVHpeNA1E/vZA/k= X-MC-Unique: bVvGmpscPqyNfpP8IA2nlA-1 X-Mimecast-MFC-AGG-ID: bVvGmpscPqyNfpP8IA2nlA_1773767997 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 05/16] virtio-gpu: use computed rowstride instead of deriving it from hostmem Date: Tue, 17 Mar 2026 21:19:05 +0400 Message-ID: <20260317171916.438575-6-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768043947154100 From: Marc-Andr=C3=A9 Lureau Since calc_image_hostmem() already computes the stride, return it and use it directly. This is both simpler and more correct. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Message-Id: <20260311-cve-v1-2-f72b4c7c1ab2@redhat.com> --- hw/display/virtio-gpu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 468ea6ab0fb..b998ce8324d 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -229,7 +229,7 @@ void virtio_gpu_get_edid(VirtIOGPU *g, =20 static bool calc_image_hostmem(pixman_format_code_t pformat, uint32_t width, uint32_t height, - uint32_t *hostmem) + uint32_t *hostmem, uint32_t *rowstride_byte= s) { uint64_t bpp =3D PIXMAN_FORMAT_BPP(pformat); uint64_t stride =3D (((uint64_t)width * bpp + 0x1f) >> 5) * sizeof(uin= t32_t); @@ -240,6 +240,7 @@ static bool calc_image_hostmem(pixman_format_code_t pfo= rmat, } =20 *hostmem =3D size; + *rowstride_bytes =3D stride; return true; } =20 @@ -250,7 +251,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, pixman_format_code_t pformat; struct virtio_gpu_simple_resource *res; struct virtio_gpu_resource_create_2d c2d; - uint32_t hostmem; + uint32_t hostmem, rowstride_bytes; =20 VIRTIO_GPU_FILL_CMD(c2d); virtio_gpu_bswap_32(&c2d, sizeof(c2d)); @@ -289,7 +290,8 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, return; } =20 - if (!calc_image_hostmem(pformat, c2d.width, c2d.height, &hostmem)) { + if (!calc_image_hostmem(pformat, c2d.width, c2d.height, + &hostmem, &rowstride_bytes)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: image dimensions overflow\n", __func__); goto end; @@ -303,7 +305,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, pformat, c2d.width, c2d.height, - c2d.height ? res->hostmem / c2d.height : 0, + rowstride_bytes, &err)) { warn_report_err(err); goto end; @@ -1302,7 +1304,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, VirtIOGPU *g =3D opaque; Error *err =3D NULL; struct virtio_gpu_simple_resource *res; - uint32_t resource_id, pformat, hostmem; + uint32_t resource_id, pformat, hostmem, rowstride_bytes; int i, ret; =20 g->hostmem =3D 0; @@ -1328,7 +1330,8 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, return -EINVAL; } =20 - if (!calc_image_hostmem(pformat, res->width, res->height, &hostmem= )) { + if (!calc_image_hostmem(pformat, res->width, res->height, + &hostmem, &rowstride_bytes)) { g_free(res); return -EINVAL; } @@ -1339,7 +1342,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, pformat, res->width, res->height, - res->height ? res->hostmem / = res->height : 0, + rowstride_bytes, &err)) { warn_report_err(err); g_free(res); --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768039; cv=none; d=zohomail.com; s=zohoarc; b=gVl0jpvM6WBPgaaE+IbHiJkLfybJ76L5KElw6mxwgJ0TvfzE9QWie0Y3iDU+lOvoikPN8z8oacAiAO0B0z63ZsSnTJFiJAlNXrwDFE3c5m/0L5erFXfiiIF47KZdjkkbjRH36TVW67FhbW24khk6cCECTI3WXeHa1x87GCGANEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768039; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t8u602C9Q/wNZVt3luVyi3m3X/+imtMU6KMp7n4fBEI=; b=loorIXsbsOP/179yZvGEypIcUJG+P/CLEIGgxqj/sqx2WXMYGsUajZWK+Ib9ugxAQydsKT3bIdJxJCUXMZCb9U4i8xISAeNT4Q1kdfqln5ILEYbA8u7xSU4hPWyqAxBUpyreiFxrE8u3694GQyG5aIk1DU+Rgs1kIZqNH95Q/ZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768039865315.6266190307333; Tue, 17 Mar 2026 10:20:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5i-00026z-GI; Tue, 17 Mar 2026 13:20:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5Y-00026X-Pb for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5T-0005OX-4Q for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:12 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-EaFiaUvRMEik3He9zj8DYg-1; Tue, 17 Mar 2026 13:20:06 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E4582195608E; Tue, 17 Mar 2026 17:20:04 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 16DC11955F19; Tue, 17 Mar 2026 17:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t8u602C9Q/wNZVt3luVyi3m3X/+imtMU6KMp7n4fBEI=; b=I5+roBM+8Iy6Izau8uToMh8BMxLf9ZOpnBxPBv3fKltIix/BmHf/dexb5m3M3FP8yd1mqS 9TdKW+VYMHejKGGDfd7eMMknxj9BF3VGVmis1il7esLfr4UPe2HEs25IR8kQoO2KmqoNNM fi3wikhh2J3BTAxgwZdwqrkdfcYm9KY= X-MC-Unique: EaFiaUvRMEik3He9zj8DYg-1 X-Mimecast-MFC-AGG-ID: EaFiaUvRMEik3He9zj8DYg_1773768005 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 06/16] ui/dbus-listener: Fix FBO leak in dbus_cursor_dmabuf Date: Tue, 17 Mar 2026 21:19:06 +0400 Message-ID: <20260317171916.438575-7-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768042068154100 From: Marc-Andr=C3=A9 Lureau cursor_fb is a local egl_fb that gets an FBO allocated via egl_fb_setup_for_tex but is never destroyed, leaking the framebuffer object on every cursor update. Add egl_fb_destroy() after the cursor data has been read. Fixes: commit 142ca628a7 ("ui: add a D-Bus display backend") Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/dbus-listener.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 3e2b4adf41f..fff7cf83274 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -660,6 +660,7 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *d= cl, egl_fb_setup_for_tex(&cursor_fb, width, height, texture, false); ds =3D qemu_create_displaysurface(width, height); egl_fb_read(ds, &cursor_fb); + egl_fb_destroy(&cursor_fb); =20 v_data =3D g_variant_new_from_data( G_VARIANT_TYPE("ay"), --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768089; cv=none; d=zohomail.com; s=zohoarc; b=Aw0YAWB/NIkkAtEmIi3Amc+1HVoIquXRzQUiJnbEWL4mKEDHFmY+XU061oJloLWQCdv0jXbmQKmort1jUjq8o05mRzxlRWQ0Npl+mhx9rk4tFpkni4X4etZBvokzlpSYERtKf6ArRyzv0ODndinu53p5SEEs+XoHNBQTAdRMjhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768089; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KtJP/jguIFKde9rRUJ0UbrChrFZ64Us15Ltb92pQXtM=; b=f9tM+HjN3xQlUvnVxmCPSvxivblZBopz2st6Q19LGbsqiOXok+H+bqF8NEGSS703dz7jgMseTK1T/g87RRsUPCwD9xfRs8Y0wKFgkHclD10k/fHlUMPpeKBRUPjrMxLm21X1AnsfNnj8QKD7pO8I26FuIoNDODjWr5SENKS91/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768089577966.9119067866394; Tue, 17 Mar 2026 10:21:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5n-0002D7-2m; Tue, 17 Mar 2026 13:20:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5a-00026l-Tx for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5Y-0005Zy-TC for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:18 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-c0E0R4mfOt6dkVMVAhA66Q-1; Tue, 17 Mar 2026 13:20:12 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3842F18002CD; Tue, 17 Mar 2026 17:20:11 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77162180075D; Tue, 17 Mar 2026 17:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KtJP/jguIFKde9rRUJ0UbrChrFZ64Us15Ltb92pQXtM=; b=YIBKG6XOaF3jTfMRSTcssw6TqDowkehqYdgQDxZ/ceeUbfzEta5+OPh/YWSu7zept0PjRt Vw5+lGWvQhkYWFWhAieqxGkH20IXQZgWRQbDdd3VNBEtBPYjIJNmZJOGpdZEAqLlFhji+g jy9b5WEI8GtUvPbR5Dil6RTi9P1WkHk= X-MC-Unique: c0E0R4mfOt6dkVMVAhA66Q-1 X-Mimecast-MFC-AGG-ID: c0E0R4mfOt6dkVMVAhA66Q_1773768011 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 07/16] ui/dbus-listener: remove dbus_filter on connection close Date: Tue, 17 Mar 2026 21:19:07 +0400 Message-ID: <20260317171916.438575-8-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768091014158500 From: Marc-Andr=C3=A9 Lureau The dbus filter holds a strong reference to the DBusDisplayListener (via GDestroyNotify) to ensure the listener remains alive while the filter may still be running in another thread. This creates a reference cycle (ddl -> conn -> filter -> ddl) that prevents the listener from being freed. Break the cycle by connecting to the connection's "closed" signal and removing the filter when the connection closes. Fixes: commit fa88b85dea96 ("ui/dbus: filter out pending messages when scan= out") Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/dbus-listener.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index fff7cf83274..37945236e11 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -1181,6 +1181,20 @@ static void dbus_display_listener_setup_scanout_dmab= uf_v2(DBusDisplayListener *d #endif } =20 +static void +dbus_conn_closed(GDBusConnection *conn, + gboolean remote_peer_vanished, + GError *error, + gpointer user_data) +{ + DBusDisplayListener *ddl =3D DBUS_DISPLAY_LISTENER(user_data); + + if (ddl->dbus_filter) { + g_dbus_connection_remove_filter(ddl->conn, ddl->dbus_filter); + ddl->dbus_filter =3D 0; + } +} + static GDBusMessage * dbus_filter(GDBusConnection *connection, GDBusMessage *message, @@ -1262,6 +1276,7 @@ dbus_display_listener_new(const char *bus_name, } =20 ddl->dbus_filter =3D g_dbus_connection_add_filter(conn, dbus_filter, g= _object_ref(ddl), g_object_unref); + g_signal_connect(conn, "closed", G_CALLBACK(dbus_conn_closed), ddl); ddl->bus_name =3D g_strdup(bus_name); ddl->conn =3D conn; ddl->console =3D console; --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768111; cv=none; d=zohomail.com; s=zohoarc; b=Qou5BaeRC1ApxcKPwDYfXeUqGDoMfhp+BsLsJKZTvFGjNJjXDEyHMzYnQy8BlhLKrhn6gJqGVAVbH1JMVKXy6umV9uq3BbqQLJETSKOC1ge5msKzWXun4dXGhjw9ObjXYapKaIw2BlddJ+3GT7VLGQ2soTtYTzXU67AkOOo0r0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768111; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CsXxg8re8FW5F+2kVJ5NcmGqhrD7GcwxsyzUaPHGSsI=; b=Oh1tliw0ZHkzt4FB7VxHv2DSlK7lxQ6Zy7HJkdztiSW+ukAnID3eNVs0fMvO80mJDDcwMyfev6pxGRB9A+X25u7kQDgdV6+hkwoolf0vd9rWbJh5ZVITf7DuROMnOQP9xsUArsheKTQb8lKjYG5UfF74KvnUqSrszsWTeCncnvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768111093147.78094735907166; Tue, 17 Mar 2026 10:21:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y5u-0002E1-1A; Tue, 17 Mar 2026 13:20:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5k-0002Ac-CS for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5g-0005bO-1O for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:25 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-nG3ESCm4M7yA8SUYnQNjIQ-1; Tue, 17 Mar 2026 13:20:18 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C27EC195607B; Tue, 17 Mar 2026 17:20:16 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 40123180035F; Tue, 17 Mar 2026 17:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CsXxg8re8FW5F+2kVJ5NcmGqhrD7GcwxsyzUaPHGSsI=; b=IXdO6NlWJ7RvfmJgQ2xfheHeYWC/HA4jOZmTtDp8rlnaHsm7Qu40gCDWN7/yiWk8iPzXX7 CJTbVlUcQ6eW2R4io4deYz1nzeo3rS11t53UcCeGEMxHo1NXEDh0OJpyeoLrjjYsz8BHOs McpSRXHIv4dCJsDfanwy/ufndJhLtI4= X-MC-Unique: nG3ESCm4M7yA8SUYnQNjIQ-1 X-Mimecast-MFC-AGG-ID: nG3ESCm4M7yA8SUYnQNjIQ_1773768016 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki , Dongwon Kim , Vivek Kasireddy Subject: [PULL 08/16] ui/gtk-egl: Ensure EGL surface is available before drawing Date: Tue, 17 Mar 2026 21:19:08 +0400 Message-ID: <20260317171916.438575-9-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768112951154100 From: Dongwon Kim The EGL surface and context are destroyed when a new GTK window is created. We must ensure these are recreated and initialized before any rendering happens in gd_egl_refresh. Currently, the check for a pending draw is performed before the surface initialization block. This can result in an attempt to draw when the EGL surface (vc->gfx.esurface) is not yet available. This patch moves the drawing check after the surface initialization to ensure a valid surface exists before rendering in gd_egl_refresh. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Vivek Kasireddy Signed-off-by: Dongwon Kim Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260303011151.1925827-1-dongwon.kim@intel.com> --- ui/gtk-egl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 1b5c1d4533c..fa8fe8970c1 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -152,12 +152,6 @@ void gd_egl_refresh(DisplayChangeListener *dcl) gd_update_monitor_refresh_rate( vc, vc->window ? vc->window : vc->gfx.drawing_area); =20 - if (vc->gfx.guest_fb.dmabuf && - qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { - gd_egl_draw(vc); - return; - } - if (!vc->gfx.esurface) { gd_egl_init(vc); if (!vc->gfx.esurface) { @@ -176,6 +170,12 @@ void gd_egl_refresh(DisplayChangeListener *dcl) #endif } =20 + if (vc->gfx.guest_fb.dmabuf && + qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { + gd_egl_draw(vc); + return; + } + graphic_hw_update(dcl->con); =20 if (vc->gfx.glupdates) { --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768135; cv=none; d=zohomail.com; s=zohoarc; b=jX28IskA5akc8TD4Gd4m5SkBL/6l+qWigkA8afzvsEJmvrKnOE5q0h07WKkpNEHR0cJzXCIVYUMe7bn07BZ9WZ9My+/iD68+YsHPrExj58y8Mag68LSdTs9GEYDMQiCaZ/g43mA87VAye2Cih2RERUqiRmQq4rx9K7cxWOg86Ss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768135; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hVzOsw3MIOOt+Jv9iKjr4crwzYrAKdjgklNI5FGLsLk=; b=EWLPvd+JiE7UfG1k3Yy5Sa33hBvMbxgDKceCCoU8k13YKPc+YlsHjzr1meGfx3DMzujVY6oNU+ehWQAOElPBQUvKiFM8XK+P+36G08KBm/gPM25JS69nNLf54aOegPj/01ECIoAuf6mNMc/PX8vxtqSt/ilunFVMgIOfJCFYcXY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768135413616.5288071726914; Tue, 17 Mar 2026 10:22:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6L-0002nm-4H; Tue, 17 Mar 2026 13:21:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5y-0002Qo-CI for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5m-0005c5-A2 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:31 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-TahFKnq_P2uFQFlh5I6e-g-1; Tue, 17 Mar 2026 13:20:25 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48E0D1956094; Tue, 17 Mar 2026 17:20:23 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 639E730001A1; Tue, 17 Mar 2026 17:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hVzOsw3MIOOt+Jv9iKjr4crwzYrAKdjgklNI5FGLsLk=; b=V0sHPS0Qp0IMpUEmnAkMM2bk68/A1l5vM5JgwKUzsN2q6tq+hvPLmwuRbuU7Lj3TYnukPm SR35agb8H3ssXwOoVykrxpYt2W3gWfUftoNoffnH1H7SqZMWXOMUD4puYmemd4eloBV4Vu L3rWC0oEUGIdPi1+9XKhppGf69Jj/rQ= X-MC-Unique: TahFKnq_P2uFQFlh5I6e-g-1 X-Mimecast-MFC-AGG-ID: TahFKnq_P2uFQFlh5I6e-g_1773768023 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki , Nikolai Barybin Subject: [PULL 09/16] dump: enhance dump_state_prepare fd initialization Date: Tue, 17 Mar 2026 21:19:09 +0400 Message-ID: <20260317171916.438575-10-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768137310158501 From: Nikolai Barybin Initializing descriptor with zero is unsafe: during cleanup we risk to unconditional close of fd =3D=3D 0 in case dump state wasn't fully initialized. Thus, let's init fd with -1 value and check its value before closing it. Signed-off-by: Nikolai Barybin Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20250911123656.413160-2-nikolai.barybin@virtuozzo.com> --- dump/dump.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 80ed6c8d219..1f216e74f5f 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -104,7 +104,10 @@ static int dump_cleanup(DumpState *s) =20 guest_phys_blocks_free(&s->guest_phys_blocks); memory_mapping_list_free(&s->list); - close(s->fd); + if (s->fd !=3D -1) { + close(s->fd); + } + s->fd =3D -1; g_free(s->guest_note); g_clear_pointer(&s->string_table_buf, g_array_unref); s->guest_note =3D NULL; @@ -1709,8 +1712,8 @@ static DumpState dump_state_global =3D { .status =3D = DUMP_STATUS_NONE }; =20 static void dump_state_prepare(DumpState *s) { - /* zero the struct, setting status to active */ - *s =3D (DumpState) { .status =3D DUMP_STATUS_ACTIVE }; + /* zero the struct, setting status to active and fd to -1 */ + *s =3D (DumpState) { .fd =3D -1, .status =3D DUMP_STATUS_ACTIVE }; } =20 bool qemu_system_dump_in_progress(void) --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768072; cv=none; d=zohomail.com; s=zohoarc; b=Hc1QMDeWujicmrqOV1CY1tPDo7iEHp3Tmxti+X2VcUPPXqvLWH8oYnrwGqAELSBAJy13y4t90Q5eYdXYjKRSrba5czlBV52wiDWtPBCF9DBrWIMQcClS+xf6tfBNTZ1gxKuVRkHXfN+84/mUyyf16IpxOIbGWN1TsCmeyIOJeLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768072; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7QOJFna4uS6y0l2Y//8zT9IKmV+9rc6k0M7hg1PiLWI=; b=gUEsk+pN3GvOgTeQuTZlSSqcFh1Brxg10lUK5mIChGNL239a/Qb/PElh4pHQ6+EaXRLzPXz29sq/rD2vvH7b1TkB5lRQrqDnWjod6Rs7DVp85gJaIea9+myK1TJuJ+gigY/QXriRVImNC+wVX1g6aCLh9cDsJMaYTPmtXvGxqiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768072051844.0877417622429; Tue, 17 Mar 2026 10:21:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6F-0002d2-5N; Tue, 17 Mar 2026 13:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5z-0002RP-UN for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5y-0005cM-4a for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:43 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-377-uXL8NLHVNOaj0PsClM_3kA-1; Tue, 17 Mar 2026 13:20:30 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9456B19560B5; Tue, 17 Mar 2026 17:20:28 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 922F430001A1; Tue, 17 Mar 2026 17:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7QOJFna4uS6y0l2Y//8zT9IKmV+9rc6k0M7hg1PiLWI=; b=CNJbTVQMeDxh5Q7WC7tGnKdu/1uRXSdSwVPg6sBWFKnZUqz9Y3gorE7lCsCUINSEpuoxMn b7h0RLTh0h8wXVdE9vUbRvPOyTcAysDMYG5xVBd8+hK+RpGfb42s2NGeOojBGyiml44dwo VWkHaJLWMMe/tzyW29XK8qLCTiFVcyM= X-MC-Unique: uXL8NLHVNOaj0PsClM_3kA-1 X-Mimecast-MFC-AGG-ID: uXL8NLHVNOaj0PsClM_3kA_1773768028 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 10/16] ui/console: Unify pixman-OpenGL format mapping Date: Tue, 17 Mar 2026 21:19:10 +0400 Message-ID: <20260317171916.438575-11-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768074423154100 From: Akihiko Odaki console_gl_check_format() was supposed to check if the pixman format is supported by surface_gl_create_texture(), but it missed PIXMAN_BE_x8r8g8b8 and PIXMAN_BE_a8r8g8b8, which are properly mapped to OpenGL formats by surface_gl_create_texture(). Fix the discrepancy of the two functions by sharing the code to map pixman formats to OpenGL ones. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260303-gl-v1-1-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> --- ui/console-gl.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ui/console-gl.c b/ui/console-gl.c index 403fc36fbdf..22e9787c415 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -31,19 +31,38 @@ =20 /* ---------------------------------------------------------------------- = */ =20 -bool console_gl_check_format(DisplayChangeListener *dcl, - pixman_format_code_t format) +static bool map_format(pixman_format_code_t format, + GLenum *glformat, GLenum *gltype) { switch (format) { case PIXMAN_BE_b8g8r8x8: case PIXMAN_BE_b8g8r8a8: + *glformat =3D GL_BGRA_EXT; + *gltype =3D GL_UNSIGNED_BYTE; + return true; + case PIXMAN_BE_x8r8g8b8: + case PIXMAN_BE_a8r8g8b8: + *glformat =3D GL_RGBA; + *gltype =3D GL_UNSIGNED_BYTE; + return true; case PIXMAN_r5g6b5: + *glformat =3D GL_RGB; + *gltype =3D GL_UNSIGNED_SHORT_5_6_5; return true; default: return false; } } =20 +bool console_gl_check_format(DisplayChangeListener *dcl, + pixman_format_code_t format) +{ + GLenum glformat; + GLenum gltype; + + return map_format(format, &glformat, &gltype); +} + void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface) { @@ -54,25 +73,7 @@ void surface_gl_create_texture(QemuGLShader *gls, return; } =20 - switch (surface_format(surface)) { - case PIXMAN_BE_b8g8r8x8: - case PIXMAN_BE_b8g8r8a8: - surface->glformat =3D GL_BGRA_EXT; - surface->gltype =3D GL_UNSIGNED_BYTE; - break; - case PIXMAN_BE_x8r8g8b8: - case PIXMAN_BE_a8r8g8b8: - surface->glformat =3D GL_RGBA; - surface->gltype =3D GL_UNSIGNED_BYTE; - break; - case PIXMAN_r5g6b5: - surface->glformat =3D GL_RGB; - surface->gltype =3D GL_UNSIGNED_SHORT_5_6_5; - break; - default: - g_assert_not_reached(); - } - + assert(map_format(surface_format(surface), &surface->glformat, &surfac= e->gltype)); glGenTextures(1, &surface->texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, surface->texture); --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768098; cv=none; d=zohomail.com; s=zohoarc; b=Pp6MR4kPnQyy2AqpeNWAfwIf+vb0iG21rQWPqDt1KogPUyhihg1eUTKTSBolfqx0yY62XgjbofNOBLws5rYGqi1t1qGsmDEUGcM5BwXSAKEDZEWLxqCh6srSTC5qaYNcTxHAq9zrqCsC7wUpfxLqefzw/subI8LzTxYnWxIazk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768098; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QQI/w+zr0ImkWaMScB8CdNpb8d18t6S6VN1q82FOZO8=; b=dYbeY43HGBwGC1syWeWTN2xbdzKGdRPdLnSa68PeoTUtpJ5oj7WDHBpj3UMEGgt3Bn2IqhMpZd8qyUSelmkX6q593ZfEeUHhtfmmUhsLgRnpbk7I0oIbrxfbJp7wp+ygKuoTuSEjbrd6KuAlneNCHSuNnoVfC6mOkKuQR8DMx0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768098479633.2168806814466; Tue, 17 Mar 2026 10:21:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6A-0002bZ-BF; Tue, 17 Mar 2026 13:20:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y60-0002RR-At for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5y-0005cb-5w for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:44 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-511-xOHd23MFM7SdRTFXGMDQpQ-1; Tue, 17 Mar 2026 13:20:36 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 08BA11956048; Tue, 17 Mar 2026 17:20:35 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EEBDD19560AB; Tue, 17 Mar 2026 17:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QQI/w+zr0ImkWaMScB8CdNpb8d18t6S6VN1q82FOZO8=; b=As13OvVvsFvRUB7S75OLI1J/wVeHC6nxqwfbfIpxXoUhXiPveZOxNdWFCmsv4Cbs6iRM6a Z3GbqklOEeFBmcAgNTTLYH4eUOYUYZFVp7xsLAQ/g2eBd8uh9CvieJ24/UqLz0W+pHbg50 PX7p5NGD0XvmtFYz8b087s1wm59H1W4= X-MC-Unique: xOHd23MFM7SdRTFXGMDQpQ-1 X-Mimecast-MFC-AGG-ID: xOHd23MFM7SdRTFXGMDQpQ_1773768035 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 11/16] ui/console: Remove DisplaySurface::mem_obj Date: Tue, 17 Mar 2026 21:19:11 +0400 Message-ID: <20260317171916.438575-12-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768099063158500 From: Akihiko Odaki Only spice uses it so move it to spice. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260303-gl-v1-2-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> --- include/ui/spice-display.h | 1 + include/ui/surface.h | 1 - ui/console-gl.c | 6 ------ ui/spice-display.c | 9 ++++++++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 690ece73801..a382553fa8e 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -121,6 +121,7 @@ struct SimpleSpiceDisplay { QEMUBH *gl_unblock_bh; QEMUTimer *gl_unblock_timer; QemuGLShader *gls; + GLuint gl_surface_mem_obj; int gl_updates; bool have_scanout; bool have_surface; diff --git a/include/ui/surface.h b/include/ui/surface.h index 006b1986bb9..f16f7be8be8 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -22,7 +22,6 @@ typedef struct DisplaySurface { GLenum glformat; GLenum gltype; GLuint texture; - GLuint mem_obj; #endif qemu_pixman_shareable share_handle; uint32_t share_handle_offset; diff --git a/ui/console-gl.c b/ui/console-gl.c index 22e9787c415..73be35c1fc7 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -185,12 +185,6 @@ void surface_gl_destroy_texture(QemuGLShader *gls, } glDeleteTextures(1, &surface->texture); surface->texture =3D 0; -#ifdef GL_EXT_memory_object_fd - if (surface->mem_obj) { - glDeleteMemoryObjectsEXT(1, &surface->mem_obj); - surface->mem_obj =3D 0; - } -#endif } =20 void surface_gl_setup_viewport(QemuGLShader *gls, diff --git a/ui/spice-display.c b/ui/spice-display.c index 5052f371f44..87cc193cdee 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -950,7 +950,14 @@ static bool spice_gl_replace_fd_texture(SimpleSpiceDis= play *ssd, } else { surface_gl_destroy_texture(ssd->gls, ssd->ds); ssd->ds->texture =3D texture; - ssd->ds->mem_obj =3D mem_obj; + +#ifdef GL_EXT_memory_object_fd + if (ssd->gl_surface_mem_obj) { + glDeleteMemoryObjectsEXT(1, &ssd->gl_surface_mem_obj); + } + + ssd->gl_surface_mem_obj =3D mem_obj; +#endif } return ret; } --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768084; cv=none; d=zohomail.com; s=zohoarc; b=KMsGZZXR8TAPr3pIueiBsgji6yZJQdk7TBai+hqK8eWDLq9UvM7Y1Ll5RQ4EMvH6ZYirsb4dvCXMQ/95dV1miUgiJzvfwfWyOIFuB8ibaPOmhFodl806DHEcyA+b+vIlHeE7pt2Q3WxlQFRLJxTJTm7x/wMTBek52k9Fn8P2+Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768084; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5rR90AFdo1Am/JLo89PgA9Iv5kx1gqs6R7n5iAEgk20=; b=CFls+EaZfRgWCAA2XF+TcSPUizEXVEnUOxKIK30QTn8vgYRTF9kB1VKibGfOknk2RfqCMftq3HpkLttYtb9Cdj0a+QBjUVIsHhCErDw8ZmOvRa94Mh0VqIIJkOQmcyLEtqL1o/JEr5/QbuOEY+v2IQX7yzc4aQSZEzgLS4UJ38E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768084263944.3239301424105; Tue, 17 Mar 2026 10:21:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6L-0002nr-47; Tue, 17 Mar 2026 13:21:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y68-0002an-4N for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y66-0005dl-8A for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:51 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-281-0kv6Y4hdPsu58QUQYHrU3A-1; Tue, 17 Mar 2026 13:20:44 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE6791944EAA; Tue, 17 Mar 2026 17:20:42 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 584A830002C3; Tue, 17 Mar 2026 17:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5rR90AFdo1Am/JLo89PgA9Iv5kx1gqs6R7n5iAEgk20=; b=CdiqFOUXAf2/Bu+2CwrCERyftBmZZxzTHJxsnAKTzYpVdevrpS2QqtmAu8Xl0AiHWriMDj 5cJ1J6pIFdZWp4uMJZkt3mk7Fam9f6owiTOzEX43d+EnOF0foSY/j6La4PRMpTmuISK/19 n0CoAJ4nbe3DW0xIAYEY5drGHUhYvhc= X-MC-Unique: 0kv6Y4hdPsu58QUQYHrU3A-1 X-Mimecast-MFC-AGG-ID: 0kv6Y4hdPsu58QUQYHrU3A_1773768042 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 12/16] ui/surface: Avoid including epoxy/gl.h in header files Date: Tue, 17 Mar 2026 21:19:12 +0400 Message-ID: <20260317171916.438575-13-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768084950158500 From: Akihiko Odaki include/ui/shader.h and include/ui/surface.h are included by files that do not depend on Epoxy so they shouldn't include epoxy/gl.h. Otherwise, compilations of these files can fail because the path to the directory containing epoxy/gl.h may not be passed to the compiler. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260303-gl-v1-3-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> --- include/ui/console.h | 4 ++-- include/ui/shader.h | 2 -- include/ui/surface.h | 5 +---- ui/console-gl.c | 27 ++++++++++++++------------- ui/shader.c | 1 + 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 3677a9d334d..08082389f71 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -423,8 +423,8 @@ bool console_gl_check_format(DisplayChangeListener *dcl, void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface); bool surface_gl_create_texture_from_fd(DisplaySurface *surface, - int fd, GLuint *texture, - GLuint *mem_obj); + int fd, uint32_t *texture, + uint32_t *mem_obj); void surface_gl_update_texture(QemuGLShader *gls, DisplaySurface *surface, int x, int y, int w, int h); diff --git a/include/ui/shader.h b/include/ui/shader.h index 4c5acb2ce8b..e82213263c4 100644 --- a/include/ui/shader.h +++ b/include/ui/shader.h @@ -1,8 +1,6 @@ #ifndef QEMU_SHADER_H #define QEMU_SHADER_H =20 -#include - typedef struct QemuGLShader QemuGLShader; =20 void qemu_gl_run_texture_blit(QemuGLShader *gls, bool flip); diff --git a/include/ui/surface.h b/include/ui/surface.h index f16f7be8be8..d2542d3ace5 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -8,7 +8,6 @@ #include "ui/qemu-pixman.h" =20 #ifdef CONFIG_OPENGL -# include # include "ui/shader.h" #endif =20 @@ -19,9 +18,7 @@ typedef struct DisplaySurface { pixman_image_t *image; uint8_t flags; #ifdef CONFIG_OPENGL - GLenum glformat; - GLenum gltype; - GLuint texture; + uint32_t texture; #endif qemu_pixman_shareable share_handle; uint32_t share_handle_offset; diff --git a/ui/console-gl.c b/ui/console-gl.c index 73be35c1fc7..d4b9017b53d 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include #include "qemu/error-report.h" #include "ui/console.h" #include "ui/shader.h" @@ -66,6 +67,9 @@ bool console_gl_check_format(DisplayChangeListener *dcl, void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface) { + GLenum glformat; + GLenum gltype; + assert(gls); assert(QEMU_IS_ALIGNED(surface_stride(surface), surface_bytes_per_pixe= l(surface))); =20 @@ -73,7 +77,7 @@ void surface_gl_create_texture(QemuGLShader *gls, return; } =20 - assert(map_format(surface_format(surface), &surface->glformat, &surfac= e->gltype)); + assert(map_format(surface_format(surface), &glformat, &gltype)); glGenTextures(1, &surface->texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, surface->texture); @@ -81,16 +85,12 @@ void surface_gl_create_texture(QemuGLShader *gls, surface_stride(surface) / surface_bytes_per_pixel(surfac= e)); if (epoxy_is_desktop_gl()) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - surface_width(surface), - surface_height(surface), - 0, surface->glformat, surface->gltype, - surface_data(surface)); + surface_width(surface), surface_height(surface), 0, + glformat, gltype, surface_data(surface)); } else { - glTexImage2D(GL_TEXTURE_2D, 0, surface->glformat, - surface_width(surface), - surface_height(surface), - 0, surface->glformat, surface->gltype, - surface_data(surface)); + glTexImage2D(GL_TEXTURE_2D, 0, glformat, + surface_width(surface), surface_height(surface), 0, + glformat, gltype, surface_data(surface)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE); } =20 @@ -150,17 +150,18 @@ void surface_gl_update_texture(QemuGLShader *gls, int x, int y, int w, int h) { uint8_t *data =3D (void *)surface_data(surface); + GLenum glformat; + GLenum gltype; =20 assert(gls); + assert(map_format(surface_format(surface), &glformat, &gltype)); =20 if (surface->texture) { glBindTexture(GL_TEXTURE_2D, surface->texture); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, surface_stride(surface) / surface_bytes_per_pixel(surface)); - glTexSubImage2D(GL_TEXTURE_2D, 0, - x, y, w, h, - surface->glformat, surface->gltype, + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, glformat, gltype, data + surface_stride(surface) * y + surface_bytes_per_pixel(surface) * x); } diff --git a/ui/shader.c b/ui/shader.c index ab448c41d4c..76ee4c32785 100644 --- a/ui/shader.c +++ b/ui/shader.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include #include "ui/shader.h" =20 #include "ui/shader/texture-blit-vert.h" --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768075; cv=none; d=zohomail.com; s=zohoarc; b=AsW8ufgZ2utdtwfnCV9REKBpEy8m6Gn0qAigOW9e9nKBGY5kThGrYe+Qw0dQC0fxah5Hf3fo/j+t7WjTY0fVmilwlWlhGy5+kdcNzPkHuiMsTdnMAnnKOup5jNXI3JEVsxcWiyhYUdF1h2Yo/PJ9Vk2TyAdb4lmJjDgoq41+4YY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768075; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZELC7n7zbnFWjRmMkg6vBGd/m+uJfldpdetbA43ORNk=; b=nMzgcHsowT0EfXnARHSFgI6WBMvOS6XJRUzL8WD+Tabb2S6DN8GCEKzT4IIkHqwveAnHFLlvyGK10db2tM7HHcGTEvfzFx9MlhzFWB0KgKmm0/+58nnnlt1BZKRDVXQ3byzqx3A0SoV06Jh31wM6uApYsfkMnNyiXx/ViBNqOEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177376807530315.836421446993995; Tue, 17 Mar 2026 10:21:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6O-0002y6-RS; Tue, 17 Mar 2026 13:21:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6E-0002eA-0A for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6B-0005f2-Dd for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:57 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-b-z7PoDGPiqWZ_QOYLmxsQ-1; Tue, 17 Mar 2026 13:20:50 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E369018005BE; Tue, 17 Mar 2026 17:20:48 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 552AC30001A1; Tue, 17 Mar 2026 17:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZELC7n7zbnFWjRmMkg6vBGd/m+uJfldpdetbA43ORNk=; b=io/si4leYCCzGlQoR0b/W7oDNXjNrwQ1L1cRPj42xDymW1aQO4N2PZ+48YdzdWgVWUqH5H qusPRAY0IBkdgi2qHvD7ZZ1kaJGw+BtPn2mElLbLB3pNMw+RF8u8D5wCAn9cvBr+sqxzSw iWoUFdai2fbHsaHGLdxD57vW1BTnqts= X-MC-Unique: b-z7PoDGPiqWZ_QOYLmxsQ-1 X-Mimecast-MFC-AGG-ID: b-z7PoDGPiqWZ_QOYLmxsQ_1773768049 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 13/16] coreaudio: Improve naming Date: Tue, 17 Mar 2026 21:19:13 +0400 Message-ID: <20260317171916.438575-14-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768077209158500 From: Akihiko Odaki coreaudio had names that are not conforming to QEMU codding style. coreaudioVoiceOut also had some members that are prefixed with redundant words like "output" or "audio". Global names included "out" to tell they are specific to output devices, but this rule was not completely enforced. The frame size had three different names "frameSize", "bufferFrameSize", and "frameCount". Replace identifiers to fix these problems. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260304-coreaudio-v8-3-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp> --- audio/coreaudio.m | 188 +++++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 93 deletions(-) diff --git a/audio/coreaudio.m b/audio/coreaudio.m index bc9ab7477b6..736227eb2b7 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -43,34 +43,34 @@ typedef struct coreaudioVoiceOut { HWVoiceOut hw; pthread_mutex_t buf_mutex; - AudioDeviceID outputDeviceID; - int frameSizeSetting; - uint32_t bufferCount; - UInt32 audioDevicePropertyBufferFrameSize; + AudioDeviceID device_id; + int frame_size_setting; + uint32_t buffer_count; + UInt32 device_frame_size; AudioDeviceIOProcID ioprocid; bool enabled; -} coreaudioVoiceOut; +} CoreaudioVoiceOut; =20 -static const AudioObjectPropertyAddress voice_addr =3D { +static const AudioObjectPropertyAddress voice_out_addr =3D { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain }; =20 -static OSStatus coreaudio_get_voice(AudioDeviceID *id) +static OSStatus coreaudio_get_voice_out(AudioDeviceID *id) { UInt32 size =3D sizeof(*id); =20 return AudioObjectGetPropertyData(kAudioObjectSystemObject, - &voice_addr, + &voice_out_addr, 0, NULL, &size, id); } =20 -static OSStatus coreaudio_get_framesizerange(AudioDeviceID id, - AudioValueRange *framerange) +static OSStatus coreaudio_get_out_framesizerange(AudioDeviceID id, + AudioValueRange *frameran= ge) { UInt32 size =3D sizeof(*framerange); AudioObjectPropertyAddress addr =3D { @@ -87,7 +87,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceI= D id, framerange); } =20 -static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesiz= e) +static OSStatus coreaudio_get_out_framesize(AudioDeviceID id, UInt32 *fram= esize) { UInt32 size =3D sizeof(*framesize); AudioObjectPropertyAddress addr =3D { @@ -104,7 +104,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID i= d, UInt32 *framesize) framesize); } =20 -static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesiz= e) +static OSStatus coreaudio_set_out_framesize(AudioDeviceID id, UInt32 *fram= esize) { UInt32 size =3D sizeof(*framesize); AudioObjectPropertyAddress addr =3D { @@ -121,8 +121,8 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID i= d, UInt32 *framesize) framesize); } =20 -static OSStatus coreaudio_set_streamformat(AudioDeviceID id, - AudioStreamBasicDescription *d) +static OSStatus coreaudio_set_out_streamformat(AudioDeviceID id, + AudioStreamBasicDescription= *d) { UInt32 size =3D sizeof(*d); AudioObjectPropertyAddress addr =3D { @@ -139,7 +139,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceI= D id, d); } =20 -static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result) +static OSStatus coreaudio_get_out_isrunning(AudioDeviceID id, UInt32 *resu= lt) { UInt32 size =3D sizeof(*result); AudioObjectPropertyAddress addr =3D { @@ -243,7 +243,8 @@ static void G_GNUC_PRINTF(3, 4) coreaudio_logerr2(OSSta= tus status, #define coreaudio_playback_logerr(status, ...) \ coreaudio_logerr2(status, "playback", __VA_ARGS__) =20 -static int coreaudio_buf_lock(coreaudioVoiceOut *core, const char *fn_name) +static int coreaudio_voice_out_buf_lock(CoreaudioVoiceOut *core, + const char *fn_name) { int err; =20 @@ -256,7 +257,8 @@ static int coreaudio_buf_lock(coreaudioVoiceOut *core, = const char *fn_name) return 0; } =20 -static int coreaudio_buf_unlock(coreaudioVoiceOut *core, const char *fn_na= me) +static int coreaudio_voice_out_buf_unlock(CoreaudioVoiceOut *core, + const char *fn_name) { int err; =20 @@ -269,20 +271,20 @@ static int coreaudio_buf_unlock(coreaudioVoiceOut *co= re, const char *fn_name) return 0; } =20 -#define COREAUDIO_WRAPPER_FUNC(name, ret_type, args_decl, args) \ - static ret_type glue(coreaudio_, name)args_decl \ - { \ - coreaudioVoiceOut *core =3D (coreaudioVoiceOut *)hw; \ - ret_type ret; \ - \ - if (coreaudio_buf_lock(core, "coreaudio_" #name)) { \ - return 0; \ - } \ - \ - ret =3D glue(audio_generic_, name)args; \ - \ - coreaudio_buf_unlock(core, "coreaudio_" #name); \ - return ret; \ +#define COREAUDIO_WRAPPER_FUNC(name, ret_type, args_decl, args) \ + static ret_type glue(coreaudio_, name)args_decl \ + { \ + CoreaudioVoiceOut *core =3D (CoreaudioVoiceOut *)hw; \ + ret_type ret; \ + \ + if (coreaudio_voice_out_buf_lock(core, "coreaudio_" #name)) { \ + return 0; \ + } \ + \ + ret =3D glue(audio_generic_, name)args; \ + \ + coreaudio_voice_out_buf_unlock(core, "coreaudio_" #name); \ + return ret; \ } COREAUDIO_WRAPPER_FUNC(buffer_get_free, size_t, (HWVoiceOut *hw), (hw)) COREAUDIO_WRAPPER_FUNC(get_buffer_out, void *, (HWVoiceOut *hw, size_t *si= ze), @@ -298,7 +300,7 @@ static ret_type glue(coreaudio_, name)args_decl = \ * callback to feed audiooutput buffer. called without BQL. * allowed to lock "buf_mutex", but disallowed to have any other locks. */ -static OSStatus audioDeviceIOProc( +static OSStatus out_device_ioproc( AudioDeviceID inDevice, const AudioTimeStamp *inNow, const AudioBufferList *inInputData, @@ -307,33 +309,33 @@ static OSStatus audioDeviceIOProc( const AudioTimeStamp *inOutputTime, void *hwptr) { - UInt32 frameCount, pending_frames; + UInt32 frame_size, pending_frames; void *out =3D outOutputData->mBuffers[0].mData; HWVoiceOut *hw =3D hwptr; - coreaudioVoiceOut *core =3D hwptr; + CoreaudioVoiceOut *core =3D hwptr; size_t len; =20 - if (coreaudio_buf_lock(core, "audioDeviceIOProc")) { + if (coreaudio_voice_out_buf_lock(core, "out_device_ioproc")) { inInputTime =3D 0; return 0; } =20 - if (inDevice !=3D core->outputDeviceID) { - coreaudio_buf_unlock(core, "audioDeviceIOProc(old device)"); + if (inDevice !=3D core->device_id) { + coreaudio_voice_out_buf_unlock(core, "out_device_ioproc(old device= )"); return 0; } =20 - frameCount =3D core->audioDevicePropertyBufferFrameSize; + frame_size =3D core->device_frame_size; pending_frames =3D hw->pending_emul / hw->info.bytes_per_frame; =20 /* if there are not enough samples, set signal and return */ - if (pending_frames < frameCount) { + if (pending_frames < frame_size) { inInputTime =3D 0; - coreaudio_buf_unlock(core, "audioDeviceIOProc(empty)"); + coreaudio_voice_out_buf_unlock(core, "out_device_ioproc(empty)"); return 0; } =20 - len =3D frameCount * hw->info.bytes_per_frame; + len =3D frame_size * hw->info.bytes_per_frame; while (len) { size_t write_len, start; =20 @@ -349,16 +351,16 @@ static OSStatus audioDeviceIOProc( out +=3D write_len; } =20 - coreaudio_buf_unlock(core, "audioDeviceIOProc"); + coreaudio_voice_out_buf_unlock(core, "out_device_ioproc"); return 0; } =20 -static OSStatus init_out_device(coreaudioVoiceOut *core) +static OSStatus init_out_device(CoreaudioVoiceOut *core) { + AudioValueRange value_range; OSStatus status; - AudioValueRange frameRange; =20 - AudioStreamBasicDescription streamBasicDescription =3D { + AudioStreamBasicDescription stream_basic_description =3D { .mBitsPerChannel =3D audio_format_bits(core->hw.info.af), .mBytesPerFrame =3D core->hw.info.bytes_per_frame, .mBytesPerPacket =3D core->hw.info.bytes_per_frame, @@ -369,21 +371,20 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) .mSampleRate =3D core->hw.info.freq }; =20 - status =3D coreaudio_get_voice(&core->outputDeviceID); + status =3D coreaudio_get_voice_out(&core->device_id); if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, "Could not get default output device"); return status; } - if (core->outputDeviceID =3D=3D kAudioDeviceUnknown) { + if (core->device_id =3D=3D kAudioDeviceUnknown) { error_report("coreaudio: Could not initialize playback: " "Unknown audio device"); return status; } =20 /* get minimum and maximum buffer frame sizes */ - status =3D coreaudio_get_framesizerange(core->outputDeviceID, - &frameRange); + status =3D coreaudio_get_out_framesizerange(core->device_id, &value_ra= nge); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } @@ -393,34 +394,34 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) return status; } =20 - if (frameRange.mMinimum > core->frameSizeSetting) { - core->audioDevicePropertyBufferFrameSize =3D frameRange.mMinimum; + if (value_range.mMinimum > core->frame_size_setting) { + core->device_frame_size =3D value_range.mMinimum; warn_report("coreaudio: Upsizing buffer frames to %f", - frameRange.mMinimum); - } else if (frameRange.mMaximum < core->frameSizeSetting) { - core->audioDevicePropertyBufferFrameSize =3D frameRange.mMaximum; + value_range.mMinimum); + } else if (value_range.mMaximum < core->frame_size_setting) { + core->device_frame_size =3D value_range.mMaximum; warn_report("coreaudio: Downsizing buffer frames to %f", - frameRange.mMaximum); + value_range.mMaximum); } else { - core->audioDevicePropertyBufferFrameSize =3D core->frameSizeSettin= g; + core->device_frame_size =3D core->frame_size_setting; } =20 /* set Buffer Frame Size */ - status =3D coreaudio_set_framesize(core->outputDeviceID, - &core->audioDevicePropertyBufferFrame= Size); + status =3D coreaudio_set_out_framesize(core->device_id, + &core->device_frame_size); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, "Could not set device buffer frame size = %" PRIu32, - (uint32_t)core->audioDevicePropertyBuffe= rFrameSize); + (uint32_t)core->device_frame_size); return status; } =20 /* get Buffer Frame Size */ - status =3D coreaudio_get_framesize(core->outputDeviceID, - &core->audioDevicePropertyBufferFrame= Size); + status =3D coreaudio_get_out_framesize(core->device_id, + &core->device_frame_size); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } @@ -429,19 +430,19 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) "Could not get device buffer frame size"= ); return status; } - core->hw.samples =3D core->bufferCount * core->audioDevicePropertyBuff= erFrameSize; + core->hw.samples =3D core->buffer_count * core->device_frame_size; =20 /* set Samplerate */ - status =3D coreaudio_set_streamformat(core->outputDeviceID, - &streamBasicDescription); + status =3D coreaudio_set_out_streamformat(core->device_id, + &stream_basic_description); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, "Could not set samplerate %lf", - streamBasicDescription.mSampleRate); - core->outputDeviceID =3D kAudioDeviceUnknown; + stream_basic_description.mSampleRate); + core->device_id =3D kAudioDeviceUnknown; return status; } =20 @@ -456,8 +457,8 @@ static OSStatus init_out_device(coreaudioVoiceOut *core) * with the callers of AudioObjectGetPropertyData. */ core->ioprocid =3D NULL; - status =3D AudioDeviceCreateIOProcID(core->outputDeviceID, - audioDeviceIOProc, + status =3D AudioDeviceCreateIOProcID(core->device_id, + out_device_ioproc, &core->hw, &core->ioprocid); if (status =3D=3D kAudioHardwareBadDeviceError) { @@ -465,20 +466,20 @@ static OSStatus init_out_device(coreaudioVoiceOut *co= re) } if (status !=3D kAudioHardwareNoError || core->ioprocid =3D=3D NULL) { coreaudio_playback_logerr(status, "Could not set IOProc"); - core->outputDeviceID =3D kAudioDeviceUnknown; + core->device_id =3D kAudioDeviceUnknown; return status; } =20 return 0; } =20 -static void fini_out_device(coreaudioVoiceOut *core) +static void fini_out_device(CoreaudioVoiceOut *core) { OSStatus status; UInt32 isrunning; =20 /* stop playback */ - status =3D coreaudio_get_isrunning(core->outputDeviceID, &isrunning); + status =3D coreaudio_get_out_isrunning(core->device_id, &isrunning); if (status !=3D kAudioHardwareBadObjectError) { if (status !=3D kAudioHardwareNoError) { coreaudio_logerr(status, @@ -486,7 +487,7 @@ static void fini_out_device(coreaudioVoiceOut *core) } =20 if (isrunning) { - status =3D AudioDeviceStop(core->outputDeviceID, core->ioproci= d); + status =3D AudioDeviceStop(core->device_id, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { coreaudio_logerr(status, "Could not stop playback"); } @@ -494,20 +495,20 @@ static void fini_out_device(coreaudioVoiceOut *core) } =20 /* remove callback */ - status =3D AudioDeviceDestroyIOProcID(core->outputDeviceID, + status =3D AudioDeviceDestroyIOProcID(core->device_id, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kAudioHard= wareNoError) { coreaudio_logerr(status, "Could not remove IOProc"); } - core->outputDeviceID =3D kAudioDeviceUnknown; + core->device_id =3D kAudioDeviceUnknown; } =20 -static void update_device_playback_state(coreaudioVoiceOut *core) +static void update_out_device_playback_state(CoreaudioVoiceOut *core) { OSStatus status; UInt32 isrunning; =20 - status =3D coreaudio_get_isrunning(core->outputDeviceID, &isrunning); + status =3D coreaudio_get_out_isrunning(core->device_id, &isrunning); if (status !=3D kAudioHardwareNoError) { if (status !=3D kAudioHardwareBadObjectError) { coreaudio_logerr(status, @@ -520,7 +521,7 @@ static void update_device_playback_state(coreaudioVoice= Out *core) if (core->enabled) { /* start playback */ if (!isrunning) { - status =3D AudioDeviceStart(core->outputDeviceID, core->ioproc= id); + status =3D AudioDeviceStart(core->device_id, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { coreaudio_logerr(status, "Could not resume playback"); } @@ -528,7 +529,7 @@ static void update_device_playback_state(coreaudioVoice= Out *core) } else { /* stop playback */ if (isrunning) { - status =3D AudioDeviceStop(core->outputDeviceID, + status =3D AudioDeviceStop(core->device_id, core->ioprocid); if (status !=3D kAudioHardwareBadDeviceError && status !=3D kA= udioHardwareNoError) { coreaudio_logerr(status, "Could not pause playback"); @@ -538,22 +539,22 @@ static void update_device_playback_state(coreaudioVoi= ceOut *core) } =20 /* called without BQL. */ -static OSStatus handle_voice_change( +static OSStatus handle_voice_out_change( AudioObjectID in_object_id, UInt32 in_number_addresses, const AudioObjectPropertyAddress *in_addresses, void *in_client_data) { - coreaudioVoiceOut *core =3D in_client_data; + CoreaudioVoiceOut *core =3D in_client_data; =20 bql_lock(); =20 - if (core->outputDeviceID) { + if (core->device_id) { fini_out_device(core); } =20 if (!init_out_device(core)) { - update_device_playback_state(core); + update_out_device_playback_state(core); } =20 bql_unlock(); @@ -563,7 +564,7 @@ static OSStatus handle_voice_change( static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as) { OSStatus status; - coreaudioVoiceOut *core =3D (coreaudioVoiceOut *)hw; + CoreaudioVoiceOut *core =3D (CoreaudioVoiceOut *)hw; int err; Audiodev *dev =3D hw->s->dev; AudiodevCoreaudioPerDirectionOptions *cpdo =3D dev->u.coreaudio.out; @@ -581,13 +582,14 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct = audsettings *as) as->fmt =3D AUDIO_FORMAT_F32; audio_pcm_init_info(&hw->info, as); =20 - core->frameSizeSetting =3D audio_buffer_frames( + core->frame_size_setting =3D audio_buffer_frames( qapi_AudiodevCoreaudioPerDirectionOptions_base(cpdo), as, 11610); =20 - core->bufferCount =3D cpdo->has_buffer_count ? cpdo->buffer_count : 4; + core->buffer_count =3D cpdo->has_buffer_count ? cpdo->buffer_count : 4; =20 status =3D AudioObjectAddPropertyListener(kAudioObjectSystemObject, - &voice_addr, handle_voice_chan= ge, + &voice_out_addr, + handle_voice_out_change, core); if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, @@ -597,8 +599,8 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct au= dsettings *as) =20 if (init_out_device(core)) { status =3D AudioObjectRemovePropertyListener(kAudioObjectSystemObj= ect, - &voice_addr, - handle_voice_change, + &voice_out_addr, + handle_voice_out_change, core); if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, @@ -615,11 +617,11 @@ static void coreaudio_fini_out (HWVoiceOut *hw) { OSStatus status; int err; - coreaudioVoiceOut *core =3D (coreaudioVoiceOut *)hw; + CoreaudioVoiceOut *core =3D (CoreaudioVoiceOut *)hw; =20 status =3D AudioObjectRemovePropertyListener(kAudioObjectSystemObject, - &voice_addr, - handle_voice_change, + &voice_out_addr, + handle_voice_out_change, core); if (status !=3D kAudioHardwareNoError) { coreaudio_logerr(status, "Could not remove voice property change l= istener"); @@ -636,10 +638,10 @@ static void coreaudio_fini_out (HWVoiceOut *hw) =20 static void coreaudio_enable_out(HWVoiceOut *hw, bool enable) { - coreaudioVoiceOut *core =3D (coreaudioVoiceOut *)hw; + CoreaudioVoiceOut *core =3D (CoreaudioVoiceOut *)hw; =20 core->enabled =3D enable; - update_device_playback_state(core); + update_out_device_playback_state(core); } =20 static void audio_coreaudio_class_init(ObjectClass *klass, const void *dat= a) --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768135; cv=none; d=zohomail.com; s=zohoarc; b=ZiIQZsW7KQHtDFT2ni1gnTZAF7mUN0yodSxymni03qw3ADsRTHHVFrfPVAoB/njYF1K751Sc2atufMgJ2PorpVnyvy12vGBJ3vOombiWiAiJew8qH/pGsmB02gcvYA3/ZMqvIzsMAhjY6JVBqwIVKGq3xyiKxOHSrorhpGTd0IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768135; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PfyPiJZx/YlqBt4/ld65PGZ0fAYl2eWxoZXvWxzVJ5Q=; b=KENQzSIPPex2qNiF+drthwL79XuZ0Hgohyh4ppno6hSzFwEAEcCx6oMjGOYirKMQVPqqmcUkl+zda/RdkVB7rPCpPpSl8VmloJ9dN2Q3/W4gDorLtt1JtQLMl4ywUYHMQj2hxEsF4hDSzKwL1mCiq1HOzbjGjbdAncnRjpsIx6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177376813516225.676870918839086; Tue, 17 Mar 2026 10:22:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6Q-000385-AV; Tue, 17 Mar 2026 13:21:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6L-0002tO-PI for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6I-0005gG-F0 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:05 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-403-pmGc-Y9ENjmsKi1sVzrhDQ-1; Tue, 17 Mar 2026 13:20:56 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C6BE1180061F; Tue, 17 Mar 2026 17:20:54 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2487D19560AB; Tue, 17 Mar 2026 17:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PfyPiJZx/YlqBt4/ld65PGZ0fAYl2eWxoZXvWxzVJ5Q=; b=LKnSVHudA+u0MCg8oDY0IFNG7+xAazt0HCfjB4K5hDpxNYGgiMq89d/5U1g7fV/05Nbllu Dnzxn3LkaP7gID4bc5NkAoCgCLffnQa5qDnsqmC7/5Zv0KzO/R5UAnRzXiwFcFsvOle7qS EKrurPFJhlfZ/12Gx7j7RSQo9uGWTvM= X-MC-Unique: pmGc-Y9ENjmsKi1sVzrhDQ-1 X-Mimecast-MFC-AGG-ID: pmGc-Y9ENjmsKi1sVzrhDQ_1773768054 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 14/16] coreaudio: Commit the result of init in the end Date: Tue, 17 Mar 2026 21:19:14 +0400 Message-ID: <20260317171916.438575-15-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768137436154101 From: Akihiko Odaki init_out_device may only commit some part of the result and leave the state inconsistent when it encounters a fatal error or the device gets unplugged during the operation, which is expressed by kAudioHardwareBadObjectError or kAudioHardwareBadDeviceError. Commit the result in the end of the function so that it commits the result iff it sees no fatal error and the device remains plugged. With this change, handle_voice_change can rely on core->outputDeviceID to know whether the output device is initialized after calling init_out_device. Signed-off-by: Akihiko Odaki Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260304-coreaudio-v8-4-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp> --- audio/coreaudio.m | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 736227eb2b7..23c3d1f80ac 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -357,8 +357,11 @@ static OSStatus out_device_ioproc( =20 static OSStatus init_out_device(CoreaudioVoiceOut *core) { + AudioDeviceID device_id; + AudioDeviceIOProcID ioprocid; AudioValueRange value_range; OSStatus status; + UInt32 device_frame_size; =20 AudioStreamBasicDescription stream_basic_description =3D { .mBitsPerChannel =3D audio_format_bits(core->hw.info.af), @@ -371,20 +374,20 @@ static OSStatus init_out_device(CoreaudioVoiceOut *co= re) .mSampleRate =3D core->hw.info.freq }; =20 - status =3D coreaudio_get_voice_out(&core->device_id); + status =3D coreaudio_get_voice_out(&device_id); if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, "Could not get default output device"); return status; } - if (core->device_id =3D=3D kAudioDeviceUnknown) { + if (device_id =3D=3D kAudioDeviceUnknown) { error_report("coreaudio: Could not initialize playback: " "Unknown audio device"); return status; } =20 /* get minimum and maximum buffer frame sizes */ - status =3D coreaudio_get_out_framesizerange(core->device_id, &value_ra= nge); + status =3D coreaudio_get_out_framesizerange(device_id, &value_range); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } @@ -395,33 +398,31 @@ static OSStatus init_out_device(CoreaudioVoiceOut *co= re) } =20 if (value_range.mMinimum > core->frame_size_setting) { - core->device_frame_size =3D value_range.mMinimum; + device_frame_size =3D value_range.mMinimum; warn_report("coreaudio: Upsizing buffer frames to %f", value_range.mMinimum); } else if (value_range.mMaximum < core->frame_size_setting) { - core->device_frame_size =3D value_range.mMaximum; + device_frame_size =3D value_range.mMaximum; warn_report("coreaudio: Downsizing buffer frames to %f", value_range.mMaximum); } else { - core->device_frame_size =3D core->frame_size_setting; + device_frame_size =3D core->frame_size_setting; } =20 /* set Buffer Frame Size */ - status =3D coreaudio_set_out_framesize(core->device_id, - &core->device_frame_size); + status =3D coreaudio_set_out_framesize(device_id, &device_frame_size); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } if (status !=3D kAudioHardwareNoError) { coreaudio_playback_logerr(status, "Could not set device buffer frame size = %" PRIu32, - (uint32_t)core->device_frame_size); + (uint32_t)device_frame_size); return status; } =20 /* get Buffer Frame Size */ - status =3D coreaudio_get_out_framesize(core->device_id, - &core->device_frame_size); + status =3D coreaudio_get_out_framesize(device_id, &device_frame_size); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; } @@ -430,10 +431,9 @@ static OSStatus init_out_device(CoreaudioVoiceOut *cor= e) "Could not get device buffer frame size"= ); return status; } - core->hw.samples =3D core->buffer_count * core->device_frame_size; =20 /* set Samplerate */ - status =3D coreaudio_set_out_streamformat(core->device_id, + status =3D coreaudio_set_out_streamformat(device_id, &stream_basic_description); if (status =3D=3D kAudioHardwareBadObjectError) { return 0; @@ -442,7 +442,6 @@ static OSStatus init_out_device(CoreaudioVoiceOut *core) coreaudio_playback_logerr(status, "Could not set samplerate %lf", stream_basic_description.mSampleRate); - core->device_id =3D kAudioDeviceUnknown; return status; } =20 @@ -456,20 +455,24 @@ static OSStatus init_out_device(CoreaudioVoiceOut *co= re) * Therefore, the specified callback must be designed to avoid a deadl= ock * with the callers of AudioObjectGetPropertyData. */ - core->ioprocid =3D NULL; - status =3D AudioDeviceCreateIOProcID(core->device_id, + ioprocid =3D NULL; + status =3D AudioDeviceCreateIOProcID(device_id, out_device_ioproc, &core->hw, - &core->ioprocid); + &ioprocid); if (status =3D=3D kAudioHardwareBadDeviceError) { return 0; } - if (status !=3D kAudioHardwareNoError || core->ioprocid =3D=3D NULL) { + if (status !=3D kAudioHardwareNoError || ioprocid =3D=3D NULL) { coreaudio_playback_logerr(status, "Could not set IOProc"); - core->device_id =3D kAudioDeviceUnknown; return status; } =20 + core->device_id =3D device_id; + core->device_frame_size =3D device_frame_size; + core->hw.samples =3D core->buffer_count * core->device_frame_size; + core->ioprocid =3D ioprocid; + return 0; } =20 @@ -553,7 +556,9 @@ static OSStatus handle_voice_out_change( fini_out_device(core); } =20 - if (!init_out_device(core)) { + init_out_device(core); + + if (core->device_id) { update_out_device_playback_state(core); } =20 @@ -650,7 +655,7 @@ static void audio_coreaudio_class_init(ObjectClass *kla= ss, const void *data) =20 k->max_voices_out =3D 1; k->max_voices_in =3D 0; - k->voice_size_out =3D sizeof(coreaudioVoiceOut); + k->voice_size_out =3D sizeof(CoreaudioVoiceOut); k->voice_size_in =3D 0; =20 k->init_out =3D coreaudio_init_out; --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768079; cv=none; d=zohomail.com; s=zohoarc; b=NLnBiWIT4qgb26pHidkUmk/YwsbX20QV8U/4BNKJcpGOzfXK7xj76yVlcRMhQLG/gMm+0TFO+F4BRmnfTOGLEoTdgemEwh8Yvl/ILGIkzPdPiVMlW++elEE7Mmozlv7sy/EM0xbMuVpEKErhEuEhNhyjMLgU/XtYtSkLWIc61l0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768079; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y2PTYZWW6vbjY5W/qWBPJmkO1oYa5RgHvvZ9XEiRBXM=; b=EnRhk0Te9vE80lCcy+0GEA9ALnz0wbR33yp7g5VwKYLFGrvZ7faFuJSVq/Np0ahwBQxqztSTNHvzYoGSzD7YnOlfi/mt2XSGwSwxZCCuJBuo3nhAzTXjG1iZdbDL27TnMtPZR/0E5AKVP5mSyjqiZucGtEy5tF4ni4VkSHnh114= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768079208144.84815988962953; Tue, 17 Mar 2026 10:21:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6S-0003Y8-UE; Tue, 17 Mar 2026 13:21:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6O-000386-98 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6M-0005gm-Ku for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:08 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-2CIyk4whO2KuXuKp7B1djg-1; Tue, 17 Mar 2026 13:21:02 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DB24D19560B9; Tue, 17 Mar 2026 17:21:00 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5366E18001FE; Tue, 17 Mar 2026 17:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y2PTYZWW6vbjY5W/qWBPJmkO1oYa5RgHvvZ9XEiRBXM=; b=XSFtwpgux2OBTvKSXsh+rmHcqo8sn+/USRXcC3CH7hsFx9A+ps3PO9eLG4I9FvJfroKbkJ plcLoe07mTJyOoZKj/kf1pJywXWEfs00w+FEAqK46Uu3EeG//0QflFeDWIiFrvYi2e1jwm h0VTVihQo56zPWiz8i/jL2IAVz+SBiI= X-MC-Unique: 2CIyk4whO2KuXuKp7B1djg-1 X-Mimecast-MFC-AGG-ID: 2CIyk4whO2KuXuKp7B1djg_1773768061 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 15/16] audio: Add functions to initialize buffers Date: Tue, 17 Mar 2026 21:19:15 +0400 Message-ID: <20260317171916.438575-16-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768082460154100 From: Akihiko Odaki These functions can be used to re-initialize buffers when hardware parameters change due to device hotplug, for example. Signed-off-by: Akihiko Odaki Reviewed-by: Phil Dennis-Jordan Reviewed-by: Christian Schoenebeck Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260304-coreaudio-v8-5-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp> --- audio/audio_int.h | 2 ++ audio/audio-mixeng-be.c | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 06f79ade6b0..290cf373b49 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -141,9 +141,11 @@ static inline void *advance(void *p, size_t incr) int wav_start_capture(AudioBackend *state, CaptureState *s, const char *pa= th, int freq, int bits, int nchannels); =20 +void audio_generic_initialize_buffer_in(HWVoiceIn *hw); void audio_generic_run_buffer_in(HWVoiceIn *hw); void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size); void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size); +void audio_generic_initialize_buffer_out(HWVoiceOut *hw); void audio_generic_run_buffer_out(HWVoiceOut *hw); size_t audio_generic_buffer_get_free(HWVoiceOut *hw); void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size); diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c index 5878b23e04e..f7d73d85608 100644 --- a/audio/audio-mixeng-be.c +++ b/audio/audio-mixeng-be.c @@ -1187,14 +1187,20 @@ void audio_run(AudioMixengBackend *s, const char *m= sg) } } =20 +void audio_generic_initialize_buffer_in(HWVoiceIn *hw) +{ + g_free(hw->buf_emul); + hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; + hw->buf_emul =3D g_malloc(hw->size_emul); + hw->pos_emul =3D hw->pending_emul =3D 0; +} + void audio_generic_run_buffer_in(HWVoiceIn *hw) { AudioMixengBackendClass *k =3D AUDIO_MIXENG_BACKEND_GET_CLASS(hw->s); =20 if (unlikely(!hw->buf_emul)) { - hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; - hw->buf_emul =3D g_malloc(hw->size_emul); - hw->pos_emul =3D hw->pending_emul =3D 0; + audio_generic_initialize_buffer_in(hw); } =20 while (hw->pending_emul < hw->size_emul) { @@ -1227,6 +1233,14 @@ void audio_generic_put_buffer_in(HWVoiceIn *hw, void= *buf, size_t size) hw->pending_emul -=3D size; } =20 +void audio_generic_initialize_buffer_out(HWVoiceOut *hw) +{ + g_free(hw->buf_emul); + hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; + hw->buf_emul =3D g_malloc(hw->size_emul); + hw->pos_emul =3D hw->pending_emul =3D 0; +} + size_t audio_generic_buffer_get_free(HWVoiceOut *hw) { if (hw->buf_emul) { @@ -1260,9 +1274,7 @@ void audio_generic_run_buffer_out(HWVoiceOut *hw) void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size) { if (unlikely(!hw->buf_emul)) { - hw->size_emul =3D hw->samples * hw->info.bytes_per_frame; - hw->buf_emul =3D g_malloc(hw->size_emul); - hw->pos_emul =3D hw->pending_emul =3D 0; + audio_generic_initialize_buffer_out(hw); } =20 *size =3D MIN(hw->size_emul - hw->pending_emul, --=20 2.53.0 From nobody Mon Apr 6 22:12:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768101; cv=none; d=zohomail.com; s=zohoarc; b=VtItChu9/81ZXu+ZouByywb/pfkZQeEH8VAJU/COJib/XF7ZW0ZayCFUwRBT9YRvm8gPemc6q/UiCdS7jYeB7xH91HnfeqrKzagWHgw3Tgzf7VNVu5vfR3AbfvzZlYkrCimdI7QhW/qOe4U6uyzt9zOQdw793VoH4IgCelwneIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768101; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tZ8XkIZKn+y0sRr98M6JWJEgOF4WgogAPRot0lLNwpo=; b=HOqXUt1zaqMfjQMAmWyNJZFi4gtZ0HUSKy7xqdFVpFWX+8z90bBg79UR5iGzZM2eRpSmbBxbdizDHAvWhQLv9t7Zexx/GOJqU6BjqUmjHmye9y+4Wq7LX+g9fMNLMy6XVSqCtteamX/i1EZIt+u7hDe/D7ZKaCaz3QQUwBLvFE0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768101667808.5195363416333; Tue, 17 Mar 2026 10:21:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6Y-00044W-Qf; Tue, 17 Mar 2026 13:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6U-0003pK-OK for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y6S-0005hP-VT for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:21:14 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-V3sX_Vp3N8KTS687o0A8Lw-1; Tue, 17 Mar 2026 13:21:08 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0AFAF18002E9; Tue, 17 Mar 2026 17:21:07 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D1CDA19560AB; Tue, 17 Mar 2026 17:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tZ8XkIZKn+y0sRr98M6JWJEgOF4WgogAPRot0lLNwpo=; b=h6NmwbtF6IXab/dQovW/lNUQlawE1uErKSPHKc0ihk238//AA9nEReZx4FoLCz7Ww2PWGo 5Pw8gW9/zkSvla/G6oYqquPMHaFvl70VlbEidijk0TQPT3R+mMAnMk5RUw2Hngku+g9RoQ OA5ym+l0Kzd0Iw3E7JRJSKcUnuJiNn8= X-MC-Unique: V3sX_Vp3N8KTS687o0A8Lw-1 X-Mimecast-MFC-AGG-ID: V3sX_Vp3N8KTS687o0A8Lw_1773768067 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 16/16] coreaudio: Initialize the buffer for device change Date: Tue, 17 Mar 2026 21:19:16 +0400 Message-ID: <20260317171916.438575-17-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768102788154100 From: Akihiko Odaki Reallocate buffers when the active device change as the required buffer size may differ. Signed-off-by: Akihiko Odaki Reviewed-by: Phil Dennis-Jordan Acked-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260304-coreaudio-v8-6-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp> --- audio/coreaudio.m | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 23c3d1f80ac..e4ec1df971c 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -471,6 +471,7 @@ static OSStatus init_out_device(CoreaudioVoiceOut *core) core->device_id =3D device_id; core->device_frame_size =3D device_frame_size; core->hw.samples =3D core->buffer_count * core->device_frame_size; + audio_generic_initialize_buffer_out(&core->hw); core->ioprocid =3D ioprocid; =20 return 0; --=20 2.53.0