Module Name:    src
Committed By:   riastradh
Date:           Thu Mar 10 00:14:34 UTC 2022

Modified Files:
        src/sys/dev/pci: gffb.c

Log Message:
gffb(4): Nix membar_sync and explain what's going on here.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/gffb.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/dev/pci/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.18 src/sys/dev/pci/gffb.c:1.19
--- src/sys/dev/pci/gffb.c:1.18	Thu Mar 10 00:14:25 2022
+++ src/sys/dev/pci/gffb.c	Thu Mar 10 00:14:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $	*/
+/*	$NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Michael Lorenz
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1133,12 +1133,23 @@ gffb_putchar(void *cookie, int row, int 
 	if (rv == GC_OK)
 		return;
 
+	/*
+	 * Use gffb_sync to wait for the engine to become idle before
+	 * we start scribbling into VRAM -- we woudn't want to stomp on
+	 * a scroll in progress or a prior glyphcache_add that hasn't
+	 * completed yet on the GPU.
+	 */
 	mutex_enter(&sc->sc_lock);
 	gffb_sync(sc);
 	sc->sc_putchar(cookie, row, col, c, attr);
-	membar_sync();
 	mutex_exit(&sc->sc_lock);
 
+	/*
+	 * If glyphcache_try asked us to, cache the newly written
+	 * character.  This will issue a gffb_bitblt which will wait
+	 * for our CPU writes to the framebuffer in VRAM to complete
+	 * before triggering GPU reads from the framebuffer in VRAM.
+	 */
 	if (rv == GC_ADD) {
 		glyphcache_add(&sc->sc_gc, c, x, y);
 	}

Reply via email to