From nobody Wed Nov 27 02:22:26 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=163.com ARC-Seal: i=1; a=rsa-sha256; t=1700898945; cv=none; d=zohomail.com; s=zohoarc; b=OmPj3AMgQqERZAhNzzeB5VcmstEigpvZzIkQHNtZqlFwNaiZ3S7HrWIEWXR2WyLykSyfPrA4LKEZidYQSuo8bVXuwS+/wBdHoj29PxbJH0oi5t9hMKcuz4beJPFZAx2/GRJ9H1lYbuXjMKBlUuzBxgTLngciSLIvupSY3LsLjV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700898945; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3KVcCuKLNr4yHlpvsJxpOlYlNbuqpUeQ+xgB15DEgUg=; b=Oyy8paMcp0DWYcgZcgopijHt3Gi2zTdZmBOKP4tlvfDKOCDavcX1rx3K/dfiYmxAfVcxRfitOYTPl4mCwj+aIHprUkfZ2QTk6kdo7lVsq9SGl2ZMdNlFdZw0cCQTzlGq5oWxJG0wS+cGUmA5NSWgU/vo2pIkX6YBmv2rnz0QfdY= 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 17008989456951014.3473813464527; Fri, 24 Nov 2023 23:55:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6nV7-0007uR-2H; Sat, 25 Nov 2023 02:54:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6nV5-0007sZ-6f for qemu-devel@nongnu.org; Sat, 25 Nov 2023 02:54:51 -0500 Received: from m15.mail.163.com ([45.254.50.220]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6nV1-0006JO-11 for qemu-devel@nongnu.org; Sat, 25 Nov 2023 02:54:50 -0500 Received: from test123.sz.office (unknown [121.12.80.215]) by zwqz-smtp-mta-g2-0 (Coremail) with SMTP id _____wBnT04iqGFlpWS+Dw--.14146S2; Sat, 25 Nov 2023 15:54:24 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=3KVcC uKLNr4yHlpvsJxpOlYlNbuqpUeQ+xgB15DEgUg=; b=Jl7YT2Z64aMz3SHv7KMNE qCjoYZUuhN9gCTfqqRK4l3DySlWWDVmp9aPzAJh2QqDACD8UlSETleD9ak5HOwHT BIIxDw1JMU+HqdwkImLj4iqidVPBmzIBqEQ9DYyn4BnV4R0sfhjaattBu3X7edcZ iC62TOAzC55ki1JJMCdscE= From: lijiejun To: kraxel@redhat.com Cc: qemu-devel@nongnu.org, lijiejun Subject: [PATCH] ui: Optimization dirty rect empty check logic Date: Sat, 25 Nov 2023 15:54:08 +0800 Message-Id: <20231125075408.131075-1-a_lijiejun@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wBnT04iqGFlpWS+Dw--.14146S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF1UZw15ur4rJFWxJw1fWFg_yoWkCwb_G3 yxZrs3AFy3t3Z3Xas8KFyakryrXFZxCFs3u3yDtFWrGr1SvF45tF9aqr4xJr9xCFZ8tFyr urn8CF93AF4fKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRCksD5UUUUU== X-Originating-IP: [121.12.80.215] X-CM-SenderInfo: pdboxyplhm30i6rwjhhfrp/1tbiSBQzFF+FinzESAAAsb 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=45.254.50.220; envelope-from=a_lijiejun@163.com; helo=m15.mail.163.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, 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @163.com) X-ZM-MESSAGEID: 1700898947847100003 Content-Type: text/plain; charset="utf-8" Reduce unnecessary code execution in function qemu_spice_create_update, such as "int blocks =3D DIV_ROUND_UP(surface_width(ssd->ds), blksize);" and "int bpp =3D surface_bytes_per_pixel(ssd->ds);". Signed-off-by: lijiejun --- ui/spice-display.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 6eb98a5a5c..508e35ed0f 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -194,10 +194,6 @@ static void qemu_spice_create_update(SimpleSpiceDispla= y *ssd) int bpp =3D surface_bytes_per_pixel(ssd->ds); uint8_t *guest, *mirror; =20 - if (qemu_spice_rect_is_empty(&ssd->dirty)) { - return; - }; - dirty_top =3D g_new(int, blocks); for (blk =3D 0; blk < blocks; blk++) { dirty_top[blk] =3D -1; @@ -488,7 +484,9 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) =20 WITH_QEMU_LOCK_GUARD(&ssd->lock) { if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) { - qemu_spice_create_update(ssd); + if (!qemu_spice_rect_is_empty(&ssd->dirty)) { + qemu_spice_create_update(ssd); + } ssd->notify++; } } --=20 2.25.1