Date: Sun, 24 Mar 2019 19:27:04 +0000 (UTC) From: Bruce Evans <bde@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345481 - head/lib/libvgl Message-ID: <201903241927.x2OJR4C9031375@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bde Date: Sun Mar 24 19:27:03 2019 New Revision: 345481 URL: https://svnweb.freebsd.org/changeset/base/345481 Log: Fix reading of pixels in (4 and 8-plane) planar modes. There seems to be no alternative to reading each plane independently using 3 slow i/o's per plane (this delivers 8 nearby pixels, but we don't buffer the results so run 8 times slower than necessary. All the code for this was there, but it was ifdefed out and replaced by simpler code that cannot work in planar modes. The ifdefed out code was correct except it was missing a volatile declaration, so compilers optimized the multiple dummy reads in it to a single read. Modified: head/lib/libvgl/simple.c Modified: head/lib/libvgl/simple.c ============================================================================== --- head/lib/libvgl/simple.c Sun Mar 24 19:11:45 2019 (r345480) +++ head/lib/libvgl/simple.c Sun Mar 24 19:27:03 2019 (r345481) @@ -148,11 +148,9 @@ VGLGetXY(VGLBitmap *object, int x, int y) { int offset; byte b[4]; -#if 0 int i; u_long color; byte mask; -#endif VGLCheckSwitch(); if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize) @@ -185,17 +183,14 @@ VGLGetXY(VGLBitmap *object, int x, int y) case VIDBUF4: offset = y*VGLAdpInfo.va_line_width + x/8; get_planar: -#if 1 - return (object->Bitmap[offset]&(0x80>>(x%8))) ? 1 : 0; /* XXX */ -#else color = 0; mask = 0x80 >> (x%8); for (i = 0; i < VGLModeInfo.vi_planes; i++) { outb(0x3ce, 0x04); outb(0x3cf, i); - color |= (object->Bitmap[offset] & mask) ? (1 << i) : 0; + color |= (((volatile VGLBitmap *)object)->Bitmap[offset] & mask) ? + (1 << i) : 0; } return color; -#endif } return 0; /* XXX black? */ }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903241927.x2OJR4C9031375>