g364fb: make display updates thread safe
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170421091632.30900-8-kraxel@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
553bcce5ac
commit
7fcf0c24e7
|
@ -64,17 +64,8 @@ typedef struct G364State {
|
||||||
|
|
||||||
static inline int check_dirty(G364State *s, ram_addr_t page)
|
static inline int check_dirty(G364State *s, ram_addr_t page)
|
||||||
{
|
{
|
||||||
return memory_region_get_dirty(&s->mem_vram, page, G364_PAGE_SIZE,
|
return memory_region_test_and_clear_dirty(&s->mem_vram, page, G364_PAGE_SIZE,
|
||||||
DIRTY_MEMORY_VGA);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void g364fb_draw_graphic8(G364State *s)
|
static void g364fb_draw_graphic8(G364State *s)
|
||||||
|
@ -83,7 +74,7 @@ static void g364fb_draw_graphic8(G364State *s)
|
||||||
int i, w;
|
int i, w;
|
||||||
uint8_t *vram;
|
uint8_t *vram;
|
||||||
uint8_t *data_display, *dd;
|
uint8_t *data_display, *dd;
|
||||||
ram_addr_t page, page_min, page_max;
|
ram_addr_t page;
|
||||||
int x, y;
|
int x, y;
|
||||||
int xmin, xmax;
|
int xmin, xmax;
|
||||||
int ymin, ymax;
|
int ymin, ymax;
|
||||||
|
@ -114,8 +105,6 @@ static void g364fb_draw_graphic8(G364State *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
page = 0;
|
page = 0;
|
||||||
page_min = (ram_addr_t)-1;
|
|
||||||
page_max = 0;
|
|
||||||
|
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
xmin = s->width;
|
xmin = s->width;
|
||||||
|
@ -137,9 +126,6 @@ static void g364fb_draw_graphic8(G364State *s)
|
||||||
if (check_dirty(s, page)) {
|
if (check_dirty(s, page)) {
|
||||||
if (y < ymin)
|
if (y < ymin)
|
||||||
ymin = ymax = y;
|
ymin = ymax = y;
|
||||||
if (page_min == (ram_addr_t)-1)
|
|
||||||
page_min = page;
|
|
||||||
page_max = page;
|
|
||||||
if (x < xmin)
|
if (x < xmin)
|
||||||
xmin = x;
|
xmin = x;
|
||||||
for (i = 0; i < G364_PAGE_SIZE; i++) {
|
for (i = 0; i < G364_PAGE_SIZE; i++) {
|
||||||
|
@ -196,10 +182,7 @@ static void g364fb_draw_graphic8(G364State *s)
|
||||||
ymax = y;
|
ymax = y;
|
||||||
} else {
|
} else {
|
||||||
int dy;
|
int dy;
|
||||||
if (page_min != (ram_addr_t)-1) {
|
if (xmax || ymax) {
|
||||||
reset_dirty(s, page_min, page_max);
|
|
||||||
page_min = (ram_addr_t)-1;
|
|
||||||
page_max = 0;
|
|
||||||
dpy_gfx_update(s->con, xmin, ymin,
|
dpy_gfx_update(s->con, xmin, ymin,
|
||||||
xmax - xmin + 1, ymax - ymin + 1);
|
xmax - xmin + 1, ymax - ymin + 1);
|
||||||
xmin = s->width;
|
xmin = s->width;
|
||||||
|
@ -219,9 +202,8 @@ static void g364fb_draw_graphic8(G364State *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (page_min != (ram_addr_t)-1) {
|
if (xmax || ymax) {
|
||||||
dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
|
dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
|
||||||
reset_dirty(s, page_min, page_max);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue