summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungho, Baek <sbsh.baek@samsung.com>2019-05-17 15:52:29 +0900
committerSeungho, Baek <sbsh.baek@samsung.com>2019-08-13 13:13:20 +0900
commit450f634bbef0123bb7bf8cae509a23fb413111a1 (patch)
tree1dd52afcf915f0c46e1ec62527e47fb828af4e32
parent6e6901f05219b7313774adbb0e1c5f246ccb1890 (diff)
downloaddali-adaptor-450f634bbef0123bb7bf8cae509a23fb413111a1.tar.gz
dali-adaptor-450f634bbef0123bb7bf8cae509a23fb413111a1.tar.bz2
dali-adaptor-450f634bbef0123bb7bf8cae509a23fb413111a1.zip
To get MaxTextureSize by using glGetIntegerv not by using environment variable
- Save MaxTextureSize in the gl-implementation after Context MakeCurrent - Get it to the ImageLoader - Use ConditionalWait to sync between two threads at the first time the DALi app is launching - Save the MaxTextureSize that is supported at the GPU to a configuration file. - After second launching of any DALi app, Adaptor read the configuration file without waiting. Change-Id: I0d9bef5f59086c49c9d44ed6efdb1ae849c6f361 Signed-off-by: Seungho, Baek <sbsh.baek@samsung.com>
-rw-r--r--.gitignore1
-rw-r--r--build/tizen/adaptor/Makefile.am19
-rw-r--r--build/tizen/adaptor/configure.ac8
-rw-r--r--build/tizen/adaptor/system-cache-path.in24
-rw-r--r--dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp16
-rwxr-xr-xdali/internal/adaptor/common/adaptor-impl.cpp64
-rw-r--r--dali/internal/adaptor/common/combined-update-render-controller.cpp2
-rw-r--r--dali/internal/adaptor/file.list3
-rw-r--r--dali/internal/graphics/gles/gl-implementation.h29
-rwxr-xr-xdali/internal/imaging/common/image-loader.cpp8
-rw-r--r--dali/internal/imaging/common/image-loader.h7
11 files changed, 164 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 8384ac860..3480ca9db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,4 @@ tags
/debugfiles.list
/debuglinks.list
/debugsources.list
+/dali/internal/adaptor/common/system-cache-path.cpp
diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am
index e5cbc8e0b..017e16d41 100644
--- a/build/tizen/adaptor/Makefile.am
+++ b/build/tizen/adaptor/Makefile.am
@@ -68,7 +68,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_window_system_ubuntu_x11_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ENABLE_NETWORK_LOGGING
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -125,7 +126,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_thread_common_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ECORE_WAYLAND2
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -191,7 +193,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_thread_common_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ECORE_WAYLAND2
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -256,7 +259,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_thread_common_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ECORE_WAYLAND2
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -320,7 +324,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_thread_common_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ECORE_WAYLAND2
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -387,7 +392,8 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_thread_common_src_files) \
$(devel_api_text_abstraction_src_files) \
$(static_libraries_glyphy_src_files) \
- $(static_libraries_libunibreak_src_files)
+ $(static_libraries_libunibreak_src_files) \
+ $(adaptor_dali_src_file)
if ECORE_WAYLAND2
LIBDALI_ADAPTOR_LA_SOURCES += \
@@ -409,7 +415,6 @@ endif
endif
-
# Package doc
package_doxy_dir = ../../../doc
include ../../../doc/file.list
diff --git a/build/tizen/adaptor/configure.ac b/build/tizen/adaptor/configure.ac
index a2a542bf0..ae20dd28b 100644
--- a/build/tizen/adaptor/configure.ac
+++ b/build/tizen/adaptor/configure.ac
@@ -312,6 +312,13 @@ if test x$FONT_CONFIGURATION_FILE != x; then
fontConfigurationFile=$FONT_CONFIGURATION_FILE
fi
+if test "x$enable_profile" = "xUBUNTU"; then
+ cachePath=$HOME
+else
+ cachePath="/home/owner"
+fi # ubuntu profile test
+
+AC_SUBST(cachePath)
AC_SUBST(dataReadWriteDir)
AC_SUBST(dataReadOnlyDir)
AC_SUBST(DALI_ADAPTOR_CFLAGS)
@@ -328,6 +335,7 @@ AC_CONFIG_FILES([
Makefile
dali-adaptor.pc
dali-adaptor-integration.pc
+ ../../../dali/internal/adaptor/common/system-cache-path.cpp:./system-cache-path.in
])
if test "x$freetype_bitmap_support" = "xyes"; then
diff --git a/build/tizen/adaptor/system-cache-path.in b/build/tizen/adaptor/system-cache-path.in
new file mode 100644
index 000000000..816be336c
--- /dev/null
+++ b/build/tizen/adaptor/system-cache-path.in
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <cstdlib>
+
+std::string GetSystemCachePath()
+{
+ return std::string( "@cachePath@/.cache/dali_common_caches/" );
+} \ No newline at end of file
diff --git a/dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp b/dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp
index 7273b9425..1a3095106 100644
--- a/dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp
+++ b/dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp
@@ -106,19 +106,19 @@ std::iostream& FileStream::Impl::GetStream()
return mBufferStream;
}
- std::ios_base::openmode openMode = std::ios::ate;
- if( mMode & Dali::FileStream::BINARY )
- {
- openMode |= std::ios::binary;
- }
-
+ std::ios_base::openmode openMode;
if( mMode & Dali::FileStream::WRITE )
{
- openMode |= std::ios::out;
+ openMode = ( std::ios::out | std::ios::ate );
}
else
{
- openMode |= std::ios::in;
+ openMode = std::ios::in;
+ }
+
+ if( mMode & Dali::FileStream::BINARY )
+ {
+ openMode |= std::ios::binary;
}
if( !mFileName.empty() )
diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp
index 6256e0478..d42eff54f 100755
--- a/dali/internal/adaptor/common/adaptor-impl.cpp
+++ b/dali/internal/adaptor/common/adaptor-impl.cpp
@@ -34,6 +34,8 @@
#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/integration-api/processor-interface.h>
+#include <fstream>
+
// INTERNAL INCLUDES
#include <dali/public-api/dali-adaptor-common.h>
#include <dali/internal/system/common/thread-controller.h>
@@ -65,9 +67,12 @@
#include <dali/internal/imaging/common/image-loader-plugin-proxy.h>
#include <dali/internal/imaging/common/image-loader.h>
+#include <dali/devel-api/adaptor-framework/file-stream.h>
using Dali::TextAbstraction::FontClient;
+extern std::string GetSystemCachePath();
+
namespace Dali
{
@@ -284,6 +289,40 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
{
Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
}
+
+ std::string systemCachePath = GetSystemCachePath();
+ if ( systemCachePath.c_str() != NULL )
+ {
+ Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::READ | Dali::FileStream::TEXT );
+ std::fstream& stream = dynamic_cast<std::fstream&>( fileStream.GetStream() );
+ if( stream.is_open() )
+ {
+ std::string line;
+ while( std::getline( stream, line ) )
+ {
+ line.erase( line.find_last_not_of( " \t\r\n" ) + 1 );
+ line.erase( 0, line.find_first_not_of( " \t\r\n" ) );
+ if( '#' == *( line.cbegin() ) || line == "" )
+ {
+ continue;
+ }
+
+ std::istringstream stream( line );
+ std::string environmentVariableName, environmentVariableValue;
+ std::getline(stream, environmentVariableName, ' ');
+ if( environmentVariableName == "DALI_ENV_MAX_TEXTURE_SIZE" && mEnvironmentOptions->GetMaxTextureSize() == 0 )
+ {
+ std::getline(stream, environmentVariableValue);
+ setenv( environmentVariableName.c_str() , environmentVariableValue.c_str(), 1 );
+ Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( std::atoi( environmentVariableValue.c_str() ) );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Fail to open file : %s\n", ( systemCachePath + "gpu-environment.conf" ).c_str() );
+ }
+ }
}
Adaptor::~Adaptor()
@@ -353,6 +392,31 @@ void Adaptor::Start()
// Initialize the thread controller
mThreadController->Initialize();
+ if( !Dali::TizenPlatform::ImageLoader::MaxTextureSizeUpdated() )
+ {
+ auto eglGraphics = static_cast<EglGraphics *>( mGraphics );
+ GlImplementation& mGLES = eglGraphics->GetGlesInterface();
+ Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mGLES.GetMaxTextureSize() );
+
+ std::string systemCachePath = GetSystemCachePath();
+ if( systemCachePath.c_str() != NULL )
+ {
+ const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() );
+ if (-1 == dir_err)
+ {
+ printf("Error creating directory!n");
+ exit(1);
+ }
+
+ Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::WRITE | Dali::FileStream::TEXT );
+ std::fstream& configFile = dynamic_cast<std::fstream&>( fileStream.GetStream() );
+ if( configFile.is_open() )
+ {
+ configFile << "DALI_ENV_MAX_TEXTURE_SIZE " << mGLES.GetMaxTextureSize() << std::endl;
+ }
+ }
+ }
+
ProcessCoreEvents(); // Ensure any startup messages are processed.
// Initialize the image loader plugin
diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp
index aae33400e..94693d205 100644
--- a/dali/internal/adaptor/common/combined-update-render-controller.cpp
+++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp
@@ -493,6 +493,8 @@ void CombinedUpdateRenderController::UpdateRenderThread()
}
}
+ eglGraphics->GetGlesInterface().ContextCreated();
+
// Tell core it has a context
mCore.ContextCreated();
diff --git a/dali/internal/adaptor/file.list b/dali/internal/adaptor/file.list
index 803b95bab..b10b5b85f 100644
--- a/dali/internal/adaptor/file.list
+++ b/dali/internal/adaptor/file.list
@@ -7,7 +7,8 @@ adaptor_adaptor_common_src_files=\
${adaptor_adaptor_dir}/common/adaptor.cpp \
${adaptor_adaptor_dir}/common/adaptor-builder-impl.cpp \
${adaptor_adaptor_dir}/common/application-impl.cpp \
- ${adaptor_adaptor_dir}/common/combined-update-render-controller.cpp
+ ${adaptor_adaptor_dir}/common/combined-update-render-controller.cpp \
+ ${adaptor_adaptor_dir}/common/system-cache-path.cpp
# module: adaptor, backend: tizen-wayland
adaptor_adaptor_tizen_wayland_src_files=\
diff --git a/dali/internal/graphics/gles/gl-implementation.h b/dali/internal/graphics/gles/gl-implementation.h
index 8c279f448..9ccc0151b 100644
--- a/dali/internal/graphics/gles/gl-implementation.h
+++ b/dali/internal/graphics/gles/gl-implementation.h
@@ -23,6 +23,7 @@
#include <cstdlib>
#include <GLES2/gl2.h>
#include <dali/integration-api/gl-abstraction.h>
+#include <dali/devel-api/threading/conditional-wait.h>
// INTERNAL INCLUDES
#include <dali/internal/graphics/gles/gles-abstraction.h>
@@ -49,7 +50,10 @@ class GlImplementation : public Dali::Integration::GlAbstraction
public:
GlImplementation()
: mGlesVersion( 30 ),
- mIsSurfacelessContextSupported( false )
+ mIsSurfacelessContextSupported( false ),
+ mIsContextCreated( false ),
+ mContextCreatedWaitCondition(),
+ mMaxTextureSize( 0 )
{
mImpl.reset( new Gles3Implementation() );
}
@@ -66,6 +70,17 @@ public:
/* Do nothing in main implementation */
}
+ void ContextCreated()
+ {
+ glGetIntegerv( GL_MAX_TEXTURE_SIZE, &mMaxTextureSize );
+
+ if( !mIsContextCreated )
+ {
+ mContextCreatedWaitCondition.Notify();
+ }
+ mIsContextCreated = true;
+ }
+
void SetGlesVersion( const int32_t glesVersion )
{
if( mGlesVersion != glesVersion )
@@ -103,6 +118,15 @@ public:
return convert;
}
+ int GetMaxTextureSize()
+ {
+ if( !mIsContextCreated )
+ {
+ mContextCreatedWaitCondition.Wait();
+ }
+ return mMaxTextureSize;
+ }
+
/* OpenGL ES 2.0 */
void ActiveTexture( GLenum texture )
@@ -1340,6 +1364,9 @@ public:
private:
int32_t mGlesVersion;
bool mIsSurfacelessContextSupported;
+ bool mIsContextCreated;
+ ConditionalWait mContextCreatedWaitCondition;
+ GLint mMaxTextureSize;
std::unique_ptr<GlesAbstraction> mImpl;
};
diff --git a/dali/internal/imaging/common/image-loader.cpp b/dali/internal/imaging/common/image-loader.cpp
index b83878ecd..598079682 100755
--- a/dali/internal/imaging/common/image-loader.cpp
+++ b/dali/internal/imaging/common/image-loader.cpp
@@ -47,6 +47,8 @@ Integration::Log::Filter* gLogFilter = Debug::Filter::New( Debug::Concise, false
static unsigned int gMaxTextureSize = 4096;
+static bool gMaxTextureSizeUpdated = false;
+
/**
* Enum for file formats, has to be in sync with BITMAP_LOADER_LOOKUP_TABLE
*/
@@ -418,6 +420,7 @@ ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer
void SetMaxTextureSize( unsigned int size )
{
gMaxTextureSize = size;
+ gMaxTextureSizeUpdated = true;
}
unsigned int GetMaxTextureSize()
@@ -425,6 +428,11 @@ unsigned int GetMaxTextureSize()
return gMaxTextureSize;
}
+bool MaxTextureSizeUpdated()
+{
+ return gMaxTextureSizeUpdated;
+}
+
} // ImageLoader
} // TizenPlatform
} // Dali
diff --git a/dali/internal/imaging/common/image-loader.h b/dali/internal/imaging/common/image-loader.h
index 55f16805f..a7c42a0f2 100644
--- a/dali/internal/imaging/common/image-loader.h
+++ b/dali/internal/imaging/common/image-loader.h
@@ -95,6 +95,13 @@ void SetMaxTextureSize( unsigned int size );
*/
unsigned int GetMaxTextureSize();
+/**
+ * @brief Check the gMaxTextureSize is updated or not.
+ *
+ * @return Whether the gMaxTextureSize is updated or not.
+ */
+bool MaxTextureSizeUpdated();
+
} // ImageLoader
} // TizenPlatform
} // Dali