From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: balrog@zabor.org, i.mitsyanko@samsung.com, paul@codesourcery.com,
Juan Quintela <quintela@trasno.org>
Subject: [Qemu-devel] [PATCH 3/7] tcx: port to test_and_clear instead of test/reset
Date: Fri, 11 Oct 2013 16:20:46 +0200 [thread overview]
Message-ID: <1381501250-19351-4-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1381501250-19351-1-git-send-email-quintela@redhat.com>
From: Juan Quintela <quintela@trasno.org>
Now page_min/max are not needed anymore.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/display/tcx.c | 72 ++++++++++++++------------------------------------------
1 file changed, 18 insertions(+), 54 deletions(-)
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 24876d3..d863a55 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -178,45 +178,31 @@ static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d,
}
}
-static inline int check_dirty(TCXState *s, ram_addr_t page, ram_addr_t page24,
- ram_addr_t cpage)
+static inline int test_and_clear_dirty(TCXState *s, ram_addr_t page,
+ ram_addr_t page24,
+ ram_addr_t cpage)
{
int ret;
- ret = memory_region_get_dirty(&s->vram_mem, page, TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
- ret |= memory_region_get_dirty(&s->vram_mem, page24, TARGET_PAGE_SIZE * 4,
- DIRTY_MEMORY_VGA);
- ret |= memory_region_get_dirty(&s->vram_mem, cpage, TARGET_PAGE_SIZE * 4,
- DIRTY_MEMORY_VGA);
+ ret = memory_region_test_and_clear_dirty(&s->vram_mem, page,
+ TARGET_PAGE_SIZE,
+ DIRTY_MEMORY_VGA);
+ ret |= memory_region_test_and_clear_dirty(&s->vram_mem, page24,
+ TARGET_PAGE_SIZE * 4,
+ DIRTY_MEMORY_VGA);
+ ret |= memory_region_test_and_clear_dirty(&s->vram_mem, cpage,
+ TARGET_PAGE_SIZE * 4,
+ DIRTY_MEMORY_VGA);
return ret;
}
-static inline void reset_dirty(TCXState *ts, ram_addr_t page_min,
- ram_addr_t page_max, ram_addr_t page24,
- ram_addr_t cpage)
-{
- memory_region_reset_dirty(&ts->vram_mem,
- page_min,
- (page_max - page_min) + TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
- memory_region_reset_dirty(&ts->vram_mem,
- page24 + page_min * 4,
- (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
- memory_region_reset_dirty(&ts->vram_mem,
- cpage + page_min * 4,
- (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
-}
-
/* Fixed line length 1024 allows us to do nice tricks not possible on
VGA... */
static void tcx_update_display(void *opaque)
{
TCXState *ts = opaque;
DisplaySurface *surface = qemu_console_surface(ts->con);
- ram_addr_t page, page_min, page_max;
+ ram_addr_t page;
int y, y_start, dd, ds;
uint8_t *d, *s;
void (*f)(TCXState *s1, uint8_t *dst, const uint8_t *src, int width);
@@ -227,8 +213,6 @@ static void tcx_update_display(void *opaque)
page = 0;
y_start = -1;
- page_min = -1;
- page_max = 0;
d = surface_data(surface);
s = ts->vram;
dd = surface_stride(surface);
@@ -251,14 +235,11 @@ static void tcx_update_display(void *opaque)
}
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
- if (memory_region_get_dirty(&ts->vram_mem, page, TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA)) {
+ if (memory_region_test_and_clear_dirty(&ts->vram_mem, page,
+ TARGET_PAGE_SIZE,
+ DIRTY_MEMORY_VGA)) {
if (y_start < 0)
y_start = y;
- if (page < page_min)
- page_min = page;
- if (page > page_max)
- page_max = page;
f(ts, d, s, ts->width);
d += dd;
s += ds;
@@ -287,20 +268,13 @@ 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 >= page_min) {
- memory_region_reset_dirty(&ts->vram_mem,
- page_min,
- (page_max - page_min) + TARGET_PAGE_SIZE,
- DIRTY_MEMORY_VGA);
- }
}
static void tcx24_update_display(void *opaque)
{
TCXState *ts = opaque;
DisplaySurface *surface = qemu_console_surface(ts->con);
- ram_addr_t page, page_min, page_max, cpage, page24;
+ ram_addr_t page, cpage, page24;
int y, y_start, dd, ds;
uint8_t *d, *s;
uint32_t *cptr, *s24;
@@ -313,8 +287,6 @@ static void tcx24_update_display(void *opaque)
page24 = ts->vram24_offset;
cpage = ts->cplane_offset;
y_start = -1;
- page_min = -1;
- page_max = 0;
d = surface_data(surface);
s = ts->vram;
s24 = ts->vram24;
@@ -324,13 +296,9 @@ static void tcx24_update_display(void *opaque)
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE,
page24 += TARGET_PAGE_SIZE, cpage += TARGET_PAGE_SIZE) {
- if (check_dirty(ts, page, page24, cpage)) {
+ if (test_and_clear_dirty(ts, page, page24, cpage)) {
if (y_start < 0)
y_start = y;
- if (page < page_min)
- page_min = page;
- if (page > page_max)
- page_max = page;
tcx24_draw_line32(ts, d, s, ts->width, cptr, s24);
d += dd;
s += ds;
@@ -369,10 +337,6 @@ 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 >= page_min) {
- reset_dirty(ts, page_min, page_max, page24, cpage);
- }
}
static void tcx_invalidate_display(void *opaque)
--
1.8.3.1
next prev parent reply other threads:[~2013-10-11 14:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 14:20 [Qemu-devel] [PATCH 0/7] Make vga devices use test_and_set Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 1/7] vmware_vga: port to test_and_clear instead of test/reset Juan Quintela
2013-10-11 14:40 ` Eric Blake
2013-10-11 15:10 ` Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 2/7] vga: " Juan Quintela
2013-10-11 14:20 ` Juan Quintela [this message]
2013-10-11 14:20 ` [Qemu-devel] [PATCH 4/7] sm501: " Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 5/7] g364fb: " Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 6/7] framebufer: " Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 7/7] exynox4210: " Juan Quintela
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=1381501250-19351-4-git-send-email-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=balrog@zabor.org \
--cc=i.mitsyanko@samsung.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@trasno.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).