qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: lijiejun <a_lijiejun@163.com>
To: kraxel@redhat.com
Cc: qemu-devel@nongnu.org, lijiejun <a_lijiejun@163.com>
Subject: [PATCH] ui: Optimization dirty rect empty check logic
Date: Sat, 25 Nov 2023 15:54:08 +0800	[thread overview]
Message-ID: <20231125075408.131075-1-a_lijiejun@163.com> (raw)

Reduce unnecessary code execution in function qemu_spice_create_update,
such as "int blocks = DIV_ROUND_UP(surface_width(ssd->ds), blksize);"
and "int bpp = surface_bytes_per_pixel(ssd->ds);".

Signed-off-by: lijiejun <a_lijiejun@163.com>
---
 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(SimpleSpiceDisplay *ssd)
     int bpp = surface_bytes_per_pixel(ssd->ds);
     uint8_t *guest, *mirror;
 
-    if (qemu_spice_rect_is_empty(&ssd->dirty)) {
-        return;
-    };
-
     dirty_top = g_new(int, blocks);
     for (blk = 0; blk < blocks; blk++) {
         dirty_top[blk] = -1;
@@ -488,7 +484,9 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
 
     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++;
         }
     }
-- 
2.25.1



             reply	other threads:[~2023-11-25  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-25  7:54 lijiejun [this message]
2023-11-27  8:05 ` [PATCH] ui: Optimization dirty rect empty check logic Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231125075408.131075-1-a_lijiejun@163.com \
    --to=a_lijiejun@163.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).