Revision 714fa308 hw/pl110.c
b/hw/pl110.c | ||
---|---|---|
10 | 10 |
#include "hw.h" |
11 | 11 |
#include "primecell.h" |
12 | 12 |
#include "console.h" |
13 |
#include "framebuffer.h" |
|
13 | 14 |
|
14 | 15 |
#define PL110_CR_EN 0x001 |
15 | 16 |
#define PL110_CR_BGR 0x100 |
... | ... | |
61 | 62 |
|
62 | 63 |
#include "pixel_ops.h" |
63 | 64 |
|
64 |
typedef void (*drawfn)(uint32_t *, uint8_t *, const uint8_t *, int); |
|
65 |
|
|
66 | 65 |
#define BITS 8 |
67 | 66 |
#include "pl110_template.h" |
68 | 67 |
#define BITS 15 |
... | ... | |
84 | 83 |
pl110_state *s = (pl110_state *)opaque; |
85 | 84 |
drawfn* fntable; |
86 | 85 |
drawfn fn; |
87 |
uint32_t *pallette; |
|
88 |
uint32_t addr; |
|
89 |
uint32_t base; |
|
90 | 86 |
int dest_width; |
91 | 87 |
int src_width; |
92 |
uint8_t *dest; |
|
93 |
uint8_t *src; |
|
94 |
int first, last = 0; |
|
95 |
int dirty, new_dirty; |
|
96 |
int i; |
|
97 | 88 |
int bpp_offset; |
89 |
int first; |
|
90 |
int last; |
|
98 | 91 |
|
99 | 92 |
if (!pl110_enabled(s)) |
100 | 93 |
return; |
... | ... | |
159 | 152 |
break; |
160 | 153 |
} |
161 | 154 |
dest_width *= s->cols; |
162 |
pallette = s->pallette; |
|
163 |
base = s->upbase; |
|
164 |
/* HACK: Arm aliases physical memory at 0x80000000. */ |
|
165 |
if (base > 0x80000000) |
|
166 |
base -= 0x80000000; |
|
167 |
src = phys_ram_base + base; |
|
168 |
dest = ds_get_data(s->ds); |
|
169 |
first = -1; |
|
170 |
addr = base; |
|
171 |
|
|
172 |
dirty = cpu_physical_memory_get_dirty(addr, VGA_DIRTY_FLAG); |
|
173 |
new_dirty = dirty; |
|
174 |
for (i = 0; i < s->rows; i++) { |
|
175 |
if ((addr & ~TARGET_PAGE_MASK) + src_width >= TARGET_PAGE_SIZE) { |
|
176 |
uint32_t tmp; |
|
177 |
new_dirty = 0; |
|
178 |
for (tmp = 0; tmp < src_width; tmp += TARGET_PAGE_SIZE) { |
|
179 |
new_dirty |= cpu_physical_memory_get_dirty(addr + tmp, |
|
180 |
VGA_DIRTY_FLAG); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
if (dirty || new_dirty || s->invalidate) { |
|
185 |
fn(pallette, dest, src, s->cols); |
|
186 |
if (first == -1) |
|
187 |
first = i; |
|
188 |
last = i; |
|
189 |
} |
|
190 |
dirty = new_dirty; |
|
191 |
addr += src_width; |
|
192 |
dest += dest_width; |
|
193 |
src += src_width; |
|
155 |
first = 0; |
|
156 |
framebuffer_update_display(s->ds, |
|
157 |
s->upbase, s->cols, s->rows, |
|
158 |
src_width, dest_width, 0, |
|
159 |
s->invalidate, |
|
160 |
fn, s->pallette, |
|
161 |
&first, &last); |
|
162 |
if (first >= 0) { |
|
163 |
dpy_update(s->ds, 0, first, s->cols, last - first + 1); |
|
194 | 164 |
} |
195 |
if (first < 0) |
|
196 |
return; |
|
197 |
|
|
198 | 165 |
s->invalidate = 0; |
199 |
cpu_physical_memory_reset_dirty(base + first * src_width, |
|
200 |
base + (last + 1) * src_width, |
|
201 |
VGA_DIRTY_FLAG); |
|
202 |
dpy_update(s->ds, 0, first, s->cols, last - first + 1); |
|
203 | 166 |
} |
204 | 167 |
|
205 | 168 |
static void pl110_invalidate_display(void * opaque) |
Also available in: Unified diff