Skip to contentSkip to conversation

PXA fb overlay support (RESUBMIT 2).

PATCH In review Rodolfo Giometti 3 participants 5 messages Sep 13, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

This patch set implements the port of the old pxafb overlay support for 2.6.22 to the latest kernel version.

It also adds the mmap() methods and fixes up an issue related to the consistent memory allocation error which causes a segfault during mmap().

Rodolfo

#1 lore raw

PATCH 1/2 pxafb: frame buffer overlay support for PXA27x.

From: Rodolfo Giometti <[email protected]>

---
 arch/arm/mach-pxa/include/mach/regs-lcd.h |   39 +
 drivers/video/Kconfig                     |    6 +
 drivers/video/Makefile                    |    1 +
 drivers/video/pxafb.c                     |   75 ++-
 drivers/video/pxafb.h                     |   74 ++
 drivers/video/pxafb_overlay.c             | 1476 +++++++++++++++++++++++++++++
 6 files changed, 1654 insertions(+), 17 deletions(-)
 create mode 100644 drivers/video/pxafb_overlay.c
arch/arm/mach-pxa/include/mach/regs-lcd.h +39 -0
index c689c4e..7439bfb 100644
@@ -14,10 +14,21 @@
 #define LCCR5		(0x014)	/* LCD Controller Control Register 5 */
 #define DFBR0		(0x020)	/* DMA Channel 0 Frame Branch Register */
 #define DFBR1		(0x024)	/* DMA Channel 1 Frame Branch Register */
+#define DFBR2		(0x028)	/* DMA Channel 2 Frame Branch Register */
+#define DFBR3		(0x02C)	/* DMA Channel 3 Frame Branch Register */
+#define DFBR4		(0x030)	/* DMA Channel 4 Frame Branch Register */
+#define DFBR5		(0x110)	/* DMA Channel 5 Frame Branch Register */
+#define DFBR6		(0x114)	/* DMA Channel 6 Frame Branch Register */
+#define LCSR1		(0x034)	/* LCD Controller Status Register 1 */
 #define LCSR		(0x038)	/* LCD Controller Status Register */
 #define LIIDR		(0x03C)	/* LCD Controller Interrupt ID Register */
 #define TMEDRGBR	(0x040)	/* TMED RGB Seed Register */
 #define TMEDCR		(0x044)	/* TMED Control Register */
+#define OVL1C1		(0x050)	/* Overlay 1 Control Register 1 */
+#define OVL1C2		(0x060)	/* Overlay 1 Control Register 2 */
+#define OVL2C1		(0x070)	/* Overlay 2 Control Register 1 */
+#define OVL2C2		(0x080)	/* Overlay 2 Control Register 2 */
+#define CCR		(0x090)	/* Cursor Control Register */
 
 #define CMDCR		(0x100)	/* Command Control Register */
 #define PRSR		(0x104)	/* Panel Read Status Register */
@@ -52,6 +63,21 @@
 #define FSADR1		(0x214)	/* DMA Channel 1 Frame Source Address Register */
 #define FIDR1		(0x218)	/* DMA Channel 1 Frame ID Register */
 #define LDCMD1		(0x21C)	/* DMA Channel 1 Command Register */
+#define FDADR2		(0x220)	/* DMA Channel 2 Frame Descriptor Address Register */
+#define FSADR2		(0x224)	/* DMA Channel 2 Frame Source Address Register */
+#define FIDR2		(0x228)	/* DMA Channel 2 Frame ID Register */
+#define FDADR3		(0x230)	/* DMA Channel 3 Frame Descriptor Address Register */
+#define FSADR3		(0x234)	/* DMA Channel 3 Frame Source Address Register */
+#define FIDR3		(0x238)	/* DMA Channel 3 Frame ID Register */
+#define LDCMD3		(0x23C)	/* DMA Channel 3 Command Register */
+#define FDADR4		(0x240)	/* DMA Channel 4 Frame Descriptor Address Register */
+#define FSADR4		(0x244)	/* DMA Channel 4 Frame Source Address Register */
+#define FIDR4		(0x248)	/* DMA Channel 4 Frame ID Register */
+#define LDCMD4		(0x24C)	/* DMA Channel 4 Command Register */
+#define FDADR5		(0x250)	/* DMA Channel 5 Frame Descriptor Address Register */
+#define FSADR5		(0x254)	/* DMA Channel 5 Frame Source Address Register */
+#define FIDR5		(0x258)	/* DMA Channel 5 Frame ID Register */
+#define LDCMD5		(0x25C)	/* DMA Channel 5 Command Register */
 #define FDADR6		(0x260) /* DMA Channel 6 Frame Descriptor Address Register */
 #define FSADR6		(0x264) /* DMA Channel 6 Frame Source Address Register */
 #define FIDR6		(0x268) /* DMA Channel 6 Frame ID Register */
@@ -143,6 +169,10 @@
 #define LCCR5_EOFM(x)	(1 << ((x) + 7))  /* end of frame mask */
 #define LCCR5_SOFM(x)	(1 << ((x) + 0))  /* start of frame mask */
 
+#define OVL1C1_O1EN	(1 << 31)	/* Enable bit for Overlay 1 */
+#define OVL2C1_O2EN	(1 << 31)	/* Enable bit for Overlay 2 */
+#define CCR_CEN		(1 << 31)	/* Enable bit for Cursor */
+
 #define LCSR_LDD	(1 << 0)	/* LCD Disable Done */
 #define LCSR_SOF	(1 << 1)	/* Start of frame */
 #define LCSR_BER	(1 << 2)	/* Bus error */
@@ -159,6 +189,15 @@
 
 #define LDCMD_PAL	(1 << 26)	/* instructs DMA to load palette buffer */
 
+/* Overlay1 & Overlay2 & Hardware Cursor */
+#define LCSR1_SOF(x)	(1 << ((x) + 0))  /* start of frame */
+#define LCSR1_EOF(x)	(1 << ((x) + 7))  /* end of frame */
+#define LCSR1_BS(x)	(1 << ((x) + 15)) /* branch status */
+#define LCSR1_IU(x)	(1 << ((x) + 23)) /* input FIFO underrun */
+
+#define LDCMD_SOFINT	(1 << 22)
+#define LDCMD_EOFINT	(1 << 21)
+
 /* smartpanel related */
 #define PRSR_DATA(x)	((x) & 0xff)	/* Panel Data */
 #define PRSR_A0		(1 << 8)	/* Read Data Source */
drivers/video/Kconfig +6 -0
index 70d135e..5d5c8c8 100644
@@ -1802,6 +1802,12 @@ config FB_PXA_SMARTPANEL
 	default n
 	depends on FB_PXA
 
+config FB_PXA_OVERLAY
+	bool "PXA LCD overlay support"
+	depends on FB_PXA && PXA27x
+	---help---
+	  Frame buffer overlay driver for PXA27x
+
 config FB_PXA_PARAMETERS
 	bool "PXA LCD command line parameters"
 	default n
drivers/video/Makefile +1 -0
index a6b5529..4968776 100644
@@ -97,6 +97,7 @@ obj-$(CONFIG_FB_GBE)              += gbefb.o
 obj-$(CONFIG_FB_CIRRUS)		  += cirrusfb.o
 obj-$(CONFIG_FB_ASILIANT)	  += asiliantfb.o
 obj-$(CONFIG_FB_PXA)		  += pxafb.o
+obj-$(CONFIG_FB_PXA_OVERLAY)	  += pxafb_overlay.o
 obj-$(CONFIG_FB_W100)		  += w100fb.o
 obj-$(CONFIG_FB_AU1100)		  += au1100fb.o
 obj-$(CONFIG_FB_AU1200)		  += au1200fb.o
drivers/video/pxafb.c +58 -17

158 lines not on this page · raw message

drivers/video/pxafb.h +74 -0

96 lines not on this page · raw message

drivers/video/pxafb_overlay.c new file +1476 -0

1,476 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#2 lore raw

PATCH 2/2 PXA: add configurable consistent memory DMA size.

From: Rodolfo Giometti <[email protected]>

---
 arch/arm/mach-pxa/include/mach/memory.h |   13 +++++++++++++
 drivers/video/Kconfig                   |   11 +++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/include/mach/memory.h +13 -0
index 552eb7f..247c2ef 100644
@@ -49,4 +49,17 @@ void cmx270_pci_adjust_zones(int node, unsigned long *size,
 #define ISA_DMA_THRESHOLD	(PHYS_OFFSET + SZ_64M - 1)
 #endif
 
+/* Override the ARM default */
+#ifdef CONFIG_FB_PXA_CONSISTENT_DMA_SIZE
+
+#if (CONFIG_FB_PXA_CONSISTENT_DMA_SIZE == 0)
+#undef CONFIG_FB_PXA_CONSISTENT_DMA_SIZE
+#define CONFIG_FB_PXA_CONSISTENT_DMA_SIZE 2
+#endif
+
+#define CONSISTENT_DMA_SIZE \
+	(((CONFIG_FB_PXA_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
+
+#endif
+
 #endif
drivers/video/Kconfig +11 -0
index 5d5c8c8..6720d78 100644
@@ -1808,6 +1808,17 @@ config FB_PXA_OVERLAY
 	---help---
 	  Frame buffer overlay driver for PXA27x
 
+config FB_PXA_CONSISTENT_DMA_SIZE
+	int "Consistent DMA memory size (MB)"
+	depends on FB_PXA
+	range 1 14
+	default 2
+	help
+	  Increase the DMA consistent memory size according to your video
+	  memory needs, for example if you want to use overlay support.
+	  The size must be 2MB aligned.
+	  If unsure say 2.
+
 config FB_PXA_PARAMETERS
 	bool "PXA LCD command line parameters"
 	default n
Signature · 1 line
1.5.4.3
#3 lore raw

Re: [PATCH 1/2] pxafb: frame buffer overlay support for PXA27x.

In reply to Rodolfo Giometti

Please cc [email protected] on fbdev patches.

Quoted 4 lines · On Wed, 10 Sep 2008 10:07:35 +0200 Rodolfo Giometti <[email protected]>…

From: Rodolfo Giometti <[email protected]>

Quoted 8 lines
 arch/arm/mach-pxa/include/mach/regs-lcd.h |   39 +
 drivers/video/Kconfig                     |    6 +
 drivers/video/Makefile                    |    1 +
 drivers/video/pxafb.c                     |   75 ++-
 drivers/video/pxafb.h                     |   74 ++
 drivers/video/pxafb_overlay.c             | 1476 +++++++++++++++++++++++++++++
 6 files changed, 1654 insertions(+), 17 deletions(-)
 create mode 100644 drivers/video/pxafb_overlay.c

Over a thousand lines of code and zero changelog? No indication what the driver does, what hardware is it for, nothing needs to be communicated about the implementation, no todo items, no shortcomings? Really?

The code looks generally OK to my untrained eye. A few things:

drivers/video/pxafb.h struct pxafb_dma_buff { · line 66

Quoted 6 lines

...

drivers/video/pxafb.h +3 -0
+#ifdef CONFIG_FB_PXA_OVERLAY
+struct overlayfb_info
+{

Please run scripts/checkpatch.pl across all patches, no exceptions, and review the result.

drivers/video/pxafb.h struct pxafb_dma_buff { · line 109

Quoted 6 lines

...

drivers/video/pxafb.h +3 -0
+#define o1_to_basefb(d)		container_of(d, struct pxafb_info, overlay1fb)
+#define o2_to_basefb(d)		container_of(d, struct pxafb_info, overlay2fb)
+#define cu_to_basefb(d)		container_of(d, struct pxafb_info, cursorfb)

Please convert to typesafe C functions. And use them.

drivers/video/pxafb_overlay.c line 114

Quoted 6 lines

...

drivers/video/pxafb_overlay.c new file +3 -0
+#define CLEAR_LCD_INTR(reg, intr) do {  \
+	reg = (intr);			\
+} while (0)

This fortunately has no callers.

Quoted 4 lines
drivers/video/pxafb_overlay.c new file +4 -0
+#define WAIT_FOR_LCD_INTR(bfi, reg, intr, timeout) ({		\
+	int __done = 0;						\
+	int __t = timeout;					\
+	while (__t) {						\

drivers/video/pxafb_overlay.c line 129

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +10 -0
+		__done = lcd_readl(bfi, reg) & (intr);		\
+		if (__done)					\
+			break;					\
+		mdelay(10);					\
+		__t--;						\
+	}							\
+	if (!__t)						\
+		dev_info(bfi->dev, "wait " #intr " timeount");	\
+	__done;							\
+})

afacit this can be implemented as a C function. That would be vastly preferable.

Quoted 37 lines
drivers/video/pxafb_overlay.c new file +37 -0
+#define DISABLE_OVERLAYS(fbi) do {	 				\
+	if (fbi->overlay1fb.state == C_ENABLE)				\
+		overlay1fb_disable((struct fb_info *) &fbi->overlay1fb);\
+	if (fbi->overlay2fb.state == C_ENABLE)				\
+		overlay2fb_disable((struct fb_info *) &fbi->overlay2fb);\
+	if (fbi->cursorfb.state == C_ENABLE)				\
+		cursorfb_disable((struct fb_info *) &fbi->cursorfb);	\
+} while (0)
+
+#define ENABLE_OVERLAYS(fbi) do {					\
+	if (fbi->overlay1fb.state == C_DISABLE)				\
+		overlay1fb_enable((struct fb_info *) &fbi->overlay1fb);	\
+	if (fbi->overlay2fb.state == C_DISABLE)				\
+		overlay2fb_enable((struct fb_info *) &fbi->overlay2fb);	\
+	if (fbi->cursorfb.state == C_DISABLE)				\
+		cursorfb_enable((struct fb_info *) &fbi->cursorfb);	\
+} while (0)
+
+#define BLANK_OVERLAYS(fbi) do {	 				\
+	if (fbi->overlay1fb.state == C_ENABLE) {			\
+		overlay1fb_disable((struct fb_info *) &fbi->overlay1fb);\
+		fbi->overlay1fb.state = C_BLANK;			\
+	}								\
+	if (fbi->overlay2fb.state == C_ENABLE) {			\
+		overlay2fb_disable((struct fb_info *) &fbi->overlay2fb);\
+		fbi->overlay2fb.state = C_BLANK;			\
+	}								\
+	if (fbi->cursorfb.state == C_ENABLE) {				\
+		cursorfb_disable((struct fb_info *) &fbi->cursorfb);	\
+		fbi->cursorfb.state = C_BLANK;				\
+	}								\
+} while (0)
+
+#define UNBLANK_OVERLAYS(fbi) do {					\
+	if (fbi->overlay1fb.state == C_BLANK) {				\
+		overlay1fb_enable((struct fb_info *) &fbi->overlay1fb);	\
+		fbi->overlay1fb.state = C_ENABLE;			\

drivers/video/pxafb_overlay.c line 177

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +10 -0
+	}								\
+	if (fbi->overlay2fb.state == C_BLANK) {				\
+		overlay2fb_enable((struct fb_info *) &fbi->overlay2fb);	\
+		fbi->overlay2fb.state = C_ENABLE;			\
+	}								\
+	if (fbi->cursorfb.state == C_BLANK) {				\
+		cursorfb_enable((struct fb_info *) &fbi->cursorfb);	\
+		fbi->cursorfb.state = C_ENABLE;				\
+	}								\
+} while (0)

Please switch to C functions.

Please remove all the casts and use container_of(), or helper functions which use container_of().

drivers/video/pxafb_overlay.c line 181

Quoted 3 lines
drivers/video/pxafb_overlay.c new file +3 -0
+static int overlay1fb_open(struct fb_info *info, int user)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;

Remove all instances of the above cast and use container_of(), or the typesafe C-coded helper function which uses container_of().

drivers/video/pxafb_overlay.c line 192

Quoted 11 lines
drivers/video/pxafb_overlay.c new file +11 -0
+	int ret = 0;
+
+	if (!atomic_dec_and_test(&fbi->refcount)) {
+		atomic_inc(&fbi->refcount);
+		return -EACCES;
+	}
+
+	/* If basefb is disable, enable fb */
+	if (o1_to_basefb(fbi)->state != C_ENABLE)
+		o1_to_basefb(fbi)->fb.fbops->fb_blank(VESA_NO_BLANKING,
+				(struct fb_info *) o1_to_basefb(fbi));

container_of().

Quoted 35 lines
drivers/video/pxafb_overlay.c new file +32 -0
+	/* Initialize the variables in overlay1 framebuffer */
+	fbi->fb.var.xres = fbi->fb.var.yres = 0;
+	fbi->fb.var.bits_per_pixel = 0;
+
+	return ret;
+}
+
 
...
 
+static int overlay1fb_map_video_memory(struct fb_info *info)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;
+
+	if (fbi->map_cpu)
+		dma_free_writecombine(o1_to_basefb(fbi)->dev, fbi->map_size,
+					(void *) fbi->map_cpu, fbi->map_dma);
+	fbi->video_offset = PAGE_ALIGN(sizeof(struct pxafb_dma_descriptor));
+	fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + fbi->video_offset);
+	fbi->map_cpu = dma_alloc_writecombine(o1_to_basefb(fbi)->dev,
+						fbi->map_size, &fbi->map_dma,
+						GFP_KERNEL);
+	if (!fbi->map_cpu)
+		return -ENOMEM;
+
+	/* Prevent initial garbage on screen */
+	memset(fbi->map_cpu, 0, fbi->map_size);
+	fbi->fb.screen_base = fbi->map_cpu + fbi->video_offset;
+	fbi->screen_cpu = fbi->map_cpu + fbi->video_offset;
+	fbi->screen_dma = fbi->map_dma + fbi->video_offset;
+
+	fbi->fb.fix.smem_start = fbi->screen_dma;
+
+	/* Setup dma descriptor */
+	fbi->dma1 = (struct pxafb_dma_descriptor *)

drivers/video/pxafb_overlay.c line 247

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +10 -0
+		(fbi->screen_cpu - sizeof(struct pxafb_dma_descriptor));
+
+	fbi->dma1->fdadr = (fbi->screen_dma -
+				sizeof(struct pxafb_dma_descriptor));
+	fbi->dma1->fsadr = fbi->screen_dma;
+	fbi->dma1->fidr  = 0;
+	fbi->dma1->ldcmd = fbi->fb.fix.smem_len;
+
+	return 0;
+}

The above code is implicitly implementing some memory layout which I assume is defined by the hardware.

Where would someone go to find out about that layout? Some documentation reference or a description in a comment would add maintainability and understandability.

drivers/video/pxafb_overlay.c line 254

Quoted 6 lines
drivers/video/pxafb_overlay.c new file +6 -0
+static int overlay1fb_enable(struct fb_info *info)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;
+
+	unsigned long bpp1;
+	unsigned int lccr5;

Avoid random newline between local definitions, please.

Quoted 53 lines
drivers/video/pxafb_overlay.c new file +50 -0
+	if (!fbi->map_cpu)
+		return -EINVAL;
+
+	switch (fbi->fb.var.bits_per_pixel) {
+	case 16:
+		bpp1 = 0x4;
+		break;
+	case 18:
+		bpp1 = 0x6;
+		break;
+	case 19:
+		bpp1 = 0x8;
+		break;
+	case 24:
+		bpp1 = 0x9;
+		break;
+	case 25:
+		bpp1 = 0xa;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* Disable branch/start/end of frame interrupt */
+	lccr5 = lcd_readl(o1_to_basefb(fbi), LCCR5);
+	lcd_writel(o1_to_basefb(fbi), LCCR5,
+				lccr5 | LCCR5_IUM(1) | LCCR5_BSM(1)
+					| LCCR5_EOFM(1) | LCCR5_SOFM(1));
+
+	if (fbi->state == C_DISABLE || fbi->state == C_BLANK)
+		lcd_writel(o1_to_basefb(fbi), FDADR1, fbi->dma1->fdadr);
+	else
+		lcd_writel(o1_to_basefb(fbi), DFBR1, fbi->dma1->fdadr | 0x1);
+
+	/* Enable overlay 1 window */
+	lcd_writel(o1_to_basefb(fbi), OVL1C2,
+				(fbi->ypos << 10) | fbi->xpos);;
+	lcd_writel(o1_to_basefb(fbi), OVL1C1,
+				OVL1C1_O1EN | (bpp1 << 20) |
+				((fbi->fb.var.yres-1)<<10) |
+				(fbi->fb.var.xres-1));
+
+	fbi->state = C_ENABLE;
+
+	return 0;
+}
+
 
...
 
+static int overlay1fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;

drivers/video/pxafb_overlay.c line 376

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +9 -0
+	unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
 
+	if (off < info->fix.smem_len) {
+		vma->vm_pgoff += fbi->video_offset / PAGE_SIZE;
+		return dma_mmap_writecombine(o1_to_basefb(fbi)->dev, vma,
+					     fbi->map_cpu, fbi->map_dma,
+					     fbi->map_size);
+	}
+	return -EINVAL;
+}

No need to set VM_IO or VM_RESERVED, etc?

Quoted 7 lines

...

drivers/video/pxafb_overlay.c new file +4 -0
+/*
+ * LCD enhancement : Overlay 2
+ *
+ * Features:

drivers/video/pxafb_overlay.c line 528

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +10 -0
+ * - support planar YCbCr420/YCbCr422/YCbCr444;
+ */
+static int overlay2fb_open(struct fb_info *info, int user)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;
+
+	if (!atomic_dec_and_test(&fbi->refcount)) {
+		atomic_inc(&fbi->refcount);
+		return -EACCES;
+	}

Now what's happening here.

- Please add a comment demystifying this. It looks fishy.

- It surely is racy

- It would be non-racy were it to use atomic_dec_not_zero(), but I suspect we're just covering up bugs here.

Quoted 8 lines
drivers/video/pxafb_overlay.c new file +8 -0
+	/* If basefb is disable, enable fb */
+	if (o2_to_basefb(fbi)->state != C_ENABLE)
+		o2_to_basefb(fbi)->fb.fbops->fb_blank(VESA_NO_BLANKING,
+				(struct fb_info *) o2_to_basefb(fbi));
+
+	fbi->fb.var.xres = fbi->fb.var.yres = 0;
+
+	return 0;

drivers/video/pxafb_overlay.c line 547

Quoted 10 lines
drivers/video/pxafb_overlay.c new file +10 -0
+}
+
+static int overlay2fb_release(struct fb_info *info, int user)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;
+
+	/* Disable overlay when released */
+	overlay2fb_blank(1, info);
+
+	atomic_inc(&fbi->refcount);

Strange to see a refcount _increase_ in a ->release handler!

drivers/video/pxafb_overlay.c

Quoted 6 lines
drivers/video/pxafb_overlay.c new file +3 -0
+	return 0;
+}
+
 
...

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

#4 lore raw

Re: [PATCH 1/2] pxafb: frame buffer overlay support for PXA27x.

Quoted 5 lines · Andrew Morton
Quoted 5 lines
drivers/video/pxafb_overlay.c new file +4 -0
+static int overlay1fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+	struct overlayfb_info *fbi = (struct overlayfb_info *) info;
+	unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
Quoted 10 lines

drivers/video/pxafb_overlay.c line 500

Quoted 8 lines
drivers/video/pxafb_overlay.c new file +8 -0
+	if (off < info->fix.smem_len) {
+		vma->vm_pgoff += fbi->video_offset / PAGE_SIZE;
+		return dma_mmap_writecombine(o1_to_basefb(fbi)->dev, vma,
+					     fbi->map_cpu, fbi->map_dma,
+					     fbi->map_size);
+	}
+	return -EINVAL;
+}

No need to set VM_IO or VM_RESERVED, etc?

That's covered by dma_mmap_writecombine -> remap_pfn_range:

        vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;