From nobody Sat Apr 27 23:49:58 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494516333314643.4551274400101; Thu, 11 May 2017 08:25:33 -0700 (PDT) Received: from localhost ([::1]:48828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8py8-0007ih-2t for importer@patchew.org; Thu, 11 May 2017 11:25:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8pJl-00033R-6r for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8pJk-0005Ac-68 for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8pJj-00059f-U5 for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A351080484; Thu, 11 May 2017 14:43:46 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221F44DA6B; Thu, 11 May 2017 14:43:43 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id AE7C280F6D; Thu, 11 May 2017 16:43:40 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A351080484 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A351080484 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 May 2017 16:43:36 +0200 Message-Id: <20170511144339.13027-2-kraxel@redhat.com> In-Reply-To: <20170511144339.13027-1-kraxel@redhat.com> References: <20170511144339.13027-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 11 May 2017 14:43:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] cg3: make display updates thread safe 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: Mark Cave-Ayland , 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" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Message-id: 1494449551-20227-2-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by: Gerd Hoffmann --- hw/display/cg3.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 7ef8a96496..1de15a1d34 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -94,7 +94,8 @@ static void cg3_update_display(void *opaque) uint32_t dval; int x, y, y_start; unsigned int width, height; - ram_addr_t page, page_min, page_max; + ram_addr_t page; + DirtyBitmapSnapshot *snap =3D NULL; =20 if (surface_bits_per_pixel(surface) !=3D 32) { return; @@ -103,29 +104,32 @@ static void cg3_update_display(void *opaque) height =3D s->height; =20 y_start =3D -1; - page_min =3D -1; - page_max =3D 0; - page =3D 0; pix =3D memory_region_get_ram_ptr(&s->vram_mem); data =3D (uint32_t *)surface_data(surface); =20 - memory_region_sync_dirty_bitmap(&s->vram_mem); + if (!s->full_update) { + memory_region_sync_dirty_bitmap(&s->vram_mem); + snap =3D memory_region_snapshot_and_clear_dirty(&s->vram_mem, 0x0, + memory_region_size(&s->vram_= mem), + DIRTY_MEMORY_VGA); + } + for (y =3D 0; y < height; y++) { - int update =3D s->full_update; + int update; =20 page =3D (ram_addr_t)y * width; - update |=3D memory_region_get_dirty(&s->vram_mem, page, width, - DIRTY_MEMORY_VGA); + + if (s->full_update) { + update =3D 1; + } else { + update =3D memory_region_snapshot_get_dirty(&s->vram_mem, snap= , page, + width); + } + if (update) { if (y_start < 0) { y_start =3D y; } - if (page < page_min) { - page_min =3D page; - } - if (page > page_max) { - page_max =3D page; - } =20 for (x =3D 0; x < width; x++) { dval =3D *pix++; @@ -134,7 +138,7 @@ static void cg3_update_display(void *opaque) } } else { if (y_start >=3D 0) { - dpy_gfx_update(s->con, 0, y_start, s->width, y - y_start); + dpy_gfx_update(s->con, 0, y_start, width, y - y_start); y_start =3D -1; } pix +=3D width; @@ -143,17 +147,14 @@ static void cg3_update_display(void *opaque) } s->full_update =3D 0; if (y_start >=3D 0) { - dpy_gfx_update(s->con, 0, y_start, s->width, y - y_start); - } - if (page_max >=3D page_min) { - memory_region_reset_dirty(&s->vram_mem, - page_min, page_max - page_min, DIRTY_MEMORY_= VGA); + dpy_gfx_update(s->con, 0, y_start, width, y - y_start); } /* vsync interrupt? */ if (s->regs[0] & CG3_CR_ENABLE_INTS) { s->regs[1] |=3D CG3_SR_PENDING_INT; qemu_irq_raise(s->irq); } + g_free(snap); } =20 static void cg3_invalidate_display(void *opaque) --=20 2.9.3 From nobody Sat Apr 27 23:49:58 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494517039852119.05264248184994; Thu, 11 May 2017 08:37:19 -0700 (PDT) Received: from localhost ([::1]:48896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8q9U-0001Gz-Ch for importer@patchew.org; Thu, 11 May 2017 11:37:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8pJm-000346-1Y for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8pJk-0005BH-Lm for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8pJk-0005A7-Cs for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F7C53D95E; Thu, 11 May 2017 14:43:47 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21F1A17B80; Thu, 11 May 2017 14:43:44 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id BF1BA80F9D; Thu, 11 May 2017 16:43:40 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5F7C53D95E Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5F7C53D95E From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 May 2017 16:43:37 +0200 Message-Id: <20170511144339.13027-3-kraxel@redhat.com> In-Reply-To: <20170511144339.13027-1-kraxel@redhat.com> References: <20170511144339.13027-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 11 May 2017 14:43:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] tcx: make display updates thread safe 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: Mark Cave-Ayland , 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" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Message-id: 1494449551-20227-3-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by: Gerd Hoffmann --- hw/display/tcx.c | 68 ++++++++++++++++++++--------------------------------= ---- 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 0e66dcd055..6593c1d6af 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -104,36 +104,23 @@ static void tcx_set_dirty(TCXState *s, ram_addr_t add= r, int len) } } =20 -static int tcx_check_dirty(TCXState *s, ram_addr_t addr, int len) +static int tcx_check_dirty(TCXState *s, DirtyBitmapSnapshot *snap, + ram_addr_t addr, int len) { int ret; =20 - ret =3D memory_region_get_dirty(&s->vram_mem, addr, len, DIRTY_MEMORY_= VGA); + ret =3D memory_region_snapshot_get_dirty(&s->vram_mem, snap, addr, len= ); =20 if (s->depth =3D=3D 24) { - ret |=3D memory_region_get_dirty(&s->vram_mem, - s->vram24_offset + addr * 4, len * = 4, - DIRTY_MEMORY_VGA); - ret |=3D memory_region_get_dirty(&s->vram_mem, - s->cplane_offset + addr * 4, len * = 4, - DIRTY_MEMORY_VGA); + ret |=3D memory_region_snapshot_get_dirty(&s->vram_mem, snap, + s->vram24_offset + addr * 4, len * = 4); + ret |=3D memory_region_snapshot_get_dirty(&s->vram_mem, snap, + s->cplane_offset + addr * 4, len * = 4); } =20 return ret; } =20 -static void tcx_reset_dirty(TCXState *s, ram_addr_t addr, int len) -{ - memory_region_reset_dirty(&s->vram_mem, addr, len, DIRTY_MEMORY_VGA); - - if (s->depth =3D=3D 24) { - memory_region_reset_dirty(&s->vram_mem, s->vram24_offset + addr * = 4, - len * 4, DIRTY_MEMORY_VGA); - memory_region_reset_dirty(&s->vram_mem, s->cplane_offset + addr * = 4, - len * 4, DIRTY_MEMORY_VGA); - } -} - static void update_palette_entries(TCXState *s, int start, int end) { DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -233,7 +220,8 @@ static void tcx_update_display(void *opaque) { TCXState *ts =3D opaque; DisplaySurface *surface =3D qemu_console_surface(ts->con); - ram_addr_t page, page_min, page_max; + ram_addr_t page; + DirtyBitmapSnapshot *snap =3D NULL; int y, y_start, dd, ds; uint8_t *d, *s; =20 @@ -243,22 +231,20 @@ static void tcx_update_display(void *opaque) =20 page =3D 0; y_start =3D -1; - page_min =3D -1; - page_max =3D 0; d =3D surface_data(surface); s =3D ts->vram; dd =3D surface_stride(surface); ds =3D 1024; =20 memory_region_sync_dirty_bitmap(&ts->vram_mem); + snap =3D memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0, + memory_region_size(&ts->vram_= mem), + DIRTY_MEMORY_VGA); + for (y =3D 0; y < ts->height; y++, page +=3D ds) { - if (tcx_check_dirty(ts, page, ds)) { + if (tcx_check_dirty(ts, snap, page, ds)) { if (y_start < 0) y_start =3D y; - if (page < page_min) - page_min =3D page; - if (page > page_max) - page_max =3D page; =20 tcx_draw_line32(ts, d, s, ts->width); if (y >=3D ts->cursy && y < ts->cursy + 32 && ts->cursx < ts->= width) { @@ -280,17 +266,15 @@ static void tcx_update_display(void *opaque) dpy_gfx_update(ts->con, 0, y_start, ts->width, y - y_start); } - /* reset modified pages */ - if (page_max >=3D page_min) { - tcx_reset_dirty(ts, page_min, page_max - page_min); - } + g_free(snap); } =20 static void tcx24_update_display(void *opaque) { TCXState *ts =3D opaque; DisplaySurface *surface =3D qemu_console_surface(ts->con); - ram_addr_t page, page_min, page_max; + ram_addr_t page; + DirtyBitmapSnapshot *snap =3D NULL; int y, y_start, dd, ds; uint8_t *d, *s; uint32_t *cptr, *s24; @@ -301,8 +285,6 @@ static void tcx24_update_display(void *opaque) =20 page =3D 0; y_start =3D -1; - page_min =3D -1; - page_max =3D 0; d =3D surface_data(surface); s =3D ts->vram; s24 =3D ts->vram24; @@ -311,14 +293,15 @@ static void tcx24_update_display(void *opaque) ds =3D 1024; =20 memory_region_sync_dirty_bitmap(&ts->vram_mem); + snap =3D memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0, + memory_region_size(&ts->vram_= mem), + DIRTY_MEMORY_VGA); + for (y =3D 0; y < ts->height; y++, page +=3D ds) { - if (tcx_check_dirty(ts, page, ds)) { + if (tcx_check_dirty(ts, snap, page, ds)) { if (y_start < 0) y_start =3D y; - if (page < page_min) - page_min =3D page; - if (page > page_max) - page_max =3D page; + tcx24_draw_line32(ts, d, s, ts->width, cptr, s24); if (y >=3D ts->cursy && y < ts->cursy+32 && ts->cursx < ts->wi= dth) { tcx_draw_cursor32(ts, d, y, ts->width); @@ -341,10 +324,7 @@ static void tcx24_update_display(void *opaque) dpy_gfx_update(ts->con, 0, y_start, ts->width, y - y_start); } - /* reset modified pages */ - if (page_max >=3D page_min) { - tcx_reset_dirty(ts, page_min, page_max - page_min); - } + g_free(snap); } =20 static void tcx_invalidate_display(void *opaque) --=20 2.9.3 From nobody Sat Apr 27 23:49:58 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494517243015273.5195742741105; Thu, 11 May 2017 08:40:43 -0700 (PDT) Received: from localhost ([::1]:48919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8qCm-0004vl-25 for importer@patchew.org; Thu, 11 May 2017 11:40:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8pJq-00039Q-AG for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8pJk-0005At-De for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8pJk-00059n-54 for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 255968049D for ; Thu, 11 May 2017 14:43:47 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0524F8B334; Thu, 11 May 2017 14:43:44 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id CE1F080FCD; Thu, 11 May 2017 16:43:40 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 255968049D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 255968049D From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 May 2017 16:43:38 +0200 Message-Id: <20170511144339.13027-4-kraxel@redhat.com> In-Reply-To: <20170511144339.13027-1-kraxel@redhat.com> References: <20170511144339.13027-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 11 May 2017 14:43:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] sm501: make display updates thread safe 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" Signed-off-by: Gerd Hoffmann Message-id: 20170509111928.30935-1-kraxel@redhat.com --- hw/display/sm501.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 2094adbc9c..9d254ef2e1 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1414,6 +1414,7 @@ static void sm501_update_display(void *opaque) { SM501State *s =3D (SM501State *)opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); + DirtyBitmapSnapshot *snap; int y, c_x =3D 0, c_y =3D 0; int crt =3D (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; int width =3D get_width(s, crt); @@ -1425,9 +1426,7 @@ static void sm501_update_display(void *opaque) draw_hwc_line_func *draw_hwc_line =3D NULL; int full_update =3D 0; int y_start =3D -1; - ram_addr_t page_min =3D ~0l; - ram_addr_t page_max =3D 0l; - ram_addr_t offset; + ram_addr_t offset =3D 0; uint32_t *palette; uint8_t hwc_palette[3 * 3]; uint8_t *hwc_src =3D NULL; @@ -1479,17 +1478,17 @@ static void sm501_update_display(void *opaque) =20 /* draw each line according to conditions */ memory_region_sync_dirty_bitmap(&s->local_mem_region); + snap =3D memory_region_snapshot_and_clear_dirty(&s->local_mem_region, + offset, width * height * src_bpp, DIRTY_MEMORY_VGA); for (y =3D 0, offset =3D 0; y < height; y++, offset +=3D width * src_b= pp) { int update, update_hwc; - ram_addr_t page0 =3D offset; - ram_addr_t page1 =3D offset + width * src_bpp - 1; =20 /* check if hardware cursor is enabled and we're within its range = */ update_hwc =3D draw_hwc_line && c_y <=3D y && y < c_y + SM501_HWC_= HEIGHT; update =3D full_update || update_hwc; /* check dirty flags for each line */ - update |=3D memory_region_get_dirty(&s->local_mem_region, page0, - page1 - page0, DIRTY_MEMORY_VGA); + update |=3D memory_region_snapshot_get_dirty(&s->local_mem_region,= snap, + offset, width * src_bpp= ); =20 /* draw line and change status */ if (update) { @@ -1507,12 +1506,6 @@ static void sm501_update_display(void *opaque) if (y_start < 0) { y_start =3D y; } - if (page0 < page_min) { - page_min =3D page0; - } - if (page1 > page_max) { - page_max =3D page1; - } } else { if (y_start >=3D 0) { /* flush to display */ @@ -1521,18 +1514,12 @@ static void sm501_update_display(void *opaque) } } } + g_free(snap); =20 /* complete flush to display */ if (y_start >=3D 0) { dpy_gfx_update(s->con, 0, y_start, width, y - y_start); } - - /* clear dirty flags */ - if (page_min !=3D ~0l) { - memory_region_reset_dirty(&s->local_mem_region, - page_min, page_max + TARGET_PAGE_SIZE, - DIRTY_MEMORY_VGA); - } } =20 static const GraphicHwOps sm501_ops =3D { --=20 2.9.3 From nobody Sat Apr 27 23:49:58 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494516724957929.5324569480689; Thu, 11 May 2017 08:32:04 -0700 (PDT) Received: from localhost ([::1]:48866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8q4Q-0005Ju-Cd for importer@patchew.org; Thu, 11 May 2017 11:32:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8pJl-00033q-Na for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8pJk-0005Am-8R for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8pJk-00059k-33 for qemu-devel@nongnu.org; Thu, 11 May 2017 10:43:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E20A8049B for ; Thu, 11 May 2017 14:43:47 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02E798B320; Thu, 11 May 2017 14:43:44 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id DD40080FD5; Thu, 11 May 2017 16:43:40 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0E20A8049B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0E20A8049B From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 May 2017 16:43:39 +0200 Message-Id: <20170511144339.13027-5-kraxel@redhat.com> In-Reply-To: <20170511144339.13027-1-kraxel@redhat.com> References: <20170511144339.13027-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 11 May 2017 14:43:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] vga: fix display update region calculation 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-Type: text/plain; charset="utf-8" vga display update mis-calculated the region for the dirty bitmap snapshot in case the scanlines are padded. This can triggere an assert in cpu_physical_memory_snapshot_get_dirty(). Fixes: fec5e8c92becad223df9d972770522f64aafdb72 Reported-by: Kevin Wolf Reported-by: =E6=9D=8E=E5=BC=BA Signed-off-by: Gerd Hoffmann Message-id: 20170509104839.19415-1-kraxel@redhat.com --- hw/display/vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index b2516c8d21..dcc95f88e2 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1630,7 +1630,7 @@ static void vga_draw_graphic(VGACommonState *s, int f= ull_update) if (!full_update) { vga_sync_dirty_bitmap(s); snap =3D memory_region_snapshot_and_clear_dirty(&s->vram, addr1, - bwidth * height, + line_offset * height, DIRTY_MEMORY_VGA); } =20 --=20 2.9.3