Skip to contentSkip to conversation

sunxi: video: Use frontend for dma on sun4i to fix memory bandwidth problems

PATCH New Hans de Goede 2 participants 3 messages Jan 19, 2015 – Jan 20, 2015

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

PATCH 1/1 sunxi: video: Use frontend for dma on sun4i to fix memory bandwidth problems

Testing has shown that on sun4i the display backend engine does not have deep enough fifo-s causing flickering / tearing in full-hd mode due to fifo underruns. On sun4i use the display frontend engine to do the dma from memory, as the frontend does have deep enough fifo-s.

As added advantage of this is that it results in much better memory bandwidth as it reduces the amount of dram bank switches, for more details see:

http://ssvb.github.io/2014/11/11/revisiting-fullhd-x11-desktop-performance-of-the-allwinner-a10.html

Note that this changes the pipeline searched for in the simplefb node, we can get away with doing this now, since no kernel has yet shipped with simplefb dtb nodes, and I will make sure to get a simplefb node with the new pipeline into 3.19 before it ships.

---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   4 +
 arch/arm/include/asm/arch-sunxi/display.h     | 116 ++++++++++++++++++++++
 drivers/video/sunxi_display.c                 | 134 +++++++++++++++++++++++++-
 3 files changed, 250 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +4 -0
index 5ebf856..05fbad3 100644
@@ -186,6 +186,7 @@ struct sunxi_ccm_reg {
 
 /* ahb clock gate bit offset (second register) */
 #define AHB_GATE_OFFSET_GMAC		17
+#define AHB_GATE_OFFSET_DE_FE0		14
 #define AHB_GATE_OFFSET_DE_BE0		12
 #define AHB_GATE_OFFSET_HDMI		11
 #define AHB_GATE_OFFSET_LCD1		5
@@ -266,7 +267,10 @@ struct sunxi_ccm_reg {
 #define CCM_MMC_CTRL_PLL5		(0x2 << 24)
 #define CCM_MMC_CTRL_ENABLE		(0x1 << 31)
 
+#define CCM_DRAM_GATE_OFFSET_DE_FE1	24 /* Note the order of FE1 and */
+#define CCM_DRAM_GATE_OFFSET_DE_FE0	25 /* FE0 is swapped ! */
 #define CCM_DRAM_GATE_OFFSET_DE_BE0	26
+#define CCM_DRAM_GATE_OFFSET_DE_BE1	27
 
 #define CCM_LCD_CH0_CTRL_PLL3		(0 << 24)
 #define CCM_LCD_CH0_CTRL_PLL7		(1 << 24)
arch/arm/include/asm/arch-sunxi/display.h +116 -0

134 lines not on this page · raw message

drivers/video/sunxi_display.c +130 -4

189 lines not on this page · raw message

Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 sunxi: video: Use frontend for dma on sun4i to fix memory bandwidth problems

Quoted 8 lines · Hans de Goede

Testing has shown that on sun4i the display backend engine does not have deep enough fifo-s causing flickering / tearing in full-hd mode due to fifo underruns. On sun4i use the display frontend engine to do the dma from memory, as the frontend does have deep enough fifo-s.

As added advantage of this is that it results in much better memory bandwidth as it reduces the amount of dram bank switches, for more details see:

Quoted 6 lines

http://ssvb.github.io/2014/11/11/revisiting-fullhd-x11-desktop-performance-of-the-allwinner-a10.html

Note that this changes the pipeline searched for in the simplefb node, we can get away with doing this now, since no kernel has yet shipped with simplefb dtb nodes, and I will make sure to get a simplefb node with the new pipeline into 3.19 before it ships.

Looks good, there was discussion around the kernel patch, looks like it has resolved in favour of the patch though?

Is it preferable to use the front or the backend (assuming sufficient fifo's etc)? IOW do we want to do this for all sun*i eventually, or only when the backend is insufficient for some reason?

Quoted 1 line

+#ifdef CONFIG_MACH_SUN4I

Perhaps another comment here, but in any case:

Quoted 4 lines
drivers/video/sunxi_display.c +4 -0
+#define PIPELINE_PREFIX "de_fe0-"
+#else
+#define PIPELINE_PREFIX
+#endif
#2 lore raw

PATCH 1/1 sunxi: video: Use frontend for dma on sun4i to fix memory bandwidth problems

Hi,

Quoted 11 lines · Ian Campbell
Quoted 10 lines · Hans de Goede

Testing has shown that on sun4i the display backend engine does not have deep enough fifo-s causing flickering / tearing in full-hd mode due to fifo underruns. On sun4i use the display frontend engine to do the dma from memory, as the frontend does have deep enough fifo-s.

As added advantage of this is that it results in much better memory bandwidth as it reduces the amount of dram bank switches, for more details see:

http://ssvb.github.io/2014/11/11/revisiting-fullhd-x11-desktop-performance-of-the-allwinner-a10.html

Quoted 7 lines
Quoted 4 lines

Note that this changes the pipeline searched for in the simplefb node, we can get away with doing this now, since no kernel has yet shipped with simplefb dtb nodes, and I will make sure to get a simplefb node with the new pipeline into 3.19 before it ships.

Looks good, there was discussion around the kernel patch, looks like it has resolved in favour of the patch though?

Correct.

Quoted 3 lines

Is it preferable to use the front or the backend (assuming sufficient fifo's etc)? IOW do we want to do this for all sun*i eventually, or only when the backend is insufficient for some reason?

It is better to use the backend usually, as we need to have the backend enabled anyways (so only using it uses less power), it supports more formats, has 4 layers, where as we only have 1 frontend, etc. But on A10 using the backend does not work well due to fifo / DRAM access issues.

Quoted 6 lines
Quoted 2 lines

+#ifdef CONFIG_MACH_SUN4I

Perhaps another comment here, but in any case:

Thanks, I've queued this one up in next.

Regards,

Hans