ia64/xen-unstable

changeset 7460:349b302f29e2

Update one file from qemu 0.71 for Cirrus Logic VGA device model.
Using the older device model running pinball game on windows with
full screen can cause guest crash.

Signed-off-by: yunhong.jiang@intel.com
author kaf24@firebug.cl.cam.ac.uk
date Fri Oct 21 10:24:35 2005 +0100 (2005-10-21)
parents 349d7b4ef7b0
children 899f7b4b19fc
files tools/ioemu/hw/cirrus_vga_rop2.h
line diff
     1.1 --- a/tools/ioemu/hw/cirrus_vga_rop2.h	Fri Oct 21 10:20:38 2005 +0100
     1.2 +++ b/tools/ioemu/hw/cirrus_vga_rop2.h	Fri Oct 21 10:24:35 2005 +0100
     1.3 @@ -47,6 +47,11 @@ glue(glue(glue(cirrus_patternfill_, ROP_
     1.4      int x, y, pattern_y, pattern_pitch, pattern_x;
     1.5      unsigned int col;
     1.6      const uint8_t *src1;
     1.7 +#if DEPTH == 24
     1.8 +    int skipleft = s->gr[0x2f] & 0x1f;
     1.9 +#else
    1.10 +    int skipleft = (s->gr[0x2f] & 0x07) * (DEPTH / 8);
    1.11 +#endif
    1.12  
    1.13  #if DEPTH == 8
    1.14      pattern_pitch = 8;
    1.15 @@ -56,11 +61,11 @@ glue(glue(glue(cirrus_patternfill_, ROP_
    1.16      pattern_pitch = 32;
    1.17  #endif
    1.18      pattern_y = s->cirrus_blt_srcaddr & 7;
    1.19 -    pattern_x = 0;
    1.20      for(y = 0; y < bltheight; y++) {
    1.21 -        d = dst;
    1.22 +        pattern_x = skipleft;
    1.23 +        d = dst + skipleft;
    1.24          src1 = src + pattern_y * pattern_pitch;
    1.25 -        for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
    1.26 +        for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
    1.27  #if DEPTH == 8
    1.28              col = src1[pattern_x];
    1.29              pattern_x = (pattern_x + 1) & 7;
    1.30 @@ -99,7 +104,13 @@ glue(glue(glue(cirrus_colorexpand_transp
    1.31      unsigned int col;
    1.32      unsigned bitmask;
    1.33      unsigned index;
    1.34 -    int srcskipleft = 0;
    1.35 +#if DEPTH == 24
    1.36 +    int dstskipleft = s->gr[0x2f] & 0x1f;
    1.37 +    int srcskipleft = dstskipleft / 3;
    1.38 +#else
    1.39 +    int srcskipleft = s->gr[0x2f] & 0x07;
    1.40 +    int dstskipleft = srcskipleft * (DEPTH / 8);
    1.41 +#endif
    1.42  
    1.43      if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
    1.44          bits_xor = 0xff;
    1.45 @@ -112,8 +123,8 @@ glue(glue(glue(cirrus_colorexpand_transp
    1.46      for(y = 0; y < bltheight; y++) {
    1.47          bitmask = 0x80 >> srcskipleft;
    1.48          bits = *src++ ^ bits_xor;
    1.49 -        d = dst;
    1.50 -        for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
    1.51 +        d = dst + dstskipleft;
    1.52 +        for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
    1.53              if ((bitmask & 0xff) == 0) {
    1.54                  bitmask = 0x80;
    1.55                  bits = *src++ ^ bits_xor;
    1.56 @@ -142,15 +153,16 @@ glue(glue(glue(cirrus_colorexpand_, ROP_
    1.57      unsigned bits;
    1.58      unsigned int col;
    1.59      unsigned bitmask;
    1.60 -    int srcskipleft = 0;
    1.61 +    int srcskipleft = s->gr[0x2f] & 0x07;
    1.62 +    int dstskipleft = srcskipleft * (DEPTH / 8);
    1.63  
    1.64      colors[0] = s->cirrus_blt_bgcol;
    1.65      colors[1] = s->cirrus_blt_fgcol;
    1.66      for(y = 0; y < bltheight; y++) {
    1.67          bitmask = 0x80 >> srcskipleft;
    1.68          bits = *src++;
    1.69 -        d = dst;
    1.70 -        for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
    1.71 +        d = dst + dstskipleft;
    1.72 +        for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
    1.73              if ((bitmask & 0xff) == 0) {
    1.74                  bitmask = 0x80;
    1.75                  bits = *src++;
    1.76 @@ -175,6 +187,13 @@ glue(glue(glue(cirrus_colorexpand_patter
    1.77      int x, y, bitpos, pattern_y;
    1.78      unsigned int bits, bits_xor;
    1.79      unsigned int col;
    1.80 +#if DEPTH == 24
    1.81 +    int dstskipleft = s->gr[0x2f] & 0x1f;
    1.82 +    int srcskipleft = dstskipleft / 3;
    1.83 +#else
    1.84 +    int srcskipleft = s->gr[0x2f] & 0x07;
    1.85 +    int dstskipleft = srcskipleft * (DEPTH / 8);
    1.86 +#endif
    1.87  
    1.88      if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
    1.89          bits_xor = 0xff;
    1.90 @@ -187,9 +206,9 @@ glue(glue(glue(cirrus_colorexpand_patter
    1.91  
    1.92      for(y = 0; y < bltheight; y++) {
    1.93          bits = src[pattern_y] ^ bits_xor;
    1.94 -        bitpos = 7;
    1.95 -        d = dst;
    1.96 -        for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
    1.97 +        bitpos = 7 - srcskipleft;
    1.98 +        d = dst + dstskipleft;
    1.99 +        for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
   1.100              if ((bits >> bitpos) & 1) {
   1.101                  PUTPIXEL();
   1.102              }
   1.103 @@ -213,6 +232,8 @@ glue(glue(glue(cirrus_colorexpand_patter
   1.104      int x, y, bitpos, pattern_y;
   1.105      unsigned int bits;
   1.106      unsigned int col;
   1.107 +    int srcskipleft = s->gr[0x2f] & 0x07;
   1.108 +    int dstskipleft = srcskipleft * (DEPTH / 8);
   1.109  
   1.110      colors[0] = s->cirrus_blt_bgcol;
   1.111      colors[1] = s->cirrus_blt_fgcol;
   1.112 @@ -220,9 +241,9 @@ glue(glue(glue(cirrus_colorexpand_patter
   1.113  
   1.114      for(y = 0; y < bltheight; y++) {
   1.115          bits = src[pattern_y];
   1.116 -        bitpos = 7;
   1.117 -        d = dst;
   1.118 -        for (x = 0; x < bltwidth; x += (DEPTH / 8)) {
   1.119 +        bitpos = 7 - srcskipleft;
   1.120 +        d = dst + dstskipleft;
   1.121 +        for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
   1.122              col = colors[(bits >> bitpos) & 1];
   1.123              PUTPIXEL();
   1.124              d += (DEPTH / 8);