[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-cvs
Subject: [Bochs-cvs] [13397] trunk/bochs/iodev/display/voodoo.cc
From: vruppert--- via Bochs-cvs <bochs-cvs () lists ! sourceforge ! net>
Date: 2017-12-17 16:55:10
Message-ID: 1513529710.379169.17841 () sfp-scm-6 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 13397
Author: vruppert
Date: 2017-12-17 16:55:10 +0000 (Sun, 17 Dec 2017)
Log Message:
-----------
Voodoo Banshee code cleanups and optimizations.
Modified Paths:
--------------
trunk/bochs/iodev/display/voodoo.cc
Modified: trunk/bochs/iodev/display/voodoo.cc
===================================================================
--- trunk/bochs/iodev/display/voodoo.cc 2017-12-16 19:34:14 UTC (rev 13396)
+++ trunk/bochs/iodev/display/voodoo.cc 2017-12-17 16:55:10 UTC (rev 13397)
@@ -2074,7 +2074,7 @@
void bx_voodoo_c::banshee_blt_launch_area_setup()
{
Bit32u pbytes;
- Bit8u srcfmt, pxpack;
+ Bit8u pxpack;
BLT.lacnt = 0;
BLT.laidx = 0;
@@ -2087,7 +2087,6 @@
BLT.lacnt = 1;
break;
case 3:
- srcfmt = (BLT.reg[blt_srcFormat] >> 16) & 0x0f;
pxpack = (BLT.reg[blt_srcFormat] >> 22) & 3;
BLT.src_wizzle = (BLT.reg[blt_srcFormat] >> 20) & 0x03;
if ((BLT.reg[blt_srcXY] & 0xffe0) != 0) {
@@ -2094,7 +2093,7 @@
BX_ERROR(("host to screen blt: srcXY: undocumented bit(s) set"));
}
if ((BLT.reg[blt_srcXY] & 0x1f) != 0) {
- if (srcfmt == 0) {
+ if (BLT.src_fmt == 0) {
BLT.h2s_pxstart = BLT.reg[blt_srcXY] & 0x1f;
} else {
BLT.h2s_pxstart = BLT.reg[blt_srcXY] & 0x03;
@@ -2102,15 +2101,15 @@
} else {
BLT.h2s_pxstart = 0;
}
- if (srcfmt == 0) {
+ if (BLT.src_fmt == 0) {
pbytes = ((BLT.dst_w + BLT.h2s_pxstart + 7) >> 3);
- } else if (srcfmt == 1) {
+ } else if (BLT.src_fmt == 1) {
pbytes = BLT.dst_w + BLT.h2s_pxstart;
- } else if ((srcfmt >= 3) && (srcfmt <= 5)) {
- pbytes = (BLT.dst_w + BLT.h2s_pxstart) * (srcfmt - 1);
+ } else if ((BLT.src_fmt >= 3) && (BLT.src_fmt <= 5)) {
+ pbytes = (BLT.dst_w + BLT.h2s_pxstart) * (BLT.src_fmt - 1);
} else {
pbytes = 0;
- BX_INFO(("Source format %d not handled yet", srcfmt));
+ BX_INFO(("Source format %d not handled yet", BLT.src_fmt));
}
if (pxpack == 0) {
BLT.h2s_pitch = (pbytes + 3) & ~0x03;
@@ -2353,7 +2352,7 @@
Bit8u dpxsize = (BLT.dst_fmt > 1) ? (BLT.dst_fmt - 1) : 1;
Bit8u *dst_ptr = &v->fbi.ram[BLT.dst_base];
Bit8u *dst_ptr1;
- int x, y, x1, y1, w, h;
+ int ncols, nrows, x1, y1, w, h;
BX_LOCK(render_mutex);
x1 = BLT.dst_x;
@@ -2363,14 +2362,16 @@
BX_DEBUG(("Rectangle fill: %d x %d ROP %02X", w, h, BLT.rop0));
banshee_blt_apply_clipwindow(NULL, NULL, &x1, &y1, &w, &h);
dst_ptr += (y1 * dpitch + x1 * dpxsize);
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
+ ncols = w;
dst_ptr1 = dst_ptr;
- for (x = x1; x < (x1 + w); x++) {
+ do {
BLT.rop_fn(dst_ptr1, BLT.fgcolor, dpitch, dpxsize, dpxsize, 1);
dst_ptr1 += dpxsize;
- }
+ } while (--ncols);
dst_ptr += dpitch;
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
@@ -2384,7 +2385,7 @@
Bit8u *dst_ptr1, *pat_ptr1;
bx_bool patrow0 = (BLT.reg[blt_commandExtra] & 0x08) > 0;
Bit8u *color;
- int x, y, x0, y0, x1, y1, w, h;
+ int ncols, nrows, x0, y0, x1, y1, w, h;
Bit8u mask, patcol, patline;
bx_bool set;
@@ -2401,10 +2402,12 @@
patcol = (x0 + BLT.patsx) & 7;
patline = (y0 + BLT.patsy) & 7;
pat_ptr1 = pat_ptr + patline;
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
dst_ptr1 = dst_ptr;
mask = 0x80 >> patcol;
- for (x = x1; x < (x1 + w); x++) {
+ ncols = w;
+ do {
set = (*pat_ptr1 & mask) > 0;
if (set) {
color = &BLT.fgcolor[0];
@@ -2419,7 +2422,7 @@
if (mask == 0) {
mask = 0x80;
}
- }
+ } while (--ncols);
dst_ptr += dpitch;
if (!patrow0) {
patline = (patline + 1) & 7;
@@ -2429,7 +2432,7 @@
pat_ptr1++;
}
}
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
@@ -2442,7 +2445,7 @@
Bit8u *pat_ptr = &BLT.cpat[0][0];
Bit8u *dst_ptr1, *pat_ptr1, *pat_ptr2;
bx_bool patrow0 = (BLT.reg[blt_commandExtra] & 0x08) > 0;
- int x, y, x0, y0, x1, y1, w, h;
+ int ncols, nrows, x0, y0, x1, y1, w, h;
Bit8u patcol, patline;
BX_LOCK(render_mutex);
@@ -2458,10 +2461,12 @@
patcol = (x0 + BLT.patsx) & 7;
patline = (y0 + BLT.patsy) & 7;
pat_ptr1 = pat_ptr + patline * dpxsize * 8 + patcol * dpxsize;
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
pat_ptr2 = pat_ptr1;
dst_ptr1 = dst_ptr;
- for (x = x1; x < (x1 + w); x++) {
+ ncols = w;
+ do {
BLT.rop_fn(dst_ptr1, pat_ptr2, dpitch, dpxsize, dpxsize, 1);
dst_ptr1 += dpxsize;
pat_ptr2 += dpxsize;
@@ -2469,7 +2474,7 @@
if (patcol == 0) {
pat_ptr2 = pat_ptr1;
}
- }
+ } while (--ncols);
dst_ptr += dpitch;
if (!patrow0) {
patline = (patline + 1) & 7;
@@ -2479,7 +2484,7 @@
pat_ptr1 += (dpxsize * 8);
}
}
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
@@ -2526,7 +2531,7 @@
bx_bool patrow0 = (BLT.reg[blt_commandExtra] & 0x08) > 0;
Bit8u dstcolor[4];
Bit8u *patcolor;
- int x, x0, x1, y, y0, y1, w, h;
+ int ncols, nrows, x0, x1, y0, y1, w, h;
Bit8u pmask = 0, rop0, patcol, patline;
bx_bool set;
@@ -2556,7 +2561,8 @@
} else {
pat_ptr1 = pat_ptr + patline * abs(dpxsize) * 8 + patcol * abs(dpxsize);
}
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
src_ptr1 = src_ptr;
dst_ptr1 = dst_ptr;
if (!patmono) {
@@ -2564,7 +2570,8 @@
} else {
pmask = 0x80 >> patcol;
}
- for (x = x1; x < (x1 + w); x++) {
+ ncols = w;
+ do {
memcpy(dstcolor, dst_ptr1, abs(dpxsize));
if (patmono) {
set = (*pat_ptr & pmask) > 0;
@@ -2593,7 +2600,7 @@
pat_ptr2 = pat_ptr1;
}
}
- }
+ } while (--ncols);
src_ptr += spitch;
dst_ptr += dpitch;
if (!patrow0) {
@@ -2613,7 +2620,7 @@
}
}
}
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
@@ -2626,11 +2633,11 @@
Bit8u *src_ptr = &BLT.lamem[0];
Bit8u *src_ptr1, *dst_ptr1;
Bit16u spitch = BLT.h2s_pitch;
- Bit8u srcfmt = (BLT.reg[blt_srcFormat] >> 16) & 0x0f;
+ Bit8u srcfmt = BLT.src_fmt;
Bit8u spxsize = 0;
Bit8u dstcolor[4];
Bit8u *srccolor;
- int x, y, x0, y0, x1, y1, w, h;
+ int ncols, nrows, x0, y0, x1, y1, w, h;
Bit8u smask;
bx_bool set;
@@ -2657,11 +2664,13 @@
src_ptr += (y0 * spitch + x0 * spxsize + BLT.h2s_pxstart);
}
dst_ptr += (y1 * dpitch + x1 * dpxsize);
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
src_ptr1 = src_ptr;
dst_ptr1 = dst_ptr;
smask = 0x80 >> (x0 & 7);
- for (x = x1; x < (x1 + w); x++) {
+ ncols = w;
+ do {
if (srcfmt == 0) {
memcpy(dstcolor, dst_ptr1, dpxsize);
set = (*src_ptr1 & smask) > 0;
@@ -2686,10 +2695,10 @@
src_ptr1 += spxsize;
}
dst_ptr1 += dpxsize;
- }
+ } while (--ncols);
src_ptr += spitch;
dst_ptr += dpitch;
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
@@ -2703,13 +2712,13 @@
Bit8u *src_ptr1, *dst_ptr1, *pat_ptr1, *pat_ptr2 = NULL;
Bit8u *pat_ptr = &BLT.cpat[0][0];
Bit16u spitch = BLT.h2s_pitch;
- Bit8u srcfmt = (BLT.reg[blt_srcFormat] >> 16) & 0x0f;
+ Bit8u srcfmt = BLT.src_fmt;
bx_bool patmono = (BLT.reg[blt_command] >> 13) & 1;
bx_bool patrow0 = (BLT.reg[blt_commandExtra] & 0x08) > 0;
Bit8u spxsize = 0;
Bit8u dstcolor[4];
Bit8u *srccolor, *patcolor;
- int x, y, x0, y0, x1, y1, w, h;
+ int ncols, nrows, x0, y0, x1, y1, w, h;
Bit8u smask, pmask = 0, rop0, patcol, patline;
bx_bool set;
@@ -2744,7 +2753,8 @@
} else {
pat_ptr1 = pat_ptr + patline * dpxsize * 8 + patcol * dpxsize;
}
- for (y = y1; y < (y1 + h); y++) {
+ nrows = h;
+ do {
src_ptr1 = src_ptr;
dst_ptr1 = dst_ptr;
smask = 0x80 >> (x0 & 7);
@@ -2753,7 +2763,8 @@
} else {
pmask = 0x80 >> patcol;
}
- for (x = x1; x < (x1 + w); x++) {
+ ncols = w;
+ do {
if (srcfmt == 0) {
memcpy(dstcolor, dst_ptr1, dpxsize);
set = (*src_ptr1 & smask) > 0;
@@ -2802,7 +2813,7 @@
}
}
dst_ptr1 += dpxsize;
- }
+ } while (--ncols);
src_ptr += spitch;
dst_ptr += dpitch;
if (!patrow0) {
@@ -2822,7 +2833,7 @@
}
}
}
- }
+ } while (--nrows);
banshee_blt_complete();
BX_UNLOCK(render_mutex);
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic