Improve drawing of the vga planar mode mouse image a little. Unobfuscate
the method a lot. Reduce the AND mask to the complement of the cursor's frame, so that area inside the frame is not drawn first in black and then in lightwhite. The AND-OR method is only directly suitable for the text mouse image, since it doesn't go to the hardware there. Planar mode Mouse cursor drawing takes 10-20 usec on my Haswell system (approx. 100 graphics accesses at 130 nsec each), so the transient was not visible. The method used the fancy read mode 1 and its color compare and color don't care registers with value 0 in them so that all colors matched. All that this did was make byte reads of frame buffer memory return 0xff, so that the x86 case could obfuscate read+write as "and". The read must be done for its side effect on the graphics controller but is not used, except it must return 0xff to avoid affecting the write when the write is obfuscated as a read-modify-write "and". Perhaps that was a good optimization for 8088 CPUs where each extra instruction byte took as long as a byte memory access. Just use read+write after removing the fancy read mode. Remove x86 ifdefs that did the "and". After removing the "and" in the non-x86 part of the ifdefs, fix 4 of 6 cases where the shift was wrong.
This commit is contained in:
parent
e1f7a5d672
commit
1b986d6aea
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316741
@ -1038,34 +1038,26 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y)
|
|||||||
yoff = y - rounddown(y, line_width);
|
yoff = y - rounddown(y, line_width);
|
||||||
ymax = imin(y + 16, scp->ypixel);
|
ymax = imin(y + 16, scp->ypixel);
|
||||||
|
|
||||||
outw(GDCIDX, 0x0805); /* read mode 1, write mode 0 */
|
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||||
outw(GDCIDX, 0x0001); /* set/reset enable */
|
outw(GDCIDX, 0x0001); /* set/reset enable */
|
||||||
outw(GDCIDX, 0x0002); /* color compare */
|
|
||||||
outw(GDCIDX, 0x0007); /* color don't care */
|
|
||||||
outw(GDCIDX, 0xff08); /* bit mask */
|
outw(GDCIDX, 0xff08); /* bit mask */
|
||||||
outw(GDCIDX, 0x0803); /* data rotate/function select (and) */
|
outw(GDCIDX, 0x0803); /* data rotate/function select (and) */
|
||||||
p = scp->sc->adp->va_window + line_width*y + x/8;
|
p = scp->sc->adp->va_window + line_width*y + x/8;
|
||||||
if (x < scp->xpixel - 8) {
|
if (x < scp->xpixel - 8) {
|
||||||
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
||||||
m = ~(mouse_and_mask[j] >> xoff);
|
m = ~((mouse_and_mask[j] & ~mouse_or_mask[j]) >> xoff);
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
readb(p);
|
||||||
*(u_char *)p &= m >> 8;
|
writeb(p, m >> 8);
|
||||||
*(u_char *)(p + 1) &= m;
|
readb(p + 1);
|
||||||
#else
|
writeb(p + 1, m);
|
||||||
writeb(p, readb(p) & (m >> 8));
|
|
||||||
writeb(p + 1, readb(p + 1) & (m >> 8));
|
|
||||||
#endif
|
|
||||||
p += line_width;
|
p += line_width;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xoff += 8;
|
xoff += 8;
|
||||||
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
||||||
m = ~(mouse_and_mask[j] >> xoff);
|
m = ~((mouse_and_mask[j] & ~mouse_or_mask[j]) >> xoff);
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
readb(p);
|
||||||
*(u_char *)p &= m;
|
writeb(p, m);
|
||||||
#else
|
|
||||||
writeb(p, readb(p) & (m >> 8));
|
|
||||||
#endif
|
|
||||||
p += line_width;
|
p += line_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1074,27 +1066,20 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y)
|
|||||||
if (x < scp->xpixel - 8) {
|
if (x < scp->xpixel - 8) {
|
||||||
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
||||||
m = mouse_or_mask[j] >> xoff;
|
m = mouse_or_mask[j] >> xoff;
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
readb(p);
|
||||||
*(u_char *)p &= m >> 8;
|
writeb(p, m >> 8);
|
||||||
*(u_char *)(p + 1) &= m;
|
readb(p + 1);
|
||||||
#else
|
writeb(p + 1, m);
|
||||||
writeb(p, readb(p) & (m >> 8));
|
|
||||||
writeb(p + 1, readb(p + 1) & (m >> 8));
|
|
||||||
#endif
|
|
||||||
p += line_width;
|
p += line_width;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
for (i = y, j = 0; i < ymax; ++i, ++j) {
|
||||||
m = mouse_or_mask[j] >> xoff;
|
m = mouse_or_mask[j] >> xoff;
|
||||||
#if defined(__i386__) || defined(__amd64__)
|
readb(p);
|
||||||
*(u_char *)p &= m;
|
writeb(p, m);
|
||||||
#else
|
|
||||||
writeb(p, readb(p) & (m >> 8));
|
|
||||||
#endif
|
|
||||||
p += line_width;
|
p += line_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
|
||||||
outw(GDCIDX, 0x0003); /* data rotate/function select */
|
outw(GDCIDX, 0x0003); /* data rotate/function select */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user