../dali-adaptor/dali-test-suite-utils
)
+FIND_LIBRARY(GLES_GRAPHICS_LIB_FOUND NAMES dali2-adaptor-gles PATHS ${${CAPI_LIB}_LIBRARY_DIRS})
+IF(GLES_GRAPHICS_LIB_FOUND)
+ SET(GLES_GRAPHICS_LIB "-ldali2-adaptor-gles")
+ENDIF()
+
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
+ ${GLES_GRAPHICS_LIB}
-lpthread --coverage -rdynamic
)
dali-test-suite-utils/mesh-builder.cpp
dali-test-suite-utils/dali-test-suite-utils.cpp
dali-test-suite-utils/test-actor-utils.cpp
+ dali-test-suite-utils/test-addon-manager.cpp
dali-test-suite-utils/test-harness.cpp
dali-test-suite-utils/test-application.cpp
dali-test-suite-utils/test-gesture-generator.cpp
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- --coverage
+ -ldl --coverage
)
INSTALL(PROGRAMS ${EXEC_NAME}
--- /dev/null
+/*
+ * Copyright (c) 2024 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.
+ *
+ */
+
+#include "test-addon-manager.h"
+
+#include <dali-test-suite-utils.h>
+#include <dlfcn.h>
+#include <memory>
+
+#include <cstring>
+
+#ifndef ADDON_LIBS_PATH
+#define ADDON_LIBS_PATH ""
+#endif
+
+namespace Test
+{
+using namespace Dali;
+
+void AddOnManager::Initialize()
+{
+ // Only create an instance if we haven't created one already
+ if(!AddOnManager::Get())
+ {
+ static std::unique_ptr<AddOnManager> sAddonManager(new AddOnManager);
+ // Memory will be freed upon test completion
+ }
+}
+
+std::vector<std::string> AddOnManager::EnumerateAddOns()
+{
+ std::string listFileName(ADDON_LIBS_PATH);
+ listFileName += "/addons.txt";
+
+ // Read list of available test addons
+ tet_printf("Enumerating addons, file: %s\n", listFileName.c_str());
+ std::vector<std::string> addons{};
+ auto* fin = fopen(listFileName.c_str(), "r");
+ char* lineBuf = new char[256];
+ memset(lineBuf, 0, 256);
+ size_t n = 256;
+ while(getline(&lineBuf, &n, fin) > 0)
+ {
+ char* c = lineBuf;
+ while(*c)
+ {
+ if(*c == '\n' || *c == '\r')
+ {
+ *c = 0;
+ break;
+ }
+ ++c;
+ }
+ tet_printf("Adding %s\n", lineBuf);
+ addons.emplace_back(lineBuf);
+ memset(lineBuf, 0, 256);
+ }
+ fclose(fin);
+ delete[] lineBuf;
+ std::vector<std::string> retval{};
+ // Open addons
+ for(auto& name : addons)
+ {
+ std::string path(ADDON_LIBS_PATH);
+ path += "/";
+ path += name;
+
+ mAddOnCache.emplace_back();
+ mAddOnCache.back().handle = dlopen(path.c_str(), RTLD_DEEPBIND | RTLD_LAZY);
+ if(!mAddOnCache.back().handle)
+ {
+ mAddOnCache.back().valid = false;
+ tet_printf("Can't open addon lib: %s\n", path.c_str());
+ continue;
+ }
+ // Here addon must self register
+ if(!mAddOnCache.back().valid)
+ {
+ puts("Addon invalid!");
+ }
+ else
+ {
+ tet_printf("Valid AddOn: %s\n", mAddOnCache.back().name.c_str());
+ retval.emplace_back(mAddOnCache.back().name);
+ }
+ }
+
+ return retval;
+
+ /**
+ * Check for self-registering addons
+ */
+}
+
+void AddOnManager::RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable)
+{
+ // Register the dispatch table
+ auto& entry = mAddOnCache.back();
+ entry.name = dispatchTable->name;
+ tet_printf("Registering AddOn: %s\n", entry.name.c_str());
+ entry.GetGlobalProc = dispatchTable->GetGlobalProc;
+ entry.GetInstanceProc = dispatchTable->GetInstanceProc;
+ entry.GetAddOnInfo = dispatchTable->GetAddOnInfo;
+ entry.OnStart = dispatchTable->OnStart;
+ entry.OnStop = dispatchTable->OnStop;
+ entry.OnPause = dispatchTable->OnPause;
+ entry.OnResume = dispatchTable->OnResume;
+ entry.valid = true;
+}
+
+bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info)
+{
+ auto retval = false;
+ std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &info](AddOnCacheEntry& entry) {
+ if(entry.name == name)
+ {
+ entry.GetAddOnInfo(info);
+ retval = true;
+ return true;
+ }
+ return false;
+ });
+ return retval;
+}
+
+std::vector<AddOnLibrary> AddOnManager::LoadAddOns(const std::vector<std::string>& addonNames)
+{
+ if(mAddOnCache.empty())
+ {
+ EnumerateAddOns();
+ }
+
+ std::vector<AddOnLibrary> retval{};
+ for(auto& name : addonNames)
+ {
+ size_t index = 0;
+ auto iter = std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &index](AddOnCacheEntry& entry) {
+ index++;
+ if(entry.name == name)
+ {
+ return true;
+ }
+ return false;
+ });
+ if(iter != mAddOnCache.end())
+ {
+ retval.emplace_back(*reinterpret_cast<void**>(&index));
+ }
+ else
+ {
+ retval.emplace_back(nullptr);
+ }
+ }
+
+ return retval;
+}
+
+AddOnLibrary AddOnManager::LoadAddOn(const std::string& addonName, const std::string& libraryName)
+{
+ AddOnLibrary addOnLibrary = nullptr;
+ size_t index = 0;
+ auto iter = std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&addonName, &index](AddOnCacheEntry& entry) {
+ index++;
+ return (entry.name == addonName);
+ });
+
+ if(iter != mAddOnCache.end())
+ {
+ addOnLibrary = reinterpret_cast<void*>(index);
+ }
+ else
+ {
+ mAddOnCache.emplace_back();
+ mAddOnCache.back().handle = dlopen(libraryName.c_str(), RTLD_LAZY); // We want to override some called methods in test code so don't do a deepbind
+ if(!mAddOnCache.back().handle)
+ {
+ mAddOnCache.back().valid = false;
+ tet_printf("Can't open addon lib: %s\n", libraryName.c_str());
+ }
+ // Here addon must self register
+ if(!mAddOnCache.back().valid)
+ {
+ puts("Addon invalid!");
+ }
+ else
+ {
+ tet_printf("Valid AddOn: %s\n", mAddOnCache.back().name.c_str());
+ addOnLibrary = reinterpret_cast<void*>(mAddOnCache.size());
+ }
+ }
+
+ return addOnLibrary;
+}
+
+void* AddOnManager::GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName)
+{
+ auto index = *reinterpret_cast<const size_t*>(&addOnLibrary);
+ return mAddOnCache[index - 1].GetGlobalProc(procName);
+}
+
+void* AddOnManager::GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName)
+{
+ auto index = *reinterpret_cast<const size_t*>(&addOnLibrary);
+ return mAddOnCache[index - 1].GetInstanceProc(procName);
+}
+
+void AddOnManager::Start()
+{
+ for(auto& entry : mAddOnCache)
+ {
+ if(entry.OnStart)
+ {
+ entry.OnStart();
+ }
+ }
+}
+
+void AddOnManager::Resume()
+{
+ for(auto& entry : mAddOnCache)
+ {
+ if(entry.OnResume)
+ {
+ entry.OnResume();
+ }
+ }
+}
+
+void AddOnManager::Stop()
+{
+ for(auto& entry : mAddOnCache)
+ {
+ if(entry.OnStop)
+ {
+ entry.OnStop();
+ }
+ }
+}
+
+void AddOnManager::Pause()
+{
+ for(auto& entry : mAddOnCache)
+ {
+ if(entry.OnPause)
+ {
+ entry.OnPause();
+ }
+ }
+}
+
+} // namespace Test
--- /dev/null
+#ifndef TEST_ADDON_MANAGER_H
+#define TEST_ADDON_MANAGER_H
+
+/*
+ * Copyright (c) 2024 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.
+ *
+ */
+
+#include <dali/integration-api/addon-manager.h>
+#include <dali/public-api/common/vector-wrapper.h>
+
+#include <string>
+
+namespace Test
+{
+class AddOnManager : public Dali::Integration::AddOnManager
+{
+public:
+ /**
+ * Initializes the test addon manager so that it can be used by DALi.
+ */
+ static void Initialize();
+
+ /**
+ * @brief Constructor, initialised by the Adaptor
+ */
+ AddOnManager() = default;
+
+ /**
+ * @brief Destructor
+ */
+ ~AddOnManager() override = default;
+
+ std::vector<std::string> EnumerateAddOns() override;
+
+ bool GetAddOnInfo(const std::string& name, Dali::AddOnInfo& info) override;
+
+ std::vector<Dali::AddOnLibrary> LoadAddOns(const std::vector<std::string>& addonNames) override;
+
+ Dali::AddOnLibrary LoadAddOn(const std::string& addonName, const std::string& libraryName) override;
+
+ void* GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override;
+
+ void* GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override;
+
+ void RegisterAddOnDispatchTable(const Dali::AddOnDispatchTable* dispatchTable) override;
+
+ void Start() override;
+
+ void Resume() override;
+
+ void Stop() override;
+
+ void Pause() override;
+
+ struct AddOnCacheEntry
+ {
+ std::string name{};
+ Dali::AddOnInfo info{};
+
+ // library handle
+ void* handle{nullptr};
+
+ // main function pointers
+ void (*GetAddOnInfo)(Dali::AddOnInfo&) = nullptr; ///< Returns AddOnInfo structure
+ void* (*GetInstanceProc)(const char*) = nullptr; ///< Returns pointer of instance function (member funtion)
+ void* (*GetGlobalProc)(const char*) = nullptr; ///< Returns pointer of global function (non-member function)
+
+ void (*OnStart)() = nullptr;
+ void (*OnResume)() = nullptr;
+ void (*OnPause)() = nullptr;
+ void (*OnStop)() = nullptr;
+
+ bool valid = false;
+ };
+
+ std::vector<AddOnCacheEntry> mAddOnCache;
+};
+} // Namespace Test
+
+#endif // TEST_ADDON_MANAGER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/gl-window.h>
#include <dali/internal/system/linux/dali-ecore-x.h>
+#include <test-addon-manager.h>
using namespace Dali;
int UtcDaliGlWindowNew1(void)
{
+ TestApplication application;
+ Test::AddOnManager::Initialize(); // GlWindow requires Gl Window addon so initialize the manager
+
try
{
PositionSize windowPosition(0, 0, 10, 10);
int UtcDaliGlWindowNew2(void)
{
+ TestApplication application;
+ Test::AddOnManager::Initialize(); // GlWindow requires Gl Window addon so initialize the manager
+
try
{
PositionSize windowPosition(20, 10, 10, 10);
../dali-adaptor/dali-test-suite-utils
)
+FIND_LIBRARY(GLES_GRAPHICS_LIB_FOUND NAMES dali2-adaptor-gles PATHS ${${CAPI_LIB}_LIBRARY_DIRS})
+IF(GLES_GRAPHICS_LIB_FOUND)
+ SET(GLES_GRAPHICS_LIB "-ldali2-adaptor-gles")
+ENDIF()
+
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
+ ${GLES_GRAPHICS_LIB}
--coverage
)
install_manifest.txt
libdali2-adaptor.so.*
linker-test
+linker-test-gles
+linker-test-vulkan
*config.cmake
*.dylib
SET(LIBTYPE STATIC)
ENDIF()
+IF(DEFINED ADAPTOR_GRAPHICS_GLES_SOURCES AND DEFINED ADAPTOR_GRAPHICS_VULKAN_SOURCES)
+ IF(enable_graphics_backend MATCHES DYNAMIC)
+ # Separate GLES Graphics Library
+ SET(ADAPTOR_GRAPHICS_GLES_NAME "${name}-gles")
+ ADD_LIBRARY(${ADAPTOR_GRAPHICS_GLES_NAME} ${LIBTYPE} ${ADAPTOR_GRAPHICS_GLES_SOURCES})
+ TARGET_COMPILE_OPTIONS(${ADAPTOR_GRAPHICS_GLES_NAME} PRIVATE ${DALI_CFLAGS})
+ TARGET_LINK_LIBRARIES(${ADAPTOR_GRAPHICS_GLES_NAME}
+ ${name}
+ ${DALICORE_LDFLAGS}
+ ${DALIADAPTOR_LDFLAGS}
+ ${COVERAGE}
+ ${OPENGLES20_LDFLAGS}
+ ${EGL_LDFLAGS}
+ )
+ INSTALL(TARGETS ${ADAPTOR_GRAPHICS_GLES_NAME} DESTINATION ${LIB_DIR})
+
+ # Linker Test for GLES Graphics
+ SET(LINKER_TEST_GLES_NAME ${DALI_ADAPTOR_PREFIX}linker-test-gles)
+ ADD_EXECUTABLE(${LINKER_TEST_GLES_NAME} linker-test-graphics-library.cpp)
+ TARGET_COMPILE_OPTIONS(${LINKER_TEST_GLES_NAME} PRIVATE -I${ROOT_SRC_DIR} ${DALI_CFLAGS} )
+ TARGET_LINK_LIBRARIES(${LINKER_TEST_GLES_NAME} ${name} ${DALI_LDFLAGS} ${ADAPTOR_GRAPHICS_GLES_NAME})
+
+ # Separate Vulkan Graphics Library
+ SET(ADAPTOR_GRAPHICS_VULKAN_NAME "${name}-vulkan")
+ ADD_LIBRARY(${ADAPTOR_GRAPHICS_VULKAN_NAME} ${LIBTYPE} ${ADAPTOR_GRAPHICS_VULKAN_SOURCES})
+ TARGET_COMPILE_OPTIONS(${ADAPTOR_GRAPHICS_VULKAN_NAME} PRIVATE -DVULKAN_HPP_NO_EXCEPTIONS ${DALI_CFLAGS})
+ TARGET_LINK_LIBRARIES(${ADAPTOR_GRAPHICS_VULKAN_NAME}
+ ${name}
+ ${DALICORE_LDFLAGS}
+ ${DALIADAPTOR_LDFLAGS}
+ ${COVERAGE}
+ ${VULKAN_LDFLAGS}
+ ${GLSLANG_LDFLAGS}
+ ${SPIRVTOOLS_LDFLAGS}
+ )
+ INSTALL(TARGETS ${ADAPTOR_GRAPHICS_VULKAN_NAME} DESTINATION ${LIB_DIR})
+
+ # Linker Test for Vulkan Graphics
+ SET(LINKER_TEST_VULKAN_NAME ${DALI_ADAPTOR_PREFIX}linker-test-vulkan)
+ ADD_EXECUTABLE(${LINKER_TEST_VULKAN_NAME} linker-test-graphics-library.cpp)
+ TARGET_COMPILE_OPTIONS(${LINKER_TEST_VULKAN_NAME} PRIVATE -I${ROOT_SRC_DIR} ${DALI_CFLAGS} )
+ TARGET_LINK_LIBRARIES(${LINKER_TEST_VULKAN_NAME} ${name} ${DALI_LDFLAGS} ${ADAPTOR_GRAPHICS_VULKAN_NAME})
+
+ SET(GRAPHICS_BACKEND_TYPE "Dynamic (GLES/VULKAN)")
+ ELSEIF(enable_graphics_backend MATCHES GLES)
+ # Add GLES sources to main adaptor library
+ SET(GRAPHICS_BACKEND_TYPE "GLES")
+ SET(SOURCES ${SOURCES} ${ADAPTOR_GRAPHICS_GLES_SOURCES})
+ SET(OPTIONAL_LIBS ${OPTIONAL_LIBS}
+ ${OPENGLES20_LDFLAGS}
+ ${EGL_LDFLAGS}
+ )
+ ELSEIF(enable_graphics_backend MATCHES VULKAN)
+ # Add VULKAN sources to main adaptor library
+ SET(GRAPHICS_BACKEND_TYPE "VULKAN")
+ SET(SOURCES ${SOURCES} ${ADAPTOR_GRAPHICS_VULKAN_SOURCES})
+ SET(OPTIONAL_LIBS ${OPTIONAL_LIBS}
+ ${VULKAN_LDFLAGS}
+ ${GLSLANG_LDFLAGS}
+ ${SPIRVTOOLS_LDFLAGS}
+ )
+ ENDIF()
+ELSE()
+ # If variables are not defined then profile does not support VULKAN and assumed to have added GLES sources
+ SET(GRAPHICS_BACKEND_TYPE "GLES")
+ENDIF()
+
ADD_LIBRARY( ${name} ${LIBTYPE} ${SOURCES} )
IF( UNIX )
ENDFOREACH(HEADER)
ENDMACRO(INSTALL_HEADERS_WITH_DIRECTORY)
+# GlWindow Addon
+IF(DEFINED GL_WINDOW_ADDON_SOURCES)
+ SET(ADAPTOR_GL_WINDOW_ADDON_NAME "${name}-gl-window-addon")
+ ADD_LIBRARY(${ADAPTOR_GL_WINDOW_ADDON_NAME} ${LIBTYPE} ${GL_WINDOW_ADDON_SOURCES})
+ TARGET_LINK_LIBRARIES(${ADAPTOR_GL_WINDOW_ADDON_NAME}
+ ${name}
+ ${DALICORE_LDFLAGS}
+ ${DALIADAPTOR_LDFLAGS}
+ ${COVERAGE}
+ ${ADAPTOR_GRAPHICS_GLES_NAME}
+ )
+ INSTALL( TARGETS ${ADAPTOR_GL_WINDOW_ADDON_NAME} DESTINATION ${LIB_DIR})
+ SET(GLWINDOW_ADDON_ENABLED "ON")
+ELSE()
+ SET(GLWINDOW_ADDON_ENABLED "OFF")
+ENDIF()
########################################################################################
# INSTALL:
MESSAGE( STATUS "Debug Build: ${ENABLE_DEBUG}")
MESSAGE( STATUS "Freetype bitmap support (Emoji): ${freetype_bitmap_support_ENABLED}")
MESSAGE( STATUS "Profile: ${ENABLE_PROFILE}")
+MESSAGE( STATUS "Graphics Backend: ${GRAPHICS_BACKEND_TYPE}")
MESSAGE( STATUS "Data Dir (Read/Write): ${dataReadWriteDir}")
MESSAGE( STATUS "Data Dir (Read Only): ${dataReadOnlyDir}")
MESSAGE( STATUS "WebP: ${webp_available_ENABLED}")
MESSAGE( STATUS "Enable AppModel: ${ENABLE_APPMODEL}" )
MESSAGE( STATUS "Enable Trace: ${ENABLE_TRACE_STRING}" )
MESSAGE( STATUS "Enable VConf: ${ENABLE_VCONF}" )
+MESSAGE( STATUS "GlWindow Addon: ${GLWINDOW_ADDON_ENABLED}")
MESSAGE( STATUS "Tizen Platform Config supported ${TIZEN_PLATFORM_CONFIG_SUPPORTED_LOGMSG}")
MESSAGE( STATUS "ThorVG version: ${THORVG_VERSION}")
MESSAGE( STATUS "Compile flags: ${CMAKE_CXX_FLAGS}")
MESSAGE( STATUS "CMAKE_SYSROOT: ${CMAKE_SYSROOT}")
MESSAGE( STATUS "CMAKE_SYSTEM_INCLUDE_PATH: ${CMAKE_SYSTEM_INCLUDE_PATH}")
MESSAGE( STATUS "CMAKE_SYSTEM_LIBRARY_PATH: ${CMAKE_SYSTEM_LIBRARY_PATH}")
-MESSAGE( STATUS "Vulkan: ${ENABLE_VULKAN}")
-MESSAGE( STATUS "Vulkan GLSLang: ${ENABLE_GLSLANG}")
IF( enable_feedback )
ADD_SUBDIRECTORY( plugins )
# Tizen Profile option
ARG_ENABLE( ENABLE_PROFILE enable_profile "${ENABLE_VAL};UBUNTU" "Select the variant of tizen" )
+# Graphics Backend option
+ARG_ENABLE( ENABLE_GRAPHICS_BACKEND enable_graphics_backend "${ENABLE_VAL};DYNAMIC" "Select the graphics backend to use (DYNAMIC/GLES/VULKAN)" )
+ARG_ENABLE( ENABLE_VULKAN enable_vulkan "${ENABLE_VAL}" "Enables Vulkan build (Deprecated)") # Keep for backwards compatibility
+
# Tizen Major version
ARG_ENABLE( ENABLE_TIZEN_MAJOR_VERSION enable_tizen_major_version "${ENABLE_VAL};0" "Specify the Tizen Major version for backwards compatibility" )
ARG_ENABLE( ENABLE_RENAME_SO enable_rename_so "${ENABLE_VAL};1" "Specify whether so file is renamed or not" )
ARG_ENABLE( ENABLE_COVERAGE enable_coverage "${ENABLE_VAL}" "Enables coverage" )
-ARG_ENABLE( ENABLE_VULKAN enable_vulkan "${ENABLE_VAL}" "Enables Vulkan build")
-
-# force GLSLANG when Vulkan enabled
-IF( enable_vulkan )
- SET(ENABLE_GLSLANG CACHE STRING "ON")
- SET(ENABLE_GLSLANG "ON")
-ENDIF()
-
-ARG_ENABLE( ENABLE_GLSLANG enable_glslang "${ENABLE_VAL}" "Enables Vulkan GLSLang")
-
# help option
ARG_ENABLE( PRINT_HELP print_help "${ENABLE_VAL}" "Prints help" )
-# If Vulkan is enabled GLSLang is used by default
-IF( ENABLE_VULKAN )
- SET(enable_glslang ON)
-ENDIF()
-
IF( print_help )
MESSAGE( STATUS ${HELP_ENABLES} )
EXIT()
SET( DEVICE_PROFILE 1 )
ENDIF()
+IF( NOT enable_graphics_backend )
+ IF( ANDROID_PROFILE OR MACOS_PROFILE OR WINDOWS_PROFILE )
+ SET( enable_graphics_backend GLES )
+ ELSE()
+ SET( enable_graphics_backend DYNAMIC )
+ ENDIF()
+ENDIF()
+
+IF(enable_vulkan AND NOT ANDROID_PROFILE AND NOT MACOS_PROFILE AND NOT WINDOWS_PROFILE )
+ SET(enable_graphics_backend VULKAN)
+ENDIF()
+
+# Test for graphics backend and exit if something wrong
+SET( VALID_GRAPHICS_BACKENDS VULKAN GLES DYNAMIC)
+LIST( FIND VALID_GRAPHICS_BACKENDS ${enable_graphics_backend} RESULT_GRAPHICS_BACKEND )
+IF( RESULT_GRAPHICS_BACKEND EQUAL -1 )
+ MESSAGE( FATAL_ERROR "Invalid graphics backend!" )
+ENDIF()
# TODO check what version we really need for Android
IF( ANDROID_PROFILE )
CHECK_MODULE_AND_SET( THORVG thorvg thorvg_support )
-IF( ENABLE_VULKAN )
- CHECK_MODULE_AND_SET( VULKAN vulkan [] )
- CHECK_MODULE_AND_SET( GLSLANG glslang [] )
- CHECK_MODULE_AND_SET( SPIRVTOOLS SPIRV-Tools [] )
+CHECK_MODULE_AND_SET( VULKAN vulkan VULKAN )
+IF(VULKAN_ENABLED)
+ CHECK_MODULE_AND_SET( GLSLANG glslang GLSLANG )
+ CHECK_MODULE_AND_SET( SPIRVTOOLS SPIRV-Tools SPIRVTOOLS )
ELSE()
- CHECK_MODULE_AND_SET( OPENGLES20 glesv2 [] )
- CHECK_MODULE_AND_SET( EGL egl [] )
+ SET(GLSLANG_ENABLED OFF)
+ SET(SPIRVTOOLS_ENABLED OFF)
+ SET(enable_graphics_backend GLES)
ENDIF()
+CHECK_MODULE_AND_SET( OPENGLES20 glesv2 [] )
+CHECK_MODULE_AND_SET( EGL egl [] )
+
IF( thorvg_support )
SET( THORVG_VERSION ${THORVG_VERSION_STRING} )
ADD_DEFINITIONS( -DTHORVG_SUPPORT )
${WAYLAND_LDFLAGS}
)
ENDIF()
-IF(enable_vulkan)
- ADD_DEFINITIONS( -DVULKAN_ENABLED )
+
+IF(VULKAN_ENABLED)
ADD_DEFINITIONS( -DVULKAN_HPP_NO_EXCEPTIONS )
#gcc_flags = -Wno-return-local-addr -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override \
# -Wstack-usage=256 -Wunsafe-loop-optimizations -Wzero-as-null-pointer-constant -Wuseless-cast
IF (HAVE_NO_CLASS_MEMACCESS)
ADD_COMPILE_OPTIONS( $<$<COMPILE_LANGUAGE:CXX>:-Wno-class-memaccess>)
ENDIF()
- IF( enable_wayland )
- ADD_DEFINITIONS( -DVULKAN_WITH_WAYLAND )
- ELSEIF(X11_REQUIRED)
+ IF(X11_REQUIRED)
SET(DALI_CFLAGS ${DALI_CFLAGS} ${XCB_CFLAGS} )
SET(DALI_LDFLAGS ${DALI_LDFLAGS} ${XCB_LDFLAGS} )
ENDIF()
SET(DALI_CFLAGS ${DALI_CFLAGS} ${VULKAN_CFLAGS} )
SET(DALI_LDFLAGS ${DALI_LDFLAGS} ${VULKAN_LDFLAGS} )
-ENDIF()
-IF(enable_glslang)
# glsllang-dev package on Ubuntu seems to be broken and doesn't
# provide valid cmake config files. On Tizen cmake files are valid
# but there's no pkg-config files so we handle both ways of obtaining
# package configuration.
IF(NOT GLSLANG_LDFLAGS)
FIND_PACKAGE(glslang)
- SET(DALI_LDFLAGS ${DALI_LDFLAGS} glslang::glslang glslang::SPIRV glslang::glslang-default-resource-limits)
+ SET(GLSLANG_LDFLAGS glslang::glslang glslang::SPIRV glslang::glslang-default-resource-limits)
ELSE()
# On Ubuntu 22.04 glslang seems to be horribly broken, pc file doesn't include
# all needed deps and SPIRV-Tools package is needed
- SET(DALI_LDFLAGS ${DALI_LDFLAGS} ${GLSLANG_LDFLAGS} -lSPIRV ${SPIRVTOOLS_LDFLAGS} -lglslang-default-resource-limits)
+ SET(GLSLANG_LDFLAGS ${GLSLANG_LDFLAGS} -lSPIRV ${SPIRVTOOLS_LDFLAGS} -lglslang-default-resource-limits)
ENDIF()
-
- SET(DALI_CFLAGS ${DALI_CFLAGS} ${GLSLANG_CFLAGS} )
ENDIF()
IF(LIBUV_X11_PROFILE)
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+#include <dali/internal/window-system/common/native-image-surface-impl.h>
+
+// Dummy Implementation for NativeWindowInterface
+class NativeWindowDummyImpl : public Dali::Graphics::NativeWindowInterface
+{
+public:
+ Dali::Any GetNativeWindow() override
+ {
+ return {};
+ }
+ int GetNativeWindowId() override
+ {
+ return 0;
+ }
+};
+
+extern "C"
+{
+ extern std::unique_ptr<Dali::Internal::Adaptor::GraphicsFactoryInterface> CreateGraphicsFactory(Dali::Internal::Adaptor::EnvironmentOptions& environmentOptions);
+ extern std::unique_ptr<Dali::Internal::Adaptor::RenderSurfaceFactory> GetRenderSurfaceFactory();
+ extern std::unique_ptr<Dali::Internal::Adaptor::NativeImageSourceFactory> GetNativeImageSourceFactory();
+ extern std::unique_ptr<Dali::Internal::Adaptor::NativeImageSurface> CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr queue);
+ extern std::unique_ptr<Dali::Graphics::SurfaceFactory> CreateSurfaceFactory(Dali::Graphics::NativeWindowInterface& nativeWindow);
+} // extern "C"
+
+int main(int argc, char** argv)
+{
+ Dali::Internal::Adaptor::EnvironmentOptions options;
+ CreateGraphicsFactory(options);
+
+ [[maybe_unused]] auto renderSurfaceFactory = GetRenderSurfaceFactory();
+ [[maybe_unused]] auto imageSourceFactory = GetNativeImageSourceFactory();
+ [[maybe_unused]] auto nativeImageSurface = CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr());
+
+ NativeWindowDummyImpl nativeWindow;
+ [[maybe_unused]] auto surfaceFactory = CreateSurfaceFactory(nativeWindow);
+
+ return 0;
+}
${static_libraries_libunibreak_src_files}
${adaptor_addons_common_src_files}
${adaptor_addons_dummy_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
)
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_tizen_src_files}
${adaptor_input_common_src_files}
${adaptor_input_tizen_wayland_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_window_system_tizen_wayland_src_files}
+ ${adaptor_window_system_tizen_wayland_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_tizen_src_files}
+ ${adaptor_imaging_tizen_egl_src_files}
+ ${adaptor_window_system_tizen_wayland_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
${adaptor_graphics_vulkan_src_files}
${adaptor_graphics_vulkan_wayland_src_files}
${adaptor_imaging_tizen_vulkan_src_files}
${adaptor_libraries_spirv_reflect_src_files}
${adaptor_window_system_tizen_wayland_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_tizen_src_files}
- ${adaptor_imaging_tizen_egl_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_tizen_wayland_egl_src_files}
- )
-ENDIF()
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_x11_src_files}
${adaptor_input_common_src_files}
${adaptor_input_generic_src_files}
${adaptor_video_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_x11_src_files}
+ ${adaptor_window_system_x11_dynamic_src_files}
${devel_api_text_abstraction_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_vulkan_src_files}
- ${adaptor_graphics_vulkan_x11_src_files}
- ${adaptor_imaging_x11_vulkan_src_files}
- ${adaptor_libraries_spirv_reflect_src_files}
- ${adaptor_window_system_x11_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_glib_x11_src_files}
- ${adaptor_graphics_x11_src_files}
- ${adaptor_imaging_x11_egl_src_files}
- ${adaptor_window_system_x11_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- )
-ENDIF()
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_x11_src_files}
+ ${adaptor_imaging_x11_egl_src_files}
+ ${adaptor_window_system_x11_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_x11_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
+ ${adaptor_graphics_vulkan_src_files}
+ ${adaptor_graphics_vulkan_x11_src_files}
+ ${adaptor_imaging_x11_vulkan_src_files}
+ ${adaptor_libraries_spirv_reflect_src_files}
+ ${adaptor_window_system_x11_vulkan_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_x11_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_haptics_tizen_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_tizen_src_files}
${adaptor_input_common_src_files}
${adaptor_input_tizen_wayland_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_window_system_tizen_wayland_src_files}
+ ${adaptor_window_system_tizen_wayland_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_tizen_src_files}
+ ${adaptor_imaging_tizen_egl_src_files}
+ ${adaptor_window_system_tizen_wayland_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
${adaptor_graphics_vulkan_src_files}
${adaptor_graphics_vulkan_wayland_src_files}
${adaptor_imaging_tizen_vulkan_src_files}
${adaptor_libraries_spirv_reflect_src_files}
${adaptor_window_system_tizen_wayland_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_tizen_src_files}
- ${adaptor_imaging_tizen_egl_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_tizen_wayland_egl_src_files}
- )
-ENDIF()
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_x11_src_files}
${adaptor_input_common_src_files}
${adaptor_input_generic_src_files}
${adaptor_video_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_x11_src_files}
+ ${adaptor_window_system_x11_dynamic_src_files}
${devel_api_text_abstraction_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_vulkan_src_files}
- ${adaptor_graphics_vulkan_x11_src_files}
- ${adaptor_imaging_x11_vulkan_src_files}
- ${adaptor_libraries_spirv_reflect_src_files}
- ${adaptor_window_system_x11_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_ubuntu_src_files}
- ${adaptor_graphics_x11_src_files}
- ${adaptor_imaging_x11_egl_src_files}
- ${adaptor_window_system_x11_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- )
-ENDIF()
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_ubuntu_src_files}
+ ${adaptor_graphics_x11_src_files}
+ ${adaptor_imaging_x11_egl_src_files}
+ ${adaptor_window_system_x11_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_x11_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
+ ${adaptor_graphics_vulkan_src_files}
+ ${adaptor_graphics_vulkan_x11_src_files}
+ ${adaptor_imaging_x11_vulkan_src_files}
+ ${adaptor_libraries_spirv_reflect_src_files}
+ ${adaptor_window_system_x11_vulkan_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_x11_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${adaptor_addons_common_src_files}
${adaptor_addons_macos_src_files}
${static_libraries_libunibreak_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
)
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_tizen_src_files}
${adaptor_input_common_src_files}
${adaptor_input_tizen_wayland_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_window_system_tizen_wayland_src_files}
+ ${adaptor_window_system_tizen_wayland_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_tizen_src_files}
+ ${adaptor_imaging_tizen_egl_src_files}
+ ${adaptor_window_system_tizen_wayland_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
${adaptor_graphics_vulkan_src_files}
${adaptor_graphics_vulkan_wayland_src_files}
${adaptor_imaging_tizen_vulkan_src_files}
${adaptor_libraries_spirv_reflect_src_files}
${adaptor_window_system_tizen_wayland_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_tizen_src_files}
- ${adaptor_imaging_tizen_egl_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_tizen_wayland_egl_src_files}
- )
-ENDIF()
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_tizen_src_files}
${adaptor_input_common_src_files}
${adaptor_input_tizen_wayland_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_window_system_tizen_wayland_src_files}
+ ${adaptor_window_system_tizen_wayland_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_tizen_src_files}
+ ${adaptor_imaging_tizen_egl_src_files}
+ ${adaptor_window_system_tizen_wayland_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
${adaptor_graphics_vulkan_src_files}
${adaptor_graphics_vulkan_wayland_src_files}
${adaptor_imaging_tizen_vulkan_src_files}
${adaptor_libraries_spirv_reflect_src_files}
${adaptor_window_system_tizen_wayland_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_tizen_src_files}
- ${adaptor_imaging_tizen_egl_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_tizen_wayland_egl_src_files}
- )
-ENDIF()
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_ubuntu_src_files}
${adaptor_input_common_src_files}
${adaptor_input_ubuntu_x11_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_ubuntu_x11_src_files}
+ ${adaptor_window_system_ubuntu_x11_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_vulkan_src_files}
- ${adaptor_graphics_vulkan_x11_src_files}
- ${adaptor_imaging_ubuntu_x11_vulkan_src_files}
- ${adaptor_libraries_spirv_reflect_src_files}
- ${adaptor_window_system_ubuntu_x11_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_ubuntu_src_files}
- ${adaptor_imaging_ubuntu_x11_src_files}
- ${adaptor_imaging_ubuntu_x11_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_ubuntu_x11_egl_src_files}
- )
-ENDIF()
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_ubuntu_src_files}
+ ${adaptor_imaging_ubuntu_x11_egl_src_files}
+ ${adaptor_window_system_ubuntu_x11_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_ubuntu_x11_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
+ ${adaptor_graphics_vulkan_src_files}
+ ${adaptor_graphics_vulkan_x11_src_files}
+ ${adaptor_imaging_ubuntu_x11_vulkan_src_files}
+ ${adaptor_libraries_spirv_reflect_src_files}
+ ${adaptor_window_system_ubuntu_x11_vulkan_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_ubuntu_x11_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${devel_api_src_files}
${adaptor_devel_api_text_abstraction_src_files}
${adaptor_graphics_common_src_files}
+ ${adaptor_graphics_common_dynamic_src_files}
${adaptor_haptics_common_src_files}
${adaptor_imaging_common_src_files}
+ ${adaptor_imaging_common_dynamic_src_files}
${adaptor_imaging_tizen_src_files}
${adaptor_input_common_src_files}
${adaptor_input_tizen_wayland_src_files}
${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
+ ${adaptor_window_system_common_dynamic_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_window_system_tizen_wayland_src_files}
+ ${adaptor_window_system_tizen_wayland_dynamic_src_files}
${adaptor_trace_common_src_files}
${adaptor_thread_common_src_files}
${adaptor_thread_linux_src_files}
${static_libraries_libunibreak_src_files}
)
-IF( ENABLE_VULKAN )
- SET(SOURCES ${SOURCES}
+# GLES Graphics Library
+SET(ADAPTOR_GRAPHICS_GLES_SOURCES
+ ${adaptor_graphics_gles_src_files}
+ ${adaptor_graphics_tizen_src_files}
+ ${adaptor_imaging_tizen_egl_src_files}
+ ${adaptor_window_system_tizen_wayland_egl_src_files}
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# Vulkan Graphics Library
+SET(ADAPTOR_GRAPHICS_VULKAN_SOURCES
${adaptor_graphics_vulkan_src_files}
${adaptor_graphics_vulkan_wayland_src_files}
${adaptor_imaging_tizen_vulkan_src_files}
${adaptor_libraries_spirv_reflect_src_files}
${adaptor_window_system_tizen_wayland_vulkan_src_files}
- )
-ELSE()
- SET(SOURCES ${SOURCES}
- ${adaptor_graphics_gles_src_files}
- ${adaptor_graphics_tizen_src_files}
- ${adaptor_imaging_tizen_egl_src_files}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- ${adaptor_window_system_tizen_wayland_egl_src_files}
- )
-ENDIF()
+ ${adaptor_graphics_library_common_src_files}
+ ${adaptor_window_system_tizen_wayland_graphics_library_src_files}
+)
+
+# GlWindow Addon
+SET( GL_WINDOW_ADDON_SOURCES ${adaptor_window_system_gl_window_src_files} )
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${adaptor_addons_dummy_src_files}
)
-IF(NOT ENABLE_VULKAN)
- SET(SOURCES ${SOURCES}
- ${adaptor_devel_api_egl_src_files}
- ${adaptor_window_system_common_egl_src_files}
- )
-ENDIF()
-
IF( ENABLE_VECTOR_BASED_TEXT_RENDERING )
SET( SOURCES ${SOURCES}
${static_libraries_glyphy_src_files}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/public-api/adaptor-framework/window.h>
// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/gl-window-impl.h>
-#include <dali/internal/window-system/common/orientation-impl.h>
+#include <dali/devel-api/common/addon-binder.h>
+#include <dali/internal/window-system/gl-window/gl-window-impl.h>
+#include <dali/public-api/adaptor-framework/graphics-backend.h>
namespace Dali
{
+using GlWindowImpl = Internal::Adaptor::GlWindow;
+
+namespace
+{
+const char* const DALI_ADAPTOR_GL_WINDOW_ADDON_SO("libdali2-adaptor-gl-window-addon.so");
+const char* const DALI_ADAPTOR_GL_WINDOW_ADDON_NAME("AdaptorGlWindowAddOn");
+
+struct AdaptorGlWindowAddOn : public Dali::AddOn::AddOnBinder
+{
+ AdaptorGlWindowAddOn()
+ : Dali::AddOn::AddOnBinder(DALI_ADAPTOR_GL_WINDOW_ADDON_NAME, DALI_ADAPTOR_GL_WINDOW_ADDON_SO)
+ {
+ }
+
+ ~AdaptorGlWindowAddOn() = default;
+
+ ADDON_BIND_FUNCTION(GlWindowNew, GlWindow(PositionSize, const std::string&, const std::string&, bool));
+ ADDON_BIND_FUNCTION(GlWindowSetGraphicsConfig, void(GlWindowImpl&, bool, bool, int, GlWindow::GlesVersion));
+ ADDON_BIND_FUNCTION(GlWindowRaise, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowLower, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowActivate, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowShow, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowHide, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowGetSupportedAuxiliaryHintCount, unsigned int(const GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowGetSupportedAuxiliaryHint, std::string(const GlWindowImpl&, unsigned int));
+ ADDON_BIND_FUNCTION(GlWindowAddAuxiliaryHint, unsigned int(GlWindowImpl&, const std::string&, const std::string&));
+ ADDON_BIND_FUNCTION(GlWindowRemoveAuxiliaryHint, bool(GlWindowImpl&, unsigned int));
+ ADDON_BIND_FUNCTION(GlWindowSetAuxiliaryHintValue, bool(GlWindowImpl&, unsigned int, const std::string&));
+ ADDON_BIND_FUNCTION(GlWindowGetAuxiliaryHintValue, std::string(const GlWindowImpl&, unsigned int));
+ ADDON_BIND_FUNCTION(GlWindowGetAuxiliaryHintId, unsigned int(const GlWindowImpl&, const std::string&));
+ ADDON_BIND_FUNCTION(GlWindowSetInputRegion, void(GlWindowImpl&, const Rect<int>&));
+ ADDON_BIND_FUNCTION(GlWindowSetOpaqueState, void(GlWindowImpl&, bool));
+ ADDON_BIND_FUNCTION(GlWindowIsOpaqueState, bool(const GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowSetPositionSize, void(GlWindowImpl&, PositionSize));
+ ADDON_BIND_FUNCTION(GlWindowGetPositionSize, PositionSize(const GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowGetCurrentOrientation, WindowOrientation(const GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowSetAvailableOrientations, void(GlWindowImpl&, const Dali::Vector<WindowOrientation>&));
+ ADDON_BIND_FUNCTION(GlWindowSetPreferredOrientation, void(GlWindowImpl&, WindowOrientation));
+ ADDON_BIND_FUNCTION(GlWindowRegisterGlCallbacks, void(GlWindowImpl&, CallbackBase*, CallbackBase*, CallbackBase*));
+ ADDON_BIND_FUNCTION(GlWindowRenderOnce, void(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowSetRenderingMode, void(GlWindowImpl&, GlWindow::RenderingMode));
+ ADDON_BIND_FUNCTION(GlWindowGetRenderingMode, GlWindow::RenderingMode(const GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowFocusChangeSignal, GlWindow::FocusChangeSignalType&(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowResizeSignal, GlWindow::ResizeSignalType&(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowKeyEventSignal, GlWindow::KeyEventSignalType&(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowTouchedSignal, GlWindow::TouchEventSignalType&(GlWindowImpl&));
+ ADDON_BIND_FUNCTION(GlWindowVisibilityChangedSignal, GlWindow::VisibilityChangedSignalType&(GlWindowImpl&));
+};
+
+std::unique_ptr<AdaptorGlWindowAddOn> gAdaptorGlWindowAddOn;
+} // unnamed namespace
+
GlWindow GlWindow::New()
{
PositionSize positionSize(0, 0, 0, 0);
GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent)
{
- GlWindow newWindow;
- Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New(positionSize, name, className, isTransparent);
- newWindow = GlWindow(window);
-
- const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
- if(isAdaptorAvailable)
+ if(Graphics::GetCurrentGraphicsBackend() == Graphics::Backend::GLES)
{
- Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
- Dali::WindowContainer windows = adaptor.GetWindows();
- if(!windows.empty())
+ if(!gAdaptorGlWindowAddOn)
{
- window->SetChild(windows[0]);
+ gAdaptorGlWindowAddOn.reset(new AdaptorGlWindowAddOn);
}
+ DALI_ASSERT_ALWAYS(gAdaptorGlWindowAddOn && "Cannot load the GlWindow Addon\n");
+ return gAdaptorGlWindowAddOn->GlWindowNew(positionSize, name, className, isTransparent);
}
- return newWindow;
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
-GlWindow::GlWindow()
-{
-}
+GlWindow::GlWindow() = default;
-GlWindow::~GlWindow()
-{
-}
+GlWindow::~GlWindow() = default;
GlWindow::GlWindow(const GlWindow& handle) = default;
void GlWindow::SetGraphicsConfig(bool depth, bool stencil, int msaa, GlesVersion version)
{
- GetImplementation(*this).SetGraphicsConfig(depth, stencil, msaa, version);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetGraphicsConfig(impl, depth, stencil, msaa, version);
+ }
}
void GlWindow::Raise()
{
- GetImplementation(*this).Raise();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowRaise(impl);
+ }
}
void GlWindow::Lower()
{
- GetImplementation(*this).Lower();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowLower(impl);
+ }
}
void GlWindow::Activate()
{
- GetImplementation(*this).Activate();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowActivate(impl);
+ }
}
void GlWindow::Show()
{
- GetImplementation(*this).Show();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowShow(impl);
+ }
}
void GlWindow::Hide()
{
- GetImplementation(*this).Hide();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowHide(impl);
+ }
}
unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
{
- return GetImplementation(*this).GetSupportedAuxiliaryHintCount();
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetSupportedAuxiliaryHintCount(impl) : 0u;
}
std::string GlWindow::GetSupportedAuxiliaryHint(unsigned int index) const
{
- return GetImplementation(*this).GetSupportedAuxiliaryHint(index);
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetSupportedAuxiliaryHint(impl, index) : "";
}
unsigned int GlWindow::AddAuxiliaryHint(const std::string& hint, const std::string& value)
{
- return GetImplementation(*this).AddAuxiliaryHint(hint, value);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowAddAuxiliaryHint(impl, hint, value) : 0u;
}
bool GlWindow::RemoveAuxiliaryHint(unsigned int id)
{
- return GetImplementation(*this).RemoveAuxiliaryHint(id);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowRemoveAuxiliaryHint(impl, id) : false;
}
bool GlWindow::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
{
- return GetImplementation(*this).SetAuxiliaryHintValue(id, value);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowSetAuxiliaryHintValue(impl, id, value) : false;
}
std::string GlWindow::GetAuxiliaryHintValue(unsigned int id) const
{
- return GetImplementation(*this).GetAuxiliaryHintValue(id);
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetAuxiliaryHintValue(impl, id) : "";
}
unsigned int GlWindow::GetAuxiliaryHintId(const std::string& hint) const
{
- return GetImplementation(*this).GetAuxiliaryHintId(hint);
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetAuxiliaryHintId(impl, hint) : 0u;
}
void GlWindow::SetInputRegion(const Rect<int>& inputRegion)
{
- GetImplementation(*this).SetInputRegion(inputRegion);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetInputRegion(impl, inputRegion);
+ }
}
void GlWindow::SetOpaqueState(bool opaque)
{
- GetImplementation(*this).SetOpaqueState(opaque);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetOpaqueState(impl, opaque);
+ }
}
bool GlWindow::IsOpaqueState() const
{
- return GetImplementation(*this).IsOpaqueState();
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowIsOpaqueState(impl) : false;
}
void GlWindow::SetPositionSize(PositionSize positionSize)
{
- GetImplementation(*this).SetPositionSize(positionSize);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetPositionSize(impl, positionSize);
+ }
}
PositionSize GlWindow::GetPositionSize() const
{
- return GetImplementation(*this).GetPositionSize();
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetPositionSize(impl) : PositionSize{};
}
WindowOrientation GlWindow::GetCurrentOrientation() const
{
- return GetImplementation(*this).GetCurrentOrientation();
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetCurrentOrientation(impl) : WindowOrientation::PORTRAIT;
}
void GlWindow::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
{
- GetImplementation(*this).SetAvailableOrientations(orientations);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetAvailableOrientations(impl, orientations);
+ }
}
void GlWindow::SetPreferredOrientation(WindowOrientation orientation)
{
- GetImplementation(*this).SetPreferredOrientation(orientation);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetPreferredOrientation(impl, orientation);
+ }
}
void GlWindow::RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
{
- GetImplementation(*this).RegisterGlCallbacks(initCallback, renderFrameCallback, terminateCallback);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowRegisterGlCallbacks(impl, initCallback, renderFrameCallback, terminateCallback);
+ }
}
void GlWindow::RenderOnce()
{
- GetImplementation(*this).RenderOnce();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowRenderOnce(impl);
+ }
}
void GlWindow::SetRenderingMode(RenderingMode mode)
{
- GetImplementation(*this).SetRenderingMode(mode);
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ gAdaptorGlWindowAddOn->GlWindowSetRenderingMode(impl, mode);
+ }
}
GlWindow::RenderingMode GlWindow::GetRenderingMode() const
{
- return GetImplementation(*this).GetRenderingMode();
+ const GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ return gAdaptorGlWindowAddOn ? gAdaptorGlWindowAddOn->GlWindowGetRenderingMode(impl) : RenderingMode::CONTINUOUS;
}
GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal()
{
- return GetImplementation(*this).FocusChangeSignal();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ return gAdaptorGlWindowAddOn->GlWindowFocusChangeSignal(impl);
+ }
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
GlWindow::ResizeSignalType& GlWindow::ResizeSignal()
{
- return GetImplementation(*this).ResizeSignal();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ return gAdaptorGlWindowAddOn->GlWindowResizeSignal(impl);
+ }
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal()
{
- return GetImplementation(*this).KeyEventSignal();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ return gAdaptorGlWindowAddOn->GlWindowKeyEventSignal(impl);
+ }
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
GlWindow::TouchEventSignalType& GlWindow::TouchedSignal()
{
- return GetImplementation(*this).TouchedSignal();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ return gAdaptorGlWindowAddOn->GlWindowTouchedSignal(impl);
+ }
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal()
{
- return GetImplementation(*this).VisibilityChangedSignal();
+ GlWindowImpl& impl = GetImplementation(*this); // Get Implementation here to catch uninitialized usage
+ if(gAdaptorGlWindowAddOn)
+ {
+ return gAdaptorGlWindowAddOn->GlWindowVisibilityChangedSignal(impl);
+ }
+ DALI_ABORT("Current Graphics Backend does not support GlWindow\n");
}
GlWindow::GlWindow(Internal::Adaptor::GlWindow* window)
#define DALI_GL_WINDOW_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
* @brief This constructor is used by Dali::Application::GetGlWindow().
* @param[in] GlWindow A pointer to the GlWindow
*/
- explicit DALI_INTERNAL GlWindow(Internal::Adaptor::GlWindow* GlWindow);
+ explicit GlWindow(Internal::Adaptor::GlWindow* GlWindow);
/// @endcond
};
${adaptor_devel_api_dir}/adaptor-framework/feedback-player.cpp
${adaptor_devel_api_dir}/adaptor-framework/file-loader.cpp
${adaptor_devel_api_dir}/adaptor-framework/file-stream.cpp
+ ${adaptor_devel_api_dir}/adaptor-framework/gl-window.cpp
${adaptor_devel_api_dir}/adaptor-framework/graphics-capabilities.cpp
${adaptor_devel_api_dir}/adaptor-framework/image-loading.cpp
${adaptor_devel_api_dir}/adaptor-framework/input-method-context.cpp
${adaptor_devel_api_dir}/adaptor-framework/window-blur-info.cpp
)
-SET( adaptor_devel_api_egl_src_files
- ${adaptor_devel_api_dir}/adaptor-framework/gl-window.cpp
-)
-
SET( devel_api_adaptor_framework_header_files
${adaptor_devel_api_dir}/adaptor-framework/accessibility.h
${adaptor_devel_api_dir}/adaptor-framework/accessibility-bitset.h
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/internal/adaptor/common/adaptor-builder-impl.h>
// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/display-utils.h>
-#include <dali/public-api/adaptor-framework/graphics-backend.h>
-
-#if defined(VULKAN_ENABLED)
-#include <dali/internal/graphics/vulkan/vulkan-graphics-factory.h>
-#else
-#include <dali/internal/graphics/gles/egl-graphics-factory.h>
-#endif
+#include <dali/internal/graphics/common/graphics-factory.h>
namespace Dali::Internal::Adaptor
{
AdaptorBuilder::AdaptorBuilder(EnvironmentOptions& environmentOptions)
: mEnvironmentOptions(environmentOptions)
{
- switch(Graphics::GetCurrentGraphicsBackend())
- {
- case Graphics::Backend::GLES:
- {
- DALI_LOG_RELEASE_INFO("DALi Graphics Backend: GLES\n");
- // TODO: Load GLES library
- break;
- }
-
- case Graphics::Backend::VULKAN:
- {
- DALI_LOG_RELEASE_INFO("DALi Graphics Backend: VULKAN\n");
- // TODO: Attempt to load Vulkan library
- break;
- }
- }
-
// Construct Graphics Factory
- mGraphicsFactory = Utils::MakeUnique<GraphicsFactory>(environmentOptions);
+ mGraphicsFactory = CreateGraphicsFactory(environmentOptions);
}
GraphicsFactoryInterface& AdaptorBuilder::GetGraphicsFactory() const
#define DALI_INTERNAL_ADAPTOR_IMPL_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
/**
* @copydoc Dali::Adaptor::Get()
+ *
+ * Needs exporting as it's used by the GlWindow library
*/
- static Dali::Adaptor& Get();
+ static DALI_ADAPTOR_API Dali::Adaptor& Get();
/**
* @copydoc Dali::Adaptor::IsAvailable()
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-factory.h>
+#include <dali/internal/graphics/common/graphics-library.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions)
+{
+ return GraphicsLibrary::CreateGraphicsFactory(environmentOptions);
+}
+} // namespace Dali::Internal::Adaptor
--- /dev/null
+#pragma once
+
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-factory-interface.h>
+#include <dali/internal/system/common/environment-options.h>
+
+namespace Dali::Internal::Adaptor
+{
+extern std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions);
+} // namespace Dali::Internal::Adaptor
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-factory.h>
+#include <dali/internal/graphics/common/surface-factory.h>
+#include <dali/internal/imaging/common/native-image-source-factory.h>
+#include <dali/internal/window-system/common/native-image-surface-factory.h>
+#include <dali/internal/window-system/common/native-image-surface-impl.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+extern "C"
+{
+ using namespace Dali::Internal::Adaptor;
+
+ DALI_ADAPTOR_API std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions)
+ {
+ return Dali::Internal::Adaptor::CreateGraphicsFactory(environmentOptions);
+ }
+
+ DALI_ADAPTOR_API std::unique_ptr<RenderSurfaceFactory> GetRenderSurfaceFactory()
+ {
+ return Dali::Internal::Adaptor::GetRenderSurfaceFactory();
+ }
+
+ DALI_ADAPTOR_API std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory()
+ {
+ return Dali::Internal::Adaptor::GetNativeImageSourceFactory();
+ }
+
+ DALI_ADAPTOR_API std::unique_ptr<NativeImageSurface> CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr queue)
+ {
+ return Dali::Internal::Adaptor::NativeImageSurfaceFactory::CreateNativeImageSurface(queue);
+ }
+
+ DALI_ADAPTOR_API std::unique_ptr<Dali::Graphics::SurfaceFactory> CreateSurfaceFactory(Dali::Graphics::NativeWindowInterface& nativeWindow)
+ {
+ return Dali::Graphics::SurfaceFactory::New(nativeWindow);
+ }
+} // extern "C"
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// HEADER
+#include <dali/internal/graphics/common/graphics-library.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dlfcn.h>
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/native-image-surface-impl.h>
+#include <dali/public-api/adaptor-framework/graphics-backend.h>
+
+namespace Dali::Internal::Adaptor::GraphicsLibrary
+{
+namespace
+{
+const char* const DALI_ADAPTOR_GRAPHICS_GLES_SO("libdali2-adaptor-gles.so");
+const char* const DALI_ADAPTOR_GRAPHICS_VULKAN_SO("libdali2-adaptor-vulkan.so");
+
+struct GraphicsLibrary
+{
+public:
+ GraphicsLibrary()
+ {
+ mHandle = dlopen((Graphics::GetCurrentGraphicsBackend() == Graphics::Backend::GLES) ? DALI_ADAPTOR_GRAPHICS_GLES_SO : DALI_ADAPTOR_GRAPHICS_VULKAN_SO,
+ RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND);
+ if(!mHandle)
+ {
+ // The shared library failed to load
+ DALI_LOG_ERROR("dlopen error: %s\n", dlerror());
+ DALI_ABORT("Unable to open Graphics Library\n");
+ }
+ }
+
+ ~GraphicsLibrary()
+ {
+ if(mHandle)
+ {
+ dlclose(mHandle);
+ }
+ }
+
+public:
+ void* mHandle{nullptr};
+};
+std::unique_ptr<GraphicsLibrary> gGraphicsLibraryHandle;
+
+template<typename FunctionSignature>
+FunctionSignature GetFunction(const char* const functionName)
+{
+ if(!gGraphicsLibraryHandle)
+ {
+ gGraphicsLibraryHandle.reset(new GraphicsLibrary);
+ }
+
+ if(gGraphicsLibraryHandle)
+ {
+ FunctionSignature func = reinterpret_cast<FunctionSignature>(dlsym(gGraphicsLibraryHandle->mHandle,
+ functionName));
+ if(!func)
+ {
+ DALI_LOG_ERROR("Cannot find %s function: %s\n", functionName, dlerror());
+ DALI_ABORT("Unable to find required function in dynamically loaded library\n");
+ }
+ return func;
+ }
+ return nullptr;
+}
+
+template<typename FunctionSignature, typename... Args>
+void CallVoidFunction(const char* const functionName, Args... args)
+{
+ static FunctionSignature func = GetFunction<FunctionSignature>(functionName);
+ if(func)
+ {
+ func(args...);
+ }
+}
+
+template<typename FunctionSignature, typename ReturnValue, typename... Args>
+ReturnValue CallReturnValueFunction(const char* const functionName, Args... args)
+{
+ static FunctionSignature func = GetFunction<FunctionSignature>(functionName);
+ if(func)
+ {
+ return func(args...);
+ }
+ return {};
+}
+} // unnamed namespace
+
+std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions)
+{
+ return CallReturnValueFunction<std::unique_ptr<GraphicsFactoryInterface> (*)(EnvironmentOptions&), std::unique_ptr<GraphicsFactoryInterface>, EnvironmentOptions&>("CreateGraphicsFactory", environmentOptions);
+}
+
+std::unique_ptr<RenderSurfaceFactory> GetRenderSurfaceFactory()
+{
+ return CallReturnValueFunction<std::unique_ptr<RenderSurfaceFactory> (*)(), std::unique_ptr<RenderSurfaceFactory>>("GetRenderSurfaceFactory");
+}
+
+std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory()
+{
+ return CallReturnValueFunction<std::unique_ptr<NativeImageSourceFactory> (*)(), std::unique_ptr<NativeImageSourceFactory>>("GetNativeImageSourceFactory");
+}
+
+std::unique_ptr<Graphics::SurfaceFactory> CreateSurfaceFactory(Graphics::NativeWindowInterface& nativeWindow)
+{
+ return CallReturnValueFunction<std::unique_ptr<Graphics::SurfaceFactory> (*)(Graphics::NativeWindowInterface&), std::unique_ptr<Graphics::SurfaceFactory>, Graphics::NativeWindowInterface&>("CreateSurfaceFactory", nativeWindow);
+}
+
+std::unique_ptr<NativeImageSurface> CreateNativeImageSurface(NativeImageSourceQueuePtr queue)
+{
+ return CallReturnValueFunction<std::unique_ptr<NativeImageSurface> (*)(NativeImageSourceQueuePtr), std::unique_ptr<NativeImageSurface>, NativeImageSourceQueuePtr>("CreateNativeImageSurface", queue);
+}
+
+Any CastToNativeGraphicsType(void* display)
+{
+ return CallReturnValueFunction<Any (*)(void*), Any, void*>("CastToNativeGraphicsType", display);
+}
+
+} // namespace Dali::Internal::Adaptor::GraphicsLibrary
--- /dev/null
+#pragma once
+
+/*
+ * Copyright (c) 2025 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 <dali/public-api/object/any.h>
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-factory-interface.h>
+#include <dali/internal/graphics/common/surface-factory.h>
+#include <dali/internal/imaging/common/native-image-source-factory.h>
+#include <dali/internal/system/common/environment-options.h>
+#include <dali/internal/window-system/common/native-image-surface-factory.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
+
+namespace Dali::Internal::Adaptor::GraphicsLibrary
+{
+std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions);
+
+std::unique_ptr<RenderSurfaceFactory> GetRenderSurfaceFactory();
+
+std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory();
+
+std::unique_ptr<Graphics::SurfaceFactory> CreateSurfaceFactory(Graphics::NativeWindowInterface& nativeWindow);
+
+std::unique_ptr<NativeImageSurface> CreateNativeImageSurface(NativeImageSourceQueuePtr queue);
+
+Any CastToNativeGraphicsType(void*);
+
+} // namespace Dali::Internal::Adaptor::GraphicsLibrary
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+#include <dali/internal/graphics/common/surface-factory.h>
+
+namespace Dali::Graphics
+{
+__attribute__((weak)) std::unique_ptr<SurfaceFactory> SurfaceFactory::New(NativeWindowInterface& nativeWindow)
+{
+ return Internal::Adaptor::GraphicsLibrary::CreateSurfaceFactory(nativeWindow);
+}
+
+} // namespace Dali::Graphics
+# module: graphics, backend: gles
+SET( adaptor_graphics_common_dynamic_src_files
+ ${adaptor_graphics_dir}/common/graphics-factory-dynamic.cpp
+ ${adaptor_graphics_dir}/common/graphics-library.cpp
+ ${adaptor_graphics_dir}/common/surface-factory-dynamic.cpp
+)
+
+# module: graphics, library
+SET( adaptor_graphics_library_common_src_files
+ ${adaptor_graphics_dir}/common/graphics-library-functions.cpp
+)
+
# module: graphics, backend: gles
SET( adaptor_graphics_gles_src_files
${adaptor_graphics_dir}/gles/egl-debug.cpp
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/internal/graphics/gles/egl-graphics-factory.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-factory.h>
+#include <dali/internal/window-system/common/display-utils.h>
namespace Dali
{
{
namespace Adaptor
{
-GraphicsFactory::GraphicsFactory(EnvironmentOptions& environmentOptions)
+EglGraphicsFactory::EglGraphicsFactory(EnvironmentOptions& environmentOptions)
: mEnvironmentOptions(environmentOptions)
{
}
-GraphicsFactory::~GraphicsFactory()
+EglGraphicsFactory::~EglGraphicsFactory()
{
/* Deleted by Adaptor destructor */
}
-Graphics::GraphicsInterface& GraphicsFactory::Create()
+Graphics::GraphicsInterface& EglGraphicsFactory::Create()
{
Graphics::GraphicsCreateInfo info{};
return *eglGraphicsInterface;
}
-void GraphicsFactory::Destroy()
+void EglGraphicsFactory::Destroy()
{
/* Deleted by EglGraphics */
}
+std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions)
+{
+ DALI_LOG_RELEASE_INFO("DALi Graphics Backend: GLES\n");
+ return Utils::MakeUnique<EglGraphicsFactory>(environmentOptions);
+}
+
} // namespace Adaptor
} // namespace Internal
} // namespace Dali
#define DALI_INTERNAL_EGL_GRAPHICS_FACTORY_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
namespace Dali::Internal::Adaptor
{
-class GraphicsFactory : public GraphicsFactoryInterface
+// Needs exporting as it's called directly by the GlWindow library
+class DALI_ADAPTOR_API EglGraphicsFactory : public GraphicsFactoryInterface
{
public:
/**
* Constructor
*/
- explicit GraphicsFactory(EnvironmentOptions& environmentOptions);
+ explicit EglGraphicsFactory(EnvironmentOptions& environmentOptions);
/**
* Destructor
*/
- ~GraphicsFactory() override;
+ ~EglGraphicsFactory() override;
/**
* @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Create()
#define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
class ConfigurationManager;
class WindowBase;
-class EglGraphics : public Graphics::GraphicsInterface
+// Needs exporting as required by the GlWindow library
+class DALI_ADAPTOR_API EglGraphics : public Graphics::GraphicsInterface
{
public:
/**
#define DALI_INTERNAL_EGL_IMPLEMENTATION_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
{
/**
* EglImplementation class provides an EGL implementation.
+ *
+ * Needs exporting as required by the GlWindow library
*/
-class EglImplementation : public EglInterface
+class DALI_ADAPTOR_API EglImplementation : public EglInterface
{
public:
/**
typedef std::vector<EGLSurface> EglWindowSurfaceContainer;
EglWindowSurfaceContainer mEglWindowSurfaces; ///< The EGL surface for the window
- int32_t mMultiSamplingLevel;
- int32_t mGlesVersion;
+ int32_t mMultiSamplingLevel;
+ int32_t mGlesVersion;
ColorDepth mColorDepth;
DALI_ASSERT_DEBUG(mRenderTarget == renderTarget && "RenderPass has different render target to cmd buffer Begin");
auto renderPass = static_cast<Vulkan::RenderPass*>(gfxRenderPass);
- auto surface = mRenderTarget->GetSurface();
+ auto surface = renderTarget->GetSurface();
auto& device = mController.GetGraphicsDevice();
FramebufferImpl* framebuffer = nullptr;
RenderPassHandle renderPassImpl;
}
else
{
- auto coreFramebuffer = mRenderTarget->GetFramebuffer();
+ auto coreFramebuffer = renderTarget->GetFramebuffer();
framebuffer = coreFramebuffer->GetImpl();
renderPassImpl = framebuffer->GetImplFromRenderPass(renderPass);
- mController.AddTextureDependencies(mRenderTarget);
+ mController.AddTextureDependencies(renderTarget);
}
std::vector<vk::ClearValue> vkClearValues;
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
// INTERNAL INCLUDES
#include <dali/integration-api/core-enumerations.h>
#include <dali/internal/graphics/vulkan/vulkan-graphics-impl.h>
+#include <dali/internal/window-system/common/display-utils.h>
namespace Dali::Internal::Adaptor
{
-GraphicsFactory::GraphicsFactory(EnvironmentOptions& environmentOptions)
+VulkanGraphicsFactory::VulkanGraphicsFactory(EnvironmentOptions& environmentOptions)
: mEnvironmentOptions(environmentOptions)
{
}
-GraphicsFactory::~GraphicsFactory() = default;
+VulkanGraphicsFactory::~VulkanGraphicsFactory() = default;
-Graphics::GraphicsInterface& GraphicsFactory::Create()
+Graphics::GraphicsInterface& VulkanGraphicsFactory::Create()
{
auto depthBufferRequired = (mEnvironmentOptions.DepthBufferRequired() ? Integration::DepthBufferAvailable::TRUE : Integration::DepthBufferAvailable::FALSE);
return static_cast<Dali::Graphics::GraphicsInterface&>(*graphics);
}
-void GraphicsFactory::Destroy()
+void VulkanGraphicsFactory::Destroy()
{
}
+std::unique_ptr<GraphicsFactoryInterface> CreateGraphicsFactory(EnvironmentOptions& environmentOptions)
+{
+ DALI_LOG_RELEASE_INFO("DALi Graphics Backend: VULKAN\n");
+ return Utils::MakeUnique<VulkanGraphicsFactory>(environmentOptions);
+}
+
} // namespace Dali::Internal::Adaptor
#define DALI_GRAPHICS_VULKAN_GRAPHICS_FACTORY_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
namespace Dali::Internal::Adaptor
{
-class DALI_ADAPTOR_API GraphicsFactory : public GraphicsFactoryInterface
+class DALI_ADAPTOR_API VulkanGraphicsFactory : public GraphicsFactoryInterface
{
public:
/**
* Constructor
*/
- explicit GraphicsFactory(EnvironmentOptions& environmentOptions);
+ explicit VulkanGraphicsFactory(EnvironmentOptions& environmentOptions);
/**
* Destructor
*/
- ~GraphicsFactory() override;
+ ~VulkanGraphicsFactory() override;
/**
* @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Create()
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+#include <dali/internal/imaging/common/native-image-source-factory.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory()
+{
+ return GraphicsLibrary::GetNativeImageSourceFactory();
+}
+} // namespace Dali::Internal::Adaptor
#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_FACTORY_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
virtual std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) = 0;
};
-extern std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory();
+// Needs exporting as it's called by the Graphics Libraries
+extern DALI_ADAPTOR_API std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory();
} // namespace Adaptor
} // namespace Internal
${adaptor_imaging_dir}/common/native-bitmap-buffer-impl.cpp
)
+# module: imaging, backend: common/dynamic
+SET( adaptor_imaging_common_dynamic_src_files
+ ${adaptor_imaging_dir}/common/native-image-source-factory-dynamic.cpp
+)
+
# module: imaging, backend: tizen
SET( adaptor_imaging_tizen_src_files
${adaptor_imaging_dir}/common/file-download.cpp
#define DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <memory>
#include <string>
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
namespace Dali
{
class FileStream;
* This class retrieves and caches the system configuration.
* Some of the methods in this class can block system until GL has been initialized,
* only at the first time the DALi application is launched in the system.
+ *
+ * Needs exporting as it's called by the Graphics Libraries
*/
-class ConfigurationManager
+class DALI_ADAPTOR_API ConfigurationManager
{
public:
/**
// Deleted move assignment operator.
ConfigurationManager& operator=(const ConfigurationManager&&) = delete;
-private: // Data
- std::string mSystemCacheFilePath; ///< The path of system cache file
- Dali::Graphics::GraphicsInterface* mGraphics; ///< Graphics interface
- ThreadController* mThreadController; ///< The thread controller
- unsigned int mMaxTextureSize; ///< The largest texture that the GL can handle
- unsigned int mMaxCombinedTextureUnits; ///< The maximum number of combined texture units
- unsigned int mShaderLanguageVersion; ///< The shader language version that the system supports.
- bool mIsMultipleWindowSupported : 1; ///< Whether multiple window is supported by the GLES
- bool mIsAdvancedBlendEquationSupported : 1; ///< Whether blend equation advanced (extension) is supported by the GLES
- bool mIsMultisampledRenderToTextureSupported : 1; ///< Whether multisampled render to texture (extension) is supported by the GLES
- bool mMaxTextureSizeCached : 1; ///< Whether we have checked the maximum texture size
- bool mIsMultipleWindowSupportedCached : 1; ///< Whether we have checked the support of multiple window
- bool mIsAdvancedBlendEquationSupportedCached : 1; ///< Whether we have checked the support of blend equation advanced (extension)
- bool mIsMultisampledRenderToTextureSupportedCached : 1; ///< Whether we have checked the support of multisampled render to texture (extension)
- bool mShaderLanguageVersionCached : 1; ///< Whether we have checked the shader language version
- bool mMaxCombinedTextureUnitsCached : 1; ///< Whether we have checked the maximum number of combined texture units
+private: // Data
+ std::string mSystemCacheFilePath; ///< The path of system cache file
+ Dali::Graphics::GraphicsInterface* mGraphics; ///< Graphics interface
+ ThreadController* mThreadController; ///< The thread controller
+ unsigned int mMaxTextureSize; ///< The largest texture that the GL can handle
+ unsigned int mMaxCombinedTextureUnits; ///< The maximum number of combined texture units
+ unsigned int mShaderLanguageVersion; ///< The shader language version that the system supports.
+ bool mIsMultipleWindowSupported : 1; ///< Whether multiple window is supported by the GLES
+ bool mIsAdvancedBlendEquationSupported : 1; ///< Whether blend equation advanced (extension) is supported by the GLES
+ bool mIsMultisampledRenderToTextureSupported : 1; ///< Whether multisampled render to texture (extension) is supported by the GLES
+ bool mMaxTextureSizeCached : 1; ///< Whether we have checked the maximum texture size
+ bool mIsMultipleWindowSupportedCached : 1; ///< Whether we have checked the support of multiple window
+ bool mIsAdvancedBlendEquationSupportedCached : 1; ///< Whether we have checked the support of blend equation advanced (extension)
+ bool mIsMultisampledRenderToTextureSupportedCached : 1; ///< Whether we have checked the support of multisampled render to texture (extension)
+ bool mShaderLanguageVersionCached : 1; ///< Whether we have checked the shader language version
+ bool mMaxCombinedTextureUnitsCached : 1; ///< Whether we have checked the maximum number of combined texture units
};
} // namespace Internal::Adaptor
#define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
* This class provides the environment options which define settings as well as
* the ability to install a log function.
*
+ * Needs exporting as it's called by the Graphics Libraries
*/
-class EnvironmentOptions : public Dali::LogFactoryInterface, public Dali::TraceFactoryInterface
+class DALI_ADAPTOR_API EnvironmentOptions : public Dali::LogFactoryInterface, public Dali::TraceFactoryInterface
{
public:
/**
#define DALI_INTERNAL_TIME_SERVICE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
*
*/
+// EXTERNAL INCLUDES
#include <stdint.h>
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
namespace Dali
{
namespace Internal
* @param[out] timeInNanoseconds The time in nanoseconds since the reference point.
*
* @note The maximum value timeInNanoseconds can hold is 0xFFFFFFFFFFFFFFFF which is 1.844674407e+19. Therefore, this can overflow after approximately 584 years.
+ *
+ * Needs exporting as required by the GlWindow library
*/
-void GetNanoseconds(uint64_t& timeInNanoseconds);
+void DALI_ADAPTOR_API GetNanoseconds(uint64_t& timeInNanoseconds);
/**
* @brief Get the monotonic time since the clock's epoch.
* @return The time in milliseconds since the reference point.
*
* @note The maximum value that can be returned is 0xFFFFFFFF which is 4,294,967,295. Therefore, this can overflow after approximately 49 days.
+ *
+ * Needs exporting as required by the GlWindow library
*/
-uint32_t GetMilliSeconds();
+uint32_t DALI_ADAPTOR_API GetMilliSeconds();
/**
* @brief Sleeps until the monotonic time specified since the clock's epoch.
* @param[in] timeInNanoseconds The time to sleep until
*
* @note The maximum value timeInNanoseconds can hold is 0xFFFFFFFFFFFFFFFF which is 1.844674407e+19. Therefore, this can overflow after approximately 584 years.
+ *
+ * Needs exporting as required by the GlWindow library
*/
-void SleepUntil(uint64_t timeInNanoseconds);
+void DALI_ADAPTOR_API SleepUntil(uint64_t timeInNanoseconds);
} // namespace TimeService
#define DALI_INTERNAL_WINDOW_SYSTEM_COMMON_DISPLAY_CONNECTION_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
class DisplayConnection;
}
-class DisplayConnection
+// Needs exporting as it's called by the Graphics Libraries
+class DALI_ADAPTOR_API DisplayConnection
{
public:
/**
#define DALI_INTERNAL_EVENT_HANDLER_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
* to TouchEvents when it does receive them.
*
* These TouchEvents are then passed on to Core.
+ *
+ * Needs exporting as it's used by the GlWindow library
*/
-class EventHandler : public ConnectionTracker, public Dali::RefObject
+class DALI_ADAPTOR_API EventHandler : public ConnectionTracker, public Dali::RefObject
{
public:
/**
+++ /dev/null
-/*
- * Copyright (c) 2024 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/window-system/common/gl-window-impl.h>
-
-// EXTERNAL HEADERS
-#include <dali/devel-api/adaptor-framework/gl-window.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-#include <dali/devel-api/events/key-event-devel.h>
-#include <dali/integration-api/core.h>
-#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/integration-api/events/touch-integ.h>
-
-// INTERNAL HEADERS
-#include <dali/internal/graphics/gles/egl-graphics-factory.h>
-#include <dali/internal/window-system/common/display-utils.h>
-#include <dali/internal/window-system/common/event-handler.h>
-#include <dali/internal/window-system/common/orientation-impl.h>
-#include <dali/internal/window-system/common/window-base.h>
-#include <dali/internal/window-system/common/window-factory.h>
-#include <dali/internal/window-system/common/window-impl.h>
-#include <dali/internal/window-system/common/window-render-surface.h>
-#include <dali/internal/window-system/common/window-system.h>
-#include <dali/internal/window-system/common/window-visibility-observer.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-namespace
-{
-const int MINIMUM_DIMENSION_CHANGE(1);
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
-#endif
-
-} // unnamed namespace
-
-GlWindow* GlWindow::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
-{
- GlWindow* window = new GlWindow();
- window->mIsTransparent = isTransparent;
- window->Initialize(positionSize, name, className);
- return window;
-}
-
-GlWindow::GlWindow()
-: mWindowBase(),
- mGraphics(),
- mDisplayConnection(nullptr),
- mGlWindowRenderThread(nullptr),
- mEventHandler(nullptr),
- mIsTransparent(false),
- mIsFocusAcceptable(false),
- mIconified(false),
- mOpaqueState(false),
- mResizeEnabled(false),
- mVisible(false),
- mIsWindowRotated(false),
- mIsTouched(false),
- mIsEGLInitialized(false),
- mDepth(false),
- mStencil(false),
- mPositionSize(),
- mAvailableAngles(),
- mColorDepth(COLOR_DEPTH_24),
- mRenderingMode(Dali::GlWindow::RenderingMode::CONTINUOUS),
- mPreferredAngle(0),
- mTotalRotationAngle(0),
- mWindowRotationAngle(0),
- mScreenRotationAngle(0),
- mOrientationMode(0),
- mWindowWidth(0),
- mWindowHeight(0),
- mNativeWindowId(-1),
- mMSAA(0),
- mKeyEventSignal(),
- mTouchedSignal(),
- mFocusChangeSignal(),
- mResizeSignal(),
- mVisibilityChangedSignal()
-{
-}
-
-GlWindow::~GlWindow()
-{
- if(mEventHandler)
- {
- mEventHandler->RemoveObserver(*this);
- }
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->Stop();
- mGlWindowRenderThread->Join();
- }
-
- if(mIsEGLInitialized)
- {
- mGraphics->Destroy();
- }
-}
-
-void GlWindow::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
-{
- int screenWidth, screenHeight;
-
- mPositionSize = positionSize;
- WindowSystem::GetScreenSize(screenWidth, screenHeight);
- if((mPositionSize.width == 0) || (mPositionSize.height == 0))
- {
- mPositionSize.x = 0;
- mPositionSize.y = 0;
- mPositionSize.width = screenWidth;
- mPositionSize.height = screenHeight;
- }
-
- if(screenWidth > screenHeight)
- {
- mOrientationMode = 1; // Default mode is landscape
- }
- else
- {
- mOrientationMode = 0; // Default mode is portrate
- }
-
- // Create a window base
- auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
- Any surface;
- mWindowBase = windowFactory->CreateWindowBase(mPositionSize, surface, (mIsTransparent ? true : false));
- mWindowBase->IconifyChangedSignal().Connect(this, &GlWindow::OnIconifyChanged);
- mWindowBase->FocusChangedSignal().Connect(this, &GlWindow::OnFocusChanged);
- mWindowBase->OutputTransformedSignal().Connect(this, &GlWindow::OnOutputTransformed);
-
- if(Dali::Adaptor::IsAvailable())
- {
- SetEventHandler();
- }
-
- if(!mPositionSize.IsEmpty())
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
- mWindowBase->Show();
-
- if(mIsTransparent)
- {
- mColorDepth = COLOR_DEPTH_32;
- }
- else
- {
- mColorDepth = COLOR_DEPTH_24;
- }
-
- SetClass(name, className);
-
- // For Debugging
- mNativeWindowId = mWindowBase->GetNativeWindowId();
-}
-
-void GlWindow::SetEventHandler()
-{
- mEventHandler = EventHandlerPtr(new EventHandler(mWindowBase.get(), *this));
- mEventHandler->AddObserver(*this);
-}
-
-void GlWindow::SetClass(const std::string& name, const std::string className)
-{
- mName = name;
- mClassName = className;
- mWindowBase->SetClass(name, className);
-}
-
-void GlWindow::SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version)
-{
- // Init Graphics
- mDepth = depth;
- mStencil = stencil;
- mMSAA = msaa;
-
- InitializeGraphics();
-
- int rVersion = 30;
-
- if(version == Dali::GlWindow::GlesVersion::VERSION_2_0)
- {
- rVersion = 20;
- }
- else if(version == Dali::GlWindow::GlesVersion::VERSION_3_0)
- {
- rVersion = 30;
- }
-
- mGlWindowRenderThread->SetGraphicsConfig(depth, stencil, msaa, rVersion);
-}
-
-void GlWindow::Raise()
-{
- mWindowBase->Raise();
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId);
-}
-
-void GlWindow::Lower()
-{
- mWindowBase->Lower();
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId);
-}
-
-void GlWindow::Activate()
-{
- mWindowBase->Activate();
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
-}
-
-void GlWindow::Show()
-{
- mVisible = true;
-
- mWindowBase->Show();
-
- if(!mIconified)
- {
- Dali::GlWindow handle(this);
- mVisibilityChangedSignal.Emit(handle, true);
- }
-
- if(mEventHandler)
- {
- mEventHandler->Resume();
- }
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->Resume();
- }
-
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
-}
-
-void GlWindow::Hide()
-{
- mVisible = false;
-
- mWindowBase->Hide();
-
- if(!mIconified)
- {
- Dali::GlWindow handle(this);
- mVisibilityChangedSignal.Emit(handle, false);
- }
-
- if(mEventHandler)
- {
- mEventHandler->Pause();
- }
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->Pause();
- }
-
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
-}
-
-unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
-{
- return mWindowBase->GetSupportedAuxiliaryHintCount();
-}
-
-std::string GlWindow::GetSupportedAuxiliaryHint(unsigned int index) const
-{
- return mWindowBase->GetSupportedAuxiliaryHint(index);
-}
-
-unsigned int GlWindow::AddAuxiliaryHint(const std::string& hint, const std::string& value)
-{
- return mWindowBase->AddAuxiliaryHint(hint, value);
-}
-
-bool GlWindow::RemoveAuxiliaryHint(unsigned int id)
-{
- return mWindowBase->RemoveAuxiliaryHint(id);
-}
-
-bool GlWindow::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
-{
- return mWindowBase->SetAuxiliaryHintValue(id, value);
-}
-
-std::string GlWindow::GetAuxiliaryHintValue(unsigned int id) const
-{
- return mWindowBase->GetAuxiliaryHintValue(id);
-}
-
-unsigned int GlWindow::GetAuxiliaryHintId(const std::string& hint) const
-{
- return mWindowBase->GetAuxiliaryHintId(hint);
-}
-
-void GlWindow::SetInputRegion(const Rect<int>& inputRegion)
-{
- mWindowBase->SetInputRegion(inputRegion);
-
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
-}
-
-void GlWindow::SetOpaqueState(bool opaque)
-{
- mOpaqueState = opaque;
-
- mWindowBase->SetOpaqueState(opaque);
-
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetOpaqueState: opaque = %d\n", opaque);
-}
-
-bool GlWindow::IsOpaqueState() const
-{
- return mOpaqueState;
-}
-
-void GlWindow::SetPositionSize(PositionSize positionSize)
-{
- if(!mResizeEnabled)
- {
- AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mResizeEnabled = true;
- }
-
- bool needToMove = false;
- bool needToResize = false;
-
- // Check moving
- if((fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
- (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE))
- {
- needToMove = true;
- }
-
- // Check resizing
- if((fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
- (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
- {
- needToResize = true;
- }
-
- if(needToResize)
- {
- if(needToMove)
- {
- mWindowBase->MoveResize(positionSize);
- }
- else
- {
- mWindowBase->Resize(positionSize);
- }
- mPositionSize = positionSize;
- }
- else
- {
- if(needToMove)
- {
- mWindowBase->Move(positionSize);
- mPositionSize = positionSize;
- }
- }
-
- // If window's size or position is changed, the signal will be emitted to user.
- if(needToMove || needToResize)
- {
- Uint16Pair newSize(mPositionSize.width, mPositionSize.height);
- Dali::GlWindow handle(this);
- mResizeSignal.Emit(newSize);
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->RequestWindowResize(mPositionSize.width, mPositionSize.height);
- }
- }
-}
-
-PositionSize GlWindow::GetPositionSize() const
-{
- PositionSize positionSize(mPositionSize);
- if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
- {
- positionSize.height = mPositionSize.width;
- positionSize.width = mPositionSize.height;
- }
-
- return positionSize;
-}
-
-void GlWindow::OnIconifyChanged(bool iconified)
-{
- if(iconified)
- {
- mIconified = true;
-
- if(mVisible)
- {
- Dali::GlWindow handle(this);
- mVisibilityChangedSignal.Emit(handle, false);
- }
-
- if(mEventHandler)
- {
- mEventHandler->Pause();
- }
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->Pause();
- }
-
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
- }
- else
- {
- mIconified = false;
-
- if(mVisible)
- {
- Dali::GlWindow handle(this);
- mVisibilityChangedSignal.Emit(handle, true);
- }
-
- if(mEventHandler)
- {
- mEventHandler->Resume();
- }
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->Resume();
- }
-
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
- }
-}
-
-void GlWindow::OnFocusChanged(bool focusIn)
-{
- Dali::GlWindow handle(this);
- mFocusChangeSignal.Emit(handle, focusIn);
-}
-
-void GlWindow::OnOutputTransformed()
-{
- int newScreenRotationAngle = mWindowBase->GetScreenRotationAngle();
- DALI_LOG_RELEASE_INFO("GlWindow::OnOutputTransformed(), screen rotation occurs, old[%d], new[%d\n", mScreenRotationAngle, newScreenRotationAngle);
-
- if(newScreenRotationAngle != mScreenRotationAngle)
- {
- UpdateScreenRotation(newScreenRotationAngle);
- }
-}
-
-void GlWindow::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
-{
- PointState::Type state = point.GetState();
-
- if(state == PointState::DOWN)
- {
- mIsTouched = true;
- }
-
- if(state == PointState::UP)
- {
- mIsTouched = false;
- }
-
- if(!mIsTouched && state == PointState::MOTION)
- {
- return;
- }
-
- Vector2 convertedPosition = RecalculatePosition(point.GetScreenPosition());
- point.SetScreenPosition(convertedPosition);
-
- Dali::TouchEvent touchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
- Dali::GlWindow handle(this);
- mTouchedSignal.Emit(touchEvent);
-}
-
-void GlWindow::OnMouseFrameEvent()
-{
-}
-
-void GlWindow::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
-{
- // TODO:
- //FeedWheelEvent( wheelEvent );
-}
-
-void GlWindow::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
-{
- Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
- Dali::DevelKeyEvent::SetWindowId(event, keyEvent.windowId);
- Dali::GlWindow handle(this);
- mKeyEventSignal.Emit(event);
-}
-
-void GlWindow::OnRotation(const RotationEvent& rotation)
-{
- mWindowRotationAngle = rotation.angle;
- mTotalRotationAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
- if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
- {
- mWindowWidth = mPositionSize.height;
- mWindowHeight = mPositionSize.width;
- }
- else
- {
- mWindowWidth = mPositionSize.width;
- mWindowHeight = mPositionSize.height;
- }
-
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
-
- // Emit Resize signal
- Dali::GlWindow handle(this);
- mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
-
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->RequestWindowRotate(mWindowRotationAngle);
- }
-}
-
-Vector2 GlWindow::RecalculatePosition(const Vector2& position)
-{
- Vector2 convertedPosition;
-
- switch(mTotalRotationAngle)
- {
- case 90:
- {
- convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
- convertedPosition.y = position.x;
- break;
- }
- case 180:
- {
- convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
- convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
- break;
- }
- case 270:
- {
- convertedPosition.x = position.y;
- convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
- break;
- }
- default:
- {
- convertedPosition = position;
- break;
- }
- }
- return convertedPosition;
-}
-
-void GlWindow::SetAvailableAnlges(const std::vector<int>& angles)
-{
- if(angles.size() > 4)
- {
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
- return;
- }
-
- mWindowBase->SetAvailableAnlges(angles);
-}
-
-bool GlWindow::IsOrientationAvailable(WindowOrientation orientation) const
-{
- if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
- {
- DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
- return false;
- }
- return true;
-}
-
-int GlWindow::ConvertToAngle(WindowOrientation orientation)
-{
- int convertAngle = 0;
- if(mOrientationMode == 0)
- {
- convertAngle = static_cast<int>(orientation);
- }
- else if(mOrientationMode == 1)
- {
- switch(orientation)
- {
- case WindowOrientation::LANDSCAPE:
- {
- convertAngle = 0;
- break;
- }
- case WindowOrientation::PORTRAIT:
- {
- convertAngle = 90;
- break;
- }
- case WindowOrientation::LANDSCAPE_INVERSE:
- {
- convertAngle = 180;
- break;
- }
- case WindowOrientation::PORTRAIT_INVERSE:
- {
- convertAngle = 270;
- break;
- }
- case WindowOrientation::NO_ORIENTATION_PREFERENCE:
- {
- convertAngle = -1;
- break;
- }
- }
- }
- return convertAngle;
-}
-
-WindowOrientation GlWindow::ConvertToOrientation(int angle) const
-{
- WindowOrientation orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
- if(mOrientationMode == 0) // Portrate mode
- {
- orientation = static_cast<WindowOrientation>(angle);
- }
- else if(mOrientationMode == 1) // Landscape mode
- {
- switch(angle)
- {
- case 0:
- {
- orientation = WindowOrientation::LANDSCAPE;
- break;
- }
- case 90:
- {
- orientation = WindowOrientation::PORTRAIT;
- break;
- }
- case 180:
- {
- orientation = WindowOrientation::LANDSCAPE_INVERSE;
- break;
- }
- case 270:
- {
- orientation = WindowOrientation::PORTRAIT_INVERSE;
- break;
- }
- case -1:
- {
- orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
- break;
- }
- }
- }
- return orientation;
-}
-
-WindowOrientation GlWindow::GetCurrentOrientation() const
-{
- return ConvertToOrientation(mTotalRotationAngle);
-}
-
-void GlWindow::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
-{
- Dali::Vector<float>::SizeType count = orientations.Count();
- for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
- {
- if(IsOrientationAvailable(orientations[index]) == false)
- {
- DALI_LOG_ERROR("Window::SetAvailableRotationAngles, invalid angle: %d\n", orientations[index]);
- continue;
- }
-
- bool found = false;
- int angle = ConvertToAngle(orientations[index]);
-
- for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
- {
- if(mAvailableAngles[i] == angle)
- {
- found = true;
- break;
- }
- }
-
- if(!found)
- {
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, angle);
- mAvailableAngles.push_back(angle);
- }
- }
- SetAvailableAnlges(mAvailableAngles);
-}
-
-void GlWindow::SetPreferredOrientation(WindowOrientation orientation)
-{
- if(IsOrientationAvailable(orientation) == false)
- {
- DALI_LOG_ERROR("Window::SetPreferredOrientation, invalid orientation: %d\n", orientation);
- return;
- }
- mPreferredAngle = ConvertToAngle(orientation);
- DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
- mWindowBase->SetPreferredAngle(mPreferredAngle);
-}
-
-void GlWindow::SetChild(Dali::Window& child)
-{
- if(DALI_UNLIKELY(child))
- {
- mChildWindow = child;
- Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(mChildWindow);
- WindowRenderSurface* renderSurface = static_cast<WindowRenderSurface*>(windowImpl.GetSurface());
- if(renderSurface)
- {
- WindowBase* childWindowBase = renderSurface->GetWindowBase();
- if(childWindowBase)
- {
- childWindowBase->SetParent(mWindowBase.get(), false);
- }
- }
- }
-}
-
-void GlWindow::RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
-{
- if(mIsEGLInitialized == false)
- {
- InitializeGraphics();
- }
- mGlWindowRenderThread->RegisterGlCallbacks(initCallback, renderFrameCallback, terminateCallback);
- mGlWindowRenderThread->Start();
-}
-
-void GlWindow::RenderOnce()
-{
- if(mGlWindowRenderThread)
- {
- mGlWindowRenderThread->RenderOnce();
- }
-}
-
-void GlWindow::SetRenderingMode(Dali::GlWindow::RenderingMode mode)
-{
- mRenderingMode = mode;
- if(mGlWindowRenderThread)
- {
- bool onDemand = false;
- if(mRenderingMode == Dali::GlWindow::RenderingMode::ON_DEMAND)
- {
- onDemand = true;
- }
- mGlWindowRenderThread->SetOnDemandRenderMode(onDemand);
- }
-}
-
-Dali::GlWindow::RenderingMode GlWindow::GetRenderingMode() const
-{
- return mRenderingMode;
-}
-
-void GlWindow::InitializeGraphics()
-{
- if(!mIsEGLInitialized)
- {
- // Init Graphics
- std::unique_ptr<GraphicsFactory> graphicsFactoryPtr = Utils::MakeUnique<GraphicsFactory>(mEnvironmentOptions);
- auto graphicsFactory = *graphicsFactoryPtr;
-
- mGraphics = std::unique_ptr<Graphics::GraphicsInterface>(&graphicsFactory.Create());
-
- Graphics::GraphicsInterface* graphics = mGraphics.get();
-
- mDisplayConnection = std::unique_ptr<Dali::DisplayConnection>(Dali::DisplayConnection::New(Dali::Integration::RenderSurfaceInterface::Type::WINDOW_RENDER_SURFACE));
- graphics->Initialize(*mDisplayConnection, mDepth, mStencil, false, mMSAA);
-
- // Create Render Thread
- mGlWindowRenderThread = std::unique_ptr<Dali::Internal::Adaptor::GlWindowRenderThread>(new GlWindowRenderThread(mPositionSize, mColorDepth));
- if(!mGlWindowRenderThread)
- {
- DALI_LOG_ERROR("Fail to create GlWindow Render Thread!!!!\n");
- return;
- }
-
- mGlWindowRenderThread->SetGraphicsInterface(graphics);
- mGlWindowRenderThread->SetWindowBase(mWindowBase.get());
- bool onDemand = false;
- if(mRenderingMode == Dali::GlWindow::RenderingMode::ON_DEMAND)
- {
- onDemand = true;
- }
- mGlWindowRenderThread->SetOnDemandRenderMode(onDemand);
-
- mIsEGLInitialized = true;
-
- // Check screen rotation
- int newScreenRotationAngle = mWindowBase->GetScreenRotationAngle();
- DALI_LOG_RELEASE_INFO("GlWindow::InitializeGraphics(), GetScreenRotationAngle(): %d\n", mScreenRotationAngle);
- if(newScreenRotationAngle != 0)
- {
- UpdateScreenRotation(newScreenRotationAngle);
- }
- }
-}
-
-void GlWindow::OnDamaged(const DamageArea& area)
-{
-}
-
-void GlWindow::UpdateScreenRotation(int newAngle)
-{
- mScreenRotationAngle = newAngle;
- mTotalRotationAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
-
- if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
- {
- mWindowWidth = mPositionSize.height;
- mWindowHeight = mPositionSize.width;
- }
- else
- {
- mWindowWidth = mPositionSize.width;
- mWindowHeight = mPositionSize.height;
- }
-
- // Emit Resize signal
- Dali::GlWindow handle(this);
- mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
-
- if(mGlWindowRenderThread)
- {
- DALI_LOG_RELEASE_INFO("GlWindow::UpdateScreenRotation(), RequestScreenRotatem(), mScreenRotationAngle: %d\n", mScreenRotationAngle);
- mGlWindowRenderThread->RequestScreenRotate(mScreenRotationAngle);
- }
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
-#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
-
-/*
- * Copyright (c) 2024 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 <dali/public-api/adaptor-framework/window.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/ref-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/gl-window.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/graphics/gles/egl-graphics.h>
-#include <dali/internal/window-system/common/event-handler.h>
-#include <dali/internal/window-system/common/gl-window-render-thread.h>
-
-namespace Dali
-{
-class Adaptor;
-
-namespace Internal
-{
-namespace Adaptor
-{
-class WindowBase;
-
-class GlWindow;
-using GlWindowPtr = IntrusivePtr<GlWindow>;
-using EventHandlerPtr = IntrusivePtr<EventHandler>;
-
-/**
- * Window provides a surface to render onto with orientation.
- */
-class GlWindow : public BaseObject, public EventHandler::Observer, public DamageObserver, public ConnectionTracker
-{
-public:
- using KeyEventSignalType = Dali::GlWindow::KeyEventSignalType;
- using TouchEventSignalType = Dali::GlWindow::TouchEventSignalType;
- using FocusChangeSignalType = Dali::GlWindow::FocusChangeSignalType;
- using ResizeSignalType = Dali::GlWindow::ResizeSignalType;
- using VisibilityChangedSignalType = Dali::GlWindow::VisibilityChangedSignalType;
- using SignalType = Signal<void()>;
-
- /**
- * @brief Create a new GlWindow. This should only be called once by the Application class
- * @param[in] positionSize The position and size of the window
- * @param[in] name The window title
- * @param[in] className The window class name
- * @param[in] isTransparent Whether window is transparent
- * @return A newly allocated Window
- */
- static GlWindow* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
-
- /**
- * @copydoc Dali::GlWindow::SetGraphicsConfig()
- */
- void SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version);
-
- /**
- * @copydoc Dali::GlWindow::Raise()
- */
- void Raise();
-
- /**
- * @copydoc Dali::GlWindow::Lower()
- */
- void Lower();
-
- /**
- * @copydoc Dali::GlWindow::Activate()
- */
- void Activate();
-
- /**
- * @copydoc Dali::GlWindow::Show()
- */
- void Show();
-
- /**
- * @copydoc Dali::GlWindow::Hide()
- */
- void Hide();
-
- /**
- * @copydoc Dali::GlWindow::GetSupportedAuxiliaryHintCount()
- */
- unsigned int GetSupportedAuxiliaryHintCount() const;
-
- /**
- * @copydoc Dali::GlWindow::GetSupportedAuxiliaryHint()
- */
- std::string GetSupportedAuxiliaryHint(unsigned int index) const;
-
- /**
- * @copydoc Dali::GlWindow::AddAuxiliaryHint()
- */
- unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value);
-
- /**
- * @copydoc Dali::GlWindow::RemoveAuxiliaryHint()
- */
- bool RemoveAuxiliaryHint(unsigned int id);
-
- /**
- * @copydoc Dali::GlWindow::SetAuxiliaryHintValue()
- */
- bool SetAuxiliaryHintValue(unsigned int id, const std::string& value);
-
- /**
- * @copydoc Dali::GlWindow::GetAuxiliaryHintValue()
- */
- std::string GetAuxiliaryHintValue(unsigned int id) const;
-
- /**
- * @copydoc Dali::GlWindow::GetAuxiliaryHintId()
- */
- unsigned int GetAuxiliaryHintId(const std::string& hint) const;
-
- /**
- * @copydoc Dali::GlWindow::SetInputRegion()
- */
- void SetInputRegion(const Rect<int>& inputRegion);
-
- /**
- * @copydoc Dali::GlWindow::SetOpaqueState()
- */
- void SetOpaqueState(bool opaque);
-
- /**
- * @copydoc Dali::GlWindow::IsOpaqueState()
- */
- bool IsOpaqueState() const;
-
- /**
- * @copydoc Dali::GlWindow::SetPositionSize()
- */
- void SetPositionSize(PositionSize positionSize);
-
- /**
- * @copydoc Dali::GlWindow::GetPositionSize()
- */
- PositionSize GetPositionSize() const;
-
- /**
- * @copydoc Dali::GlWindow::GetCurrentOrientation() const
- */
- WindowOrientation GetCurrentOrientation() const;
-
- /**
- * @copydoc Dali::GlWindow::SetAvailableOrientations()
- */
- void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
-
- /**
- * @copydoc Dali::GlWindow::SetPreferredOrientation()
- */
- void SetPreferredOrientation(WindowOrientation orientation);
-
- /**
- * @copydoc Dali::GlWindow::RegisterGlCallbacks()
- */
- void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
-
- /**
- * @copydoc Dali::GlWindow::RenderOnce()
- */
- void RenderOnce();
-
- /**
- * @copydoc Dali::GlWindow::SetRenderingMode()
- */
- void SetRenderingMode(Dali::GlWindow::RenderingMode mode);
-
- /**
- * @copydoc Dali::GlWindow::GetRenderingMode()
- */
- Dali::GlWindow::RenderingMode GetRenderingMode() const;
-
-public: // For implementation
- /**
- * @brief Sets child window with Dali::Window
- *
- * @param[in] child The child window.
- *
- * Most of cases, child window is the default window in adaptor
- *
- * Currently the child window is default window.
- */
- void SetChild(Dali::Window& child);
-
-private:
- /**
- * Private constructor.
- * @sa Window::New()
- */
- GlWindow();
-
- /**
- * Destructor
- */
- virtual ~GlWindow();
-
- /**
- * Second stage initialization
- *
- * @param[in] positionSize The position and size of the window
- * @param[in] name The window title
- * @param[in] className The window class name
- */
- void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
-
- /**
- * Called when the window becomes iconified or deiconified.
- *
- * @param[in] iconified The flag whether window is iconifed or deiconfied.
- */
- void OnIconifyChanged(bool iconified);
-
- /**
- * Called when the window focus is changed.
- * @param[in] focusIn The flag whether window is focused or not.
- */
- void OnFocusChanged(bool focusIn);
-
- /**
- * Called when the output is transformed.
- */
- void OnOutputTransformed();
-
- /**
- * Called when the window receives a delete request.
- */
- void OnDeleteRequest();
-
- /**
- * @brief Set available rotation angle to window base.
- *
- * @param[in] angles The list of the avaiabled rotation angle.
- */
- void SetAvailableAnlges(const std::vector<int>& angles);
-
- /**
- * @brief Check available window orientation for Available angle.
- *
- * @param[in] orientation the oritation value of window rotation.
- *
- * @return true is available window orientation. false is not available.
- */
- bool IsOrientationAvailable(WindowOrientation orientation) const;
-
- /**
- * @brief Convert from window orientation to angle using orientation mode value.
- *
- * @param[in] orientation the oritation value of window rotation.
- *
- * @return The coverted angle value is returned.
- */
- int ConvertToAngle(WindowOrientation orientation);
-
- /**
- * @brief Convert from angle to window orientation using orientation mode value.
- *
- * @param[in] angle the angle value of window rotation.
- *
- * @return The converted window orientation value is returned.
- */
- WindowOrientation ConvertToOrientation(int angle) const;
-
- /**
- * @brief Initialize and create EGL resource
- */
- void InitializeGraphics();
-
- /**
- * @brief Sets event handler for window's events.
- */
- void SetEventHandler();
-
- /**
- * @brief calculate screen position for rotation.
- */
- Vector2 RecalculatePosition(const Vector2& position);
-
- /**
- * @brief Sets window and class name.
- *
- * @param[in] name The name of the window
- * @param[in] className The class of the window
- */
- void SetClass(const std::string& name, const std::string className);
-
-private:
- /**
- * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint
- */
- void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnMouseFrameEvent
- */
- void OnMouseFrameEvent() override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
- */
- void OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent
- */
- void OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation
- */
- void OnRotation(const RotationEvent& rotation) override;
-
-private: // From Dali::Internal::Adaptor::DamageObserver
- /**
- * @copydoc Dali::Internal::Adaptor::DamageObserver::OnDamaged()
- */
- void OnDamaged(const DamageArea& area);
-
- /**
- * @brief Updates screen rotation value and screen rotation works.
- *
- * @param[in] newAngle new screen rotation angle
- */
- void UpdateScreenRotation(int newAngle);
-
-public: // Signals
- /**
- * @copydoc Dali::GlWindow::FocusChangeSignal()
- */
- FocusChangeSignalType& FocusChangeSignal()
- {
- return mFocusChangeSignal;
- }
-
- /**
- * @copydoc Dali::GlWindow::ResizeSignal()
- */
- ResizeSignalType& ResizeSignal()
- {
- return mResizeSignal;
- }
-
- /**
- * @copydoc Dali::GlWindow::KeyEventSignal()
- */
- KeyEventSignalType& KeyEventSignal()
- {
- return mKeyEventSignal;
- }
-
- /**
- * @copydoc Dali::GlWindow::TouchSignal()
- */
- TouchEventSignalType& TouchedSignal()
- {
- return mTouchedSignal;
- }
-
- /**
- * @copydoc Dali::GlWindow::VisibilityChangedSignal()
- */
- VisibilityChangedSignalType& VisibilityChangedSignal()
- {
- return mVisibilityChangedSignal;
- }
-
-private:
- std::unique_ptr<WindowBase> mWindowBase;
- std::unique_ptr<Graphics::GraphicsInterface> mGraphics; ///< Graphics interface
- std::unique_ptr<Dali::DisplayConnection> mDisplayConnection; ///< The native display connection
- std::unique_ptr<GlWindowRenderThread> mGlWindowRenderThread; ///< The render thread
- EventHandlerPtr mEventHandler; ///< The window events handler
- Dali::Window mChildWindow; ///< The default child UI Window
- std::string mName;
- std::string mClassName;
- bool mIsTransparent : 1;
- bool mIsFocusAcceptable : 1;
- bool mIconified : 1;
- bool mOpaqueState : 1;
- bool mResizeEnabled : 1;
- bool mVisible : 1;
- bool mIsWindowRotated : 1;
- bool mIsTouched : 1;
- bool mIsEGLInitialized : 1;
- bool mDepth : 1;
- bool mStencil : 1;
-
- PositionSize mPositionSize; ///< The window position and size
- EnvironmentOptions mEnvironmentOptions;
- std::vector<int> mAvailableAngles; ///< The list of available angle
- ColorDepth mColorDepth; ///< The color depth of window
- Dali::GlWindow::RenderingMode mRenderingMode; ///< The rendering mode
-
- int mPreferredAngle; ///< The angle of preferred angle
- int mTotalRotationAngle; ///< The angle of window + screen rotation angle % 360
- int mWindowRotationAngle; ///< The angle of window rotation angle
- int mScreenRotationAngle; ///< The angle of screen rotation angle
- int mOrientationMode; ///< 0: Default portrati, 1:Default landscape
- int mWindowWidth; ///< The width of the window
- int mWindowHeight; ///< The height of the window
- int mNativeWindowId; ///< The Native Window Id
- int mMSAA; ///< The multisample anti-aliasing for EGL Configuration
-
- // Signals
- KeyEventSignalType mKeyEventSignal;
- TouchEventSignalType mTouchedSignal;
- FocusChangeSignalType mFocusChangeSignal;
- ResizeSignalType mResizeSignal;
- VisibilityChangedSignalType mVisibilityChangedSignal;
-};
-
-} // namespace Adaptor
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::Adaptor::GlWindow& GetImplementation(Dali::GlWindow& window)
-{
- DALI_ASSERT_ALWAYS(window && "Window handle is empty");
- BaseObject& object = window.GetBaseObject();
- return static_cast<Internal::Adaptor::GlWindow&>(object);
-}
-
-inline const Internal::Adaptor::GlWindow& GetImplementation(const Dali::GlWindow& window)
-{
- DALI_ASSERT_ALWAYS(window && "Window handle is empty");
- const BaseObject& object = window.GetBaseObject();
- return static_cast<const Internal::Adaptor::GlWindow&>(object);
-}
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
+++ /dev/null
-/*
- * Copyright (c) 2024 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 <dali/devel-api/adaptor-framework/thread-settings.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/system/common/time-service.h>
-#include <dali/internal/window-system/common/gl-window-render-thread.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-namespace
-{
-constexpr unsigned int NANOSECONDS_PER_SECOND(1e+9);
-
-// The following values will get calculated at compile time
-constexpr float DEFAULT_FRAME_DURATION_IN_SECONDS(1.0f / 60.0f);
-constexpr uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS(DEFAULT_FRAME_DURATION_IN_SECONDS* NANOSECONDS_PER_SECOND);
-constexpr uint64_t REFRESH_RATE(1u);
-
-constexpr int MINIMUM_DIMENSION_CHANGE(1);
-} // namespace
-
-GlWindowRenderThread::GlWindowRenderThread(PositionSize positionSize, ColorDepth colorDepth)
-: mGraphics(nullptr),
- mWindowBase(nullptr),
- mWindowRotationTrigger(),
- mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
- mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
- mPositionSize(positionSize),
- mColorDepth(colorDepth),
- mGLInitCallback(),
- mGLRenderFrameCallback(),
- mGLTerminateCallback(),
- mEGLSurface(nullptr),
- mEGLContext(nullptr),
- mDepth(false),
- mStencil(false),
- mIsEGLInitialize(false),
- mGLESVersion(30), //Default GLES version 30
- mMSAA(0),
- mWindowRotationAngle(0),
- mScreenRotationAngle(0),
- mRenderThreadWaitCondition(),
- mDestroyRenderThread(0),
- mPauseRenderThread(0),
- mRenderingMode(0),
- mRequestRenderOnce(0),
- mSurfaceStatus(0),
- mPostRendering(0),
- mDefaultFrameDurationNanoseconds(REFRESH_RATE * DEFAULT_FRAME_DURATION_IN_NANOSECONDS)
-{
-}
-
-GlWindowRenderThread::~GlWindowRenderThread()
-{
-}
-
-void GlWindowRenderThread::SetGraphicsInterface(Graphics::GraphicsInterface* graphics)
-{
- mGraphics = graphics;
-}
-
-void GlWindowRenderThread::SetWindowBase(WindowBase* windowBase)
-{
- mWindowBase = windowBase;
-}
-
-void GlWindowRenderThread::SetGraphicsConfig(bool depth, bool stencil, int msaa, int version)
-{
- mDepth = depth;
- mStencil = stencil;
- mMSAA = msaa;
- mGLESVersion = version;
-}
-
-void GlWindowRenderThread::Pause()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mPauseRenderThread = 1;
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Pause()\n");
-}
-
-void GlWindowRenderThread::Resume()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mPauseRenderThread = 0;
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Resume()\n");
- mRenderThreadWaitCondition.Notify(lock);
-}
-
-void GlWindowRenderThread::Stop()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mDestroyRenderThread = 1;
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Stop()\n");
- mRenderThreadWaitCondition.Notify(lock);
-}
-
-void GlWindowRenderThread::RegisterGlCallbacks(CallbackBase* initCallback,
- CallbackBase* renderFrameCallback,
- CallbackBase* terminateCallback)
-{
- mGLInitCallback = std::unique_ptr<CallbackBase>(initCallback);
- mGLRenderFrameCallback = std::unique_ptr<CallbackBase>(renderFrameCallback);
- mGLTerminateCallback = std::unique_ptr<CallbackBase>(terminateCallback);
-}
-
-void GlWindowRenderThread::SetOnDemandRenderMode(bool onDemand)
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mRenderingMode = static_cast<unsigned int>(onDemand);
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::SetOnDemandRenderMode(): mRenderingMode: %d\n", mRenderingMode);
- if(!onDemand)
- {
- mRenderThreadWaitCondition.Notify(lock);
- }
-}
-
-void GlWindowRenderThread::RenderOnce()
-{
- // Most of all, this function is called in event thread
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mRequestRenderOnce = 1;
- mRenderThreadWaitCondition.Notify(lock);
-}
-
-void GlWindowRenderThread::RequestWindowResize(int width, int height)
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- // Check resizing
- if((fabs(width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
- (fabs(height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
- {
- mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::RESIZED); // Set bit for window resized
- mPositionSize.width = width;
- mPositionSize.height = height;
-
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestWindowResize(), width:%d, height:%d\n", width, height);
- mRenderThreadWaitCondition.Notify(lock);
- }
-}
-
-void GlWindowRenderThread::RequestWindowRotate(int windowAngle)
-{
- if(!mWindowRotationTrigger)
- {
- mWindowRotationTrigger = std::unique_ptr<TriggerEventInterface>(TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &GlWindowRenderThread::WindowRotationCompleted),
- TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
- }
-
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- if(mWindowRotationAngle != windowAngle)
- {
- mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::WINDOW_ROTATED); // Set bit for window rotation
- mWindowRotationAngle = windowAngle;
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestWindowRotate(): %d\n", windowAngle);
- mRenderThreadWaitCondition.Notify(lock);
- }
-}
-
-void GlWindowRenderThread::RequestScreenRotate(int screenAngle)
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- if(mScreenRotationAngle != screenAngle)
- {
- mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::SCREEN_ROTATED); // Set bit for screen rotation
- mScreenRotationAngle = screenAngle;
- DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestScreenRotate(): %d\n", screenAngle);
- mRenderThreadWaitCondition.Notify(lock);
- }
-}
-
-void GlWindowRenderThread::WindowRotationCompleted()
-{
- mWindowBase->WindowRotationCompleted(mWindowRotationAngle, mPositionSize.width, mPositionSize.height);
-
- PostRenderFinish();
-}
-
-unsigned int GlWindowRenderThread::GetSurfaceStatus(int& windowRotationAngle, int& screenRotationAngle)
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
-
- // Get the surface status and reset that.
- unsigned int status = mSurfaceStatus;
- mSurfaceStatus = static_cast<unsigned int>(SurfaceStatus::NO_CHANGED);
-
- windowRotationAngle = mWindowRotationAngle;
- screenRotationAngle = mScreenRotationAngle;
-
- return status;
-}
-
-void GlWindowRenderThread::Run()
-{
- Dali::SetThreadName("GlWindowRenderThread");
- mLogFactory.InstallLogFunction();
- mTraceFactory.InstallTraceFunction();
-
- int renderFrameResult = 0;
- unsigned int isSurfaceChanged = 0;
- bool isWindowResized = false, isWindowRotated = false, isScreenRotated = false;
- int windowRotationAngle = 0, screenRotationAngle = 0, totalAngle = 0;
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(mGraphics);
-
- Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-
- InitializeGraphics(eglGraphics);
-
- eglImpl.MakeContextCurrent(mEGLSurface, mEGLContext);
-
- if(mGLInitCallback)
- {
- CallbackBase::Execute(*mGLInitCallback);
- }
-
- uint64_t timeToSleepUntil = 0;
-
- while(RenderReady(timeToSleepUntil))
- {
- uint64_t currentFrameStartTime = 0;
- TimeService::GetNanoseconds(currentFrameStartTime);
-
- if(mGLRenderFrameCallback)
- {
- // PreRender
- isSurfaceChanged = GetSurfaceStatus(windowRotationAngle, screenRotationAngle);
- if(DALI_UNLIKELY(isSurfaceChanged))
- {
- isWindowResized = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::RESIZED)) ? true : false;
- isWindowRotated = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::WINDOW_ROTATED)) ? true : false;
- isScreenRotated = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::SCREEN_ROTATED)) ? true : false;
- totalAngle = (windowRotationAngle + screenRotationAngle) % 360;
-
- if(isWindowRotated || isScreenRotated)
- {
- mWindowBase->SetWindowBufferTransform(totalAngle);
- if(isWindowRotated)
- {
- mWindowBase->SetWindowTransform(windowRotationAngle);
- }
- }
-
- if(isWindowResized)
- {
- Dali::PositionSize positionSize;
- positionSize.x = mPositionSize.x;
- positionSize.y = mPositionSize.y;
- if(totalAngle == 0 || totalAngle == 180)
- {
- positionSize.width = mPositionSize.width;
- positionSize.height = mPositionSize.height;
- }
- else
- {
- positionSize.width = mPositionSize.height;
- positionSize.height = mPositionSize.width;
- }
- mWindowBase->ResizeWindow(positionSize);
- }
- }
-
- // Render
- renderFrameResult = CallbackBase::ExecuteReturn<int>(*mGLRenderFrameCallback);
-
- // PostRender
- if(DALI_UNLIKELY(isWindowRotated))
- {
- PostRenderStart();
-
- mWindowRotationTrigger->Trigger();
-
- PostRenderWaitForFinished();
- isWindowRotated = false;
- }
-
- // buffer commit
- if(renderFrameResult)
- {
- eglImpl.SwapBuffers(mEGLSurface);
- }
- }
- renderFrameResult = 0;
-
- if(timeToSleepUntil == 0)
- {
- timeToSleepUntil = currentFrameStartTime + mDefaultFrameDurationNanoseconds;
- }
- else
- {
- timeToSleepUntil += mDefaultFrameDurationNanoseconds;
- uint64_t currentFrameEndTime = 0;
- TimeService::GetNanoseconds(currentFrameEndTime);
- while(currentFrameEndTime > timeToSleepUntil + mDefaultFrameDurationNanoseconds)
- {
- timeToSleepUntil += mDefaultFrameDurationNanoseconds;
- }
- }
-
- TimeService::SleepUntil(timeToSleepUntil);
- }
-
- if(mGLTerminateCallback)
- {
- CallbackBase::Execute(*mGLTerminateCallback);
- }
-
- if(mIsEGLInitialize)
- {
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(mGraphics);
- Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-
- if(mEGLSurface)
- {
- eglImpl.DestroySurface(mEGLSurface);
- mEGLSurface = nullptr;
- }
-
- if(mEGLContext)
- {
- eglImpl.DestroyContext(mEGLContext);
- mEGLContext = nullptr;
- }
-
- eglImpl.TerminateGles();
- }
-}
-
-void GlWindowRenderThread::InitializeGraphics(EglGraphics* eglGraphics)
-{
- mIsEGLInitialize = true;
-
- Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- eglImpl.SetGlesVersion(mGLESVersion);
-
- if(eglImpl.ChooseConfig(true, mColorDepth) == false)
- {
- if(mGLESVersion == 30)
- {
- DALI_LOG_RELEASE_INFO("InitializeGraphics: Fail to choose config with GLES30, retry with GLES20\n");
- eglImpl.SetGlesVersion(20);
- mGLESVersion = 20;
- if(eglImpl.ChooseConfig(true, mColorDepth) == false)
- {
- DALI_LOG_ERROR("InitializeGraphics: Fail to choose config with GLES20");
- return;
- }
- }
- else
- {
- DALI_LOG_ERROR("InitializeGraphics: Fail to choose config with GLES20");
- return;
- }
- }
- eglImpl.CreateWindowContext(mEGLContext);
-
- // Create the EGL window
- Dali::Any window = mWindowBase->CreateWindow(mPositionSize.width, mPositionSize.height);
- mEGLSurface = eglImpl.CreateSurfaceWindow(reinterpret_cast<EGLNativeWindowType>(window.Get<void*>()), mColorDepth);
-}
-
-bool GlWindowRenderThread::RenderReady(uint64_t& timeToSleepUntil)
-{
- ConditionalWait::ScopedLock updateLock(mRenderThreadWaitCondition);
- while((!mDestroyRenderThread && mRenderingMode && !mRequestRenderOnce && !mSurfaceStatus) || mPauseRenderThread)
- {
- timeToSleepUntil = 0;
- mRenderThreadWaitCondition.Wait(updateLock);
- }
-
- mRequestRenderOnce = 0;
- // Keep the update-render thread alive if this thread is NOT to be destroyed
- return !mDestroyRenderThread;
-}
-
-void GlWindowRenderThread::PostRenderStart()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mPostRendering = false;
-}
-
-void GlWindowRenderThread::PostRenderFinish()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- mPostRendering = true;
- mRenderThreadWaitCondition.Notify(lock);
-}
-
-void GlWindowRenderThread::PostRenderWaitForFinished()
-{
- ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
- while(!mPostRendering && !mDestroyRenderThread)
- {
- mRenderThreadWaitCondition.Wait(lock);
- }
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_RENDER_THREAD_H
-#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_RENDER_THREAD_H
-
-/*
- * Copyright (c) 2024 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 <dali/devel-api/threading/conditional-wait.h>
-#include <dali/devel-api/threading/thread.h>
-#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
-#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles/egl-graphics.h>
-#include <dali/internal/window-system/common/window-base.h>
-
-namespace Dali
-{
-class Adaptor;
-class TriggerEventInterface;
-
-namespace Internal
-{
-namespace Adaptor
-{
-class WindowBase;
-class GlWindow;
-
-/**
- * @brief It is for render thread for GlWindow.
- * User callbacks works in the thread.
- *
- * Key Points:
- * 1. Two Threads:
- * a. Main/Event Thread.
- * b. Render Thread.
- * 2. There is NO VSync thread:
- * a. We calculate the difference between these two times and if:
- * i. The difference is less than the default frame time, we sleep.
- * ii. If it’s more or the same, we continue.
- * 3. Support Rendering mode
- * a. CONTINUOUS mode
- * i. The rendering loop works continuously.
- * b. ON_DEMAND mode
- * i. The rendering works by user's request.
- * ii. User's request is the renderOnce()'s function calling.
- */
-
-class GlWindowRenderThread : public Dali::Thread
-{
-public:
- /**
- * @brief Enumeration for GlWindow Surface status type
- * It has the status as resized, window is rotated and screen is rotated.
- *
- */
- enum class SurfaceStatus
- {
- NO_CHANGED = 0x00, ///< no changed,
- RESIZED = 0x01, ///< When surface is resized,
- WINDOW_ROTATED = 0x02, ///< When window is rotated,
- SCREEN_ROTATED = 0x04 ///< When screen is rotated,
- };
-
- /**
- * Constructor
- *
- * @param[in] positionSize The position and size of the physical window
- * @param[in] depth color depth of the physical window
- */
- GlWindowRenderThread(PositionSize positionSize, ColorDepth colorDepth);
-
- /**
- * destructor.
- */
- virtual ~GlWindowRenderThread();
-
- /**
- * Sets the GraphicsInterface instance.
- * This graphics instance is used to create and initialize graphics resource
- *
- * @param[in] graphics The graphice instance
- */
- void SetGraphicsInterface(Graphics::GraphicsInterface* graphics);
-
- /**
- * Sets the WindowBase instance
- * This WindowBase instance is used to call wl egl window APIs.
- *
- * @param[in] windowBase The WindowBase instance
- */
- void SetWindowBase(WindowBase* windowBase);
-
- /**
- * @brief Sets graphics configuration for GlWindow
- *
- * @param[in] depth the flag of depth buffer. If true is set, 24bit depth buffer is enabled.
- * @param[in] stencil the flag of stencil. it true is set, 8bit stencil buffer is enabled.
- * @param[in] msaa the bit of msaa.
- * @param[in] version the GLES version.
- *
- */
- void SetGraphicsConfig(bool depth, bool stencil, int msaa, int version);
-
- /**
- * Pauses the Render Thread.
- * It is called when GlWindow is iconified or hidden.
- *
- * This will lock the mutex in mRenderThreadWaitCondition.
- */
- void Pause();
-
- /**
- * Resumes the Render Thread.
- * It is called when GlWindow is de-iconified or shown.
- *
- * This will lock the mutex in mRenderThreadWaitCondition.
- */
- void Resume();
-
- /**
- * Stops the Render Thread.
- * This will lock the mutex in mRenderThreadWaitCondition.
- *
- * @note Should only be called in Stop as calling this will kill the render thread.
- */
- void Stop();
-
- /**
- * @copydoc Dali::GlWindow::RegisterGlCallbacks()
- */
- void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
-
- /**
- * Enable OnDemand Rendering Mode
- *
- * @param[in] onDemand the flag of OnDemand Rendering Mode. If the flag is true, rendering mode is OnDemand, otherwise the flag is false, rendering mode is continuous mode.
- */
- void SetOnDemandRenderMode(bool onDemand);
-
- /**
- * @copydoc Dali::GlWindow::RenderOnce()
- */
- void RenderOnce();
-
- /**
- * Requests the window resize to GlWindow's render thread.
- *
- * @param[in] width new width.
- * @param[in] height new height.
- */
- void RequestWindowResize(int width, int height);
-
- /**
- * Requests the window rotation to GlWindow's render thread.
- *
- * @param[in] windowAngle the window rotation's angle as 0, 90, 180 and 270.
- */
- void RequestWindowRotate(int windowAngle);
-
- /**
- * Requests the screen rotation to GlWindow's render thread.
- *
- * @param[in] screenAngle the screen rotation's angle as 0, 90, 180 and 270.
- */
- void RequestScreenRotate(int screenAngle);
-
-protected:
- /**
- * The Render thread loop. This thread will be destroyed on exit from this function.
- */
- virtual void Run();
-
-private:
- /**
- * @brief Initialize and create EGL resource
- */
- void InitializeGraphics(EglGraphics* eglGraphics);
-
- /**
- * Called by the Render Thread which ensures a wait if required.
- *
- * @param[out] timeToSleepUntil The time remaining in nanoseconds to keep the thread sleeping before resuming.
- * @return false, if the thread should stop.
- */
- bool RenderReady(uint64_t& timeToSleepUntil);
-
- /**
- * In the Tizen world, when GlWindow rotation is finished in client side,
- * the completed message should be sent to display server.
- * This function should be called in the event thread after buffer is committed.
- */
- void WindowRotationCompleted();
-
- /**
- * Gets window's current surface status
- *
- * @brief This function return window's current surface status.
- * The status has the the information of window resized, window rotated and screen rotated.
- * After called, the status value is reset
- *
- * @[output] windowRotationAngle return current window rotation angle.
- * @[output] screenRotationAngle return current screen rotation angle.
- * @return the window's current surface status.
- */
- unsigned int GetSurfaceStatus(int& windowRotationAngle, int& screenRotationAngle);
-
- /**
- * Starts post rendering process
- *
- * @brief Starts post rendering process for window rotation
- * It is to pause the render thread until maint thread finishes the window rotation work.
- */
- void PostRenderStart();
-
- /**
- * Finishs post rendering process
- *
- * @brief Finishes post rendering process for window rotation
- * It set the resume flag for resume the render thread.
- */
- void PostRenderFinish();
-
- /**
- * Pauses the render thread unitil post rendering process
- *
- * @brief Pauses the render thread until main thread works window rotation.
- */
- void PostRenderWaitForFinished();
-
-private:
- Graphics::GraphicsInterface* mGraphics; ///< Graphics interface
- WindowBase* mWindowBase;
- std::unique_ptr<TriggerEventInterface> mWindowRotationTrigger;
-
- const Dali::LogFactoryInterface& mLogFactory;
- const Dali::TraceFactoryInterface& mTraceFactory;
-
- PositionSize mPositionSize; ///< Position
- ColorDepth mColorDepth;
-
- // EGL, GL Resource
- std::unique_ptr<CallbackBase> mGLInitCallback;
- std::unique_ptr<CallbackBase> mGLRenderFrameCallback;
- std::unique_ptr<CallbackBase> mGLTerminateCallback;
- EGLSurface mEGLSurface;
- EGLContext mEGLContext;
- bool mDepth : 1;
- bool mStencil : 1;
- bool mIsEGLInitialize : 1;
- int mGLESVersion;
- int mMSAA;
- int mWindowRotationAngle; ///< The angle of window rotation angle
- int mScreenRotationAngle; ///< The angle of screen rotation angle
-
- // To manage the render/main thread
- ConditionalWait mRenderThreadWaitCondition; ///< The wait condition for the update-render-thread.
- volatile unsigned int mDestroyRenderThread; ///< Stop render thread. It means this rendter thread will be destoried.
- volatile unsigned int mPauseRenderThread; ///< Sleep render thread by pause.
- volatile unsigned int mRenderingMode; ///< Rendering Mode, 0: continuous, 1:OnDemad
- volatile unsigned int mRequestRenderOnce; ///< Request rendering once
- volatile unsigned int mSurfaceStatus; ///< When surface is changed as resized or rotated, this flag is set. 0: No changed, 1:resized, 2:window rotation, 4:screen rotation
- volatile unsigned int mPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread).
-
- uint64_t mDefaultFrameDurationNanoseconds; ///< Default duration of a frame (used for sleeping if not enough time elapsed). Not protected by lock, but written to rarely so not worth adding a lock when reading.
-
-}; // GlWindowRenderThread
-
-} // namespace Adaptor
-} // namespace Internal
-} // namespace Dali
-
-#endif
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/common/native-image-surface-factory.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+#include <dali/internal/window-system/common/native-image-surface-impl.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) std::unique_ptr<Dali::Internal::Adaptor::NativeImageSurface> NativeImageSurfaceFactory::CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr queue)
+{
+ return GraphicsLibrary::CreateNativeImageSurface(queue);
+}
+} // namespace Dali::Internal::Adaptor
#define DALI_INTERNAL_NATIVE_IMAGE_SURFACE_FACTORY_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
*
* @param [in] queue the native image surface handle
* @return A pointer to a newly allocated surface
+ *
+ * Needs exporting as it's called by one of the the other libraries
*/
- static std::unique_ptr<Dali::Internal::Adaptor::NativeImageSurface> CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr queue);
+ static DALI_ADAPTOR_API std::unique_ptr<Dali::Internal::Adaptor::NativeImageSurface> CreateNativeImageSurface(Dali::NativeImageSourceQueuePtr queue);
};
} // namespace Adaptor
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL HEADERS
+#include <dali/internal/graphics/common/graphics-library.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) std::unique_ptr<RenderSurfaceFactory> GetRenderSurfaceFactory()
+{
+ return GraphicsLibrary::GetRenderSurfaceFactory();
+}
+} // namespace Dali::Internal::Adaptor
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
{
/**
* WindowBase interface
+ *
+ * Needs exporting as it's used by the GlWindow library
*/
-class WindowBase
+class DALI_ADAPTOR_API WindowBase
{
public:
/**
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_FACTORY_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
virtual std::unique_ptr<WindowBase> CreateWindowBase(Dali::PositionSize positionSize, Any surface, bool isTransparent) = 0;
};
-extern std::unique_ptr<WindowFactory> GetWindowFactory();
+// Needs exporting as it's called directly by the GlWindow library
+extern DALI_ADAPTOR_API std::unique_ptr<WindowFactory> GetWindowFactory();
} // namespace Adaptor
} // namespace Internal
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
{
// Create a window render surface
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
- mSurface = renderSurfaceFactory->CreateWindowRenderSurface(positionSize, surface, mIsTransparent);
- mWindowSurface = static_cast<WindowRenderSurface*>(mSurface.get());
+ DALI_ASSERT_DEBUG(renderSurfaceFactory && "Cannot create render surface factory\n");
+
+ mSurface = renderSurfaceFactory->CreateWindowRenderSurface(positionSize, surface, mIsTransparent);
+ mWindowSurface = static_cast<WindowRenderSurface*>(mSurface.get());
// Get a window base
mWindowBase = mWindowSurface->GetWindowBase();
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_RENDER_SURFACE_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
/**
* Window interface of render surface.
+ *
+ * Needs exporting as it's called by the Graphics Libraries
*/
-class WindowRenderSurface : public Dali::Integration::RenderSurfaceInterface,
- public ConnectionTracker,
- public Graphics::NativeWindowInterface
+class DALI_ADAPTOR_API WindowRenderSurface : public Dali::Integration::RenderSurfaceInterface,
+ public ConnectionTracker,
+ public Graphics::NativeWindowInterface
{
public:
using RotationFinishedSignalType = Signal<void()>; ///<The signal of window rotation's finished.
#define DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
#include <dali/public-api/object/any.h>
#include <cstdint>
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
namespace Dali
{
namespace Internal
/**
* @brief Get the screen size
+ *
+ * Needs exporting as it's called directly by the GlWindow library
*/
-void GetScreenSize(int32_t& width, int32_t& height);
+void DALI_ADAPTOR_API GetScreenSize(int32_t& width, int32_t& height);
/**
* @brief Update the screen size
${adaptor_window_system_dir}/common/window-system.cpp
)
-SET( adaptor_window_system_common_egl_src_files
- ${adaptor_window_system_dir}/common/gl-window-impl.cpp
- ${adaptor_window_system_dir}/common/gl-window-render-thread.cpp
+SET( adaptor_window_system_gl_window_src_files
+ ${adaptor_window_system_dir}/gl-window/gl-window-addon.cpp
+ ${adaptor_window_system_dir}/gl-window/gl-window-impl.cpp
+ ${adaptor_window_system_dir}/gl-window/gl-window-render-thread.cpp
+)
+
+# module: window-system, backend: common/dynamic
+SET( adaptor_window_system_common_dynamic_src_files
+ ${adaptor_window_system_dir}/common/native-image-surface-factory-dynamic.cpp
+ ${adaptor_window_system_dir}/common/render-surface-factory-dynamic.cpp
)
# module: window-system, backend: tizen-wayland
${adaptor_window_system_dir}/tizen-wayland/ecore-wl2/render-surface-factory-ecore-wl2-vulkan.cpp
)
-# module: window-system, backend: libuv-x11
+# module: window-system, backend: tizen-wayland/dynamic
+SET( adaptor_window_system_tizen_wayland_dynamic_src_files
+ ${adaptor_window_system_dir}/tizen-wayland/display-connection-native-types-dynamic.cpp
+)
+
+# module: window-system, backend: tizen-wayland/graphics-library
+SET( adaptor_window_system_tizen_wayland_graphics_library_src_files
+ ${adaptor_window_system_dir}/tizen-wayland/graphics-library-functions-tizen-wayland.cpp
+)
+
+# module: window-system, backend: x11
SET( adaptor_window_system_x11_src_files
${adaptor_window_system_dir}/x11/display-connection-factory-x.cpp
${adaptor_window_system_dir}/x11/display-connection-impl-x.cpp
${adaptor_window_system_dir}/x11/window-system-x.cpp
)
-# module: window-system, backend: libuv-x11/egl
+# module: window-system, backend: x11/egl
SET( adaptor_window_system_x11_egl_src_files
${adaptor_window_system_dir}/x11/display-connection-native-types-egl.cpp
${adaptor_window_system_dir}/x11/pixmap-render-surface-x.cpp
${adaptor_window_system_dir}/x11/render-surface-factory-x-egl.cpp
)
-# module: window-system, backend: libuv-x11/vulkan
+# module: window-system, backend: x11/vulkan
SET( adaptor_window_system_x11_vulkan_src_files
${adaptor_window_system_dir}/x11/display-connection-native-types-vulkan.cpp
${adaptor_window_system_dir}/x11/render-surface-factory-x-vulkan.cpp
)
+# module: window-system, backend: x11/dynamic
+SET( adaptor_window_system_x11_dynamic_src_files
+ ${adaptor_window_system_dir}/x11/display-connection-native-types-dynamic.cpp
+)
+
+# module: window-system, backend: x11/graphics-library
+SET( adaptor_window_system_x11_graphics_library_src_files
+ ${adaptor_window_system_dir}/x11/graphics-library-functions-x11.cpp
+)
+
# module: window-system, backend: ubuntu-x11
SET( adaptor_window_system_ubuntu_x11_src_files
${adaptor_window_system_dir}/ubuntu-x11/display-connection-factory-x.cpp
${adaptor_window_system_dir}/ubuntu-x11/render-surface-factory-ecore-x-vulkan.cpp
)
+# module: window-system, backend: ubuntu-x11/dynamic
+SET( adaptor_window_system_ubuntu_x11_dynamic_src_files
+ ${adaptor_window_system_dir}/ubuntu-x11/display-connection-native-types-dynamic.cpp
+)
+
+# module: window-system, backend: ubuntu-x11/graphics-library
+SET( adaptor_window_system_ubuntu_x11_graphics_library_src_files
+ ${adaptor_window_system_dir}/ubuntu-x11/graphics-library-functions-ubuntu-x11.cpp
+)
+
# module: window-system, backend: android
SET( adaptor_window_system_android_src_files
${adaptor_window_system_dir}/android/display-connection-factory-android.cpp
--- /dev/null
+/*
+ * Copyright (c) 2025 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 <dali/devel-api/addons/addon-base.h>
+#include <dali/integration-api/debug.h>
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/gl-window.h>
+#include <dali/devel-api/common/addon-binder.h>
+#include <dali/internal/window-system/gl-window/gl-window-impl.h>
+#include <dali/public-api/adaptor-framework/window.h>
+
+using namespace Dali;
+using GlWindowImpl = Internal::Adaptor::GlWindow;
+
+namespace
+{
+const char* const DALI_ADAPTOR_GL_WINDOW_ADDON_NAME("AdaptorGlWindowAddOn");
+
+GlWindow
+GlWindowNew(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent)
+{
+ GlWindow newWindow;
+ Internal::Adaptor::GlWindow* window = Internal::Adaptor::GlWindow::New(positionSize, name, className, isTransparent);
+ newWindow = GlWindow(window);
+
+ const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
+ if(isAdaptorAvailable)
+ {
+ Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+ Dali::WindowContainer windows = adaptor.GetWindows();
+ if(!windows.empty())
+ {
+ window->SetChild(windows[0]);
+ }
+ }
+ return newWindow;
+}
+
+void GlWindowSetGraphicsConfig(GlWindowImpl& glWindowImpl, bool depth, bool stencil, int msaa, GlWindow::GlesVersion version)
+{
+ glWindowImpl.SetGraphicsConfig(depth, stencil, msaa, version);
+}
+
+void GlWindowRaise(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.Raise();
+}
+
+void GlWindowLower(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.Lower();
+}
+
+void GlWindowActivate(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.Activate();
+}
+
+void GlWindowShow(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.Show();
+}
+
+void GlWindowHide(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.Hide();
+}
+
+unsigned int GlWindowGetSupportedAuxiliaryHintCount(const GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.GetSupportedAuxiliaryHintCount();
+}
+
+std::string GlWindowGetSupportedAuxiliaryHint(const GlWindowImpl& glWindowImpl, unsigned int index)
+{
+ return glWindowImpl.GetSupportedAuxiliaryHint(index);
+}
+
+unsigned int GlWindowAddAuxiliaryHint(GlWindowImpl& glWindowImpl, const std::string& hint, const std::string& value)
+{
+ return glWindowImpl.AddAuxiliaryHint(hint, value);
+}
+
+bool GlWindowRemoveAuxiliaryHint(GlWindowImpl& glWindowImpl, unsigned int id)
+{
+ return glWindowImpl.RemoveAuxiliaryHint(id);
+}
+
+bool GlWindowSetAuxiliaryHintValue(GlWindowImpl& glWindowImpl, unsigned int id, const std::string& value)
+{
+ return glWindowImpl.SetAuxiliaryHintValue(id, value);
+}
+
+std::string GlWindowGetAuxiliaryHintValue(const GlWindowImpl& glWindowImpl, unsigned int id)
+{
+ return glWindowImpl.GetAuxiliaryHintValue(id);
+}
+
+unsigned int GlWindowGetAuxiliaryHintId(const GlWindowImpl& glWindowImpl, const std::string& hint)
+{
+ return glWindowImpl.GetAuxiliaryHintId(hint);
+}
+
+void GlWindowSetInputRegion(GlWindowImpl& glWindowImpl, const Rect<int>& inputRegion)
+{
+ glWindowImpl.SetInputRegion(inputRegion);
+}
+
+void GlWindowSetOpaqueState(GlWindowImpl& glWindowImpl, bool opaque)
+{
+ glWindowImpl.SetOpaqueState(opaque);
+}
+
+bool GlWindowIsOpaqueState(const GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.IsOpaqueState();
+}
+
+void GlWindowSetPositionSize(GlWindowImpl& glWindowImpl, PositionSize positionSize)
+{
+ glWindowImpl.SetPositionSize(positionSize);
+}
+
+PositionSize GlWindowGetPositionSize(const GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.GetPositionSize();
+}
+
+WindowOrientation GlWindowGetCurrentOrientation(const GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.GetCurrentOrientation();
+}
+
+void GlWindowSetAvailableOrientations(GlWindowImpl& glWindowImpl, const Dali::Vector<WindowOrientation>& orientations)
+{
+ glWindowImpl.SetAvailableOrientations(orientations);
+}
+
+void GlWindowSetPreferredOrientation(GlWindowImpl& glWindowImpl, WindowOrientation orientation)
+{
+ glWindowImpl.SetPreferredOrientation(orientation);
+}
+
+void GlWindowRegisterGlCallbacks(GlWindowImpl& glWindowImpl, CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
+{
+ glWindowImpl.RegisterGlCallbacks(initCallback, renderFrameCallback, terminateCallback);
+}
+
+void GlWindowRenderOnce(GlWindowImpl& glWindowImpl)
+{
+ glWindowImpl.RenderOnce();
+}
+
+void GlWindowSetRenderingMode(GlWindowImpl& glWindowImpl, GlWindow::RenderingMode mode)
+{
+ glWindowImpl.SetRenderingMode(mode);
+}
+
+GlWindow::RenderingMode GlWindowGetRenderingMode(const GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.GetRenderingMode();
+}
+
+GlWindow::FocusChangeSignalType& GlWindowFocusChangeSignal(GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.FocusChangeSignal();
+}
+
+GlWindow::ResizeSignalType& GlWindowResizeSignal(GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.ResizeSignal();
+}
+
+GlWindow::KeyEventSignalType& GlWindowKeyEventSignal(GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.KeyEventSignal();
+}
+
+GlWindow::TouchEventSignalType& GlWindowTouchedSignal(GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.TouchedSignal();
+}
+
+GlWindow::VisibilityChangedSignalType& GlWindowVisibilityChangedSignal(GlWindowImpl& glWindowImpl)
+{
+ return glWindowImpl.VisibilityChangedSignal();
+}
+
+} // unnamed namespace
+
+class AdaptorGlWindowAddOn : public Dali::AddOns::AddOnBase
+{
+public:
+ void GetAddOnInfo(Dali::AddOnInfo& info) override
+ {
+ info.type = Dali::AddOnType::GENERIC;
+ info.name = DALI_ADAPTOR_GL_WINDOW_ADDON_NAME;
+ info.version = Dali::DALI_ADDON_VERSION(1, 0, 0);
+ info.next = nullptr;
+ }
+
+ /**
+ * Dispatch table for global functions
+ * @return
+ */
+ Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override
+ {
+ static Dali::AddOns::DispatchTable dispatchTable{};
+ if(dispatchTable.Empty())
+ {
+ dispatchTable["GlWindowNew"] = GlWindowNew;
+ dispatchTable["GlWindowSetGraphicsConfig"] = GlWindowSetGraphicsConfig;
+ dispatchTable["GlWindowRaise"] = GlWindowRaise;
+ dispatchTable["GlWindowLower"] = GlWindowLower;
+ dispatchTable["GlWindowActivate"] = GlWindowActivate;
+ dispatchTable["GlWindowShow"] = GlWindowShow;
+ dispatchTable["GlWindowHide"] = GlWindowHide;
+ dispatchTable["GlWindowGetSupportedAuxiliaryHintCount"] = GlWindowGetSupportedAuxiliaryHintCount;
+ dispatchTable["GlWindowGetSupportedAuxiliaryHint"] = GlWindowGetSupportedAuxiliaryHint;
+ dispatchTable["GlWindowAddAuxiliaryHint"] = GlWindowAddAuxiliaryHint;
+ dispatchTable["GlWindowRemoveAuxiliaryHint"] = GlWindowRemoveAuxiliaryHint;
+ dispatchTable["GlWindowSetAuxiliaryHintValue"] = GlWindowSetAuxiliaryHintValue;
+ dispatchTable["GlWindowGetAuxiliaryHintValue"] = GlWindowGetAuxiliaryHintValue;
+ dispatchTable["GlWindowGetAuxiliaryHintId"] = GlWindowGetAuxiliaryHintId;
+ dispatchTable["GlWindowSetInputRegion"] = GlWindowSetInputRegion;
+ dispatchTable["GlWindowSetOpaqueState"] = GlWindowSetOpaqueState;
+ dispatchTable["GlWindowIsOpaqueState"] = GlWindowIsOpaqueState;
+ dispatchTable["GlWindowSetPositionSize"] = GlWindowSetPositionSize;
+ dispatchTable["GlWindowGetPositionSize"] = GlWindowGetPositionSize;
+ dispatchTable["GlWindowGetCurrentOrientation"] = GlWindowGetCurrentOrientation;
+ dispatchTable["GlWindowSetAvailableOrientations"] = GlWindowSetAvailableOrientations;
+ dispatchTable["GlWindowSetPreferredOrientation"] = GlWindowSetPreferredOrientation;
+ dispatchTable["GlWindowRegisterGlCallbacks"] = GlWindowRegisterGlCallbacks;
+ dispatchTable["GlWindowRenderOnce"] = GlWindowRenderOnce;
+ dispatchTable["GlWindowSetRenderingMode"] = GlWindowSetRenderingMode;
+ dispatchTable["GlWindowGetRenderingMode"] = GlWindowGetRenderingMode;
+ dispatchTable["GlWindowFocusChangeSignal"] = GlWindowFocusChangeSignal;
+ dispatchTable["GlWindowResizeSignal"] = GlWindowResizeSignal;
+ dispatchTable["GlWindowKeyEventSignal"] = GlWindowKeyEventSignal;
+ dispatchTable["GlWindowTouchedSignal"] = GlWindowTouchedSignal;
+ dispatchTable["GlWindowVisibilityChangedSignal"] = GlWindowVisibilityChangedSignal;
+ }
+ return &dispatchTable;
+ }
+
+ /**
+ * Dispatch table for instance functions
+ * @return
+ */
+ Dali::AddOns::DispatchTable* GetInstanceDispatchTable() override
+ {
+ return nullptr;
+ }
+};
+
+REGISTER_ADDON_CLASS(AdaptorGlWindowAddOn);
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/gl-window/gl-window-impl.h>
+
+// EXTERNAL HEADERS
+#include <dali/devel-api/adaptor-framework/gl-window.h>
+#include <dali/devel-api/adaptor-framework/orientation.h>
+#include <dali/devel-api/events/key-event-devel.h>
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
+#include <dali/internal/window-system/common/display-utils.h>
+#include <dali/internal/window-system/common/event-handler.h>
+#include <dali/internal/window-system/common/orientation-impl.h>
+#include <dali/internal/window-system/common/window-base.h>
+#include <dali/internal/window-system/common/window-factory.h>
+#include <dali/internal/window-system/common/window-impl.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/window-system.h>
+#include <dali/internal/window-system/common/window-visibility-observer.h>
+#include <dali/internal/window-system/gl-window/gl-window-render-thread.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace
+{
+const int MINIMUM_DIMENSION_CHANGE(1);
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
+#endif
+
+} // unnamed namespace
+
+GlWindow* GlWindow::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+{
+ GlWindow* window = new GlWindow();
+ window->mIsTransparent = isTransparent;
+ window->Initialize(positionSize, name, className);
+ return window;
+}
+
+GlWindow::GlWindow()
+: mWindowBase(),
+ mGraphics(),
+ mDisplayConnection(nullptr),
+ mGlWindowRenderThread(nullptr),
+ mEventHandler(nullptr),
+ mIsTransparent(false),
+ mIsFocusAcceptable(false),
+ mIconified(false),
+ mOpaqueState(false),
+ mResizeEnabled(false),
+ mVisible(false),
+ mIsWindowRotated(false),
+ mIsTouched(false),
+ mIsEGLInitialized(false),
+ mDepth(false),
+ mStencil(false),
+ mPositionSize(),
+ mAvailableAngles(),
+ mColorDepth(COLOR_DEPTH_24),
+ mRenderingMode(Dali::GlWindow::RenderingMode::CONTINUOUS),
+ mPreferredAngle(0),
+ mTotalRotationAngle(0),
+ mWindowRotationAngle(0),
+ mScreenRotationAngle(0),
+ mOrientationMode(0),
+ mWindowWidth(0),
+ mWindowHeight(0),
+ mNativeWindowId(-1),
+ mMSAA(0),
+ mKeyEventSignal(),
+ mTouchedSignal(),
+ mFocusChangeSignal(),
+ mResizeSignal(),
+ mVisibilityChangedSignal()
+{
+}
+
+GlWindow::~GlWindow()
+{
+ if(mEventHandler)
+ {
+ mEventHandler->RemoveObserver(*this);
+ }
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->Stop();
+ mGlWindowRenderThread->Join();
+ }
+
+ if(mIsEGLInitialized)
+ {
+ mGraphics->Destroy();
+ }
+}
+
+void GlWindow::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
+{
+ int screenWidth, screenHeight;
+
+ mPositionSize = positionSize;
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+ if((mPositionSize.width == 0) || (mPositionSize.height == 0))
+ {
+ mPositionSize.x = 0;
+ mPositionSize.y = 0;
+ mPositionSize.width = screenWidth;
+ mPositionSize.height = screenHeight;
+ }
+
+ if(screenWidth > screenHeight)
+ {
+ mOrientationMode = 1; // Default mode is landscape
+ }
+ else
+ {
+ mOrientationMode = 0; // Default mode is portrate
+ }
+
+ // Create a window base
+ auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
+ Any surface;
+ mWindowBase = windowFactory->CreateWindowBase(mPositionSize, surface, (mIsTransparent ? true : false));
+ mWindowBase->IconifyChangedSignal().Connect(this, &GlWindow::OnIconifyChanged);
+ mWindowBase->FocusChangedSignal().Connect(this, &GlWindow::OnFocusChanged);
+ mWindowBase->OutputTransformedSignal().Connect(this, &GlWindow::OnOutputTransformed);
+
+ if(Dali::Adaptor::IsAvailable())
+ {
+ SetEventHandler();
+ }
+
+ if(!mPositionSize.IsEmpty())
+ {
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
+ mResizeEnabled = true;
+ }
+
+ mWindowBase->Show();
+
+ if(mIsTransparent)
+ {
+ mColorDepth = COLOR_DEPTH_32;
+ }
+ else
+ {
+ mColorDepth = COLOR_DEPTH_24;
+ }
+
+ SetClass(name, className);
+
+ // For Debugging
+ mNativeWindowId = mWindowBase->GetNativeWindowId();
+}
+
+void GlWindow::SetEventHandler()
+{
+ mEventHandler = EventHandlerPtr(new EventHandler(mWindowBase.get(), *this));
+ mEventHandler->AddObserver(*this);
+}
+
+void GlWindow::SetClass(const std::string& name, const std::string className)
+{
+ mName = name;
+ mClassName = className;
+ mWindowBase->SetClass(name, className);
+}
+
+void GlWindow::SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version)
+{
+ // Init Graphics
+ mDepth = depth;
+ mStencil = stencil;
+ mMSAA = msaa;
+
+ InitializeGraphics();
+
+ int rVersion = 30;
+
+ if(version == Dali::GlWindow::GlesVersion::VERSION_2_0)
+ {
+ rVersion = 20;
+ }
+ else if(version == Dali::GlWindow::GlesVersion::VERSION_3_0)
+ {
+ rVersion = 30;
+ }
+
+ mGlWindowRenderThread->SetGraphicsConfig(depth, stencil, msaa, rVersion);
+}
+
+void GlWindow::Raise()
+{
+ mWindowBase->Raise();
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId);
+}
+
+void GlWindow::Lower()
+{
+ mWindowBase->Lower();
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId);
+}
+
+void GlWindow::Activate()
+{
+ mWindowBase->Activate();
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
+}
+
+void GlWindow::Show()
+{
+ mVisible = true;
+
+ mWindowBase->Show();
+
+ if(!mIconified)
+ {
+ Dali::GlWindow handle(this);
+ mVisibilityChangedSignal.Emit(handle, true);
+ }
+
+ if(mEventHandler)
+ {
+ mEventHandler->Resume();
+ }
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->Resume();
+ }
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
+}
+
+void GlWindow::Hide()
+{
+ mVisible = false;
+
+ mWindowBase->Hide();
+
+ if(!mIconified)
+ {
+ Dali::GlWindow handle(this);
+ mVisibilityChangedSignal.Emit(handle, false);
+ }
+
+ if(mEventHandler)
+ {
+ mEventHandler->Pause();
+ }
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->Pause();
+ }
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
+}
+
+unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const
+{
+ return mWindowBase->GetSupportedAuxiliaryHintCount();
+}
+
+std::string GlWindow::GetSupportedAuxiliaryHint(unsigned int index) const
+{
+ return mWindowBase->GetSupportedAuxiliaryHint(index);
+}
+
+unsigned int GlWindow::AddAuxiliaryHint(const std::string& hint, const std::string& value)
+{
+ return mWindowBase->AddAuxiliaryHint(hint, value);
+}
+
+bool GlWindow::RemoveAuxiliaryHint(unsigned int id)
+{
+ return mWindowBase->RemoveAuxiliaryHint(id);
+}
+
+bool GlWindow::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
+{
+ return mWindowBase->SetAuxiliaryHintValue(id, value);
+}
+
+std::string GlWindow::GetAuxiliaryHintValue(unsigned int id) const
+{
+ return mWindowBase->GetAuxiliaryHintValue(id);
+}
+
+unsigned int GlWindow::GetAuxiliaryHintId(const std::string& hint) const
+{
+ return mWindowBase->GetAuxiliaryHintId(hint);
+}
+
+void GlWindow::SetInputRegion(const Rect<int>& inputRegion)
+{
+ mWindowBase->SetInputRegion(inputRegion);
+
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+}
+
+void GlWindow::SetOpaqueState(bool opaque)
+{
+ mOpaqueState = opaque;
+
+ mWindowBase->SetOpaqueState(opaque);
+
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "GlWindow::SetOpaqueState: opaque = %d\n", opaque);
+}
+
+bool GlWindow::IsOpaqueState() const
+{
+ return mOpaqueState;
+}
+
+void GlWindow::SetPositionSize(PositionSize positionSize)
+{
+ if(!mResizeEnabled)
+ {
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
+ mResizeEnabled = true;
+ }
+
+ bool needToMove = false;
+ bool needToResize = false;
+
+ // Check moving
+ if((fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
+ (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE))
+ {
+ needToMove = true;
+ }
+
+ // Check resizing
+ if((fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
+ (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
+ {
+ needToResize = true;
+ }
+
+ if(needToResize)
+ {
+ if(needToMove)
+ {
+ mWindowBase->MoveResize(positionSize);
+ }
+ else
+ {
+ mWindowBase->Resize(positionSize);
+ }
+ mPositionSize = positionSize;
+ }
+ else
+ {
+ if(needToMove)
+ {
+ mWindowBase->Move(positionSize);
+ mPositionSize = positionSize;
+ }
+ }
+
+ // If window's size or position is changed, the signal will be emitted to user.
+ if(needToMove || needToResize)
+ {
+ Uint16Pair newSize(mPositionSize.width, mPositionSize.height);
+ Dali::GlWindow handle(this);
+ mResizeSignal.Emit(newSize);
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->RequestWindowResize(mPositionSize.width, mPositionSize.height);
+ }
+ }
+}
+
+PositionSize GlWindow::GetPositionSize() const
+{
+ PositionSize positionSize(mPositionSize);
+ if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
+ {
+ positionSize.height = mPositionSize.width;
+ positionSize.width = mPositionSize.height;
+ }
+
+ return positionSize;
+}
+
+void GlWindow::OnIconifyChanged(bool iconified)
+{
+ if(iconified)
+ {
+ mIconified = true;
+
+ if(mVisible)
+ {
+ Dali::GlWindow handle(this);
+ mVisibilityChangedSignal.Emit(handle, false);
+ }
+
+ if(mEventHandler)
+ {
+ mEventHandler->Pause();
+ }
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->Pause();
+ }
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
+ }
+ else
+ {
+ mIconified = false;
+
+ if(mVisible)
+ {
+ Dali::GlWindow handle(this);
+ mVisibilityChangedSignal.Emit(handle, true);
+ }
+
+ if(mEventHandler)
+ {
+ mEventHandler->Resume();
+ }
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->Resume();
+ }
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
+ }
+}
+
+void GlWindow::OnFocusChanged(bool focusIn)
+{
+ Dali::GlWindow handle(this);
+ mFocusChangeSignal.Emit(handle, focusIn);
+}
+
+void GlWindow::OnOutputTransformed()
+{
+ int newScreenRotationAngle = mWindowBase->GetScreenRotationAngle();
+ DALI_LOG_RELEASE_INFO("GlWindow::OnOutputTransformed(), screen rotation occurs, old[%d], new[%d\n", mScreenRotationAngle, newScreenRotationAngle);
+
+ if(newScreenRotationAngle != mScreenRotationAngle)
+ {
+ UpdateScreenRotation(newScreenRotationAngle);
+ }
+}
+
+void GlWindow::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
+{
+ PointState::Type state = point.GetState();
+
+ if(state == PointState::DOWN)
+ {
+ mIsTouched = true;
+ }
+
+ if(state == PointState::UP)
+ {
+ mIsTouched = false;
+ }
+
+ if(!mIsTouched && state == PointState::MOTION)
+ {
+ return;
+ }
+
+ Vector2 convertedPosition = RecalculatePosition(point.GetScreenPosition());
+ point.SetScreenPosition(convertedPosition);
+
+ Dali::TouchEvent touchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
+ Dali::GlWindow handle(this);
+ mTouchedSignal.Emit(touchEvent);
+}
+
+void GlWindow::OnMouseFrameEvent()
+{
+}
+
+void GlWindow::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
+{
+ // TODO:
+ //FeedWheelEvent( wheelEvent );
+}
+
+void GlWindow::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
+{
+ Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
+ Dali::DevelKeyEvent::SetWindowId(event, keyEvent.windowId);
+ Dali::GlWindow handle(this);
+ mKeyEventSignal.Emit(event);
+}
+
+void GlWindow::OnRotation(const RotationEvent& rotation)
+{
+ mWindowRotationAngle = rotation.angle;
+ mTotalRotationAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+ if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
+ {
+ mWindowWidth = mPositionSize.height;
+ mWindowHeight = mPositionSize.width;
+ }
+ else
+ {
+ mWindowWidth = mPositionSize.width;
+ mWindowHeight = mPositionSize.height;
+ }
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
+
+ // Emit Resize signal
+ Dali::GlWindow handle(this);
+ mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
+
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->RequestWindowRotate(mWindowRotationAngle);
+ }
+}
+
+Vector2 GlWindow::RecalculatePosition(const Vector2& position)
+{
+ Vector2 convertedPosition;
+
+ switch(mTotalRotationAngle)
+ {
+ case 90:
+ {
+ convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
+ convertedPosition.y = position.x;
+ break;
+ }
+ case 180:
+ {
+ convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
+ convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
+ break;
+ }
+ case 270:
+ {
+ convertedPosition.x = position.y;
+ convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
+ break;
+ }
+ default:
+ {
+ convertedPosition = position;
+ break;
+ }
+ }
+ return convertedPosition;
+}
+
+void GlWindow::SetAvailableAnlges(const std::vector<int>& angles)
+{
+ if(angles.size() > 4)
+ {
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
+ return;
+ }
+
+ mWindowBase->SetAvailableAnlges(angles);
+}
+
+bool GlWindow::IsOrientationAvailable(WindowOrientation orientation) const
+{
+ if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
+ {
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
+ return false;
+ }
+ return true;
+}
+
+int GlWindow::ConvertToAngle(WindowOrientation orientation)
+{
+ int convertAngle = 0;
+ if(mOrientationMode == 0)
+ {
+ convertAngle = static_cast<int>(orientation);
+ }
+ else if(mOrientationMode == 1)
+ {
+ switch(orientation)
+ {
+ case WindowOrientation::LANDSCAPE:
+ {
+ convertAngle = 0;
+ break;
+ }
+ case WindowOrientation::PORTRAIT:
+ {
+ convertAngle = 90;
+ break;
+ }
+ case WindowOrientation::LANDSCAPE_INVERSE:
+ {
+ convertAngle = 180;
+ break;
+ }
+ case WindowOrientation::PORTRAIT_INVERSE:
+ {
+ convertAngle = 270;
+ break;
+ }
+ case WindowOrientation::NO_ORIENTATION_PREFERENCE:
+ {
+ convertAngle = -1;
+ break;
+ }
+ }
+ }
+ return convertAngle;
+}
+
+WindowOrientation GlWindow::ConvertToOrientation(int angle) const
+{
+ WindowOrientation orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
+ if(mOrientationMode == 0) // Portrate mode
+ {
+ orientation = static_cast<WindowOrientation>(angle);
+ }
+ else if(mOrientationMode == 1) // Landscape mode
+ {
+ switch(angle)
+ {
+ case 0:
+ {
+ orientation = WindowOrientation::LANDSCAPE;
+ break;
+ }
+ case 90:
+ {
+ orientation = WindowOrientation::PORTRAIT;
+ break;
+ }
+ case 180:
+ {
+ orientation = WindowOrientation::LANDSCAPE_INVERSE;
+ break;
+ }
+ case 270:
+ {
+ orientation = WindowOrientation::PORTRAIT_INVERSE;
+ break;
+ }
+ case -1:
+ {
+ orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
+ break;
+ }
+ }
+ }
+ return orientation;
+}
+
+WindowOrientation GlWindow::GetCurrentOrientation() const
+{
+ return ConvertToOrientation(mTotalRotationAngle);
+}
+
+void GlWindow::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
+{
+ Dali::Vector<float>::SizeType count = orientations.Count();
+ for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
+ {
+ if(IsOrientationAvailable(orientations[index]) == false)
+ {
+ DALI_LOG_ERROR("Window::SetAvailableRotationAngles, invalid angle: %d\n", orientations[index]);
+ continue;
+ }
+
+ bool found = false;
+ int angle = ConvertToAngle(orientations[index]);
+
+ for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
+ {
+ if(mAvailableAngles[i] == angle)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, angle);
+ mAvailableAngles.push_back(angle);
+ }
+ }
+ SetAvailableAnlges(mAvailableAngles);
+}
+
+void GlWindow::SetPreferredOrientation(WindowOrientation orientation)
+{
+ if(IsOrientationAvailable(orientation) == false)
+ {
+ DALI_LOG_ERROR("Window::SetPreferredOrientation, invalid orientation: %d\n", orientation);
+ return;
+ }
+ mPreferredAngle = ConvertToAngle(orientation);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
+ mWindowBase->SetPreferredAngle(mPreferredAngle);
+}
+
+void GlWindow::SetChild(Dali::Window& child)
+{
+ if(DALI_UNLIKELY(child))
+ {
+ mChildWindow = child;
+ Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(mChildWindow);
+ WindowRenderSurface* renderSurface = static_cast<WindowRenderSurface*>(windowImpl.GetSurface());
+ if(renderSurface)
+ {
+ WindowBase* childWindowBase = renderSurface->GetWindowBase();
+ if(childWindowBase)
+ {
+ childWindowBase->SetParent(mWindowBase.get(), false);
+ }
+ }
+ }
+}
+
+void GlWindow::RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
+{
+ if(mIsEGLInitialized == false)
+ {
+ InitializeGraphics();
+ }
+ mGlWindowRenderThread->RegisterGlCallbacks(initCallback, renderFrameCallback, terminateCallback);
+ mGlWindowRenderThread->Start();
+}
+
+void GlWindow::RenderOnce()
+{
+ if(mGlWindowRenderThread)
+ {
+ mGlWindowRenderThread->RenderOnce();
+ }
+}
+
+void GlWindow::SetRenderingMode(Dali::GlWindow::RenderingMode mode)
+{
+ mRenderingMode = mode;
+ if(mGlWindowRenderThread)
+ {
+ bool onDemand = false;
+ if(mRenderingMode == Dali::GlWindow::RenderingMode::ON_DEMAND)
+ {
+ onDemand = true;
+ }
+ mGlWindowRenderThread->SetOnDemandRenderMode(onDemand);
+ }
+}
+
+Dali::GlWindow::RenderingMode GlWindow::GetRenderingMode() const
+{
+ return mRenderingMode;
+}
+
+void GlWindow::InitializeGraphics()
+{
+ if(!mIsEGLInitialized)
+ {
+ // Init Graphics
+ std::unique_ptr<EglGraphicsFactory> graphicsFactoryPtr = Utils::MakeUnique<EglGraphicsFactory>(mEnvironmentOptions);
+ auto graphicsFactory = *graphicsFactoryPtr;
+
+ mGraphics = std::unique_ptr<Graphics::GraphicsInterface>(&graphicsFactory.Create());
+
+ Graphics::GraphicsInterface* graphics = mGraphics.get();
+
+ mDisplayConnection = std::unique_ptr<Dali::DisplayConnection>(Dali::DisplayConnection::New(Dali::Integration::RenderSurfaceInterface::Type::WINDOW_RENDER_SURFACE));
+ graphics->Initialize(*mDisplayConnection, mDepth, mStencil, false, mMSAA);
+
+ // Create Render Thread
+ mGlWindowRenderThread = std::unique_ptr<Dali::Internal::Adaptor::GlWindowRenderThread>(new GlWindowRenderThread(mPositionSize, mColorDepth));
+ if(!mGlWindowRenderThread)
+ {
+ DALI_LOG_ERROR("Fail to create GlWindow Render Thread!!!!\n");
+ return;
+ }
+
+ mGlWindowRenderThread->SetGraphicsInterface(graphics);
+ mGlWindowRenderThread->SetWindowBase(mWindowBase.get());
+ bool onDemand = false;
+ if(mRenderingMode == Dali::GlWindow::RenderingMode::ON_DEMAND)
+ {
+ onDemand = true;
+ }
+ mGlWindowRenderThread->SetOnDemandRenderMode(onDemand);
+
+ mIsEGLInitialized = true;
+
+ // Check screen rotation
+ int newScreenRotationAngle = mWindowBase->GetScreenRotationAngle();
+ DALI_LOG_RELEASE_INFO("GlWindow::InitializeGraphics(), GetScreenRotationAngle(): %d\n", mScreenRotationAngle);
+ if(newScreenRotationAngle != 0)
+ {
+ UpdateScreenRotation(newScreenRotationAngle);
+ }
+ }
+}
+
+void GlWindow::OnDamaged(const DamageArea& area)
+{
+}
+
+void GlWindow::UpdateScreenRotation(int newAngle)
+{
+ mScreenRotationAngle = newAngle;
+ mTotalRotationAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+
+ if(mTotalRotationAngle == 90 || mTotalRotationAngle == 270)
+ {
+ mWindowWidth = mPositionSize.height;
+ mWindowHeight = mPositionSize.width;
+ }
+ else
+ {
+ mWindowWidth = mPositionSize.width;
+ mWindowHeight = mPositionSize.height;
+ }
+
+ // Emit Resize signal
+ Dali::GlWindow handle(this);
+ mResizeSignal.Emit(Dali::Uint16Pair(mWindowWidth, mWindowHeight));
+
+ if(mGlWindowRenderThread)
+ {
+ DALI_LOG_RELEASE_INFO("GlWindow::UpdateScreenRotation(), RequestScreenRotatem(), mScreenRotationAngle: %d\n", mScreenRotationAngle);
+ mGlWindowRenderThread->RequestScreenRotate(mScreenRotationAngle);
+ }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
+
+/*
+ * Copyright (c) 2025 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 <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/gl-window.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
+#include <dali/internal/window-system/common/event-handler.h>
+
+namespace Dali
+{
+class Adaptor;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class WindowBase;
+
+class GlWindow;
+using GlWindowPtr = IntrusivePtr<GlWindow>;
+using EventHandlerPtr = IntrusivePtr<EventHandler>;
+
+class GlWindowRenderThread;
+
+/**
+ * Window provides a surface to render onto with orientation.
+ */
+class GlWindow : public BaseObject, public EventHandler::Observer, public DamageObserver, public ConnectionTracker
+{
+public:
+ using KeyEventSignalType = Dali::GlWindow::KeyEventSignalType;
+ using TouchEventSignalType = Dali::GlWindow::TouchEventSignalType;
+ using FocusChangeSignalType = Dali::GlWindow::FocusChangeSignalType;
+ using ResizeSignalType = Dali::GlWindow::ResizeSignalType;
+ using VisibilityChangedSignalType = Dali::GlWindow::VisibilityChangedSignalType;
+ using SignalType = Signal<void()>;
+
+ /**
+ * @brief Create a new GlWindow. This should only be called once by the Application class
+ * @param[in] positionSize The position and size of the window
+ * @param[in] name The window title
+ * @param[in] className The window class name
+ * @param[in] isTransparent Whether window is transparent
+ * @return A newly allocated Window
+ */
+ static GlWindow* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
+
+ /**
+ * @copydoc Dali::GlWindow::SetGraphicsConfig()
+ */
+ void SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::GlWindow::GlesVersion version);
+
+ /**
+ * @copydoc Dali::GlWindow::Raise()
+ */
+ void Raise();
+
+ /**
+ * @copydoc Dali::GlWindow::Lower()
+ */
+ void Lower();
+
+ /**
+ * @copydoc Dali::GlWindow::Activate()
+ */
+ void Activate();
+
+ /**
+ * @copydoc Dali::GlWindow::Show()
+ */
+ void Show();
+
+ /**
+ * @copydoc Dali::GlWindow::Hide()
+ */
+ void Hide();
+
+ /**
+ * @copydoc Dali::GlWindow::GetSupportedAuxiliaryHintCount()
+ */
+ unsigned int GetSupportedAuxiliaryHintCount() const;
+
+ /**
+ * @copydoc Dali::GlWindow::GetSupportedAuxiliaryHint()
+ */
+ std::string GetSupportedAuxiliaryHint(unsigned int index) const;
+
+ /**
+ * @copydoc Dali::GlWindow::AddAuxiliaryHint()
+ */
+ unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value);
+
+ /**
+ * @copydoc Dali::GlWindow::RemoveAuxiliaryHint()
+ */
+ bool RemoveAuxiliaryHint(unsigned int id);
+
+ /**
+ * @copydoc Dali::GlWindow::SetAuxiliaryHintValue()
+ */
+ bool SetAuxiliaryHintValue(unsigned int id, const std::string& value);
+
+ /**
+ * @copydoc Dali::GlWindow::GetAuxiliaryHintValue()
+ */
+ std::string GetAuxiliaryHintValue(unsigned int id) const;
+
+ /**
+ * @copydoc Dali::GlWindow::GetAuxiliaryHintId()
+ */
+ unsigned int GetAuxiliaryHintId(const std::string& hint) const;
+
+ /**
+ * @copydoc Dali::GlWindow::SetInputRegion()
+ */
+ void SetInputRegion(const Rect<int>& inputRegion);
+
+ /**
+ * @copydoc Dali::GlWindow::SetOpaqueState()
+ */
+ void SetOpaqueState(bool opaque);
+
+ /**
+ * @copydoc Dali::GlWindow::IsOpaqueState()
+ */
+ bool IsOpaqueState() const;
+
+ /**
+ * @copydoc Dali::GlWindow::SetPositionSize()
+ */
+ void SetPositionSize(PositionSize positionSize);
+
+ /**
+ * @copydoc Dali::GlWindow::GetPositionSize()
+ */
+ PositionSize GetPositionSize() const;
+
+ /**
+ * @copydoc Dali::GlWindow::GetCurrentOrientation() const
+ */
+ WindowOrientation GetCurrentOrientation() const;
+
+ /**
+ * @copydoc Dali::GlWindow::SetAvailableOrientations()
+ */
+ void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
+
+ /**
+ * @copydoc Dali::GlWindow::SetPreferredOrientation()
+ */
+ void SetPreferredOrientation(WindowOrientation orientation);
+
+ /**
+ * @copydoc Dali::GlWindow::RegisterGlCallbacks()
+ */
+ void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
+
+ /**
+ * @copydoc Dali::GlWindow::RenderOnce()
+ */
+ void RenderOnce();
+
+ /**
+ * @copydoc Dali::GlWindow::SetRenderingMode()
+ */
+ void SetRenderingMode(Dali::GlWindow::RenderingMode mode);
+
+ /**
+ * @copydoc Dali::GlWindow::GetRenderingMode()
+ */
+ Dali::GlWindow::RenderingMode GetRenderingMode() const;
+
+public: // For implementation
+ /**
+ * @brief Sets child window with Dali::Window
+ *
+ * @param[in] child The child window.
+ *
+ * Most of cases, child window is the default window in adaptor
+ *
+ * Currently the child window is default window.
+ */
+ void SetChild(Dali::Window& child);
+
+private:
+ /**
+ * Private constructor.
+ * @sa Window::New()
+ */
+ GlWindow();
+
+ /**
+ * Destructor
+ */
+ virtual ~GlWindow();
+
+ /**
+ * Second stage initialization
+ *
+ * @param[in] positionSize The position and size of the window
+ * @param[in] name The window title
+ * @param[in] className The window class name
+ */
+ void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
+
+ /**
+ * Called when the window becomes iconified or deiconified.
+ *
+ * @param[in] iconified The flag whether window is iconifed or deiconfied.
+ */
+ void OnIconifyChanged(bool iconified);
+
+ /**
+ * Called when the window focus is changed.
+ * @param[in] focusIn The flag whether window is focused or not.
+ */
+ void OnFocusChanged(bool focusIn);
+
+ /**
+ * Called when the output is transformed.
+ */
+ void OnOutputTransformed();
+
+ /**
+ * Called when the window receives a delete request.
+ */
+ void OnDeleteRequest();
+
+ /**
+ * @brief Set available rotation angle to window base.
+ *
+ * @param[in] angles The list of the avaiabled rotation angle.
+ */
+ void SetAvailableAnlges(const std::vector<int>& angles);
+
+ /**
+ * @brief Check available window orientation for Available angle.
+ *
+ * @param[in] orientation the oritation value of window rotation.
+ *
+ * @return true is available window orientation. false is not available.
+ */
+ bool IsOrientationAvailable(WindowOrientation orientation) const;
+
+ /**
+ * @brief Convert from window orientation to angle using orientation mode value.
+ *
+ * @param[in] orientation the oritation value of window rotation.
+ *
+ * @return The coverted angle value is returned.
+ */
+ int ConvertToAngle(WindowOrientation orientation);
+
+ /**
+ * @brief Convert from angle to window orientation using orientation mode value.
+ *
+ * @param[in] angle the angle value of window rotation.
+ *
+ * @return The converted window orientation value is returned.
+ */
+ WindowOrientation ConvertToOrientation(int angle) const;
+
+ /**
+ * @brief Initialize and create EGL resource
+ */
+ void InitializeGraphics();
+
+ /**
+ * @brief Sets event handler for window's events.
+ */
+ void SetEventHandler();
+
+ /**
+ * @brief calculate screen position for rotation.
+ */
+ Vector2 RecalculatePosition(const Vector2& position);
+
+ /**
+ * @brief Sets window and class name.
+ *
+ * @param[in] name The name of the window
+ * @param[in] className The class of the window
+ */
+ void SetClass(const std::string& name, const std::string className);
+
+private:
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint
+ */
+ void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnMouseFrameEvent
+ */
+ void OnMouseFrameEvent() override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
+ */
+ void OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent
+ */
+ void OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation
+ */
+ void OnRotation(const RotationEvent& rotation) override;
+
+private: // From Dali::Internal::Adaptor::DamageObserver
+ /**
+ * @copydoc Dali::Internal::Adaptor::DamageObserver::OnDamaged()
+ */
+ void OnDamaged(const DamageArea& area);
+
+ /**
+ * @brief Updates screen rotation value and screen rotation works.
+ *
+ * @param[in] newAngle new screen rotation angle
+ */
+ void UpdateScreenRotation(int newAngle);
+
+public: // Signals
+ /**
+ * @copydoc Dali::GlWindow::FocusChangeSignal()
+ */
+ FocusChangeSignalType& FocusChangeSignal()
+ {
+ return mFocusChangeSignal;
+ }
+
+ /**
+ * @copydoc Dali::GlWindow::ResizeSignal()
+ */
+ ResizeSignalType& ResizeSignal()
+ {
+ return mResizeSignal;
+ }
+
+ /**
+ * @copydoc Dali::GlWindow::KeyEventSignal()
+ */
+ KeyEventSignalType& KeyEventSignal()
+ {
+ return mKeyEventSignal;
+ }
+
+ /**
+ * @copydoc Dali::GlWindow::TouchSignal()
+ */
+ TouchEventSignalType& TouchedSignal()
+ {
+ return mTouchedSignal;
+ }
+
+ /**
+ * @copydoc Dali::GlWindow::VisibilityChangedSignal()
+ */
+ VisibilityChangedSignalType& VisibilityChangedSignal()
+ {
+ return mVisibilityChangedSignal;
+ }
+
+private:
+ std::unique_ptr<WindowBase> mWindowBase;
+ std::unique_ptr<Graphics::GraphicsInterface> mGraphics; ///< Graphics interface
+ std::unique_ptr<Dali::DisplayConnection> mDisplayConnection; ///< The native display connection
+ std::unique_ptr<GlWindowRenderThread> mGlWindowRenderThread; ///< The render thread
+ EventHandlerPtr mEventHandler; ///< The window events handler
+ Dali::Window mChildWindow; ///< The default child UI Window
+ std::string mName;
+ std::string mClassName;
+ bool mIsTransparent : 1;
+ bool mIsFocusAcceptable : 1;
+ bool mIconified : 1;
+ bool mOpaqueState : 1;
+ bool mResizeEnabled : 1;
+ bool mVisible : 1;
+ bool mIsWindowRotated : 1;
+ bool mIsTouched : 1;
+ bool mIsEGLInitialized : 1;
+ bool mDepth : 1;
+ bool mStencil : 1;
+
+ PositionSize mPositionSize; ///< The window position and size
+ EnvironmentOptions mEnvironmentOptions;
+ std::vector<int> mAvailableAngles; ///< The list of available angle
+ ColorDepth mColorDepth; ///< The color depth of window
+ Dali::GlWindow::RenderingMode mRenderingMode; ///< The rendering mode
+
+ int mPreferredAngle; ///< The angle of preferred angle
+ int mTotalRotationAngle; ///< The angle of window + screen rotation angle % 360
+ int mWindowRotationAngle; ///< The angle of window rotation angle
+ int mScreenRotationAngle; ///< The angle of screen rotation angle
+ int mOrientationMode; ///< 0: Default portrati, 1:Default landscape
+ int mWindowWidth; ///< The width of the window
+ int mWindowHeight; ///< The height of the window
+ int mNativeWindowId; ///< The Native Window Id
+ int mMSAA; ///< The multisample anti-aliasing for EGL Configuration
+
+ // Signals
+ KeyEventSignalType mKeyEventSignal;
+ TouchEventSignalType mTouchedSignal;
+ FocusChangeSignalType mFocusChangeSignal;
+ ResizeSignalType mResizeSignal;
+ VisibilityChangedSignalType mVisibilityChangedSignal;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::GlWindow& GetImplementation(Dali::GlWindow& window)
+{
+ DALI_ASSERT_ALWAYS(window && "Window handle is empty");
+ BaseObject& object = window.GetBaseObject();
+ return static_cast<Internal::Adaptor::GlWindow&>(object);
+}
+
+inline const Internal::Adaptor::GlWindow& GetImplementation(const Dali::GlWindow& window)
+{
+ DALI_ASSERT_ALWAYS(window && "Window handle is empty");
+ const BaseObject& object = window.GetBaseObject();
+ return static_cast<const Internal::Adaptor::GlWindow&>(object);
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/gl-window/gl-window-render-thread.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/thread-settings.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/system/common/time-service.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace
+{
+constexpr unsigned int NANOSECONDS_PER_SECOND(1e+9);
+
+// The following values will get calculated at compile time
+constexpr float DEFAULT_FRAME_DURATION_IN_SECONDS(1.0f / 60.0f);
+constexpr uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS(DEFAULT_FRAME_DURATION_IN_SECONDS* NANOSECONDS_PER_SECOND);
+constexpr uint64_t REFRESH_RATE(1u);
+
+constexpr int MINIMUM_DIMENSION_CHANGE(1);
+} // namespace
+
+GlWindowRenderThread::GlWindowRenderThread(PositionSize positionSize, ColorDepth colorDepth)
+: mGraphics(nullptr),
+ mWindowBase(nullptr),
+ mWindowRotationTrigger(),
+ mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+ mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
+ mPositionSize(positionSize),
+ mColorDepth(colorDepth),
+ mGLInitCallback(),
+ mGLRenderFrameCallback(),
+ mGLTerminateCallback(),
+ mEGLSurface(nullptr),
+ mEGLContext(nullptr),
+ mDepth(false),
+ mStencil(false),
+ mIsEGLInitialize(false),
+ mGLESVersion(30), //Default GLES version 30
+ mMSAA(0),
+ mWindowRotationAngle(0),
+ mScreenRotationAngle(0),
+ mRenderThreadWaitCondition(),
+ mDestroyRenderThread(0),
+ mPauseRenderThread(0),
+ mRenderingMode(0),
+ mRequestRenderOnce(0),
+ mSurfaceStatus(0),
+ mPostRendering(0),
+ mDefaultFrameDurationNanoseconds(REFRESH_RATE * DEFAULT_FRAME_DURATION_IN_NANOSECONDS)
+{
+}
+
+GlWindowRenderThread::~GlWindowRenderThread()
+{
+}
+
+void GlWindowRenderThread::SetGraphicsInterface(Graphics::GraphicsInterface* graphics)
+{
+ mGraphics = graphics;
+}
+
+void GlWindowRenderThread::SetWindowBase(WindowBase* windowBase)
+{
+ mWindowBase = windowBase;
+}
+
+void GlWindowRenderThread::SetGraphicsConfig(bool depth, bool stencil, int msaa, int version)
+{
+ mDepth = depth;
+ mStencil = stencil;
+ mMSAA = msaa;
+ mGLESVersion = version;
+}
+
+void GlWindowRenderThread::Pause()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mPauseRenderThread = 1;
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Pause()\n");
+}
+
+void GlWindowRenderThread::Resume()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mPauseRenderThread = 0;
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Resume()\n");
+ mRenderThreadWaitCondition.Notify(lock);
+}
+
+void GlWindowRenderThread::Stop()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mDestroyRenderThread = 1;
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::Stop()\n");
+ mRenderThreadWaitCondition.Notify(lock);
+}
+
+void GlWindowRenderThread::RegisterGlCallbacks(CallbackBase* initCallback,
+ CallbackBase* renderFrameCallback,
+ CallbackBase* terminateCallback)
+{
+ mGLInitCallback = std::unique_ptr<CallbackBase>(initCallback);
+ mGLRenderFrameCallback = std::unique_ptr<CallbackBase>(renderFrameCallback);
+ mGLTerminateCallback = std::unique_ptr<CallbackBase>(terminateCallback);
+}
+
+void GlWindowRenderThread::SetOnDemandRenderMode(bool onDemand)
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mRenderingMode = static_cast<unsigned int>(onDemand);
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::SetOnDemandRenderMode(): mRenderingMode: %d\n", mRenderingMode);
+ if(!onDemand)
+ {
+ mRenderThreadWaitCondition.Notify(lock);
+ }
+}
+
+void GlWindowRenderThread::RenderOnce()
+{
+ // Most of all, this function is called in event thread
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mRequestRenderOnce = 1;
+ mRenderThreadWaitCondition.Notify(lock);
+}
+
+void GlWindowRenderThread::RequestWindowResize(int width, int height)
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ // Check resizing
+ if((fabs(width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
+ (fabs(height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE))
+ {
+ mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::RESIZED); // Set bit for window resized
+ mPositionSize.width = width;
+ mPositionSize.height = height;
+
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestWindowResize(), width:%d, height:%d\n", width, height);
+ mRenderThreadWaitCondition.Notify(lock);
+ }
+}
+
+void GlWindowRenderThread::RequestWindowRotate(int windowAngle)
+{
+ if(!mWindowRotationTrigger)
+ {
+ mWindowRotationTrigger = std::unique_ptr<TriggerEventInterface>(TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &GlWindowRenderThread::WindowRotationCompleted),
+ TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
+ }
+
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ if(mWindowRotationAngle != windowAngle)
+ {
+ mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::WINDOW_ROTATED); // Set bit for window rotation
+ mWindowRotationAngle = windowAngle;
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestWindowRotate(): %d\n", windowAngle);
+ mRenderThreadWaitCondition.Notify(lock);
+ }
+}
+
+void GlWindowRenderThread::RequestScreenRotate(int screenAngle)
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ if(mScreenRotationAngle != screenAngle)
+ {
+ mSurfaceStatus |= static_cast<unsigned int>(SurfaceStatus::SCREEN_ROTATED); // Set bit for screen rotation
+ mScreenRotationAngle = screenAngle;
+ DALI_LOG_RELEASE_INFO("GlWindowRenderThread::RequestScreenRotate(): %d\n", screenAngle);
+ mRenderThreadWaitCondition.Notify(lock);
+ }
+}
+
+void GlWindowRenderThread::WindowRotationCompleted()
+{
+ mWindowBase->WindowRotationCompleted(mWindowRotationAngle, mPositionSize.width, mPositionSize.height);
+
+ PostRenderFinish();
+}
+
+unsigned int GlWindowRenderThread::GetSurfaceStatus(int& windowRotationAngle, int& screenRotationAngle)
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+
+ // Get the surface status and reset that.
+ unsigned int status = mSurfaceStatus;
+ mSurfaceStatus = static_cast<unsigned int>(SurfaceStatus::NO_CHANGED);
+
+ windowRotationAngle = mWindowRotationAngle;
+ screenRotationAngle = mScreenRotationAngle;
+
+ return status;
+}
+
+void GlWindowRenderThread::Run()
+{
+ Dali::SetThreadName("GlWindowRenderThread");
+ mLogFactory.InstallLogFunction();
+ mTraceFactory.InstallTraceFunction();
+
+ int renderFrameResult = 0;
+ unsigned int isSurfaceChanged = 0;
+ bool isWindowResized = false, isWindowRotated = false, isScreenRotated = false;
+ int windowRotationAngle = 0, screenRotationAngle = 0, totalAngle = 0;
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
+ InitializeGraphics(eglGraphics);
+
+ eglImpl.MakeContextCurrent(mEGLSurface, mEGLContext);
+
+ if(mGLInitCallback)
+ {
+ CallbackBase::Execute(*mGLInitCallback);
+ }
+
+ uint64_t timeToSleepUntil = 0;
+
+ while(RenderReady(timeToSleepUntil))
+ {
+ uint64_t currentFrameStartTime = 0;
+ TimeService::GetNanoseconds(currentFrameStartTime);
+
+ if(mGLRenderFrameCallback)
+ {
+ // PreRender
+ isSurfaceChanged = GetSurfaceStatus(windowRotationAngle, screenRotationAngle);
+ if(DALI_UNLIKELY(isSurfaceChanged))
+ {
+ isWindowResized = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::RESIZED)) ? true : false;
+ isWindowRotated = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::WINDOW_ROTATED)) ? true : false;
+ isScreenRotated = (isSurfaceChanged & static_cast<unsigned int>(SurfaceStatus::SCREEN_ROTATED)) ? true : false;
+ totalAngle = (windowRotationAngle + screenRotationAngle) % 360;
+
+ if(isWindowRotated || isScreenRotated)
+ {
+ mWindowBase->SetWindowBufferTransform(totalAngle);
+ if(isWindowRotated)
+ {
+ mWindowBase->SetWindowTransform(windowRotationAngle);
+ }
+ }
+
+ if(isWindowResized)
+ {
+ Dali::PositionSize positionSize;
+ positionSize.x = mPositionSize.x;
+ positionSize.y = mPositionSize.y;
+ if(totalAngle == 0 || totalAngle == 180)
+ {
+ positionSize.width = mPositionSize.width;
+ positionSize.height = mPositionSize.height;
+ }
+ else
+ {
+ positionSize.width = mPositionSize.height;
+ positionSize.height = mPositionSize.width;
+ }
+ mWindowBase->ResizeWindow(positionSize);
+ }
+ }
+
+ // Render
+ renderFrameResult = CallbackBase::ExecuteReturn<int>(*mGLRenderFrameCallback);
+
+ // PostRender
+ if(DALI_UNLIKELY(isWindowRotated))
+ {
+ PostRenderStart();
+
+ mWindowRotationTrigger->Trigger();
+
+ PostRenderWaitForFinished();
+ isWindowRotated = false;
+ }
+
+ // buffer commit
+ if(renderFrameResult)
+ {
+ eglImpl.SwapBuffers(mEGLSurface);
+ }
+ }
+ renderFrameResult = 0;
+
+ if(timeToSleepUntil == 0)
+ {
+ timeToSleepUntil = currentFrameStartTime + mDefaultFrameDurationNanoseconds;
+ }
+ else
+ {
+ timeToSleepUntil += mDefaultFrameDurationNanoseconds;
+ uint64_t currentFrameEndTime = 0;
+ TimeService::GetNanoseconds(currentFrameEndTime);
+ while(currentFrameEndTime > timeToSleepUntil + mDefaultFrameDurationNanoseconds)
+ {
+ timeToSleepUntil += mDefaultFrameDurationNanoseconds;
+ }
+ }
+
+ TimeService::SleepUntil(timeToSleepUntil);
+ }
+
+ if(mGLTerminateCallback)
+ {
+ CallbackBase::Execute(*mGLTerminateCallback);
+ }
+
+ if(mIsEGLInitialize)
+ {
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
+ if(mEGLSurface)
+ {
+ eglImpl.DestroySurface(mEGLSurface);
+ mEGLSurface = nullptr;
+ }
+
+ if(mEGLContext)
+ {
+ eglImpl.DestroyContext(mEGLContext);
+ mEGLContext = nullptr;
+ }
+
+ eglImpl.TerminateGles();
+ }
+}
+
+void GlWindowRenderThread::InitializeGraphics(EglGraphics* eglGraphics)
+{
+ mIsEGLInitialize = true;
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+ eglImpl.SetGlesVersion(mGLESVersion);
+
+ if(eglImpl.ChooseConfig(true, mColorDepth) == false)
+ {
+ if(mGLESVersion == 30)
+ {
+ DALI_LOG_RELEASE_INFO("InitializeGraphics: Fail to choose config with GLES30, retry with GLES20\n");
+ eglImpl.SetGlesVersion(20);
+ mGLESVersion = 20;
+ if(eglImpl.ChooseConfig(true, mColorDepth) == false)
+ {
+ DALI_LOG_ERROR("InitializeGraphics: Fail to choose config with GLES20");
+ return;
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("InitializeGraphics: Fail to choose config with GLES20");
+ return;
+ }
+ }
+ eglImpl.CreateWindowContext(mEGLContext);
+
+ // Create the EGL window
+ Dali::Any window = mWindowBase->CreateWindow(mPositionSize.width, mPositionSize.height);
+ mEGLSurface = eglImpl.CreateSurfaceWindow(reinterpret_cast<EGLNativeWindowType>(window.Get<void*>()), mColorDepth);
+}
+
+bool GlWindowRenderThread::RenderReady(uint64_t& timeToSleepUntil)
+{
+ ConditionalWait::ScopedLock updateLock(mRenderThreadWaitCondition);
+ while((!mDestroyRenderThread && mRenderingMode && !mRequestRenderOnce && !mSurfaceStatus) || mPauseRenderThread)
+ {
+ timeToSleepUntil = 0;
+ mRenderThreadWaitCondition.Wait(updateLock);
+ }
+
+ mRequestRenderOnce = 0;
+ // Keep the update-render thread alive if this thread is NOT to be destroyed
+ return !mDestroyRenderThread;
+}
+
+void GlWindowRenderThread::PostRenderStart()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mPostRendering = false;
+}
+
+void GlWindowRenderThread::PostRenderFinish()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ mPostRendering = true;
+ mRenderThreadWaitCondition.Notify(lock);
+}
+
+void GlWindowRenderThread::PostRenderWaitForFinished()
+{
+ ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition);
+ while(!mPostRendering && !mDestroyRenderThread)
+ {
+ mRenderThreadWaitCondition.Wait(lock);
+ }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_RENDER_THREAD_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_RENDER_THREAD_H
+
+/*
+ * Copyright (c) 2025 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 <dali/devel-api/threading/conditional-wait.h>
+#include <dali/devel-api/threading/thread.h>
+#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/gles/egl-graphics.h>
+#include <dali/internal/window-system/common/window-base.h>
+
+namespace Dali
+{
+class Adaptor;
+class TriggerEventInterface;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class WindowBase;
+class GlWindow;
+
+/**
+ * @brief It is for render thread for GlWindow.
+ * User callbacks works in the thread.
+ *
+ * Key Points:
+ * 1. Two Threads:
+ * a. Main/Event Thread.
+ * b. Render Thread.
+ * 2. There is NO VSync thread:
+ * a. We calculate the difference between these two times and if:
+ * i. The difference is less than the default frame time, we sleep.
+ * ii. If it’s more or the same, we continue.
+ * 3. Support Rendering mode
+ * a. CONTINUOUS mode
+ * i. The rendering loop works continuously.
+ * b. ON_DEMAND mode
+ * i. The rendering works by user's request.
+ * ii. User's request is the renderOnce()'s function calling.
+ */
+
+class GlWindowRenderThread : public Dali::Thread
+{
+public:
+ /**
+ * @brief Enumeration for GlWindow Surface status type
+ * It has the status as resized, window is rotated and screen is rotated.
+ *
+ */
+ enum class SurfaceStatus
+ {
+ NO_CHANGED = 0x00, ///< no changed,
+ RESIZED = 0x01, ///< When surface is resized,
+ WINDOW_ROTATED = 0x02, ///< When window is rotated,
+ SCREEN_ROTATED = 0x04 ///< When screen is rotated,
+ };
+
+ /**
+ * Constructor
+ *
+ * @param[in] positionSize The position and size of the physical window
+ * @param[in] depth color depth of the physical window
+ */
+ GlWindowRenderThread(PositionSize positionSize, ColorDepth colorDepth);
+
+ /**
+ * destructor.
+ */
+ virtual ~GlWindowRenderThread();
+
+ /**
+ * Sets the GraphicsInterface instance.
+ * This graphics instance is used to create and initialize graphics resource
+ *
+ * @param[in] graphics The graphice instance
+ */
+ void SetGraphicsInterface(Graphics::GraphicsInterface* graphics);
+
+ /**
+ * Sets the WindowBase instance
+ * This WindowBase instance is used to call wl egl window APIs.
+ *
+ * @param[in] windowBase The WindowBase instance
+ */
+ void SetWindowBase(WindowBase* windowBase);
+
+ /**
+ * @brief Sets graphics configuration for GlWindow
+ *
+ * @param[in] depth the flag of depth buffer. If true is set, 24bit depth buffer is enabled.
+ * @param[in] stencil the flag of stencil. it true is set, 8bit stencil buffer is enabled.
+ * @param[in] msaa the bit of msaa.
+ * @param[in] version the GLES version.
+ *
+ */
+ void SetGraphicsConfig(bool depth, bool stencil, int msaa, int version);
+
+ /**
+ * Pauses the Render Thread.
+ * It is called when GlWindow is iconified or hidden.
+ *
+ * This will lock the mutex in mRenderThreadWaitCondition.
+ */
+ void Pause();
+
+ /**
+ * Resumes the Render Thread.
+ * It is called when GlWindow is de-iconified or shown.
+ *
+ * This will lock the mutex in mRenderThreadWaitCondition.
+ */
+ void Resume();
+
+ /**
+ * Stops the Render Thread.
+ * This will lock the mutex in mRenderThreadWaitCondition.
+ *
+ * @note Should only be called in Stop as calling this will kill the render thread.
+ */
+ void Stop();
+
+ /**
+ * @copydoc Dali::GlWindow::RegisterGlCallbacks()
+ */
+ void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
+
+ /**
+ * Enable OnDemand Rendering Mode
+ *
+ * @param[in] onDemand the flag of OnDemand Rendering Mode. If the flag is true, rendering mode is OnDemand, otherwise the flag is false, rendering mode is continuous mode.
+ */
+ void SetOnDemandRenderMode(bool onDemand);
+
+ /**
+ * @copydoc Dali::GlWindow::RenderOnce()
+ */
+ void RenderOnce();
+
+ /**
+ * Requests the window resize to GlWindow's render thread.
+ *
+ * @param[in] width new width.
+ * @param[in] height new height.
+ */
+ void RequestWindowResize(int width, int height);
+
+ /**
+ * Requests the window rotation to GlWindow's render thread.
+ *
+ * @param[in] windowAngle the window rotation's angle as 0, 90, 180 and 270.
+ */
+ void RequestWindowRotate(int windowAngle);
+
+ /**
+ * Requests the screen rotation to GlWindow's render thread.
+ *
+ * @param[in] screenAngle the screen rotation's angle as 0, 90, 180 and 270.
+ */
+ void RequestScreenRotate(int screenAngle);
+
+protected:
+ /**
+ * The Render thread loop. This thread will be destroyed on exit from this function.
+ */
+ virtual void Run();
+
+private:
+ /**
+ * @brief Initialize and create EGL resource
+ */
+ void InitializeGraphics(EglGraphics* eglGraphics);
+
+ /**
+ * Called by the Render Thread which ensures a wait if required.
+ *
+ * @param[out] timeToSleepUntil The time remaining in nanoseconds to keep the thread sleeping before resuming.
+ * @return false, if the thread should stop.
+ */
+ bool RenderReady(uint64_t& timeToSleepUntil);
+
+ /**
+ * In the Tizen world, when GlWindow rotation is finished in client side,
+ * the completed message should be sent to display server.
+ * This function should be called in the event thread after buffer is committed.
+ */
+ void WindowRotationCompleted();
+
+ /**
+ * Gets window's current surface status
+ *
+ * @brief This function return window's current surface status.
+ * The status has the the information of window resized, window rotated and screen rotated.
+ * After called, the status value is reset
+ *
+ * @[output] windowRotationAngle return current window rotation angle.
+ * @[output] screenRotationAngle return current screen rotation angle.
+ * @return the window's current surface status.
+ */
+ unsigned int GetSurfaceStatus(int& windowRotationAngle, int& screenRotationAngle);
+
+ /**
+ * Starts post rendering process
+ *
+ * @brief Starts post rendering process for window rotation
+ * It is to pause the render thread until maint thread finishes the window rotation work.
+ */
+ void PostRenderStart();
+
+ /**
+ * Finishs post rendering process
+ *
+ * @brief Finishes post rendering process for window rotation
+ * It set the resume flag for resume the render thread.
+ */
+ void PostRenderFinish();
+
+ /**
+ * Pauses the render thread unitil post rendering process
+ *
+ * @brief Pauses the render thread until main thread works window rotation.
+ */
+ void PostRenderWaitForFinished();
+
+private:
+ Graphics::GraphicsInterface* mGraphics; ///< Graphics interface
+ WindowBase* mWindowBase;
+ std::unique_ptr<TriggerEventInterface> mWindowRotationTrigger;
+
+ const Dali::LogFactoryInterface& mLogFactory;
+ const Dali::TraceFactoryInterface& mTraceFactory;
+
+ PositionSize mPositionSize; ///< Position
+ ColorDepth mColorDepth;
+
+ // EGL, GL Resource
+ std::unique_ptr<CallbackBase> mGLInitCallback;
+ std::unique_ptr<CallbackBase> mGLRenderFrameCallback;
+ std::unique_ptr<CallbackBase> mGLTerminateCallback;
+ EGLSurface mEGLSurface;
+ EGLContext mEGLContext;
+ bool mDepth : 1;
+ bool mStencil : 1;
+ bool mIsEGLInitialize : 1;
+ int mGLESVersion;
+ int mMSAA;
+ int mWindowRotationAngle; ///< The angle of window rotation angle
+ int mScreenRotationAngle; ///< The angle of screen rotation angle
+
+ // To manage the render/main thread
+ ConditionalWait mRenderThreadWaitCondition; ///< The wait condition for the update-render-thread.
+ volatile unsigned int mDestroyRenderThread; ///< Stop render thread. It means this rendter thread will be destoried.
+ volatile unsigned int mPauseRenderThread; ///< Sleep render thread by pause.
+ volatile unsigned int mRenderingMode; ///< Rendering Mode, 0: continuous, 1:OnDemad
+ volatile unsigned int mRequestRenderOnce; ///< Request rendering once
+ volatile unsigned int mSurfaceStatus; ///< When surface is changed as resized or rotated, this flag is set. 0: No changed, 1:resized, 2:window rotation, 4:screen rotation
+ volatile unsigned int mPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread).
+
+ uint64_t mDefaultFrameDurationNanoseconds; ///< Default duration of a frame (used for sleeping if not enough time elapsed). Not protected by lock, but written to rarely so not worth adding a lock when reading.
+
+}; // GlWindowRenderThread
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2025 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 <dali/internal/window-system/tizen-wayland/display-connection-native-types.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) Any CastToNativeGraphicsType(wl_display* display)
+{
+ return GraphicsLibrary::CastToNativeGraphicsType(display);
+}
+
+} // namespace Dali::Internal::Adaptor
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/tizen-wayland/display-connection-native-types.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+extern "C"
+{
+ DALI_ADAPTOR_API Dali::Any CastToNativeGraphicsType(void* display)
+ {
+ return Dali::Internal::Adaptor::CastToNativeGraphicsType(static_cast<wl_display*>(display));
+ }
+} // extern "C"
\ No newline at end of file
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
void NativeImageSurfaceEcoreWl::InitializeGraphics()
{
- std::unique_ptr<GraphicsFactory> graphicsFactoryPtr = Utils::MakeUnique<GraphicsFactory>(*(new EnvironmentOptions()));
- auto graphicsFactory = *graphicsFactoryPtr.get();
+ std::unique_ptr<EglGraphicsFactory> graphicsFactoryPtr = Utils::MakeUnique<EglGraphicsFactory>(*(new EnvironmentOptions()));
+ auto graphicsFactory = *graphicsFactoryPtr.get();
mGraphics = std::unique_ptr<Graphics::GraphicsInterface>(&graphicsFactory.Create());
auto graphics = mGraphics.get();
--- /dev/null
+/*
+ * Copyright (c) 2025 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 <dali/internal/window-system/ubuntu-x11/display-connection-native-types.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) Any CastToNativeGraphicsType(XDisplay* display)
+{
+ return GraphicsLibrary::CastToNativeGraphicsType(display);
+}
+
+} // namespace Dali::Internal::Adaptor
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/ubuntu-x11/display-connection-native-types.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+extern "C"
+{
+ DALI_ADAPTOR_API Dali::Any CastToNativeGraphicsType(void* display)
+ {
+ return Dali::Internal::Adaptor::CastToNativeGraphicsType(static_cast<Dali::XDisplay*>(display));
+ }
+} // extern "C"
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2025 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 <dali/internal/window-system/x11/display-connection-native-types.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-library.h>
+
+namespace Dali::Internal::Adaptor
+{
+__attribute__((weak)) Any CastToNativeGraphicsType(::Display* display)
+{
+ return GraphicsLibrary::CastToNativeGraphicsType(display);
+}
+
+} // namespace Dali::Internal::Adaptor
--- /dev/null
+/*
+ * Copyright (c) 2025 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/x11/display-connection-native-types.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+extern "C"
+{
+ DALI_ADAPTOR_API Dali::Any CastToNativeGraphicsType(void* display)
+ {
+ return Dali::Internal::Adaptor::CastToNativeGraphicsType(static_cast<::Display*>(display));
+ }
+} // extern "C"
\ No newline at end of file
#define DALI_INTERNAL_WINDOW_SYSTEM_X11_WINDOW_SYSTEM_H
/*
- * COPYRIGHT (c) 2023 Samsung Electronics Co., Ltd.
+ * COPYRIGHT (c) 2025 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.
{
/**
* Class to encapsulate the actual window system calls to X11
+ * Needs exporting as it's called by the graphics libraries
*/
-class WindowSystemX : public WindowSystemBase
+class DALI_ADAPTOR_API WindowSystemX : public WindowSystemBase
{
public:
static Atom ATOM_WM_PROTOCOLS;
/**
* Get the platform implementation of the window system
* @return the platform implementation of the window system
+ * Needs exporting as it's called by the graphics libraries
*/
-WindowSystemX& GetImplementation();
+DALI_ADAPTOR_API WindowSystemX& GetImplementation();
} // namespace Dali::Internal::Adaptor::WindowSystem
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
Backend GetCurrentGraphicsBackend()
{
-// TODO: Remove below once we actually have it dynamic, but for now just use define
-// return gCurrentGraphics;
-#if VULKAN_ENABLED
- return Backend::VULKAN;
-#else
- return Backend::GLES;
-#endif
+ return gCurrentGraphicsBackend;
}
void SetGraphicsBackend(Backend backend)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
NativeImageSource::NativeImageSource(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSource)
{
auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory();
- mImpl = factory->CreateNativeImageSource(width, height, depth, nativeImageSource).release();
+ DALI_ASSERT_DEBUG(factory && "Unable to get NativeImageSourceFactory\n");
+
+ mImpl = factory->CreateNativeImageSource(width, height, depth, nativeImageSource).release();
}
NativeImageSource::~NativeImageSource()
Requires(postun): /sbin/ldconfig
Requires: giflib
-%if 0%{?enable_vulkan}
-Requires: glslang
-%endif
-
%define tizen_platform_config_supported 1
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-system-sensor)
-%if 0%{?enable_vulkan}
BuildRequires: pkgconfig(vulkan)
BuildRequires: glslang-devel
BuildRequires: glslang
-%else
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(wayland-egl)
-%endif
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(input-method-client)
# We use ecore mainloop
BuildRequires: pkgconfig(ecore-wl2)
-%if !0%{?enable_vulkan}
BuildRequires: pkgconfig(wayland-egl-tizen)
-%endif
# We need tbm_surface in tizen 3.0 wayland
BuildRequires: pkgconfig(libtbm)
The DALi Tizen Adaptor provides a Tizen specific implementation of the dali-core
platform abstraction and application shell
+###########################################
+# Vulkan Graphics Backend
+###########################################
+%package vulkan
+Summary: The DALi Tizen Adaptor with the Vulkan library
+Requires: %{name}
+Requires: glslang
+%description vulkan
+The DALi Tizen Adaptor with the Vulkan library.
+
###########################################
# Dali adapter for profiles
###########################################
cmake_flags+=" -DENABLE_NETWORK_LOGGING=ON"
%endif
-%if 0%{?enable_vulkan}
-cmake_flags+=" -DENABLE_VULKAN=ON"
-%endif
-
libtoolize --force
cd %{_builddir}/%{name}-%{version}/build/tizen
%{_libdir}/libdali2-adaptor.so
%{_libdir}/libdali2-adaptor.so.2
%{_libdir}/libdali2-adaptor.so.2.0.0
+%{_libdir}/libdali2-adaptor-gles.so
+%{_libdir}/libdali2-adaptor-gl-window-addon.so
%{_libdir}/libdali2-adaptor-application-normal.so*
%{_libdir}/libdali2-adaptor-application-widget.so*
%{_libdir}/libdali2-adaptor-application-watch.so*
#################################################
+%files vulkan
+%manifest dali-adaptor.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libdali2-adaptor-vulkan.so
+
+#################################################
+
%files dali2-feedback-plugin
%manifest dali-adaptor.manifest
%defattr(-,root,root,-)