From nobody Mon Nov 3 00:13:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528102388210499.27808295625755; Mon, 4 Jun 2018 01:53:08 -0700 (PDT) Received: from localhost ([::1]:38374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPlEa-0000P0-6y for importer@patchew.org; Mon, 04 Jun 2018 04:53:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPlAs-0006lh-M4 for qemu-devel@nongnu.org; Mon, 04 Jun 2018 04:49:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPlAo-0007XI-ML for qemu-devel@nongnu.org; Mon, 04 Jun 2018 04:49:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48969 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPlAo-0007VA-HG for qemu-devel@nongnu.org; Mon, 04 Jun 2018 04:49:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAD9084221 for ; Mon, 4 Jun 2018 08:49:04 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-24.ams2.redhat.com [10.36.116.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA32D2026DEF; Mon, 4 Jun 2018 08:49:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0C1A331E2C; Mon, 4 Jun 2018 10:49:04 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 4 Jun 2018 10:49:03 +0200 Message-Id: <20180604084903.8163-3-kraxel@redhat.com> In-Reply-To: <20180604084903.8163-1-kraxel@redhat.com> References: <20180604084903.8163-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 04 Jun 2018 08:49:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 04 Jun 2018 08:49:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/2] vga: cleanup surface handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Just set the full_update flag if we need a new DisplaySurface. Create a new surface when the flag is set instead of having two places where qemu_create_displaysurface_from() is called. Signed-off-by: Gerd Hoffmann Message-id: 20180525131318.28437-1-kraxel@redhat.com --- hw/display/vga.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index a7794f6d1f..ed476e4e80 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1548,12 +1548,31 @@ static void vga_draw_graphic(VGACommonState *s, int= full_update) } else { share_surface =3D false; } + if (s->line_offset !=3D s->last_line_offset || disp_width !=3D s->last_width || height !=3D s->last_height || s->last_depth !=3D depth || s->last_byteswap !=3D byteswap || share_surface !=3D is_buffer_shared(surface)) { + /* display parameters changed -> need new display surface */ + s->last_scr_width =3D disp_width; + s->last_scr_height =3D height; + s->last_width =3D disp_width; + s->last_height =3D height; + s->last_line_offset =3D s->line_offset; + s->last_depth =3D depth; + s->last_byteswap =3D byteswap; + full_update =3D 1; + } + if (surface_data(surface) !=3D s->vram_ptr + (s->start_addr * 4) + && is_buffer_shared(surface)) { + /* base address changed (page flip) -> shared display surfaces + * must be updated with the new base address */ + full_update =3D 1; + } + + if (full_update) { if (share_surface) { surface =3D qemu_create_displaysurface_from(disp_width, height, format, s->line_offset, @@ -1563,23 +1582,6 @@ static void vga_draw_graphic(VGACommonState *s, int = full_update) qemu_console_resize(s->con, disp_width, height); surface =3D qemu_console_surface(s->con); } - s->last_scr_width =3D disp_width; - s->last_scr_height =3D height; - s->last_width =3D disp_width; - s->last_height =3D height; - s->last_line_offset =3D s->line_offset; - s->last_depth =3D depth; - s->last_byteswap =3D byteswap; - full_update =3D 1; - } else if (is_buffer_shared(surface) && - (full_update || surface_data(surface) !=3D s->vram_ptr - + (s->start_addr * 4))) { - pixman_format_code_t format =3D - qemu_default_pixman_format(depth, !byteswap); - surface =3D qemu_create_displaysurface_from(disp_width, - height, format, s->line_offset, - s->vram_ptr + (s->start_addr * 4)); - dpy_gfx_replace_surface(s->con, surface); } =20 if (shift_control =3D=3D 0) { --=20 2.9.3