From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 7/9] g364fb: make display updates thread safe
Date: Fri, 21 Apr 2017 11:16:30 +0200 [thread overview]
Message-ID: <20170421091632.30900-8-kraxel@redhat.com> (raw)
In-Reply-To: <20170421091632.30900-1-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/g364fb.c | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 8cdc205dd9..86557d14a9 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -64,17 +64,8 @@ typedef struct G364State {
static inline int check_dirty(G364State *s, ram_addr_t page)
{
- return memory_region_get_dirty(&s->mem_vram, page, G364_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
-}
-
-static inline void reset_dirty(G364State *s,
- ram_addr_t page_min, ram_addr_t page_max)
-{
- memory_region_reset_dirty(&s->mem_vram,
- page_min,
- page_max + G364_PAGE_SIZE - page_min - 1,
- DIRTY_MEMORY_VGA);
+ return memory_region_test_and_clear_dirty(&s->mem_vram, page, G364_PAGE_SIZE,
+ DIRTY_MEMORY_VGA);
}
static void g364fb_draw_graphic8(G364State *s)
@@ -83,7 +74,7 @@ static void g364fb_draw_graphic8(G364State *s)
int i, w;
uint8_t *vram;
uint8_t *data_display, *dd;
- ram_addr_t page, page_min, page_max;
+ ram_addr_t page;
int x, y;
int xmin, xmax;
int ymin, ymax;
@@ -114,8 +105,6 @@ static void g364fb_draw_graphic8(G364State *s)
}
page = 0;
- page_min = (ram_addr_t)-1;
- page_max = 0;
x = y = 0;
xmin = s->width;
@@ -137,9 +126,6 @@ static void g364fb_draw_graphic8(G364State *s)
if (check_dirty(s, page)) {
if (y < ymin)
ymin = ymax = y;
- if (page_min == (ram_addr_t)-1)
- page_min = page;
- page_max = page;
if (x < xmin)
xmin = x;
for (i = 0; i < G364_PAGE_SIZE; i++) {
@@ -196,10 +182,7 @@ static void g364fb_draw_graphic8(G364State *s)
ymax = y;
} else {
int dy;
- if (page_min != (ram_addr_t)-1) {
- reset_dirty(s, page_min, page_max);
- page_min = (ram_addr_t)-1;
- page_max = 0;
+ if (xmax || ymax) {
dpy_gfx_update(s->con, xmin, ymin,
xmax - xmin + 1, ymax - ymin + 1);
xmin = s->width;
@@ -219,9 +202,8 @@ static void g364fb_draw_graphic8(G364State *s)
}
done:
- if (page_min != (ram_addr_t)-1) {
+ if (xmax || ymax) {
dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
- reset_dirty(s, page_min, page_max);
}
}
--
2.9.3
next prev parent reply other threads:[~2017-04-21 9:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 9:16 [Qemu-devel] [PATCH 0/9] hw/display: make display updates thread safe, part 1 Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 1/9] bitmap: add bitmap_copy_and_clear_atomic Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 2/9] memory: add support getting and using a dirty bitmap copy Gerd Hoffmann
2017-04-27 14:00 ` Kevin Wolf
2017-04-27 15:01 ` Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 3/9] vga: add vga_scanline_invalidated helper Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 4/9] vga: make display updates thread safe Gerd Hoffmann
2017-05-09 12:57 ` Ladi Prosek
2017-05-09 14:02 ` Gerd Hoffmann
2017-05-09 14:17 ` Ladi Prosek
2017-04-21 9:16 ` [Qemu-devel] [PATCH 5/9] framebuffer: " Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 6/9] exynos: " Gerd Hoffmann
2017-04-21 9:16 ` Gerd Hoffmann [this message]
2017-04-21 9:16 ` [Qemu-devel] [PATCH 8/9] vmsvga: fix vmsvga_update_display Gerd Hoffmann
2017-04-21 9:16 ` [Qemu-devel] [PATCH 9/9] sm501: make display updates thread safe Gerd Hoffmann
2017-04-21 10:42 ` BALATON Zoltan
2017-04-24 12:09 ` Peter Maydell
2017-04-24 12:30 ` Gerd Hoffmann
2017-04-21 13:44 ` [Qemu-devel] [PATCH 0/9] hw/display: make display updates thread safe, part 1 Mark Cave-Ayland
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=20170421091632.30900-8-kraxel@redhat.com \
--to=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).