vga: Replace VGA_COMMON with a structure

All VGA devices share a common field subset; currently they do so by
a macro which defines the common fields inline their state structures,
relying on the the common state being placed at offset 0 in the structure.
This makes refactoring the code difficult and requires a lot of error prone
casts.

Replace the macro by a new VGACommonState structure, and the casts by
regular field access and container_of() for upcasts.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Avi Kivity 2009-05-03 22:25:16 +03:00 committed by Anthony Liguori
parent fbb7b4e080
commit 4e12cd946f
5 changed files with 467 additions and 467 deletions

View file

@ -82,7 +82,7 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
for (x = 0; x < bltwidth; x++) {
p = *dst;
ROP_OP(p, *src);
if (p != s->gr[0x34]) *dst = p;
if (p != s->vga.gr[0x34]) *dst = p;
dst++;
src++;
}
@ -105,7 +105,7 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
for (x = 0; x < bltwidth; x++) {
p = *dst;
ROP_OP(p, *src);
if (p != s->gr[0x34]) *dst = p;
if (p != s->vga.gr[0x34]) *dst = p;
dst--;
src--;
}
@ -130,7 +130,7 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
p2 = *(dst+1);
ROP_OP(p1, *src);
ROP_OP(p2, *(src+1));
if ((p1 != s->gr[0x34]) || (p2 != s->gr[0x35])) {
if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
*dst = p1;
*(dst+1) = p2;
}
@ -158,7 +158,7 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
p2 = *dst;
ROP_OP(p1, *(src-1));
ROP_OP(p2, *src);
if ((p1 != s->gr[0x34]) || (p2 != s->gr[0x35])) {
if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
*(dst-1) = p1;
*dst = p2;
}