get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1571483,
    "url": "http://patchwork.ozlabs.org/api/patches/1571483/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-19-marcandre.lureau@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": "<20211221065855.142578-19-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2021-12-21T06:58:37",
    "name": "[PULL,v2,18/36] console: save current scanout details",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3acbd27a40987afc9663bfe6c26e750f2069d3ad",
    "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/20211221065855.142578-19-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 277865,
            "url": "http://patchwork.ozlabs.org/api/series/277865/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=277865",
            "date": "2021-12-21T06:58:19",
            "name": "[PULL,v2,01/36] ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/277865/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1571483/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1571483/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@bilbo.ozlabs.org",
        "Authentication-Results": [
            "bilbo.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=Sj8VbOXo;\n\tdkim-atps=neutral",
            "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=<UNKNOWN>)",
            "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4JJ7Q94DRVz9s3q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Dec 2021 18:29:53 +1100 (AEDT)",
            "from localhost ([::1]:32822 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1mzZap-0001w6-A0\n\tfor incoming@patchwork.ozlabs.org; Tue, 21 Dec 2021 02:29:51 -0500",
            "from eggs.gnu.org ([209.51.188.92]:58690)\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 1mzZBD-0006Hx-Ik\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:03:23 -0500",
            "from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32414)\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 1mzZBA-00026R-3I\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:03:22 -0500",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-223-OUxumi5eO7eJK4R-9y00ug-1; Tue, 21 Dec 2021 02:03:18 -0500",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com\n [10.5.11.23])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09DA51023F4D;\n Tue, 21 Dec 2021 07:03:17 +0000 (UTC)",
            "from localhost (unknown [10.39.208.37])\n by smtp.corp.redhat.com (Postfix) with ESMTP id E1A1138DFE;\n Tue, 21 Dec 2021 07:03:08 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1640070199;\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=qMiNkCokrtNT9mUUH6x5x11OrQaJ0Ac5k+jaVR3jnpg=;\n b=Sj8VbOXo1yJqKKHnZ+jqAKPlWymWIfmJPcoZGEnQ3kky9YLkiu/I4X7Fa+AMdp+MQzWMua\n u/XFKsRzjc4Y8eCMe/SyL/iCSFgCJGfmujqcC0WlfVf28lbnACJajOohxWN1NMdP8unKDH\n j5W1BcaL50J+pF12B/+WBElOThqyWFk=",
        "X-MC-Unique": "OUxumi5eO7eJK4R-9y00ug-1",
        "From": "marcandre.lureau@redhat.com",
        "To": "qemu-devel@nongnu.org",
        "Subject": "[PULL v2 18/36] console: save current scanout details",
        "Date": "Tue, 21 Dec 2021 10:58:37 +0400",
        "Message-Id": "<20211221065855.142578-19-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20211221065855.142578-1-marcandre.lureau@redhat.com>",
        "References": "<20211221065855.142578-1-marcandre.lureau@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.23",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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": "-29",
        "X-Spam_score": "-3.0",
        "X-Spam_bar": "---",
        "X-Spam_report": "(-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-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>",
        "Cc": "peter.maydell@linaro.org, richard.henderson@linaro.org, =?utf-8?q?Marc-A?=\n\t=?utf-8?q?ndr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "From: Marc-André Lureau <marcandre.lureau@redhat.com>\n\nAdd a new DisplayScanout structure to save the current scanout details.\nThis allows to attach later UI backends and set the scanout.\n\nIntroduce displaychangelistener_display_console() helper function to\nhandle the dpy_gfx_switch/gl_scanout() & dpy_gfx_update() calls.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nAcked-by: Gerd Hoffmann <kraxel@redhat.com>\n---\n include/ui/console.h |  27 +++++++\n ui/console.c         | 165 +++++++++++++++++++++++++++++--------------\n 2 files changed, 138 insertions(+), 54 deletions(-)",
    "diff": "diff --git a/include/ui/console.h b/include/ui/console.h\nindex eefd7e4dc1f4..f590819880b5 100644\n--- a/include/ui/console.h\n+++ b/include/ui/console.h\n@@ -108,6 +108,17 @@ struct QemuConsoleClass {\n #define QEMU_ALLOCATED_FLAG     0x01\n #define QEMU_PLACEHOLDER_FLAG   0x02\n \n+typedef struct ScanoutTexture {\n+    uint32_t backing_id;\n+    bool backing_y_0_top;\n+    uint32_t backing_width;\n+    uint32_t backing_height;\n+    uint32_t x;\n+    uint32_t y;\n+    uint32_t width;\n+    uint32_t height;\n+} ScanoutTexture;\n+\n typedef struct DisplaySurface {\n     pixman_format_code_t format;\n     pixman_image_t *image;\n@@ -178,6 +189,22 @@ typedef struct QemuDmaBuf {\n     bool      draw_submitted;\n } QemuDmaBuf;\n \n+enum display_scanout {\n+    SCANOUT_NONE,\n+    SCANOUT_SURFACE,\n+    SCANOUT_TEXTURE,\n+    SCANOUT_DMABUF,\n+};\n+\n+typedef struct DisplayScanout {\n+    enum display_scanout kind;\n+    union {\n+        /* DisplaySurface *surface; is kept in QemuConsole */\n+        ScanoutTexture texture;\n+        QemuDmaBuf *dmabuf;\n+    };\n+} DisplayScanout;\n+\n typedef struct DisplayState DisplayState;\n typedef struct DisplayGLCtx DisplayGLCtx;\n \ndiff --git a/ui/console.c b/ui/console.c\nindex 78583df92035..40eebb6d2cc2 100644\n--- a/ui/console.c\n+++ b/ui/console.c\n@@ -77,6 +77,7 @@ struct QemuConsole {\n     console_type_t console_type;\n     DisplayState *ds;\n     DisplaySurface *surface;\n+    DisplayScanout scanout;\n     int dcls;\n     DisplayGLCtx *gl;\n     int gl_block;\n@@ -146,6 +147,7 @@ static void dpy_refresh(DisplayState *s);\n static DisplayState *get_alloc_displaystate(void);\n static void text_console_update_cursor_timer(void);\n static void text_console_update_cursor(void *opaque);\n+static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl);\n \n static void gui_update(void *opaque)\n {\n@@ -481,6 +483,8 @@ static void text_console_resize(QemuConsole *s)\n     TextCell *cells, *c, *c1;\n     int w1, x, y, last_width;\n \n+    assert(s->scanout.kind == SCANOUT_SURFACE);\n+\n     last_width = s->width;\n     s->width = surface_width(s->surface) / FONT_WIDTH;\n     s->height = surface_height(s->surface) / FONT_HEIGHT;\n@@ -1052,6 +1056,48 @@ static void console_putchar(QemuConsole *s, int ch)\n     }\n }\n \n+static void displaychangelistener_display_console(DisplayChangeListener *dcl,\n+                                                  QemuConsole *con)\n+{\n+    static const char nodev[] =\n+        \"This VM has no graphic display device.\";\n+    static DisplaySurface *dummy;\n+\n+    if (!con) {\n+        if (!dcl->ops->dpy_gfx_switch) {\n+            return;\n+        }\n+        if (!dummy) {\n+            dummy = qemu_create_placeholder_surface(640, 480, nodev);\n+        }\n+        dcl->ops->dpy_gfx_switch(dcl, dummy);\n+        return;\n+    }\n+\n+    if (con->scanout.kind == SCANOUT_DMABUF &&\n+        displaychangelistener_has_dmabuf(dcl)) {\n+        dcl->ops->dpy_gl_scanout_dmabuf(dcl, con->scanout.dmabuf);\n+    } else if (con->scanout.kind == SCANOUT_TEXTURE &&\n+               dcl->ops->dpy_gl_scanout_texture) {\n+        dcl->ops->dpy_gl_scanout_texture(dcl,\n+                                         con->scanout.texture.backing_id,\n+                                         con->scanout.texture.backing_y_0_top,\n+                                         con->scanout.texture.backing_width,\n+                                         con->scanout.texture.backing_height,\n+                                         con->scanout.texture.x,\n+                                         con->scanout.texture.y,\n+                                         con->scanout.texture.width,\n+                                         con->scanout.texture.height);\n+    } else if (con->scanout.kind == SCANOUT_SURFACE &&\n+               dcl->ops->dpy_gfx_switch) {\n+        dcl->ops->dpy_gfx_switch(dcl, con->surface);\n+    }\n+\n+    dcl->ops->dpy_gfx_update(dcl, 0, 0,\n+                             qemu_console_get_width(con, 0),\n+                             qemu_console_get_height(con, 0));\n+}\n+\n void console_select(unsigned int index)\n {\n     DisplayChangeListener *dcl;\n@@ -1068,13 +1114,7 @@ void console_select(unsigned int index)\n                 if (dcl->con != NULL) {\n                     continue;\n                 }\n-                if (dcl->ops->dpy_gfx_switch) {\n-                    dcl->ops->dpy_gfx_switch(dcl, s->surface);\n-                }\n-            }\n-            if (s->surface) {\n-                dpy_gfx_update(s, 0, 0, surface_width(s->surface),\n-                               surface_height(s->surface));\n+                displaychangelistener_display_console(dcl, s);\n             }\n         }\n         if (ds->have_text) {\n@@ -1480,9 +1520,6 @@ static bool dpy_gl_compatible_with(QemuConsole *con, DisplayChangeListener *dcl)\n \n void register_displaychangelistener(DisplayChangeListener *dcl)\n {\n-    static const char nodev[] =\n-        \"This VM has no graphic display device.\";\n-    static DisplaySurface *dummy;\n     QemuConsole *con;\n \n     assert(!dcl->ds);\n@@ -1507,16 +1544,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)\n     } else {\n         con = active_console;\n     }\n-    if (dcl->ops->dpy_gfx_switch) {\n-        if (con) {\n-            dcl->ops->dpy_gfx_switch(dcl, con->surface);\n-        } else {\n-            if (!dummy) {\n-                dummy = qemu_create_placeholder_surface(640, 480, nodev);\n-            }\n-            dcl->ops->dpy_gfx_switch(dcl, dummy);\n-        }\n-    }\n+    displaychangelistener_display_console(dcl, con);\n     text_console_update_cursor(NULL);\n }\n \n@@ -1597,13 +1625,9 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)\n {\n     DisplayState *s = con->ds;\n     DisplayChangeListener *dcl;\n-    int width = w;\n-    int height = h;\n+    int width = qemu_console_get_width(con, x + w);\n+    int height = qemu_console_get_height(con, y + h);\n \n-    if (con->surface) {\n-        width = surface_width(con->surface);\n-        height = surface_height(con->surface);\n-    }\n     x = MAX(x, 0);\n     y = MAX(y, 0);\n     x = MIN(x, width);\n@@ -1626,12 +1650,10 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)\n \n void dpy_gfx_update_full(QemuConsole *con)\n {\n-    if (!con->surface) {\n-        return;\n-    }\n-    dpy_gfx_update(con, 0, 0,\n-                   surface_width(con->surface),\n-                   surface_height(con->surface));\n+    int w = qemu_console_get_width(con, 0);\n+    int h = qemu_console_get_height(con, 0);\n+\n+    dpy_gfx_update(con, 0, 0, w, h);\n }\n \n void dpy_gfx_replace_surface(QemuConsole *con,\n@@ -1658,6 +1680,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,\n \n     assert(old_surface != surface);\n \n+    con->scanout.kind = SCANOUT_SURFACE;\n     con->surface = surface;\n     QLIST_FOREACH(dcl, &s->listeners, next) {\n         if (con != (dcl->con ? dcl->con : active_console)) {\n@@ -1833,6 +1856,9 @@ void dpy_gl_scanout_disable(QemuConsole *con)\n     DisplayState *s = con->ds;\n     DisplayChangeListener *dcl;\n \n+    if (con->scanout.kind != SCANOUT_SURFACE) {\n+        con->scanout.kind = SCANOUT_NONE;\n+    }\n     QLIST_FOREACH(dcl, &s->listeners, next) {\n         dcl->ops->dpy_gl_scanout_disable(dcl);\n     }\n@@ -1849,6 +1875,11 @@ void dpy_gl_scanout_texture(QemuConsole *con,\n     DisplayState *s = con->ds;\n     DisplayChangeListener *dcl;\n \n+    con->scanout.kind = SCANOUT_TEXTURE;\n+    con->scanout.texture = (ScanoutTexture) {\n+        backing_id, backing_y_0_top, backing_width, backing_height,\n+        x, y, width, height\n+    };\n     QLIST_FOREACH(dcl, &s->listeners, next) {\n         dcl->ops->dpy_gl_scanout_texture(dcl, backing_id,\n                                          backing_y_0_top,\n@@ -1863,6 +1894,8 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,\n     DisplayState *s = con->ds;\n     DisplayChangeListener *dcl;\n \n+    con->scanout.kind = SCANOUT_DMABUF;\n+    con->scanout.dmabuf = dmabuf;\n     QLIST_FOREACH(dcl, &s->listeners, next) {\n         dcl->ops->dpy_gl_scanout_dmabuf(dcl, dmabuf);\n     }\n@@ -1989,10 +2022,8 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,\n     s = qemu_console_lookup_unused();\n     if (s) {\n         trace_console_gfx_reuse(s->index);\n-        if (s->surface) {\n-            width = surface_width(s->surface);\n-            height = surface_height(s->surface);\n-        }\n+        width = qemu_console_get_width(s, 0);\n+        height = qemu_console_get_height(s, 0);\n     } else {\n         trace_console_gfx_new();\n         s = new_console(ds, GRAPHIC_CONSOLE, head);\n@@ -2021,13 +2052,8 @@ void graphic_console_close(QemuConsole *con)\n     static const char unplugged[] =\n         \"Guest display has been unplugged\";\n     DisplaySurface *surface;\n-    int width = 640;\n-    int height = 480;\n-\n-    if (con->surface) {\n-        width = surface_width(con->surface);\n-        height = surface_height(con->surface);\n-    }\n+    int width = qemu_console_get_width(con, 640);\n+    int height = qemu_console_get_height(con, 480);\n \n     trace_console_gfx_close(con->index);\n     object_property_set_link(OBJECT(con), \"device\", NULL, &error_abort);\n@@ -2179,7 +2205,19 @@ int qemu_console_get_width(QemuConsole *con, int fallback)\n     if (con == NULL) {\n         con = active_console;\n     }\n-    return con ? surface_width(con->surface) : fallback;\n+    if (con == NULL) {\n+        return fallback;\n+    }\n+    switch (con->scanout.kind) {\n+    case SCANOUT_DMABUF:\n+        return con->scanout.dmabuf->width;\n+    case SCANOUT_TEXTURE:\n+        return con->scanout.texture.width;\n+    case SCANOUT_SURFACE:\n+        return surface_width(con->surface);\n+    default:\n+        return fallback;\n+    }\n }\n \n int qemu_console_get_height(QemuConsole *con, int fallback)\n@@ -2187,7 +2225,19 @@ int qemu_console_get_height(QemuConsole *con, int fallback)\n     if (con == NULL) {\n         con = active_console;\n     }\n-    return con ? surface_height(con->surface) : fallback;\n+    if (con == NULL) {\n+        return fallback;\n+    }\n+    switch (con->scanout.kind) {\n+    case SCANOUT_DMABUF:\n+        return con->scanout.dmabuf->height;\n+    case SCANOUT_TEXTURE:\n+        return con->scanout.texture.height;\n+    case SCANOUT_SURFACE:\n+        return surface_height(con->surface);\n+    default:\n+        return fallback;\n+    }\n }\n \n static void vc_chr_accept_input(Chardev *chr)\n@@ -2253,12 +2303,13 @@ static void text_console_do_init(Chardev *chr, DisplayState *ds)\n     s->total_height = DEFAULT_BACKSCROLL;\n     s->x = 0;\n     s->y = 0;\n-    if (!s->surface) {\n-        if (active_console && active_console->surface) {\n-            g_width = surface_width(active_console->surface);\n-            g_height = surface_height(active_console->surface);\n+    if (s->scanout.kind != SCANOUT_SURFACE) {\n+        if (active_console && active_console->scanout.kind == SCANOUT_SURFACE) {\n+            g_width = qemu_console_get_width(active_console, g_width);\n+            g_height = qemu_console_get_height(active_console, g_height);\n         }\n         s->surface = qemu_create_displaysurface(g_width, g_height);\n+        s->scanout.kind = SCANOUT_SURFACE;\n     }\n \n     s->hw_ops = &text_console_ops;\n@@ -2317,6 +2368,7 @@ static void vc_chr_open(Chardev *chr,\n         s = new_console(NULL, TEXT_CONSOLE, 0);\n     } else {\n         s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0);\n+        s->scanout.kind = SCANOUT_SURFACE;\n         s->surface = qemu_create_displaysurface(width, height);\n     }\n \n@@ -2340,13 +2392,13 @@ static void vc_chr_open(Chardev *chr,\n \n void qemu_console_resize(QemuConsole *s, int width, int height)\n {\n-    DisplaySurface *surface;\n+    DisplaySurface *surface = qemu_console_surface(s);\n \n     assert(s->console_type == GRAPHIC_CONSOLE);\n \n-    if (s->surface && (s->surface->flags & QEMU_ALLOCATED_FLAG) &&\n-        pixman_image_get_width(s->surface->image) == width &&\n-        pixman_image_get_height(s->surface->image) == height) {\n+    if (surface && (surface->flags & QEMU_ALLOCATED_FLAG) &&\n+        pixman_image_get_width(surface->image) == width &&\n+        pixman_image_get_height(surface->image) == height) {\n         return;\n     }\n \n@@ -2356,7 +2408,12 @@ void qemu_console_resize(QemuConsole *s, int width, int height)\n \n DisplaySurface *qemu_console_surface(QemuConsole *console)\n {\n-    return console->surface;\n+    switch (console->scanout.kind) {\n+    case SCANOUT_SURFACE:\n+        return console->surface;\n+    default:\n+        return NULL;\n+    }\n }\n \n PixelFormat qemu_default_pixelformat(int bpp)\n",
    "prefixes": [
        "PULL",
        "v2",
        "18/36"
    ]
}