PXA3xx 2D graphics accelerator
Hi Eric,
Here's a rebased driver for the PXA3xx 2D graphics accelerator unit which acts as backend for the DirectFB userspace library. All the magic is in userspace, the driver is kept as simple as possible.
It's been awhile since I last proposed taking this code mainline, and in the meantime, the DirectFB people further improved the userspace driver part and fixed some bugs which I suspected to be problems related to this kernel driver. It's all good now, and the thing is ready for production use.
The only concern is that the API this driver implements is proprietary. But given that there is currently no better, more generic way, I think we can re-address this later. It would be fine to change the API at a later point as long as we keep the old interface around in userspace for backward compatibility.
If anyone happens to have a system based on these SoCs with a display attached, please give it a try :)
Daniel
[PATCH 1/2] video: add driver for PXA3xx 2D graphics accelerator [PATCH 2/2] ARM: pxa/raumfeld: enable PXA3XX_GCU driver
PATCH 1/2 video: add driver for PXA3xx 2D graphics accelerator
From: Daniel Mack <[email protected]>
This adds a driver for the the 2D graphics accelerator found on PXA3xx processors. Only resource mapping, interrupt handling and a simple ioctl handler is done by the kernel part, the rest of the logic is implemented in DirectFB userspace.
Graphic applications greatly benefit for line drawing, blend, and rectangle and triangle filling operations.
Benchmarks done on a PXA303 using the df_dok benchmarking tool follow, where the value in square brackets show the CPU usage during that test.
Without accelerator (benchmarking 256x252 on 480x262 RGB16 (16bit)):
Anti-aliased Text 3.016 secs ( 65.649 KChars/sec) [ 99.6%] Fill Rectangle 3.021 secs ( 175.107 MPixel/sec) [ 98.0%] Fill Rectangle (blend) 3.582 secs ( 3.602 MPixel/sec) [ 99.7%] Fill Rectangles [10] 3.177 secs ( 182.753 MPixel/sec) [ 98.1%] Fill Rectangles [10] (blend) 18.020 secs ( 3.580 MPixel/sec) [ 98.7%] Fill Spans 3.019 secs ( 145.306 MPixel/sec) [ 98.0%] Fill Spans (blend) 3.616 secs ( 3.568 MPixel/sec) [ 99.4%] Blit 3.074 secs ( 39.874 MPixel/sec) [ 98.0%] Blit 180 3.020 secs ( 32.042 MPixel/sec) [ 98.0%] Blit with format conversion 3.005 secs ( 19.321 MPixel/sec) [ 99.6%] Blit from 32bit (blend) 4.792 secs ( 2.692 MPixel/sec) [ 98.7%]
With accelerator:
Anti-aliased Text 3.056 secs (* 36.518 KChars/sec) [ 21.3%] Fill Rectangle 3.015 secs (* 115.543 MPixel/sec) [ 8.9%] Fill Rectangle (blend) 3.180 secs (* 20.286 MPixel/sec) [ 1.8%] Fill Rectangles [10] 3.251 secs (* 119.062 MPixel/sec) [ 1.2%] Fill Rectangles [10] (blend) 6.293 secs (* 20.502 MPixel/sec) [ 0.3%] Fill Spans 3.051 secs (* 97.264 MPixel/sec) [ 35.7%] Fill Spans (blend) 3.377 secs (* 15.282 MPixel/sec) [ 17.8%] Blit 3.046 secs (* 27.533 MPixel/sec) [ 2.6%] Blit 180 3.098 secs (* 27.070 MPixel/sec) [ 2.2%] Blit with format conversion 3.131 secs (* 39.148 MPixel/sec) [ 2.8%] Blit from 32bit (blend) 3.346 secs (* 11.568 MPixel/sec) [ 0.8%]
--- drivers/video/Kconfig | 10 + drivers/video/Makefile | 1 + drivers/video/pxa3xx-gcu.c | 772 ++++++++++++++++++++++++++++++++++++++++++++ drivers/video/pxa3xx-gcu.h | 38 +++ 4 files changed, 821 insertions(+), 0 deletions(-) create mode 100644 drivers/video/pxa3xx-gcu.c create mode 100644 drivers/video/pxa3xx-gcu.h
drivers/video/Kconfig +10 -0
@@ -1848,6 +1848,16 @@ config FB_PXA_PARAMETERS <file:Documentation/fb/pxafb.txt> describes the available parameters. +config PXA3XX_GCU + tristate "PXA3xx 2D graphics accelerator driver" + depends on FB_PXA + help + Kernelspace driver for the 2D graphics controller unit (GCU) + found on PXA3xx processors. There is a counterpart driver in the + DirectFB suite, see http://www.directfb.org/ + + If you compile this as a module, it will be called pxa3xx_gcu. + config FB_MBX tristate "2700G LCD framebuffer support" depends on FB && ARCH_PXA
drivers/video/Makefile +1 -0
@@ -100,6 +100,7 @@ obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o obj-$(CONFIG_FB_PXA) += pxafb.o obj-$(CONFIG_FB_PXA168) += pxa168fb.o +obj-$(CONFIG_PXA3XX_GCU) += pxa3xx-gcu.o obj-$(CONFIG_FB_W100) += w100fb.o obj-$(CONFIG_FB_TMIO) += tmiofb.o obj-$(CONFIG_FB_AU1100) += au1100fb.o
drivers/video/pxa3xx-gcu.c new file +772 -0
772 lines not on this page · raw message
drivers/video/pxa3xx-gcu.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __PXA3XX_GCU_H__ +#define __PXA3XX_GCU_H__ + +#include <linux/types.h> + +/* Number of 32bit words in display list (ring buffer). */ +#define PXA3XX_GCU_BUFFER_WORDS ((256 * 1024 - 256) / 4) + +/* To be increased when breaking the ABI */ +#define PXA3XX_GCU_SHARED_MAGIC 0x30000001 + +#define PXA3XX_GCU_BATCH_WORDS 8192 + +struct pxa3xx_gcu_shared { +u32 buffer[PXA3XX_GCU_BUFFER_WORDS ]; + +bool hw_running; + +unsigned long buffer_phys; + +unsigned int num_words; +unsigned int num_writes; +unsigned int num_done; +unsigned int num_interrupts; +unsigned int num_wait_idle; +unsigned int num_wait_free; +unsigned int num_idle; + +u32 magic; +}; + +/* Initialization and synchronization. +* Hardware is started upon write(). */ +#define PXA3XX_GCU_IOCTL_RESET _IO('G', 0) +#define PXA3XX_GCU_IOCTL_WAIT_IDLE _IO('G', 2) + +#endif /* __PXA3XX_GCU_H__ */ +
Signature · 1 line
1.7.1
PATCH 2/2 ARM: pxa/raumfeld: enable PXA3XX_GCU driver
In reply to Daniel MackFrom: Daniel Mack <[email protected]>
--- arch/arm/mach-pxa/raumfeld.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/raumfeld.c +5 -0
@@ -588,6 +588,9 @@ static struct pxafb_mach_info raumfeld_sharp_lcd_info = { .num_modes = 1, .video_mem_size = 0x400000, .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, +#ifdef CONFIG_PXA3XX_GCU + .acceleration_enabled = 1, +#endif };static void __init raumfeld_lcd_init (void )
@@ -616,6 +619,8 @@ static void __init raumfeld_lcd_init(void)pr_warning ("Unable to request GPIO_DISPLAY_ENABLE\n" ); else gpio_direction_output(GPIO_DISPLAY_ENABLE, 1); + +platform_device_register (&pxa3xx_device_gcu); }/**
Signature · 1 line
1.7.1
Quoted 9 lines · Daniel Mack
Here's a rebased driver for the PXA3xx 2D graphics accelerator unit which acts as backend for the DirectFB userspace library. All the magic is in userspace, the driver is kept as simple as possible.
It's been awhile since I last proposed taking this code mainline, and in the meantime, the DirectFB people further improved the userspace driver part and fixed some bugs which I suspected to be problems related to this kernel driver. It's all good now, and the thing is ready for production use.
I should probably add that the fixes that were needed in DirectFB are all in DirectFB 1.4.10, which was released yesterday.
Sven
Eric Miao
AppliedPATCH 1/2 video: add driver for PXA3xx 2D graphics accelerator
In reply to Daniel MackQuoted 41 lines · Daniel Mack
From: Daniel Mack <[email protected]>
This adds a driver for the the 2D graphics accelerator found on PXA3xx processors. Only resource mapping, interrupt handling and a simple ioctl handler is done by the kernel part, the rest of the logic is implemented in DirectFB userspace.
Graphic applications greatly benefit for line drawing, blend, and rectangle and triangle filling operations.
Benchmarks done on a PXA303 using the
df_dokbenchmarking tool follow, where the value in square brackets show the CPU usage during that test.Without accelerator (benchmarking 256x252 on 480x262 RGB16 (16bit)):
?Anti-aliased Text ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?3.016 secs ( ? 65.649 KChars/sec) [ 99.6%] ?Fill Rectangle ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.021 secs ( ?175.107 MPixel/sec) [ 98.0%] ?Fill Rectangle (blend) ? ? ? ? ? ? ? ? ? ? ? ? 3.582 secs ( ? ?3.602 MPixel/sec) [ 99.7%] ?Fill Rectangles [10] ? ? ? ? ? ? ? ? ? ? ? ? ? 3.177 secs ( ?182.753 MPixel/sec) [ 98.1%] ?Fill Rectangles [10] (blend) ? ? ? ? ? ? ? ? ?18.020 secs ( ? ?3.580 MPixel/sec) [ 98.7%] ?Fill Spans ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.019 secs ( ?145.306 MPixel/sec) [ 98.0%] ?Fill Spans (blend) ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.616 secs ( ? ?3.568 MPixel/sec) [ 99.4%] ?Blit ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.074 secs ( ? 39.874 MPixel/sec) [ 98.0%] ?Blit 180 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.020 secs ( ? 32.042 MPixel/sec) [ 98.0%] ?Blit with format conversion ? ? ? ? ? ? ? ? ? ?3.005 secs ( ? 19.321 MPixel/sec) [ 99.6%] ?Blit from 32bit (blend) ? ? ? ? ? ? ? ? ? ? ? ?4.792 secs ( ? ?2.692 MPixel/sec) [ 98.7%]
With accelerator:
?Anti-aliased Text ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?3.056 secs (* ?36.518 KChars/sec) [ 21.3%] ?Fill Rectangle ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.015 secs (* 115.543 MPixel/sec) [ ?8.9%] ?Fill Rectangle (blend) ? ? ? ? ? ? ? ? ? ? ? ? 3.180 secs (* ?20.286 MPixel/sec) [ ?1.8%] ?Fill Rectangles [10] ? ? ? ? ? ? ? ? ? ? ? ? ? 3.251 secs (* 119.062 MPixel/sec) [ ?1.2%] ?Fill Rectangles [10] (blend) ? ? ? ? ? ? ? ? ? 6.293 secs (* ?20.502 MPixel/sec) [ ?0.3%] ?Fill Spans ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.051 secs (* ?97.264 MPixel/sec) [ 35.7%] ?Fill Spans (blend) ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.377 secs (* ?15.282 MPixel/sec) [ 17.8%] ?Blit ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.046 secs (* ?27.533 MPixel/sec) [ ?2.6%] ?Blit 180 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3.098 secs (* ?27.070 MPixel/sec) [ ?2.2%] ?Blit with format conversion ? ? ? ? ? ? ? ? ? ?3.131 secs (* ?39.148 MPixel/sec) [ ?2.8%] ?Blit from 32bit (blend) ? ? ? ? ? ? ? ? ? ? ? ?3.346 secs (* ?11.568 MPixel/sec) [ ?0.8%]
Quoted 2 lines
Signed-off-by Daniel Mack <[email protected]>Tested-by Sven Neumann <[email protected]>
This has been around for too much time, and thanks Daniel and Sven for the great work. It looks good to me and it's time to get this in.
Applied.
PATCH 2/2 ARM: pxa/raumfeld: enable PXA3XX_GCU driver
In reply to Daniel MackQuoted 2 lines · Daniel Mack
From: Daniel Mack <[email protected]>
Applied with your SOB.
Quoted 31 lines
---
?arch/arm/mach-pxa/raumfeld.c | ? ?5 +++++
?1 files changed, 5 insertions(+), 0 deletions(-)arch/arm/mach-pxa/raumfeld.c +3
-0@@ -588,6 +588,9 @@ static struct pxafb_mach_info raumfeld_sharp_lcd_info = { ? ? ? ?.num_modes ? ? ?= 1, ? ? ? ?.video_mem_size = 0x400000, ? ? ? ?.lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, +#ifdef CONFIG_PXA3XX_GCU + ? ? ? .acceleration_enabled = 1, +#endif ?}; ?static void __init raumfeld_lcd_init(void)@@ -616,6 +619,8 @@ static void __init raumfeld_lcd_init(void) ? ? ? ? ? ? ? ?pr_warning("Unable to request GPIO_DISPLAY_ENABLE\n");? ? ? ?else
? ? ? ? ? ? ? ?gpio_direction_output(GPIO_DISPLAY_ENABLE, 1); +
+ ? ? ?platform_device_register(&pxa3xx_device_gcu); ?}?/**
--
1.7.1