From nobody Fri May 3 17:20:59 2024 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1641319771; cv=none; d=zohomail.com; s=zohoarc; b=ml5RyA2sckbc6b6nkjQTwnAVRwGJ5YEe7uv4HvYtHi9aGtAj2VHhn793jjt8sHMjyPjn4xcXpBBXNSeKk1q54Um3eurKfmchptXkLkXop2mSz6cpJ+AmaC8gQmzHeDD5oG/SoKQZU3QfzB0G8I8Rp6ZLfIyvjWuvNw31lstuXws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641319771; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TC6fcyrbPLoGHS5hWK+yxMJDZROs9siQqDFYf3yADSw=; b=bTyIVonIHR151EeuKgG8WDb4cwhURnxAAtuYNepGMKVpo2T1baT1oAHChwvIkocGSPorDg3Cx2k35zPMgoEUm3menmSO2cF6FBtx7AuAeHyI605SF0eLonwINecf8EE2/YttA1ndu8aYsxidylK/P0ukxvOB+comFDNPb72cy5c= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641319771304385.4740478818103; Tue, 4 Jan 2022 10:09:31 -0800 (PST) Received: from localhost ([::1]:34172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4oFV-0007j3-Pp for importer@patchew.org; Tue, 04 Jan 2022 13:09:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4oDG-0004M8-J8; Tue, 04 Jan 2022 13:07:11 -0500 Received: from [2a00:1450:4864:20::436] (port=39595 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4oDE-0006Nt-PR; Tue, 04 Jan 2022 13:07:10 -0500 Received: by mail-wr1-x436.google.com with SMTP id s1so77822531wra.6; Tue, 04 Jan 2022 10:07:08 -0800 (PST) Received: from localhost.localdomain (201.11.75.194.dyn.plus.net. [194.75.11.201]) by smtp.googlemail.com with ESMTPSA id o11sm121997wmq.15.2022.01.04.10.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 10:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:signed-off-by:content-transfer-encoding; bh=TC6fcyrbPLoGHS5hWK+yxMJDZROs9siQqDFYf3yADSw=; b=opx8uJTz3UBqgStZLVQjxj5HPlrciun+/okRxBubUH4tPp6TBUuOxxqBF1N7pEkP3y NSFKrtqNKN81sqUV6Nr+Y7Dpg82S8s3ENGEB4kCCPCchPtVL5uw5QFbI3VkfZwQIXEl4 ctpLVPRXjcSXBBaWa5dMm0/J2y1hmad5su7HvquSC6hFCs3V7hkwj73zC1w7BoD+UWC+ cdEZVtWkEMXUl7qx8lEuEsY2qfWulne1qUXF2Riq+xbbxa+xvDkz7+jaHXVtsq06Hv6m ETJG/g1mzPrr0E/wEOq0sphWsfTSNZforZEntFHZyKGLKeyhO0plf4aChYTqQsmm0sio 34ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:signed-off-by:content-transfer-encoding; bh=TC6fcyrbPLoGHS5hWK+yxMJDZROs9siQqDFYf3yADSw=; b=otNk26gextQt14n1zp/EWmE40QUf8sSkbib2GKhNy0ENdDbitiyw1ZVrNGI1/nZGHn LK1OMFQeY9d8BgqA2NuSoSZC0VpbQBvKIt6UXn07EvUmlO08fLbtLpR6Isnt1g/UjILi a22aiYI9gHOPSfcMfVNrRLHHS1msAo1vDXgCjEzYB5LX7xbhpVNBVjAUUHITCByLbLJw tRdcu7+pDVXEFdPYCtsZ/hlaqph/PYnD7XWdfFZuZeJMxDaNHPESLeho+hBBr5rj2mQs ejbx7ShcpDi6LLlr11PAmGywAbaPn9ODujCKEtkXBFkUQ8lFqJ+tsSmfRjwuc0HdyyjF XhKA== X-Gm-Message-State: AOAM531pfdZIyHy1EbcYfz1bocAvVVhCIgws35vRau9BJNT2PhLq8mzc wXFQrGQEYymisW2NXAaDdpCWFG77IeY= X-Google-Smtp-Source: ABdhPJyuQNQejx/sUdlwgRoZCyV3SVk5JAdGekBKR/zMT3k1jE8AY8ishzhHYUQBhQOshJdemTMOlg== X-Received: by 2002:a5d:4c48:: with SMTP id n8mr42878804wrt.25.1641319626786; Tue, 04 Jan 2022 10:07:06 -0800 (PST) From: Carwyn Ellis To: qemu-devel@nongnu.org Subject: [PATCH 1/2] hw/display/vmware_vga: replace fprintf calls with trace events Date: Tue, 4 Jan 2022 18:06:58 +0000 Message-Id: <20220104180659.91619-2-carwynellis@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220104180659.91619-1-carwynellis@gmail.com> References: <20220104180659.91619-1-carwynellis@gmail.com> MIME-Version: 1.0 Signed-off-by: Carwyn Ellis Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) 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=2a00:1450:4864:20::436; envelope-from=carwynellis@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Carwyn Ellis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1641319772264100001 Content-Type: text/plain; charset="utf-8" Debug output was always being sent to STDERR. This has been replaced with trace events. Signed-off-by: Carwyn Ellis Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/trace-events | 3 +++ hw/display/vmware_vga.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/display/trace-events b/hw/display/trace-events index 3a7a2c957f..e1a0d2a88a 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -21,6 +21,9 @@ vmware_palette_write(uint32_t index, uint32_t value) "ind= ex %d, value 0x%x" vmware_scratch_read(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_scratch_write(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp" +vmware_verify_rect_less_than_zero(const char *name, const char *param, int= x) "%s: %s was < 0 (%d)" +vmware_verify_rect_greater_than_bound(const char *name, const char *param,= int bound, int x) "%s: %s was > %d (%d)" +vmware_verify_rect_surface_bound_exceeded(const char *name, const char *co= mponent, int bound, const char *param1, int value1, const char *param2, int= value2) "%s: %s > %d (%s: %d, %s, %d)" =20 # virtio-gpu-base.c virtio_gpu_features(bool virgl) "virgl %d" diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index e2969a6c81..0d32a605a0 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -297,46 +297,44 @@ static inline bool vmsvga_verify_rect(DisplaySurface = *surface, int x, int y, int w, int h) { if (x < 0) { - fprintf(stderr, "%s: x was < 0 (%d)\n", name, x); + trace_vmware_verify_rect_less_than_zero(name, "x", x); return false; } if (x > SVGA_MAX_WIDTH) { - fprintf(stderr, "%s: x was > %d (%d)\n", name, SVGA_MAX_WIDTH, x); + trace_vmware_verify_rect_greater_than_bound(name, "x", SVGA_MAX_WI= DTH, x); return false; } if (w < 0) { - fprintf(stderr, "%s: w was < 0 (%d)\n", name, w); + trace_vmware_verify_rect_less_than_zero(name, "w", w); return false; } if (w > SVGA_MAX_WIDTH) { - fprintf(stderr, "%s: w was > %d (%d)\n", name, SVGA_MAX_WIDTH, w); + trace_vmware_verify_rect_greater_than_bound(name, "w", SVGA_MAX_WI= DTH, w); return false; } if (x + w > surface_width(surface)) { - fprintf(stderr, "%s: width was > %d (x: %d, w: %d)\n", - name, surface_width(surface), x, w); + trace_vmware_verify_rect_surface_bound_exceeded(name, "width", sur= face_width(surface), "x", x, "w", w); return false; } =20 if (y < 0) { - fprintf(stderr, "%s: y was < 0 (%d)\n", name, y); + trace_vmware_verify_rect_less_than_zero(name, "y", y); return false; } if (y > SVGA_MAX_HEIGHT) { - fprintf(stderr, "%s: y was > %d (%d)\n", name, SVGA_MAX_HEIGHT, y); + trace_vmware_verify_rect_greater_than_bound(name, "y", SVGA_MAX_HE= IGHT, y); return false; } if (h < 0) { - fprintf(stderr, "%s: h was < 0 (%d)\n", name, h); + trace_vmware_verify_rect_less_than_zero(name, "h", h); return false; } if (h > SVGA_MAX_HEIGHT) { - fprintf(stderr, "%s: h was > %d (%d)\n", name, SVGA_MAX_HEIGHT, h); + trace_vmware_verify_rect_greater_than_bound(name, "y", SVGA_MAX_HE= IGHT, y); return false; } if (y + h > surface_height(surface)) { - fprintf(stderr, "%s: update height > %d (y: %d, h: %d)\n", - name, surface_height(surface), y, h); + trace_vmware_verify_rect_surface_bound_exceeded(name, "height", su= rface_height(surface), "y", y, "h", h); return false; } =20 --=20 2.34.1 From nobody Fri May 3 17:20:59 2024 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1641319885; cv=none; d=zohomail.com; s=zohoarc; b=W9QyrOOFBKfBvOmHLqNSgDU/jsA+RZyMu0k3Mj30d5W96rttSjDrYlH40fPRcNuAKyUH6sOYef3EcOpOCi0TWxJbB6XV/2cKiEOWqqwGyime6DAi5jVx70k4asOmwu8hT32reIqYJq7vQ8LI3AiZ0xGbNF4nE3tWBvlDMCc4kzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641319885; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3ZZxFr5xVe+GuL3uJDgrFgJ0B4WFBTuqdC66x2MxRHY=; b=Z+X5lwXUg4Z1suIE47gOQAVv7ob/go2xs7ei4y+7iqsUt1GhNBvQvGrfG3q9qqnRQaZdh9tOBfQKYcyXiHNSnvdltg1DDIwhGVsEcTL3HOktAfn/nZgsRj3Em9jnWu0WbYBpQ3P3qCOmkbsVMb62LkHFFYMNivVHXPLwWHc0MPk= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641319885806693.8604016665291; Tue, 4 Jan 2022 10:11:25 -0800 (PST) Received: from localhost ([::1]:39818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4oHM-00038L-Q1 for importer@patchew.org; Tue, 04 Jan 2022 13:11:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4oDG-0004M9-Sy; Tue, 04 Jan 2022 13:07:11 -0500 Received: from [2a00:1450:4864:20::435] (port=36664 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4oDF-0006OH-BQ; Tue, 04 Jan 2022 13:07:10 -0500 Received: by mail-wr1-x435.google.com with SMTP id r17so77788667wrc.3; Tue, 04 Jan 2022 10:07:08 -0800 (PST) Received: from localhost.localdomain (201.11.75.194.dyn.plus.net. [194.75.11.201]) by smtp.googlemail.com with ESMTPSA id o11sm121997wmq.15.2022.01.04.10.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 10:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:signed-off-by:content-transfer-encoding; bh=3ZZxFr5xVe+GuL3uJDgrFgJ0B4WFBTuqdC66x2MxRHY=; b=a3iELk3zFrKw+CWckRD/cTKv1LBR0KgAJIOfBQuqMDUdZPl6/QePrjs553ZCmewyYg Ol8Z3FQWE/aMhbLJFOKT9F/yzyE9eyGJj4hw5ZutZ4tCawmXgneny9CGystjmd5IDEFn r0UL7hEjLBPqJTDTxcVLCjHCYBjmoepKuMz4dx9lkeYCd4ndGx1+YZxzmvZPOv9lTB5l /3mZGBwmHAkbd3n0qKft8hnXDshEfXPVjzINrCztCxCTFhhQDwPW8725hLnjDMxqhq1l a+89Ohu3xObOxUjn2poOBPvitLV+aYTk+kmfnRKBWIdNwaLFl4OT6QqXSbxreJjoEkMJ xISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:signed-off-by:content-transfer-encoding; bh=3ZZxFr5xVe+GuL3uJDgrFgJ0B4WFBTuqdC66x2MxRHY=; b=bEvpqyi1yQprPHIZD1GqJxqsJ3Uf+Oc0QoDWvBSiyLStzDWwhQa/K8fKNVXp1z99w9 jpwpFOkHiYuy7CxxfdKeayB7+5Fu8koyjp/S60CUGtsbf/uKzLHXs3520UAi0LeJ+rVN tFsUcQ+NmdAOFpcaFLgOUC1Jk74fWx9KIpY7zijUKmzlAK3I9h9j1n4y2WGohJLDNRku O5wWEQBaGuLqAz/Ntk6Vm7dUoZdtIBvLP/FtHTl0nwpxFilsELeqWreeNzd+eKBhvT/S D1PUeJ93LoxXuGSmeiG/RdKrCwFj1Bjg2GamUIKk5H/QcgrX66m6c7AAnEJcWGS6wPHf UW7Q== X-Gm-Message-State: AOAM530QKCutEvEkPmYScnPtBsLANEunEnI6ABKk+9UDmTFbN+WMY/jg yR1ITI9M65tdq1QKrzEY3i+DDusWvGI= X-Google-Smtp-Source: ABdhPJzGGgFlneqG2XeOVPWEMTQ0smHo+iIgBYlLWgnOb/ZfigUNI5OOdNtMWi98QLJ0ed1ZGNbnGg== X-Received: by 2002:adf:efc5:: with SMTP id i5mr43125082wrp.263.1641319627862; Tue, 04 Jan 2022 10:07:07 -0800 (PST) From: Carwyn Ellis To: qemu-devel@nongnu.org Subject: [PATCH 2/2] hw/display/vmware_vga: do not discard screen updates Date: Tue, 4 Jan 2022 18:06:59 +0000 Message-Id: <20220104180659.91619-3-carwynellis@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220104180659.91619-1-carwynellis@gmail.com> References: <20220104180659.91619-1-carwynellis@gmail.com> MIME-Version: 1.0 Signed-off-by: Carwyn Ellis Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::435 (failed) 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=2a00:1450:4864:20::435; envelope-from=carwynellis@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Carwyn Ellis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1641319887927100001 Content-Type: text/plain; charset="utf-8" In certain circumstances, typically when there is lots changing on the screen, updates will be discarded resulting in garbled output. This change simplifies the traversal of the display update FIFO queue when applying updates. We just track the queue length and iterate up to the end of the queue. Additionanlly when adding updates to the queue, if the buffer reaches capacity we force a flush before accepting further events. Signed-off-by: Carwyn Ellis --- hw/display/trace-events | 1 + hw/display/vmware_vga.c | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/hw/display/trace-events b/hw/display/trace-events index e1a0d2a88a..5e3cdb3fa3 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -24,6 +24,7 @@ vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx= %d @ %d bpp" vmware_verify_rect_less_than_zero(const char *name, const char *param, int= x) "%s: %s was < 0 (%d)" vmware_verify_rect_greater_than_bound(const char *name, const char *param,= int bound, int x) "%s: %s was > %d (%d)" vmware_verify_rect_surface_bound_exceeded(const char *name, const char *co= mponent, int bound, const char *param1, int value1, const char *param2, int= value2) "%s: %s > %d (%s: %d, %s, %d)" +vmware_update_rect_delayed_flush(void) "display update FIFO full - forcing= flush" =20 # virtio-gpu-base.c virtio_gpu_features(bool virgl) "virgl %d" diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 0d32a605a0..e6943005e3 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -80,7 +80,7 @@ struct vmsvga_state_s { struct vmsvga_rect_s { int x, y, w, h; } redraw_fifo[REDRAW_FIFO_LEN]; - int redraw_fifo_first, redraw_fifo_last; + int redraw_fifo_last; }; =20 #define TYPE_VMWARE_SVGA "vmware-svga" @@ -372,33 +372,39 @@ static inline void vmsvga_update_rect(struct vmsvga_s= tate_s *s, dpy_gfx_update(s->vga.con, x, y, w, h); } =20 -static inline void vmsvga_update_rect_delayed(struct vmsvga_state_s *s, - int x, int y, int w, int h) -{ - struct vmsvga_rect_s *rect =3D &s->redraw_fifo[s->redraw_fifo_last++]; - - s->redraw_fifo_last &=3D REDRAW_FIFO_LEN - 1; - rect->x =3D x; - rect->y =3D y; - rect->w =3D w; - rect->h =3D h; -} - static inline void vmsvga_update_rect_flush(struct vmsvga_state_s *s) { struct vmsvga_rect_s *rect; =20 if (s->invalidated) { - s->redraw_fifo_first =3D s->redraw_fifo_last; + s->redraw_fifo_last =3D 0; return; } /* Overlapping region updates can be optimised out here - if someone * knows a smart algorithm to do that, please share. */ - while (s->redraw_fifo_first !=3D s->redraw_fifo_last) { - rect =3D &s->redraw_fifo[s->redraw_fifo_first++]; - s->redraw_fifo_first &=3D REDRAW_FIFO_LEN - 1; + for (int i =3D 0; i < s->redraw_fifo_last; i++) { + rect =3D &s->redraw_fifo[i]; vmsvga_update_rect(s, rect->x, rect->y, rect->w, rect->h); } + + s->redraw_fifo_last =3D 0; +} + +static inline void vmsvga_update_rect_delayed(struct vmsvga_state_s *s, + int x, int y, int w, int h) +{ + + if (s->redraw_fifo_last >=3D REDRAW_FIFO_LEN) { + trace_vmware_update_rect_delayed_flush(); + vmsvga_update_rect_flush(s); + } + + struct vmsvga_rect_s *rect =3D &s->redraw_fifo[s->redraw_fifo_last++]; + + rect->x =3D x; + rect->y =3D y; + rect->w =3D w; + rect->h =3D h; } =20 #ifdef HW_RECT_ACCEL @@ -1151,7 +1157,6 @@ static void vmsvga_reset(DeviceState *dev) s->config =3D 0; s->svgaid =3D SVGA_ID; s->cursor.on =3D 0; - s->redraw_fifo_first =3D 0; s->redraw_fifo_last =3D 0; s->syncing =3D 0; =20 --=20 2.34.1