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 5/7] g364fb: port to test_and_clear instead of test/reset
Date: Fri, 11 Oct 2013 16:20:48 +0200 [thread overview]
Message-ID: <1381501250-19351-6-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. In this case, we need to
know if something has changed to refresh the display. Introduce
"dirty" bool for that.
Signed-off-by: Juan Quintela <quintela@trasno.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/display/g364fb.c | 38 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 7082171..8306294 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -60,19 +60,11 @@ typedef struct G364State {
#define G364_PAGE_SIZE 4096
-static inline int check_dirty(G364State *s, ram_addr_t page)
+static inline bool test_and_clear_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)
@@ -81,12 +73,13 @@ 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;
int xcursor, ycursor;
unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned int b);
+ bool dirty;
switch (surface_bits_per_pixel(surface)) {
case 8:
@@ -112,9 +105,7 @@ static void g364fb_draw_graphic8(G364State *s)
}
page = 0;
- page_min = (ram_addr_t)-1;
- page_max = 0;
-
+ dirty = false;
x = y = 0;
xmin = s->width;
xmax = 0;
@@ -132,12 +123,10 @@ static void g364fb_draw_graphic8(G364State *s)
/* XXX: out of range in vram? */
data_display = dd = surface_data(surface);
while (y < s->height) {
- if (check_dirty(s, page)) {
+ if (test_and_clear_dirty(s, page)) {
+ dirty = true;
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++) {
@@ -194,10 +183,8 @@ 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 (dirty) {
+ dirty = false;
dpy_gfx_update(s->con, xmin, ymin,
xmax - xmin + 1, ymax - ymin + 1);
xmin = s->width;
@@ -217,9 +204,8 @@ static void g364fb_draw_graphic8(G364State *s)
}
done:
- if (page_min != (ram_addr_t)-1) {
+ if (dirty) {
dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
- reset_dirty(s, page_min, page_max);
}
}
--
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 ` [Qemu-devel] [PATCH 3/7] tcx: " Juan Quintela
2013-10-11 14:20 ` [Qemu-devel] [PATCH 4/7] sm501: " Juan Quintela
2013-10-11 14:20 ` Juan Quintela [this message]
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-6-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).