Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys



On 2019/07/24 2:13, Jason Thorpe wrote:
Also, didn't Jared make a change to the Allwinner u-boot configs that ensure the frame buffer is page-aligned?  Should we make that change everywhere?

For tifb, color-palette register is page-aligned, and framebuffer
follows it. Therefore, framebuffer cannot be aligned (I think).

On 2019/07/24 2:07, Jason Thorpe wrote:
Since fundamental memory allocation is done on page boundaries, would it suffice to simply ensure that the "leaked" memory is zero'd out first?  I mean, nothing else can use it for anything meaninful...

Something like this?

----
Index: tifb.c
===================================================================
RCS file: /home/netbsd/src/sys/arch/arm/omap/tifb.c,v
retrieving revision 1.8
diff -p -u -r1.8 tifb.c
--- tifb.c	23 Jul 2019 14:34:11 -0000	1.8
+++ tifb.c	23 Jul 2019 17:26:21 -0000
@@ -357,6 +357,13 @@ tifb_attach(device_t parent, device_t se
 		aprint_error_dev(sc->sc_dev, "failed to map video RAM\n");
 		return;
 	}
+
+	/*
+	 * bus_dmamem_{alloc,map} allocates/maps memory rounded up in
+	 * pagesize. Clear it before expose to userland via mmap.
+	 */
+	memset(sc->sc_vramaddr, 0, round_page(sc->sc_vramsize));
+
 	sc->sc_fbaddr = (uint8_t *)sc->sc_vramaddr + sc->sc_palettesize;
 	sc->sc_palette = sc->sc_vramaddr;
@@ -372,7 +379,7 @@ tifb_attach(device_t parent, device_t se
 		return;
 	}
- memset((void *)sc->sc_vramaddr, 0, sc->sc_vramsize);
+	memset(sc->sc_vramaddr, 0, sc->sc_vramsize);
 	switch (sc->sc_pi->panel_bpp) {
 	case 8:
 		j = 0;

----

Thanks,
rin


Home | Main Index | Thread Index | Old Index