shithub: riscv

Download patch

ref: ba787cc587803e3dfe400755c4fa2fa04701dd53
parent: 02a2eb6676d3dbdaea5e5339b32bfa4c9d321175
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jan 18 22:29:52 EST 2014

kernel: replace BY2WD in scanline width calculation to sizeof(ulong) like libmemdraw

--- a/sys/src/9/pc/screen.c
+++ b/sys/src/9/pc/screen.c
@@ -186,7 +186,7 @@
 	if(rectclip(&r, scr->gscreen->r) == 0)
 		return;
 	disp = scr->vaddr;
-	incs = scr->gscreen->width*BY2WD;
+	incs = scr->gscreen->width*sizeof(ulong);
 	off = (r.min.x*scr->gscreen->depth) / 8;
 	len = (r.max.x*scr->gscreen->depth + 7) / 8;
 	len -= off;
--- a/sys/src/9/pc/vgact65545.c
+++ b/sys/src/9/pc/vgact65545.c
@@ -34,7 +34,7 @@
 	 * Find a place for the cursor data in display memory.
 	 * Must be on a 1024-byte boundary.
 	 */
-	storage = ROUND(scr->gscreen->width*BY2WD*scr->gscreen->r.max.y, 1024);
+	storage = ROUND(scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y, 1024);
 	outl(0xB3D0, storage);
 	scr->storage = storage;
 
--- a/sys/src/9/pc/vgacyber938x.c
+++ b/sys/src/9/pc/vgacyber938x.c
@@ -169,7 +169,7 @@
 	/*
 	 * Find a place for the cursor data in display memory.
 	 */
-	storage = ((scr->gscreen->width*BY2WD*scr->gscreen->r.max.y+1023)/1024);
+	storage = ((scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y+1023)/1024);
 	vgaxo(Crtx, 0x44, storage & 0xFF);
 	vgaxo(Crtx, 0x45, (storage>>8) & 0xFF);
 	storage *= 1024;
--- a/sys/src/9/pc/vgaet4000.c
+++ b/sys/src/9/pc/vgaet4000.c
@@ -79,7 +79,7 @@
 	 * 1024-byte boundary so that there's no danger of it
 	 * crossing a page.
 	 */
-	scr->storage = (scr->gscreen->width*BY2WD*scr->gscreen->r.max.y+1023)/1024;
+	scr->storage = (scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y+1023)/1024;
 	scr->storage *= 1024/4;
 	outb(0x217A, 0xE8);
 	outb(0x217B, scr->storage & 0xFF);
--- a/sys/src/9/pc/vgamach64xx.c
+++ b/sys/src/9/pc/vgamach64xx.c
@@ -589,7 +589,7 @@
 	 * Find a place for the cursor data in display memory.
 	 * Must be 64-bit aligned.
 	 */
-	storage = (scr->gscreen->width*BY2WD*scr->gscreen->r.max.y+7)/8;
+	storage = (scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y+7)/8;
 	iow32(scr, CurOffset, storage);
 	scr->storage = storage*8;
 
--- a/sys/src/9/pc/vganeomagic.c
+++ b/sys/src/9/pc/vganeomagic.c
@@ -377,7 +377,7 @@
 		| NEO_BC3_SKIP_MAPPING
 		| GXcopy;
 	mmio[DstStartOff] = scr->paddr
-		+ r.min.y*scr->gscreen->width*BY2WD
+		+ r.min.y*scr->gscreen->width*sizeof(ulong)
 		+ r.min.x*scr->gscreen->depth/BI2BY;
 	mmio[XYExt] = (Dy(r) << 16) | (Dx(r) & 0xffff);
 	waitforidle(scr);
@@ -392,7 +392,7 @@
 
 	mmio = scr->mmio;
 
-	pitch = scr->gscreen->width*BY2WD;
+	pitch = scr->gscreen->width*sizeof(ulong);
 	pixel = scr->gscreen->depth/BI2BY;
 
 	waitforfifo(scr, 4);
@@ -433,7 +433,7 @@
 
 	mmio = scr->mmio;
 
-	pitch = scr->gscreen->width*BY2WD;
+	pitch = scr->gscreen->width*sizeof(ulong);
 
 	neomagicbltflags = bltmode = 0;
 
--- a/sys/src/9/pc/vganvidia.c
+++ b/sys/src/9/pc/vganvidia.c
@@ -346,7 +346,7 @@
 	if(scr->paddr == 0)
 		return -1;
 
-	pitch = scr->gscreen->width*BY2WD;
+	pitch = scr->gscreen->width*sizeof(ulong);
 
 	/*
 	 * DMA is at the end of the virtual window,
--- a/sys/src/9/pc/vgas3.c
+++ b/sys/src/9/pc/vgas3.c
@@ -307,7 +307,7 @@
 	 * Find a place for the cursor data in display memory.
 	 * Must be on a 1024-byte boundary.
 	 */
-	storage = (scr->gscreen->width*BY2WD*scr->gscreen->r.max.y+1023)/1024;
+	storage = (scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y+1023)/1024;
 	vgaxo(Crtx, 0x4C, storage>>8);
 	vgaxo(Crtx, 0x4D, storage & 0xFF);
 	storage *= 1024;
--