Skip to contentSkip to conversation

video: add driver for PXA3xx 2D graphics accelerator

PATCH New Daniel Mack 1 participant 1 message Jun 30, 2009 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: add driver for PXA3xx 2D graphics accelerator

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 benefit for line drawing, blend, and rectangle and triangle filling operations.

Measurements 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:

  Fill Rectangle                                 3.007 secs (  175.922 MPixel/sec) [100.3%]
  Fill Rectangles [10]                           3.178 secs (  182.696 MPixel/sec) [100.0%]
  Fill Triangles                                 3.023 secs (   99.232 MPixel/sec) [100.3%]
  Blit                                           3.082 secs (   39.770 MPixel/sec) [100.0%]
  Blit 180                                       3.115 secs (   28.994 MPixel/sec) [100.3%]
  Blit with format conversion                    3.078 secs (   18.863 MPixel/sec) [100.0%]

With accelerator:

  Fill Rectangle                                 4.377 secs (*  88.433 MPixel/sec) [  5.9%]
  Fill Rectangles [10]                           5.176 secs (*  87.245 MPixel/sec) [  0.5%]
  Fill Triangles                                 3.025 secs (   87.437 MPixel/sec) [ 46.6%]
  Blit                                          12.177 secs (*  22.250 MPixel/sec) [  1.3%]
  Blit 180                                       8.421 secs (*  32.175 MPixel/sec) [  4.9%]
  Blit with format conversion                    8.216 secs (*  40.045 MPixel/sec) [  2.5%]
Cc Denis Oliver Kropp <[email protected]>
Cc Sven Neumann <[email protected]>
---
 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
index 9bbb285..4facf93 100644
@@ -1800,6 +1800,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
index 80232e1..81e744c 100644
@@ -99,6 +99,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
new file mode 100644
index 0000000..0428ed0
@@ -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.6.5