CVS commit: src/share/man/man4/man4.amiga

2024-04-11 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Thu Apr 11 13:06:29 UTC 2024

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Mention the 16-color screenmode.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/man4.amiga/amidisplaycc.4
diff -u src/share/man/man4/man4.amiga/amidisplaycc.4:1.16 src/share/man/man4/man4.amiga/amidisplaycc.4:1.17
--- src/share/man/man4/man4.amiga/amidisplaycc.4:1.16	Sat Aug 13 17:06:38 2022
+++ src/share/man/man4/man4.amiga/amidisplaycc.4	Thu Apr 11 13:06:29 2024
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.16 2022/08/13 17:06:38 wiz Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.17 2024/04/11 13:06:29 jandberg Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -88,7 +88,7 @@ utility runtime.
 The X11 server works using the
 .Xr wsfb 4
 driver.
-The driver supports 256 color and monochrome modes.
+The driver supports 256 and 16 color modes.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsdisplay 4 ,



CVS commit: src/share/man/man4/man4.amiga

2024-04-11 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Thu Apr 11 13:06:29 UTC 2024

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Mention the 16-color screenmode.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: xsrc/external/mit

2024-03-25 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Mon Mar 25 14:11:39 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c
xsrc/external/mit/xorg-server/dist/miext/shadow: shadow.h shafb4.c

Log Message:
xf86-video-wsfb: Add support for 16 color mode on Amiga

- Sets up 8bpp shadow framebuffer with depth 4
- Bitplane conversion done in shadow update function
- Adds new shadow update function shadowUpdateAfb4x8,
  which is a slightly modified version of existing shadowUpdateAfb4/8.

Discussion on tech-x11: 
http://mail-index.netbsd.org/tech-x11/2024/02/29/msg002447.html


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
cvs rdiff -u -r1.1.1.5 -r1.2 \
xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.49 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.50
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.49	Fri Jan 26 13:37:21 2024
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Mon Mar 25 14:11:39 2024
@@ -554,14 +554,20 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 	if (wstype == WSDISPLAY_TYPE_AMIGACC) {
 		/*
 		 * Video memory is organized in bitplanes.
-		 * 8bpp or 1bpp supported in this driver.
-		 * With 8bpp conversion to bitplane format
-		 * is done in shadow update proc.
+		 * 8bpp, 4bpp, and 1bpp supported in this driver.
+		 * With 8bpp/4bpp conversion to bitplane format
+		 * is done in shadow update proc. In both cases
+		 * shadow fb uses 8bpp memory layout and shadow
+		 * update proc ignores the possible extra bits.
 		 * With 1bpp no conversion needed.
 		 */
 #ifdef HAVE_SHADOW_AFB
 		if (bitsperpixel == 8) {
 			fPtr->planarAfb = TRUE;
+		} else if (bitsperpixel == 4) {
+			fPtr->planarAfb = TRUE;
+			default_depth = 4;
+			bitsperpixel = 8;
 		} else
 #endif
 		{
@@ -643,6 +649,16 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		fPtr->fbi.fbi_pixeltype = WSFB_RGB;
 	}
 #endif
+#ifdef HAVE_SHADOW_AFB
+	if (fPtr->planarAfb)
+	{
+		if (!fPtr->shadowFB) {
+			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+   "Shadow FB forced on for planar framebuffer\n");
+			fPtr->shadowFB = TRUE;
+		}
+	}
+#endif
 	/* Rotation */
 	fPtr->rotate = WSFB_ROTATE_NONE;
 	if ((s = xf86GetOptValString(fPtr->Options, OPTION_ROTATE))) {
@@ -891,9 +907,12 @@ WsfbCreateScreenResources(ScreenPtr pScr
 		shadowproc = wsfbUpdateRotatePacked;
 	} else
 #ifdef HAVE_SHADOW_AFB
-	if (fPtr->planarAfb) {
+	if (fPtr->planarAfb && fPtr->fbi.fbi_bitsperpixel == 8) {
 		shadowproc = shadowUpdateAfb8;
 		windowproc = WsfbWindowAfb;
+	} else if (fPtr->planarAfb && fPtr->fbi.fbi_bitsperpixel == 4) {
+		shadowproc = shadowUpdateAfb4x8;
+		windowproc = WsfbWindowAfb;
 	} else
 #endif
 	{

Index: xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h
diff -u xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h:1.1.1.5 xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h:1.2
--- xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h:1.1.1.5	Mon Dec 31 09:36:07 2018
+++ xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h	Mon Mar 25 14:11:39 2024
@@ -88,6 +88,9 @@ extern _X_EXPORT void
  shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf);
 
 extern _X_EXPORT void
+ shadowUpdateAfb4x8(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+extern _X_EXPORT void
  shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf);
 
 extern _X_EXPORT void

Index: xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c
diff -u xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c:1.1.1.2 xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c:1.2
--- xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c:1.1.1.2	Mon Dec 31 09:36:07 2018
+++ xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c	Mon Mar 25 14:11:39 2024
@@ -137,3 +137,70 @@ shadowUpdateAfb4(ScreenPtr pScreen, shad
 pbox++;
 }
 }
+
+/*
+ * Like above, except input is 8-bit chunky pixels (upper 4 bits zero)
+ */
+void
+shadowUpdateAfb4x8(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+RegionPtr damage = DamageRegion(pBuf->pDamage);
+PixmapPtr pShadow = pBuf->pPixmap;
+int nbox = RegionNumRects(damage);
+BoxPtr pbox = RegionRects(damage);
+FbBits *shaBase;
+CARD32 *shaLine, *sha;
+FbStride shaStride;
+int scrLine;
+_X_UNUSED int shaBpp, shaXoff, shaYoff;
+int x, y, w, h;
+int i, n;
+CARD32 *win;
+CARD32 off, winStride;
+CARD32 dwords[4];
+
+fbGetDrawable(>drawable, shaBase, shaStride, shaBpp, shaXoff,
+  shaYoff);
+if (sizeof(FbBits) != 

CVS commit: xsrc/external/mit

2024-03-25 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Mon Mar 25 14:11:39 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c
xsrc/external/mit/xorg-server/dist/miext/shadow: shadow.h shafb4.c

Log Message:
xf86-video-wsfb: Add support for 16 color mode on Amiga

- Sets up 8bpp shadow framebuffer with depth 4
- Bitplane conversion done in shadow update function
- Adds new shadow update function shadowUpdateAfb4x8,
  which is a slightly modified version of existing shadowUpdateAfb4/8.

Discussion on tech-x11: 
http://mail-index.netbsd.org/tech-x11/2024/02/29/msg002447.html


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
cvs rdiff -u -r1.1.1.5 -r1.2 \
xsrc/external/mit/xorg-server/dist/miext/shadow/shadow.h
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xorg-server/dist/miext/shadow/shafb4.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Aug 13 10:53:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update comment about X11 support


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/man4.amiga/amidisplaycc.4
diff -u src/share/man/man4/man4.amiga/amidisplaycc.4:1.14 src/share/man/man4/man4.amiga/amidisplaycc.4:1.15
--- src/share/man/man4/man4.amiga/amidisplaycc.4:1.14	Sat Oct  9 08:25:33 2021
+++ src/share/man/man4/man4.amiga/amidisplaycc.4	Sat Aug 13 10:53:38 2022
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.14 2021/10/09 08:25:33 jandberg Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.15 2022/08/13 10:53:38 jandberg Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -43,10 +43,6 @@ operate a text terminal with virtual scr
 It uses the Amiga abstract graphic driver (grfabs) functions for
 the low-level display management.
 .Pp
-The X11 server works in monochrome mode using the
-.Xr wsfb 4
-driver.
-.Pp
 It supports foreground and background color, and the hilite (bold),
 underline, and reverse text attributes.
 .Ss Virtual terminals and screen types
@@ -88,6 +84,10 @@ Fonts can be compiled into the kernel by
 in the configuration file, or loaded with the
 .Xr wsfontload 8
 utility runtime.
+.Ss X11
+The X11 server works using the
+.Xr wsfb 4
+driver. The driver supports 256 color and monochrome modes.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsdisplay 4 ,



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Aug 13 10:53:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update comment about X11 support


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/amiga/dev

2022-07-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Wed Jul  6 14:34:13 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Return display depth correctly from WSDISPLAYIO_GET_FBINFO.
(previous workaround to always return 1 no longer needed with latest wsfb)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amiga/dev/amidisplaycc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/dev/amidisplaycc.c
diff -u src/sys/arch/amiga/dev/amidisplaycc.c:1.39 src/sys/arch/amiga/dev/amidisplaycc.c:1.40
--- src/sys/arch/amiga/dev/amidisplaycc.c:1.39	Sun Feb  6 10:05:56 2022
+++ src/sys/arch/amiga/dev/amidisplaycc.c	Wed Jul  6 14:34:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $ */
+/*	$NetBSD: amidisplaycc.c,v 1.40 2022/07/06 14:34:13 jandberg Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.40 2022/07/06 14:34:13 jandberg Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -1112,14 +1112,13 @@ amidisplaycc_getfbinfo(struct amidisplay
 	bm = adp->gfxview->bitmap;
 	KASSERT(bm);
 
-	/* Depth 1 since current X wsfb driver doesn't support multiple bitplanes */
 	memset(fbinfo, 0, sizeof(*fbinfo));
-	fbinfo->fbi_fbsize = bm->bytes_per_row * bm->rows;
+	fbinfo->fbi_fbsize = bm->bytes_per_row * bm->rows * adp->gfxdepth;
 	fbinfo->fbi_fboffset = 0;
 	fbinfo->fbi_width = bm->bytes_per_row * 8;
 	fbinfo->fbi_height = bm->rows;
 	fbinfo->fbi_stride = bm->bytes_per_row;
-	fbinfo->fbi_bitsperpixel = 1;
+	fbinfo->fbi_bitsperpixel = adp->gfxdepth;
 	fbinfo->fbi_pixeltype = WSFB_CI;
 	fbinfo->fbi_flags = 0;
 	fbinfo->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << adp->gfxdepth;



CVS commit: src/sys/arch/amiga/dev

2022-07-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Wed Jul  6 14:34:13 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Return display depth correctly from WSDISPLAYIO_GET_FBINFO.
(previous workaround to always return 1 no longer needed with latest wsfb)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amiga/dev/amidisplaycc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2022-07-06 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Wed Jul  6 14:27:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
Add support for 8bpp with Amiga native graphics.

Conversion to bitplane format is done in shadowfb update proc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.37 -r1.38 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.7
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6	Tue Aug 16 06:28:25 2016
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h	Wed Jul  6 14:27:50 2022
@@ -63,6 +63,7 @@ typedef struct {
 	Bool			shadowFB;
 	Bool			HWCursor;
 	Bool			useSwap32;
+	Bool			planarAfb;
 	CloseScreenProcPtr	CloseScreen;
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	void(*PointerMoved)(SCRN_ARG_TYPE, int, int);

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.38
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37	Mon Dec 30 18:27:50 2019
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Wed Jul  6 14:27:50 2022
@@ -121,6 +121,8 @@ static Bool WsfbScreenInit(SCREEN_INIT_A
 static Bool WsfbCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static void *WsfbWindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
 			  void *);
+static void *WsfbWindowAfb(ScreenPtr, CARD32, CARD32, int, CARD32 *,
+			  void *);
 static void WsfbPointerMoved(SCRN_ARG_TYPE, int, int);
 static Bool WsfbEnterVT(VT_FUNC_ARGS_DECL);
 static void WsfbLeaveVT(VT_FUNC_ARGS_DECL);
@@ -211,6 +213,7 @@ static const char *shadowSymbols[] = {
 	"shadowUpdatePackedWeak",
 	"shadowUpdateRotatePacked",
 	"shadowUpdateRotatePackedWeak",
+	"shadowUpdateAfb8",
 	NULL
 };
 
@@ -444,6 +447,13 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		return FALSE;
 	}
 
+	if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, ) == -1) {
+		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+			   "ioctl WSDISPLAY_GTYPE: %s\n",
+			   strerror(errno));
+		wstype = WSDISPLAY_TYPE_UNKNOWN;
+	}
+
 	if (ioctl(fPtr->fd, WSDISPLAYIO_GET_FBINFO, >fbi) != 0) {
 		struct wsdisplay_fbinfo info;
 		struct wsdisplayio_fbinfo *fbi = >fbi;
@@ -457,12 +467,6 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
    strerror(errno));
 			return FALSE;
 		}
-		if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, ) == -1) {
-			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-   "ioctl WSDISPLAY_GTYPE: %s\n",
-   strerror(errno));
-			return FALSE;
-		}
 		if (ioctl(fPtr->fd, WSDISPLAYIO_LINEBYTES, ) == -1) {
 			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    "ioctl WSDISPLAYIO_LINEBYTES: %s\n",
@@ -573,6 +577,25 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		bitsperpixel = 1;
 	}
 #endif
+#if defined(__NetBSD__) && defined(WSDISPLAY_TYPE_AMIGACC)
+	if (wstype == WSDISPLAY_TYPE_AMIGACC)
+	{
+		/*
+		 * Video memory is organized in bitplanes.
+		 * 8bpp or 1bpp supported in this driver.
+		 * With 8bpp conversion to bitplane format
+		 * is done in shadow update proc.
+		 * With 1bpp no conversion needed.
+		 */
+		if (bitsperpixel == 8) {
+			fPtr->planarAfb = TRUE;
+		} else {
+			default_depth = 1;
+			bitsperpixel = 1;
+		}
+	}
+#endif
+
 	if (!xf86SetDepthBpp(pScrn, default_depth, default_depth,
 		bitsperpixel,
 		bitsperpixel >= 24 ? Support24bppFb|Support32bppFb : 0))
@@ -826,6 +849,7 @@ WsfbCreateScreenResources(ScreenPtr pScr
 	PixmapPtr pPixmap;
 	Bool ret;
 	void (*shadowproc)(ScreenPtr, shadowBufPtr);
+	ShadowWindowProc windowproc = WsfbWindowLinear;
 
 	pScreen->CreateScreenResources = fPtr->CreateScreenResources;
 	ret = pScreen->CreateScreenResources(pScreen);
@@ -841,11 +865,14 @@ WsfbCreateScreenResources(ScreenPtr pScr
 		shadowproc = WsfbShadowUpdateSwap32;
 	} else if (fPtr->rotate) {
 		shadowproc = shadowUpdateRotatePacked;
+	} else if (fPtr->planarAfb) {
+		shadowproc = shadowUpdateAfb8;
+		windowproc = WsfbWindowAfb;
 	} else
 		shadowproc = shadowUpdatePacked;
 	
 	if (!shadowAdd(pScreen, pPixmap, shadowproc,
-		WsfbWindowLinear, fPtr->rotate, NULL)) {
+		windowproc, fPtr->rotate, NULL)) {
 		return FALSE;
 	}
 	return TRUE;
@@ -987,6 +1014,9 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 			 */
 			len = pScrn->virtualX * pScrn->virtualY *
 			(pScrn->bitsPerPixel >> 3);
+		} else if (fPtr->planarAfb) {
+			/* always 8bpp */
+			len = pScrn->virtualX * pScrn->virtualY;
 		} else {
 			len = fPtr->fbi.fbi_stride * pScrn->virtualY;
 		}
@@ -1006,6 +1036,8 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	 */
 	if (fPtr->rotate) {
 		

CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2022-07-06 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Wed Jul  6 14:27:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
Add support for 8bpp with Amiga native graphics.

Conversion to bitplane format is done in shadowfb update proc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.37 -r1.38 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/amiga/dev

2022-02-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sun Feb  6 10:05:56 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Refactor cursor drawing.
Fixes rare case where cursor gets painted over when screen is cleared.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amiga/dev/amidisplaycc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/dev/amidisplaycc.c
diff -u src/sys/arch/amiga/dev/amidisplaycc.c:1.38 src/sys/arch/amiga/dev/amidisplaycc.c:1.39
--- src/sys/arch/amiga/dev/amidisplaycc.c:1.38	Sat Aug 21 23:00:31 2021
+++ src/sys/arch/amiga/dev/amidisplaycc.c	Sun Feb  6 10:05:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amidisplaycc.c,v 1.38 2021/08/21 23:00:31 andvar Exp $ */
+/*	$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.38 2021/08/21 23:00:31 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -122,6 +122,9 @@ static int amidisplaycc_getfbinfo(struct
 
 static int amidisplaycc_setfont(struct amidisplaycc_screen *, const char *);
 static const struct wsdisplay_font * amidisplaycc_getbuiltinfont(void);
+static void amidisplaycc_cursor_undraw(struct amidisplaycc_screen *);
+static void amidisplaycc_cursor_draw(struct amidisplaycc_screen *);
+static void amidisplaycc_cursor_xor(struct amidisplaycc_screen *, int, int);
 
 static void dprintf(const char *fmt, ...);
 
@@ -276,6 +279,7 @@ struct amidisplaycc_screen
 
 	int   cursorrow;
 	int   cursorcol;
+	int   cursordrawn;
 
 	/* Active bitplanes for each character row. */
 	int   rowmasks[MAXROWS];
@@ -499,36 +503,55 @@ void
 amidisplaycc_cursor(void *screen, int on, int row, int col)
 {
 	adccscr_t  * scr;
-	u_char * dst;
-	int  i;
 
 	scr = screen;
 
 	if (row < 0 || col < 0 || row >= scr->nrows || col >= scr->ncols)
 		return;
 
-	/* was off, turning off again? */
-	if (!on && scr->cursorrow == -1 && scr->cursorcol == -1)
-		return;
-
-	/* was on, and turning on again? */
-	if (on && scr->cursorrow >= 0 && scr->cursorcol >= 0)
-	{
-		/* clear from old location first */
-		amidisplaycc_cursor (screen, 0, scr->cursorrow, scr->cursorcol);
-	}
-	
-	dst = scr->planes[0];
-	dst += row * scr->rowbytes;
-	dst += col;
+	amidisplaycc_cursor_undraw(scr);
 
 	if (on) {
 		scr->cursorrow = row;
 		scr->cursorcol = col;
+		amidisplaycc_cursor_draw(scr);
 	} else {
 		scr->cursorrow = -1;
 		scr->cursorcol = -1;
 	}
+}
+
+void
+amidisplaycc_cursor_undraw(struct amidisplaycc_screen * scr)
+{
+	if (scr->cursordrawn) {
+		amidisplaycc_cursor_xor(scr, scr->cursorrow, scr->cursorcol);
+		scr->cursordrawn = 0;
+	}
+}
+
+void
+amidisplaycc_cursor_draw(struct amidisplaycc_screen * scr)
+{
+	if (!scr->cursordrawn && scr->cursorrow >= 0 && scr->cursorcol >= 0) {
+		amidisplaycc_cursor_xor(scr, scr->cursorrow, scr->cursorcol);
+		scr->cursordrawn = 1;
+	}
+}
+
+void
+amidisplaycc_cursor_xor(struct amidisplaycc_screen * scr, int row, int col)
+{
+	u_char * dst;
+	int i;
+
+	KASSERT(scr);
+	KASSERT(row >= 0);
+	KASSERT(col >= 0);
+
+	dst = scr->planes[0];
+	dst += row * scr->rowbytes;
+	dst += col;
 
 	for (i = scr->fontheight ; i > 0 ; i--) {
 		*dst ^= 255;
@@ -536,7 +559,6 @@ amidisplaycc_cursor(void *screen, int on
 	}
 }
 
-
 int
 amidisplaycc_mapchar(void *screen, int ch, unsigned int *chp)
 {
@@ -924,6 +946,7 @@ amidisplaycc_eraserows(void *screen, int
 
 	if (row < 0 || row + nrows > scr->nrows)
 		return;
+	amidisplaycc_cursor_undraw(scr);
 
 	depth  = scr->depth;
 	widthbytes = scr->widthbytes;
@@ -958,6 +981,7 @@ amidisplaycc_eraserows(void *screen, int
 		}
 		bgcolor >>= 1;
 	}
+	amidisplaycc_cursor_draw(scr);
 }
 
 
@@ -1870,7 +1894,7 @@ amidisplaycc_setfont(struct amidisplaycc
 
 	scr->wsfont = wsfont;
 	scr->wsfontcookie = wsfontcookie;
-	
+
 	return 0;
 }
 



CVS commit: src/sys/arch/amiga/dev

2022-02-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sun Feb  6 10:05:56 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Refactor cursor drawing.
Fixes rare case where cursor gets painted over when screen is cleared.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amiga/dev/amidisplaycc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man4/man4.amiga

2021-10-09 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Oct  9 08:25:33 UTC 2021

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update documentation to mention current status of X11


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man4/man4.amiga

2021-10-09 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Oct  9 08:25:33 UTC 2021

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update documentation to mention current status of X11


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.amiga/amidisplaycc.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/man4.amiga/amidisplaycc.4
diff -u src/share/man/man4/man4.amiga/amidisplaycc.4:1.13 src/share/man/man4/man4.amiga/amidisplaycc.4:1.14
--- src/share/man/man4/man4.amiga/amidisplaycc.4:1.13	Sun Feb  7 14:06:04 2016
+++ src/share/man/man4/man4.amiga/amidisplaycc.4	Sat Oct  9 08:25:33 2021
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.13 2016/02/07 14:06:04 wiz Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.14 2021/10/09 08:25:33 jandberg Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -43,11 +43,9 @@ operate a text terminal with virtual scr
 It uses the Amiga abstract graphic driver (grfabs) functions for
 the low-level display management.
 .Pp
-Currently it does not support running X.
-It can however coexist well enough with grf0 to make possible running
-X the old way, but be warned, you cannot switch screens while
-in X and when quitting it, it seems to hang.
-Switching a screen then will bring up the text console.
+The X11 server works in monochrome mode using the
+.Xr wsfb 4
+driver.
 .Pp
 It supports foreground and background color, and the hilite (bold),
 underline, and reverse text attributes.