From 467f9364593b85c0993c05dbda224b64bb678b68 Mon Sep 17 00:00:00 2001
From: Andrey Pavlenko <no@email>
Date: Fri, 25 Nov 2011 15:39:24 +0000
Subject: [PATCH] Adding optimized Mat Allocator

---
 OpenCVModule.cmake          | 4 +++-
 modules/core/src/matrix.cpp | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/OpenCVModule.cmake b/OpenCVModule.cmake
index 5f79514c29..48e6dee690 100644
--- a/OpenCVModule.cmake
+++ b/OpenCVModule.cmake
@@ -210,7 +210,9 @@ macro(define_opencv_module name)
     endif()
 
     # Dependencies of this target:
-    add_dependencies(${the_target} ${ARGN})
+    if(ARGN)
+        add_dependencies(${the_target} ${ARGN})
+    endif()
 
     install(TARGETS ${the_target}
         RUNTIME DESTINATION bin COMPONENT main
diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp
index 4906deb10b..83357af3fd 100644
--- a/modules/core/src/matrix.cpp
+++ b/modules/core/src/matrix.cpp
@@ -203,6 +203,9 @@ void Mat::create(int d, const int* _sizes, int _type)
     
     if( total() > 0 )
     {
+#ifdef HAVE_TGPU
+        if( !allocator ) allocator = tegra::getAllocator(d, _sizes, _type);
+#endif
         if( !allocator )
         {
             size_t total = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
-- 
2.18.0