get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2196847/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2196847,
    "url": "http://patchwork.ozlabs.org/api/patches/2196847/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-62-e676662e4514@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260216-audio-v1-62-e676662e4514@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-16T11:15:51",
    "name": "[62/85] audio/dsound: replace custom logging with error_report & trace",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "22e368889c6662bae14a6c8e91175fec9bda465d",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-62-e676662e4514@redhat.com/mbox/",
    "series": [
        {
            "id": 492294,
            "url": "http://patchwork.ozlabs.org/api/series/492294/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492294",
            "date": "2026-02-16T11:14:52",
            "name": "audio: cleanups & add a manual test",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492294/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196847/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196847/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Wx5mx7Lo;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fF0pD1X8jz1xwF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 16 Feb 2026 22:26:12 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vrwfc-000090-Pj; Mon, 16 Feb 2026 06:21:40 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwcm-00075e-Hj\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:46 -0500",
            "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwci-0008Hn-Jo\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:42 -0500",
            "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-Ov7S36wAPRCG5fbdAF4h1w-1; Mon,\n 16 Feb 2026 06:18:35 -0500",
            "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id B05DA1954B34; Mon, 16 Feb 2026 11:18:33 +0000 (UTC)",
            "from localhost (unknown [10.45.242.26])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id EAD4819560AD; Mon, 16 Feb 2026 11:18:32 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771240720;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=hxleiIuMmSQxAplkZkRImBt1hhK43Xtyj3HdkAU9nk4=;\n b=Wx5mx7LoyIkXItaQHACsYHil6ZuX4qszfYnUrLxxCsqNZ3+x5UpraFBwKZ8FO6OFetUOlj\n fCZ6QFF9xRDycqI/MpP9UK8BrBQH07LD3XzWxk12ljn0oStnciA+1jTnBLNd/1hG0fXPvO\n 5n91xhrxarYhIaVWAbqElaNmCJBSfnU=",
        "X-MC-Unique": "Ov7S36wAPRCG5fbdAF4h1w-1",
        "X-Mimecast-MFC-AGG-ID": "Ov7S36wAPRCG5fbdAF4h1w_1771240713",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "Date": "Mon, 16 Feb 2026 12:15:51 +0100",
        "Subject": "[PATCH 62/85] audio/dsound: replace custom logging with\n error_report & trace",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "8bit",
        "Message-Id": "<20260216-audio-v1-62-e676662e4514@redhat.com>",
        "References": "<20260216-audio-v1-0-e676662e4514@redhat.com>",
        "In-Reply-To": "<20260216-audio-v1-0-e676662e4514@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Gerd Hoffmann <kraxel@redhat.com>,  Eduardo Habkost <eduardo@habkost.net>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, =?utf-8?q?Phil?=\n\t=?utf-8?q?ippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n  John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>,\n  Christian Schoenebeck <qemu_oss@crudebyte.com>,\n  Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,\n  Thomas Huth <huth@tuxfamily.org>, Alexandre Ratchov <alex@caoua.org>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n  Laurent Vivier <laurent@vivier.eu>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n  Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,\n  Alistair Francis <alistair@alistair23.me>,\n  \"Edgar E. Iglesias\" <edgar.iglesias@gmail.com>,\n  Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org, =?utf-8?q?M?=\n\t=?utf-8?q?arc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n  Mark Cave-Ayland <mark.caveayland@nutanix.com>",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=21303;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=5rlLKZYChnAU7rxWYkldvo1LS6BroTN0lrE9LwrT7vU=;\n b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxReoWbj5FukBIihc8PV7DcL64s7eWJWS6OX\n 9/KJbTEsPuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UQAKCRDa6OEJdZac\n 5XmFD/9DPJEWxNt8e7oRJggBnpreYniCdEMzO0m2ScEPVXDg6QZHRa688RxBGJ/utR2W+sWYJeZ\n hJ/1cWNHbIjIYV4TO+lon4QAe2I5BOi6oVViaEcTAuZ7YYKFGevNn9psEWUNlFNFIBqWPNQfsvs\n 1T6u33yji5I/o0lYRwb4bktc7WtLgVdYInRA+wrDtjjST2EOzkDFmM2FdZ7udk7E1SLxjHij6dK\n Cq7SLfbp/87MSHeFmzhBUokV2nkd7opCiGT137B8q2bC4XyScHHLl2wBL5Zq5gHPLb5LKNPwYbE\n yS8OIY0dFrYi1Io9Umx+kf1H8Ux87uhj3ixSSm+yOSuiqaGF0QnKmR9MnjPp4m58tR3DooTOsnh\n aH5hRk3WAGnctN3kPexhS6KrQxg+N+3pcMkNRUjQiJAksAiJONTAnW9WJww8j2qbfb8zGjJe5mP\n ST2fWrufRC0/zaUtOBwD/No5E09F7ao1IAfQVtfGCHiiDBuWhvgab86iqxKVLfZsv/hzIQmi9ui\n 6dFnt3VjC743PZTvviOlMZLd8IggWp0Ado26IMDc2WJrNnx5gdLo1qHFKwbrSXM0Qq7jG6Sg5ud\n OL6z0y1LNCaLntBpt9lulox9RJ6Yd7NZIu6PH2/CqmCbY8/Kbni+pQm99XFwPWT8P+a2FWoOJfP\n /OvF6ssn+9d6htA==",
        "X-Developer-Key": "i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12",
        "Received-SPF": "pass client-ip=170.10.129.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=unavailable 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 <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "The DirectSound audio backend uses its own logging infrastructure\n(AUD_log, AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is\ninconsistent with the rest of QEMU and makes the output harder to\nfilter and configure.\n\nReplace the custom logging with standard QEMU error reporting.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nReviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>\n---\n audio/dsound_template.h |  72 ++++++++++++--------------\n audio/audio_win_int.c   |  31 ++++++-----\n audio/dsoundaudio.c     | 134 +++++++++++++++++++-----------------------------\n audio/trace-events      |   5 ++\n 4 files changed, 108 insertions(+), 134 deletions(-)",
    "diff": "diff --git a/audio/dsound_template.h b/audio/dsound_template.h\nindex 022a7307c99..af4019bcb34 100644\n--- a/audio/dsound_template.h\n+++ b/audio/dsound_template.h\n@@ -53,9 +53,9 @@ static int glue (dsound_unlock_, TYPE) (\n {\n     HRESULT hr;\n \n-    hr = glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2);\n-    if (FAILED (hr)) {\n-        dsound_logerr (hr, \"Could not unlock \" NAME \"\\n\");\n+    hr = glue(IFACE, _Unlock)(buf, p1, blen1, p2, blen2);\n+    if (FAILED(hr)) {\n+        dsound_logerr(hr, \"Could not unlock \" NAME);\n         return -1;\n     }\n \n@@ -85,35 +85,35 @@ static int glue (dsound_lock_, TYPE) (\n #endif\n     hr = glue(IFACE, _Lock)(buf, pos, len, p1p, blen1p, p2p, blen2p, flag);\n \n-    if (FAILED (hr)) {\n+    if (FAILED(hr)) {\n #ifndef DSBTYPE_IN\n         if (hr == DSERR_BUFFERLOST) {\n-            if (glue (dsound_restore_, TYPE) (buf, s)) {\n-                dsound_logerr (hr, \"Could not lock \" NAME \"\\n\");\n+            if (glue(dsound_restore_, TYPE)(buf, s)) {\n+                dsound_logerr(hr, \"Could not lock \" NAME);\n             }\n             goto fail;\n         }\n #endif\n-        dsound_logerr (hr, \"Could not lock \" NAME \"\\n\");\n+        dsound_logerr(hr, \"Could not lock \" NAME);\n         goto fail;\n     }\n \n     if ((p1p && *p1p && (*blen1p % info->bytes_per_frame)) ||\n         (p2p && *p2p && (*blen2p % info->bytes_per_frame))) {\n-        dolog(\"DirectSound returned misaligned buffer %ld %ld\\n\",\n-              *blen1p, *blen2p);\n+        error_report(\"dsound: returned misaligned buffer %ld %ld\",\n+                     *blen1p, *blen2p);\n         glue(dsound_unlock_, TYPE)(buf, *p1p, p2p ? *p2p : NULL, *blen1p,\n                                    blen2p ? *blen2p : 0);\n         goto fail;\n     }\n \n     if (p1p && !*p1p && *blen1p) {\n-        dolog(\"warning: !p1 && blen1=%ld\\n\", *blen1p);\n+        warn_report(\"dsound: !p1 && blen1=%ld\", *blen1p);\n         *blen1p = 0;\n     }\n \n     if (p2p && !*p2p && *blen2p) {\n-        dolog(\"warning: !p2 && blen2=%ld\\n\", *blen2p);\n+        warn_report(\"dsound: !p2 && blen2=%ld\", *blen2p);\n         *blen2p = 0;\n     }\n \n@@ -143,14 +143,14 @@ static void dsound_fini_out (HWVoiceOut *hw)\n #endif\n \n     if (ds->FIELD) {\n-        hr = glue (IFACE, _Stop) (ds->FIELD);\n-        if (FAILED (hr)) {\n-            dsound_logerr (hr, \"Could not stop \" NAME \"\\n\");\n+        hr = glue(IFACE, _Stop)(ds->FIELD);\n+        if (FAILED(hr)) {\n+            dsound_logerr(hr, \"Could not stop \" NAME);\n         }\n \n-        hr = glue (IFACE, _Release) (ds->FIELD);\n-        if (FAILED (hr)) {\n-            dsound_logerr (hr, \"Could not release \" NAME \"\\n\");\n+        hr = glue(IFACE, _Release)(ds->FIELD);\n+        if (FAILED(hr)) {\n+            dsound_logerr(hr, \"Could not release \" NAME);\n         }\n         ds->FIELD = NULL;\n     }\n@@ -182,7 +182,8 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as)\n #endif\n \n     if (!s->FIELD2) {\n-        dolog (\"Attempt to initialize voice without \" NAME2 \" object\\n\");\n+        error_report(\"dsound: Attempt to initialize voice without \"\n+                     NAME2 \" object\");\n         return -1;\n     }\n \n@@ -212,28 +213,28 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as)\n         );\n #endif\n \n-    if (FAILED (hr)) {\n-        dsound_logerr2 (hr, typ, \"Could not create \" NAME \"\\n\");\n+    if (FAILED(hr)) {\n+        dsound_logerr2(hr, typ, \"Could not create \" NAME);\n         return -1;\n     }\n \n-    hr = glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL);\n-    if (FAILED (hr)) {\n-        dsound_logerr2 (hr, typ, \"Could not get \" NAME \" format\\n\");\n+    hr = glue(IFACE, _GetFormat)(ds->FIELD, &wfx, sizeof(wfx), NULL);\n+    if (FAILED(hr)) {\n+        dsound_logerr2(hr, typ, \"Could not get \" NAME \" format\");\n         goto fail0;\n     }\n \n-#ifdef DEBUG_DSOUND\n-    dolog (NAME \"\\n\");\n-    print_wave_format (&wfx);\n-#endif\n+    trace_dsound_wave_format(\n+        wfx.wFormatTag, wfx.nChannels,\n+        wfx.nSamplesPerSec, wfx.nAvgBytesPerSec,\n+        wfx.nBlockAlign, wfx.wBitsPerSample, wfx.cbSize);\n \n     memset (&bc, 0, sizeof (bc));\n     bc.dwSize = sizeof (bc);\n \n-    hr = glue (IFACE, _GetCaps) (ds->FIELD, &bc);\n-    if (FAILED (hr)) {\n-        dsound_logerr2 (hr, typ, \"Could not get \" NAME \" format\\n\");\n+    hr = glue(IFACE, _GetCaps)(ds->FIELD, &bc);\n+    if (FAILED(hr)) {\n+        dsound_logerr2(hr, typ, \"Could not get \" NAME \" caps\");\n         goto fail0;\n     }\n \n@@ -247,18 +248,13 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as)\n     audio_pcm_init_info (&hw->info, &obt_as);\n \n     if (bc.dwBufferBytes % hw->info.bytes_per_frame) {\n-        dolog (\n-            \"GetCaps returned misaligned buffer size %ld, alignment %d\\n\",\n-            bc.dwBufferBytes, hw->info.bytes_per_frame\n-            );\n+        warn_report(\"dsound: GetCaps returned misaligned buffer size %ld, \"\n+                    \"alignment %d\", bc.dwBufferBytes, hw->info.bytes_per_frame);\n     }\n     hw->size_emul = bc.dwBufferBytes;\n     hw->samples = bc.dwBufferBytes / hw->info.bytes_per_frame;\n \n-#ifdef DEBUG_DSOUND\n-    dolog (\"caps %ld, desc %ld\\n\",\n-           bc.dwBufferBytes, bd.dwBufferBytes);\n-#endif\n+    trace_dsound_buffer_bytes(bc.dwBufferBytes, bd.dwBufferBytes);\n     return 0;\n \n  fail0:\ndiff --git a/audio/audio_win_int.c b/audio/audio_win_int.c\nindex 44a8ff24a6f..ecd599c87de 100644\n--- a/audio/audio_win_int.c\n+++ b/audio/audio_win_int.c\n@@ -2,12 +2,12 @@\n \n #include \"qemu/osdep.h\"\n \n-#define AUDIO_CAP \"win-int\"\n #include <windows.h>\n #include <mmreg.h>\n #include <mmsystem.h>\n \n #include \"qemu/audio.h\"\n+#include \"qemu/error-report.h\"\n #include \"audio_int.h\"\n #include \"audio_win_int.h\"\n \n@@ -53,7 +53,7 @@ int waveformat_from_audio_settings (WAVEFORMATEX *wfx,\n         break;\n \n     default:\n-        dolog(\"Internal logic error: Bad audio format %d\\n\", as->fmt);\n+        error_report(\"dsound: Internal logic error: Bad audio format %d\", as->fmt);\n         return -1;\n     }\n \n@@ -64,7 +64,7 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx,\n                                   struct audsettings *as)\n {\n     if (!wfx->nSamplesPerSec) {\n-        dolog (\"Invalid wave format, frequency is zero\\n\");\n+        error_report(\"dsound: Invalid wave format, frequency is zero\");\n         return -1;\n     }\n     as->freq = wfx->nSamplesPerSec;\n@@ -79,10 +79,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx,\n         break;\n \n     default:\n-        dolog (\n-            \"Invalid wave format, number of channels is not 1 or 2, but %d\\n\",\n-            wfx->nChannels\n-            );\n+        error_report(\"dsound: Invalid wave format, \"\n+                     \"number of channels is not 1 or 2, but %d\",\n+                     wfx->nChannels);\n         return -1;\n     }\n \n@@ -101,9 +100,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx,\n             break;\n \n         default:\n-            dolog(\"Invalid PCM wave format, bits per sample is not \"\n-                  \"8, 16 or 32, but %d\\n\",\n-                  wfx->wBitsPerSample);\n+            error_report(\"dsound: Invalid PCM wave format, bits per sample is not \"\n+                         \"8, 16 or 32, but %d\",\n+                         wfx->wBitsPerSample);\n             return -1;\n         }\n     } else if (wfx->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) {\n@@ -113,15 +112,15 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx,\n             break;\n \n         default:\n-            dolog(\"Invalid IEEE_FLOAT wave format, bits per sample is not \"\n-                  \"32, but %d\\n\",\n-                  wfx->wBitsPerSample);\n+            error_report(\"dsound: Invalid IEEE_FLOAT wave format, \"\n+                         \"bits per sample is not 32, but %d\",\n+                         wfx->wBitsPerSample);\n             return -1;\n         }\n     } else {\n-        dolog(\"Invalid wave format, tag is not PCM and not IEEE_FLOAT, \"\n-              \"but %d\\n\",\n-              wfx->wFormatTag);\n+        error_report(\"dsound: Invalid wave format, \"\n+                     \"tag is not PCM and not IEEE_FLOAT, but %d\",\n+                     wfx->wFormatTag);\n         return -1;\n     }\n \ndiff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c\nindex 2c592c56663..704bc3da73b 100644\n--- a/audio/dsoundaudio.c\n+++ b/audio/dsoundaudio.c\n@@ -28,8 +28,7 @@\n \n #include \"qemu/osdep.h\"\n #include \"qemu/audio.h\"\n-\n-#define AUDIO_CAP \"dsound\"\n+#include \"qemu/error-report.h\"\n #include \"audio_int.h\"\n #include \"qemu/module.h\"\n #include \"qapi/error.h\"\n@@ -40,6 +39,7 @@\n #include <objbase.h>\n #include <dsound.h>\n \n+#include \"trace.h\"\n #include \"audio_win_int.h\"\n \n #define TYPE_AUDIO_DSOUND \"audio-dsound\"\n@@ -55,9 +55,6 @@ struct AudioDsound {\n     struct audsettings settings;\n };\n \n-\n-/* #define DEBUG_DSOUND */\n-\n typedef struct {\n     HWVoiceOut hw;\n     LPDIRECTSOUNDBUFFER dsound_buffer;\n@@ -214,56 +211,37 @@ static void dsound_log_hresult(HRESULT hr)\n     const char *str = dserror(hr);\n \n     if (str) {\n-        AUD_log (AUDIO_CAP, \"Reason: %s\\n\", str);\n+        error_printf(\" Reason: %s\", str);\n     } else {\n-        AUD_log (AUDIO_CAP, \"Reason: Unknown (HRESULT: 0x%lx)\\n\", hr);\n+        error_printf(\" Reason: Unknown (HRESULT: 0x%lx)\", hr);\n     }\n }\n \n-static void G_GNUC_PRINTF (2, 3) dsound_logerr (\n-    HRESULT hr,\n-    const char *fmt,\n-    ...\n-    )\n+static void G_GNUC_PRINTF(2, 3) dsound_logerr(HRESULT hr, const char *fmt, ...)\n {\n     va_list ap;\n \n-    va_start (ap, fmt);\n-    AUD_vlog (AUDIO_CAP, fmt, ap);\n-    va_end (ap);\n-\n-    dsound_log_hresult (hr);\n+    error_printf(\"dsound: \");\n+    va_start(ap, fmt);\n+    error_vprintf(fmt, ap);\n+    va_end(ap);\n+    dsound_log_hresult(hr);\n+    error_printf(\"\\n\");\n }\n \n-static void G_GNUC_PRINTF (3, 4) dsound_logerr2 (\n-    HRESULT hr,\n-    const char *typ,\n-    const char *fmt,\n-    ...\n-    )\n+static void G_GNUC_PRINTF(3, 4) dsound_logerr2(HRESULT hr, const char *typ,\n+                                               const char *fmt, ...)\n {\n     va_list ap;\n \n-    AUD_log (AUDIO_CAP, \"Could not initialize %s\\n\", typ);\n-    va_start (ap, fmt);\n-    AUD_vlog (AUDIO_CAP, fmt, ap);\n-    va_end (ap);\n-\n-    dsound_log_hresult (hr);\n+    error_printf(\"dsound: Could not initialize %s: \", typ);\n+    va_start(ap, fmt);\n+    error_vprintf(fmt, ap);\n+    va_end(ap);\n+    dsound_log_hresult(hr);\n+    error_printf(\"\\n\");\n }\n \n-#ifdef DEBUG_DSOUND\n-static void print_wave_format (WAVEFORMATEX *wfx)\n-{\n-    dolog (\"tag             = %d\\n\", wfx->wFormatTag);\n-    dolog (\"nChannels       = %d\\n\", wfx->nChannels);\n-    dolog (\"nSamplesPerSec  = %ld\\n\", wfx->nSamplesPerSec);\n-    dolog (\"nAvgBytesPerSec = %ld\\n\", wfx->nAvgBytesPerSec);\n-    dolog (\"nBlockAlign     = %d\\n\", wfx->nBlockAlign);\n-    dolog (\"wBitsPerSample  = %d\\n\", wfx->wBitsPerSample);\n-    dolog (\"cbSize          = %d\\n\", wfx->cbSize);\n-}\n-#endif\n \n static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s)\n {\n@@ -272,7 +250,7 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s)\n     hr = IDirectSoundBuffer_Restore (dsb);\n \n     if (hr != DS_OK) {\n-        dsound_logerr (hr, \"Could not restore playback buffer\\n\");\n+        dsound_logerr(hr, \"Could not restore playback buffer\");\n         return -1;\n     }\n     return 0;\n@@ -290,7 +268,7 @@ static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb, DWORD *statusp,\n \n     hr = IDirectSoundBuffer_GetStatus (dsb, statusp);\n     if (FAILED (hr)) {\n-        dsound_logerr (hr, \"Could not get playback buffer status\\n\");\n+        dsound_logerr(hr, \"Could not get playback buffer status\");\n         return -1;\n     }\n \n@@ -309,7 +287,7 @@ static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBUFFER dscb,\n \n     hr = IDirectSoundCaptureBuffer_GetStatus (dscb, statusp);\n     if (FAILED (hr)) {\n-        dsound_logerr (hr, \"Could not get capture buffer status\\n\");\n+        dsound_logerr(hr, \"Could not get capture buffer status\");\n         return -1;\n     }\n \n@@ -340,11 +318,7 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb,\n     len1 = blen1 / hw->info.bytes_per_frame;\n     len2 = blen2 / hw->info.bytes_per_frame;\n \n-#ifdef DEBUG_DSOUND\n-    dolog (\"clear %p,%ld,%ld %p,%ld,%ld\\n\",\n-           p1, blen1, len1,\n-           p2, blen2, len2);\n-#endif\n+    trace_dsound_clear_sample(p1, blen1, len1, p2, blen2, len2);\n \n     if (p1 && len1) {\n         audio_pcm_info_clear_buf (&hw->info, p1, len1);\n@@ -366,40 +340,40 @@ static void dsound_enable_out(HWVoiceOut *hw, bool enable)\n     LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer;\n \n     if (!dsb) {\n-        dolog (\"Attempt to control voice without a buffer\\n\");\n+        error_report(\"dsound: Attempt to control voice without a buffer\");\n         return;\n     }\n \n     if (enable) {\n-        if (dsound_get_status_out (dsb, &status, s)) {\n+        if (dsound_get_status_out(dsb, &status, s)) {\n             return;\n         }\n \n         if (status & DSBSTATUS_PLAYING) {\n-            dolog (\"warning: Voice is already playing\\n\");\n+            warn_report(\"dsound: Voice is already playing\");\n             return;\n         }\n \n-        dsound_clear_sample (hw, dsb, s);\n+        dsound_clear_sample(hw, dsb, s);\n \n-        hr = IDirectSoundBuffer_Play (dsb, 0, 0, DSBPLAY_LOOPING);\n-        if (FAILED (hr)) {\n-            dsound_logerr (hr, \"Could not start playing buffer\\n\");\n+        hr = IDirectSoundBuffer_Play(dsb, 0, 0, DSBPLAY_LOOPING);\n+        if (FAILED(hr)) {\n+            dsound_logerr(hr, \"Could not start playing buffer\");\n             return;\n         }\n     } else {\n-        if (dsound_get_status_out (dsb, &status, s)) {\n+        if (dsound_get_status_out(dsb, &status, s)) {\n             return;\n         }\n \n         if (status & DSBSTATUS_PLAYING) {\n-            hr = IDirectSoundBuffer_Stop (dsb);\n-            if (FAILED (hr)) {\n-                dsound_logerr (hr, \"Could not stop playing buffer\\n\");\n+            hr = IDirectSoundBuffer_Stop(dsb);\n+            if (FAILED(hr)) {\n+                dsound_logerr(hr, \"Could not stop playing buffer\");\n                 return;\n             }\n         } else {\n-            dolog (\"warning: Voice is not playing\\n\");\n+            warn_report(\"dsound: Voice is not playing\");\n         }\n     }\n }\n@@ -414,7 +388,7 @@ static size_t dsound_buffer_get_free(HWVoiceOut *hw)\n     hr = IDirectSoundBuffer_GetCurrentPosition(\n         dsb, &ppos, ds->first_time ? &wpos : NULL);\n     if (FAILED(hr)) {\n-        dsound_logerr(hr, \"Could not get playback buffer position\\n\");\n+        dsound_logerr(hr, \"Could not get playback buffer position\");\n         return 0;\n     }\n \n@@ -441,7 +415,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size_t *size)\n     err = dsound_lock_out(dsb, &hw->info, hw->pos_emul, req_size, &ret, NULL,\n                           &act_size, NULL, false, AUDIO_DSOUND(hw->s));\n     if (err) {\n-        dolog(\"Failed to lock buffer\\n\");\n+        error_report(\"dsound: Failed to lock buffer\");\n         *size = 0;\n         return NULL;\n     }\n@@ -457,7 +431,7 @@ static size_t dsound_put_buffer_out(HWVoiceOut *hw, void *buf, size_t len)\n     int err = dsound_unlock_out(dsb, buf, NULL, len, 0);\n \n     if (err) {\n-        dolog(\"Failed to unlock buffer!!\\n\");\n+        error_report(\"dsound: Failed to unlock buffer\");\n         return 0;\n     }\n     hw->pos_emul = (hw->pos_emul + len) % hw->size_emul;\n@@ -473,40 +447,40 @@ static void dsound_enable_in(HWVoiceIn *hw, bool enable)\n     LPDIRECTSOUNDCAPTUREBUFFER dscb = ds->dsound_capture_buffer;\n \n     if (!dscb) {\n-        dolog (\"Attempt to control capture voice without a buffer\\n\");\n+        error_report(\"dsound: Attempt to control capture voice without a buffer\");\n         return;\n     }\n \n     if (enable) {\n-        if (dsound_get_status_in (dscb, &status)) {\n+        if (dsound_get_status_in(dscb, &status)) {\n             return;\n         }\n \n         if (status & DSCBSTATUS_CAPTURING) {\n-            dolog (\"warning: Voice is already capturing\\n\");\n+            warn_report(\"dsound: Voice is already capturing\");\n             return;\n         }\n \n         /* clear ?? */\n \n-        hr = IDirectSoundCaptureBuffer_Start (dscb, DSCBSTART_LOOPING);\n-        if (FAILED (hr)) {\n-            dsound_logerr (hr, \"Could not start capturing\\n\");\n+        hr = IDirectSoundCaptureBuffer_Start(dscb, DSCBSTART_LOOPING);\n+        if (FAILED(hr)) {\n+            dsound_logerr(hr, \"Could not start capturing\");\n             return;\n         }\n     } else {\n-        if (dsound_get_status_in (dscb, &status)) {\n+        if (dsound_get_status_in(dscb, &status)) {\n             return;\n         }\n \n         if (status & DSCBSTATUS_CAPTURING) {\n-            hr = IDirectSoundCaptureBuffer_Stop (dscb);\n-            if (FAILED (hr)) {\n-                dsound_logerr (hr, \"Could not stop capturing\\n\");\n+            hr = IDirectSoundCaptureBuffer_Stop(dscb);\n+            if (FAILED(hr)) {\n+                dsound_logerr(hr, \"Could not stop capturing\");\n                 return;\n             }\n         } else {\n-            dolog (\"warning: Voice is not capturing\\n\");\n+            warn_report(\"dsound: Voice is not capturing\");\n         }\n     }\n }\n@@ -523,7 +497,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t *size)\n \n     hr = IDirectSoundCaptureBuffer_GetCurrentPosition(dscb, NULL, &rpos);\n     if (FAILED(hr)) {\n-        dsound_logerr(hr, \"Could not get capture buffer position\\n\");\n+        dsound_logerr(hr, \"Could not get capture buffer position\");\n         *size = 0;\n         return NULL;\n     }\n@@ -544,7 +518,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t *size)\n     err = dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, NULL,\n                          &act_size, NULL, false, AUDIO_DSOUND(hw->s));\n     if (err) {\n-        dolog(\"Failed to lock buffer\\n\");\n+        error_report(\"dsound: Failed to lock buffer\");\n         *size = 0;\n         return NULL;\n     }\n@@ -560,7 +534,7 @@ static void dsound_put_buffer_in(HWVoiceIn *hw, void *buf, size_t len)\n     int err = dsound_unlock_in(dscb, buf, NULL, len, 0);\n \n     if (err) {\n-        dolog(\"Failed to unlock buffer!!\\n\");\n+        error_report(\"dsound: Failed to unlock buffer\");\n         return;\n     }\n     hw->pos_emul = (hw->pos_emul + len) % hw->size_emul;\n@@ -577,7 +551,7 @@ static void audio_dsound_finalize(Object *obj)\n \n     hr = IDirectSound_Release (s->dsound);\n     if (FAILED (hr)) {\n-        dsound_logerr (hr, \"Could not release DirectSound\\n\");\n+        dsound_logerr(hr, \"Could not release DirectSound\");\n     }\n     s->dsound = NULL;\n \n@@ -587,7 +561,7 @@ static void audio_dsound_finalize(Object *obj)\n \n     hr = IDirectSoundCapture_Release (s->dsound_capture);\n     if (FAILED (hr)) {\n-        dsound_logerr (hr, \"Could not release DirectSoundCapture\\n\");\n+        dsound_logerr(hr, \"Could not release DirectSoundCapture\");\n     }\n     s->dsound_capture = NULL;\n }\ndiff --git a/audio/trace-events b/audio/trace-events\nindex 737e3e60694..b2f29666700 100644\n--- a/audio/trace-events\n+++ b/audio/trace-events\n@@ -23,6 +23,11 @@ dbus_audio_register(const char *s, const char *dir) \"sender = %s, dir = %s\"\n dbus_audio_put_buffer_out(size_t pos, size_t size) \"buf_pos = %zu, buf_size = %zu\"\n dbus_audio_read(size_t len) \"len = %zu\"\n \n+# dsoundaudio.c\n+dsound_clear_sample(void *p1, uint32_t blen1, uint32_t len1, void *p2, uint32_t blen2, uint32_t len2) \"p1=%p, blen1=%u, len1=%u, p2=%p, blen2=%u, len2=%u\"\n+dsound_wave_format(uint16_t wFormatTag, uint16_t nChannels, uint32_t nSamplesPerSec, uint32_t nAvgBytesPerSec, uint16_t nBlockAlign, uint16_t wBitsPerSample, uint16_t cbSize) \"wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u\"\n+dsound_buffer_bytes(uint32_t caps_bytes, uint32_t desc_bytes) \"caps_bytes=%u, desc_bytes=%u\"\n+\n # pwaudio.c\n pw_state_changed(int nodeid, const char *s) \"node id: %d stream state: %s\"\n pw_read(int32_t avail, uint32_t index, size_t len) \"avail=%d index=%u len=%zu\"\n",
    "prefixes": [
        "62/85"
    ]
}