svn commit: r306555 - in head/sys: dev/fb sys

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sat Oct 1 18:16:24 UTC 2016


Author: gonzo
Date: Sat Oct  1 17:43:02 2016
New Revision: 306555
URL: https://svnweb.freebsd.org/changeset/base/306555

Log:
  Provide way for framebuffer driver to request mmap(2) mapping type
  
  On ARM if memattr is not overriden mmap(2) maps framebuffer
  memory as WBWA which means part of changes to content in userland
  end up in cache and appear on screen gradually as cache lines are
  evicted. This change adds configurable memattr that hardware fb
  implementation can set to get the memory mapping type it
  requires:
  
  - Add new flag FB_FLAG_MEMATTR that indicates that framebuffer
      driver overrides default memattr
  - Add new field fb_memattr to struct fb_info to specify requested
      memattr
  
  Reviewed by:	ray
  Differential Revision:	https://reviews.freebsd.org/D8064

Modified:
  head/sys/dev/fb/fbd.c
  head/sys/sys/fbio.h

Modified: head/sys/dev/fb/fbd.c
==============================================================================
--- head/sys/dev/fb/fbd.c	Sat Oct  1 11:43:37 2016	(r306554)
+++ head/sys/dev/fb/fbd.c	Sat Oct  1 17:43:02 2016	(r306555)
@@ -178,6 +178,8 @@ fb_mmap(struct cdev *dev, vm_ooffset_t o
 			*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
 		else
 			*paddr = info->fb_pbase + offset;
+		if (info->fb_flags & FB_FLAG_MEMATTR)
+			*memattr = info->fb_memattr;
 		return (0);
 	}
 	return (EINVAL);

Modified: head/sys/sys/fbio.h
==============================================================================
--- head/sys/sys/fbio.h	Sat Oct  1 11:43:37 2016	(r306554)
+++ head/sys/sys/fbio.h	Sat Oct  1 17:43:02 2016	(r306555)
@@ -142,6 +142,8 @@ struct fb_info {
 	uint32_t	fb_flags;
 #define	FB_FLAG_NOMMAP		1	/* mmap unsupported. */
 #define	FB_FLAG_NOWRITE		2	/* disable writes for the time being */
+#define	FB_FLAG_MEMATTR		4	/* override memattr for mmap */
+	vm_memattr_t	fb_memattr;
 	int		fb_stride;
 	int		fb_bpp;		/* bits per pixel */
 	uint32_t	fb_cmap[16];


More information about the svn-src-head mailing list