From 3e9bb0e093a9fcc9c64e4c61fd93f973c0fc1cde Mon Sep 17 00:00:00 2001
From: Phil Edworthy <phil.edworthy@renesas.com>
Date: Fri, 4 Feb 2011 10:03:53 +0000
Subject: [PATCH 4/4] sh772x: Register phys memory with UIOMux

This is patch significantly improves the performance on sh772x devices.

The sh772x gfx code uses an external library (libshbeu) to access the
BEU hardware. In order for this library to understand that the virtual
addresses passed to it are for contiguous memory, the memory must be
registered with another external library (UIOMux).

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 configure.in               |    3 +++
 systems/devmem/Makefile.am |    4 ++--
 systems/devmem/devmem.c    |    8 ++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 58110e8..93c2edd 100644
--- a/configure.in
+++ b/configure.in
@@ -1185,6 +1185,9 @@ if test "$checkfor_sh772x" = "yes" && test "$have_sh4" = "yes"; then
        AC_MSG_WARN([*** Missing UIOMUX, SHBEU or SHJPEG library -- sh772x driver will not be built.])
   fi
 fi
+if test "$sh772x" = "yes"; then
+  AC_DEFINE(HAVE_GFX_SH772X, [], [Define to 1 if sh772x])
+fi
 
 if test "$checkfor_sis315" = "yes"; then
   sis315=yes
diff --git a/systems/devmem/Makefile.am b/systems/devmem/Makefile.am
index b85d92a..f2c47b7 100644
--- a/systems/devmem/Makefile.am
+++ b/systems/devmem/Makefile.am
@@ -24,7 +24,8 @@ systems_LTLIBRARIES = libdirectfb_devmem.la
 
 libdirectfb_devmem_la_LDFLAGS = \
 	-avoid-version	\
-	-module
+	-module \
+	$(SH772X_DEP_LIBS)
 
 libdirectfb_devmem_la_SOURCES = \
 	devmem.c		\
@@ -36,5 +37,4 @@ libdirectfb_devmem_la_LIBADD = \
 	$(top_builddir)/lib/fusion/libfusion.la \
 	$(top_builddir)/src/libdirectfb.la
 
-
 include $(top_srcdir)/rules/libobject.make
diff --git a/systems/devmem/devmem.c b/systems/devmem/devmem.c
index 2a19538..e23ce70 100644
--- a/systems/devmem/devmem.c
+++ b/systems/devmem/devmem.c
@@ -49,6 +49,10 @@
 
 #include <core/core_system.h>
 
+#ifdef HAVE_GFX_SH772X
+#include <uiomux/uiomux.h>
+#endif
+
 DFB_CORE_SYSTEM( devmem )
 
 /**********************************************************************************************************************/
@@ -88,6 +92,10 @@ MapMemAndReg( DevMemData    *data,
           }
      }
 
+#ifdef HAVE_GFX_SH772X
+	uiomux_register (data->mem, mem_phys, mem_length);
+#endif
+
      close( fd );
 
      return DFB_OK;
-- 
1.7.1

