From 1e98c14c964ed0f3ce3d9e7c89e8650133cf7997 Mon Sep 17 00:00:00 2001 From: MuHong Byun Date: Wed, 23 Jun 2021 08:31:22 +0900 Subject: [PATCH 1/7] Enable x64(pc) build for tizen shell Signed-off-by: MuHong Byun Use enable_desktop_embeddings instead of embedder_for_pc Signed-off-by: MuHong Byun Co-authored-by: Swift Kim Add flutter_tizen_engine TC Signed-off-by: MuHong Byun Add basic shell for test Signed-off-by: MuHong Byun Introduce mock_engine for unittest * copied from linux port ('/shell/platform/linux/testing/mock_engine.cc') Signed-off-by: MuHong Byun Apply review's comment Signed-off-by: MuHong Byun Code clean-up && Apply review's comment Signed-off-by: MuHong Byun Clean up shell/platform/tizen/BUILD.gn Signed-off-by: MuHong Byun Clean up shell/platform/tizen/BUILD.gn #2 Signed-off-by: MuHong Byun Add EvasGL Helper for x64 shell build * This file is the same file as Evas_GL_GLES3_Helpers.h in tizen. Signed-off-by: MuHong Byun Fix minor thing * Change ecore lib path at X64 shell * Refactor log function dummy * Apply review's comment Signed-off-by: MuHong Byun --- BUILD.gn | 5 + shell/platform/BUILD.gn | 5 +- shell/platform/common/BUILD.gn | 2 + shell/platform/tizen/BUILD.gn | 257 +++++-- .../tizen/channels/localization_channel.cc | 52 +- .../tizen/channels/platform_channel.cc | 57 ++ .../tizen/channels/settings_channel.cc | 16 + .../tizen/channels/settings_channel.h | 17 + .../tizen/channels/text_input_channel.cc | 2 + .../tizen/external_texture_pixel_gl.cc | 6 + .../tizen/external_texture_surface_gl.cc | 31 + .../tizen/flutter_tizen_engine_unittest.cc | 111 +++ shell/platform/tizen/flutter_tizen_shell.cc | 120 +++ shell/platform/tizen/key_event_handler.cc | 11 + shell/platform/tizen/key_event_handler.h | 4 + shell/platform/tizen/testing/mock_engine.cc | 334 +++++++++ shell/platform/tizen/tizen_evas_gl_helper.h | 687 ++++++++++++++++++ shell/platform/tizen/tizen_event_loop.cc | 3 + shell/platform/tizen/tizen_event_loop.h | 1 + shell/platform/tizen/tizen_log.cc | 11 +- shell/platform/tizen/tizen_log.h | 16 +- .../platform/tizen/tizen_renderer_ecore_wl2.h | 1 - .../platform/tizen/tizen_renderer_evas_gl.cc | 13 +- shell/platform/tizen/tizen_vsync_waiter.h | 1 - shell/platform/tizen/touch_event_handler.h | 4 + 25 files changed, 1691 insertions(+), 76 deletions(-) create mode 100644 shell/platform/tizen/flutter_tizen_engine_unittest.cc create mode 100644 shell/platform/tizen/flutter_tizen_shell.cc create mode 100644 shell/platform/tizen/testing/mock_engine.cc create mode 100644 shell/platform/tizen/tizen_evas_gl_helper.h diff --git a/BUILD.gn b/BUILD.gn index bf6522aa4e778..24af00141b68c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,6 +5,7 @@ import("//flutter/common/config.gni") import("//flutter/shell/platform/config.gni") import("//flutter/shell/platform/glfw/config.gni") +import("//flutter/shell/platform/tizen/config.gni") import("//flutter/testing/testing.gni") # Whether to build the dartdevc sdk, libraries, and source files @@ -159,6 +160,10 @@ group("flutter") { public_deps += [ "//flutter/shell/platform/glfw:flutter_glfw_unittests" ] } + if (build_tizen_shell) { + public_deps += + [ "//flutter/shell/platform/tizen:flutter_tizen_unittests" ] + } } if (is_mac) { diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn index 45519610ae9f9..0e5fb51a2e040 100644 --- a/shell/platform/BUILD.gn +++ b/shell/platform/BUILD.gn @@ -13,11 +13,10 @@ group("platform") { deps = [ "android" ] } else if (is_linux) { deps = [] - if (enable_desktop_embeddings) { - deps += [ "linux" ] - } if (build_tizen_shell) { deps += [ "tizen" ] + } else if (enable_desktop_embeddings) { + deps += [ "linux" ] } } else if (is_win) { deps = [] diff --git a/shell/platform/common/BUILD.gn b/shell/platform/common/BUILD.gn index dde2ee14199d7..8ec0a8466d6e1 100644 --- a/shell/platform/common/BUILD.gn +++ b/shell/platform/common/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//flutter/common/config.gni") +import("//flutter/shell/platform/config.gni") import("//flutter/shell/platform/tizen/config.gni") import("//flutter/testing/testing.gni") @@ -181,6 +182,7 @@ if (enable_unittests) { ":common_cpp_switches", "//flutter/shell/platform/common/client_wrapper:client_wrapper", "//flutter/shell/platform/common/client_wrapper:client_wrapper_library_stubs", + "//flutter/shell/platform/embedder:embedder_as_internal_library", "//flutter/testing", ] diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index 18bc5e2f7b447..8d6684781ddf5 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -3,7 +3,9 @@ # found in the LICENSE file. import("//flutter/shell/platform/common/client_wrapper/publish.gni") +import("//flutter/shell/platform/config.gni") import("//flutter/shell/platform/tizen/config.gni") +import("//flutter/testing/testing.gni") # Sets the rpath of dependent targets (shared libs) to $ORIGIN. # We assume that the flutter_engine library exists next to the embedder library @@ -24,6 +26,35 @@ source_set("flutter_engine") { deps = [ "//flutter/shell/platform/embedder:flutter_engine" ] } +_flutter_tizen_source = [ + "channels/key_event_channel.cc", + "channels/lifecycle_channel.cc", + "channels/localization_channel.cc", + "channels/navigation_channel.cc", + "channels/platform_channel.cc", + "channels/platform_view_channel.cc", + "channels/settings_channel.cc", + "channels/text_input_channel.cc", + "external_texture_pixel_gl.cc", + "external_texture_surface_gl.cc", + "flutter_tizen.cc", + "flutter_tizen_engine.cc", + "flutter_tizen_texture_registrar.cc", + "key_event_handler.cc", + "tizen_event_loop.cc", + "tizen_log.cc", + "tizen_renderer.cc", + "touch_event_handler.cc", +] + +_libs_minimum = [ + "ecore", + "ecore_imf", + "ecore_input", + "eina", + "wayland-client", +] + _public_headers = [ "public/flutter_platform_view.h", "public/flutter_tizen.h", @@ -33,42 +64,54 @@ _public_headers = [ # added to the compiler's search paths. Since we are not using the Tizen CLI # builder, we have to add them manually. config("tizen_rootstrap_include_dirs") { + local_prefix = "$custom_sysroot/usr" + + if (enable_desktop_embeddings && target_cpu == "x64") { + defines = [ "__X64_SHELL__" ] + local_prefix += "/local" + } + include_dirs = [ - "$custom_sysroot/usr/include", - "$custom_sysroot/usr/include/appfw", - "$custom_sysroot/usr/include/base", - "$custom_sysroot/usr/include/dlog", - "$custom_sysroot/usr/include/ecore-1", - "$custom_sysroot/usr/include/ecore-imf-1", - "$custom_sysroot/usr/include/ecore-input-1", - "$custom_sysroot/usr/include/ecore-wayland-1", - "$custom_sysroot/usr/include/ecore-wl2-1", - "$custom_sysroot/usr/include/efl-1", - "$custom_sysroot/usr/include/eina-1", - "$custom_sysroot/usr/include/eina-1/eina", - "$custom_sysroot/usr/include/emile-1", - "$custom_sysroot/usr/include/eo-1", - "$custom_sysroot/usr/include/feedback", - "$custom_sysroot/usr/include/system", - "$custom_sysroot/usr/include/wayland-extension", + local_prefix + "/include", + local_prefix + "/include/appfw", + local_prefix + "/include/base", + local_prefix + "/include/dlog", + local_prefix + "/include/ecore-1", + local_prefix + "/include/ecore-imf-1", + local_prefix + "/include/ecore-input-1", + local_prefix + "/include/ecore-wayland-1", + local_prefix + "/include/ecore-wl2-1", + local_prefix + "/include/efl-1", + local_prefix + "/include/eina-1", + local_prefix + "/include/eina-1/eina", + local_prefix + "/include/emile-1", + local_prefix + "/include/eo-1", + local_prefix + "/include/feedback", + local_prefix + "/include/system", + local_prefix + "/include/wayland-extension", ] # Contain headers that the Evas_GL renderer depends on. include_dirs += [ - "$custom_sysroot/usr/include/ecore-con-1", - "$custom_sysroot/usr/include/ecore-evas-1", - "$custom_sysroot/usr/include/ecore-file-1", - "$custom_sysroot/usr/include/edje-1", - "$custom_sysroot/usr/include/eet-1", - "$custom_sysroot/usr/include/efl-1/interfaces", - "$custom_sysroot/usr/include/efreet-1", - "$custom_sysroot/usr/include/elementary-1", - "$custom_sysroot/usr/include/ethumb-1", - "$custom_sysroot/usr/include/ethumb-client-1", - "$custom_sysroot/usr/include/evas-1", + local_prefix + "/include/ecore-con-1", + local_prefix + "/include/ecore-evas-1", + local_prefix + "/include/ecore-file-1", + local_prefix + "/include/edje-1", + local_prefix + "/include/eet-1", + local_prefix + "/include/efl-1/interfaces", + local_prefix + "/include/efreet-1", + local_prefix + "/include/elementary-1", + local_prefix + "/include/ethumb-1", + local_prefix + "/include/ethumb-client-1", + local_prefix + "/include/evas-1", ] - lib_dirs = [ "$custom_sysroot/usr/lib" ] + if (enable_desktop_embeddings && target_cpu == "x64") { + include_dirs += [ local_prefix + "/include/eldbus-1" ] + lib_dirs = [ local_prefix + "/lib/x86_64-linux-gnu" ] + } else { + lib_dirs = [ local_prefix + "/lib" ] + } } # Template for the embedder build. Used to generate embedders for different @@ -86,48 +129,29 @@ template("embedder_for_profile") { shared_library("flutter_tizen_${target_name}") { public = _public_headers - sources = [ - "channels/key_event_channel.cc", - "channels/lifecycle_channel.cc", - "channels/localization_channel.cc", - "channels/navigation_channel.cc", - "channels/platform_channel.cc", - "channels/platform_view_channel.cc", - "channels/settings_channel.cc", - "channels/text_input_channel.cc", - "external_texture_pixel_gl.cc", - "external_texture_surface_gl.cc", - "flutter_tizen.cc", - "flutter_tizen_engine.cc", - "flutter_tizen_texture_registrar.cc", - "key_event_handler.cc", - "tizen_event_loop.cc", - "tizen_log.cc", - "tizen_renderer.cc", - "touch_event_handler.cc", - ] + sources = _flutter_tizen_source - libs = [ - "base-utils-i18n", - "capi-appfw-application", - "capi-base-common", - "capi-system-system-settings", - "dlog", - "ecore", - "ecore_imf", - "ecore_input", - "eina", - "EGL", - "feedback", - "GLESv2", - "tbm", - "tdm-client", - "wayland-client", - ] + libs = _libs_minimum + + if (!enable_desktop_embeddings) { + libs += [ + "base-utils-i18n", + "capi-appfw-application", + "capi-base-common", + "capi-system-info", + "capi-system-system-settings", + "dlog", + "feedback", + "tbm", + "tdm-client", + "EGL", + "GLESv2", + ] + } defines = invoker.defines - if (use_evas_gl_renderer) { + if (use_evas_gl_renderer || enable_desktop_embeddings) { sources += [ "tizen_renderer_evas_gl.cc" ] libs += [ @@ -167,6 +191,11 @@ template("embedder_for_profile") { "//flutter/shell/platform/common/client_wrapper:client_wrapper", "//third_party/rapidjson", ] + + if (enable_desktop_embeddings) { + deps += + [ "//flutter/shell/platform/embedder:embedder_as_internal_library" ] + } } } @@ -188,6 +217,97 @@ embedder_for_profile("common") { defines = [ "COMMON_PROFILE" ] } +test_fixtures("flutter_tizen_fixtures") { + fixtures = [] +} + +template("embedder_executable") { + forward_variables_from(invoker, [ "unit_test" ]) + + if (!defined(unit_test)) { + unit_test = false + } + + executable("${target_name}") { + if (unit_test) { + testonly = true + } + + public = _public_headers + + sources = _flutter_tizen_source + + sources += [ "tizen_renderer_evas_gl.cc" ] + + if (defined(invoker.sources)) { + sources += invoker.sources + } + + libs = _libs_minimum + + libs += [ + "ecore_evas", + "elementary", + "evas", + ] + + defines = [ "TIZEN_RENDERER_EVAS_GL" ] + + cflags_cc = [ + "-Wno-newline-eof", + "-Wno-macro-redefined", + ] + + public_configs = [ "//flutter:config" ] + + configs += [ + ":tizen_rootstrap_include_dirs", + "//flutter/shell/platform/common:desktop_library_implementation", + ] + + deps = [ + "//flutter/runtime:libdart", + "//flutter/shell/platform/common:common_cpp", + "//flutter/shell/platform/common:common_cpp_input", + "//flutter/shell/platform/common:common_cpp_library_headers", + "//flutter/shell/platform/common/client_wrapper:client_wrapper", + "//flutter/shell/platform/embedder:embedder_headers", + "//third_party/rapidjson", + ] + + if (defined(invoker.deps)) { + deps += invoker.deps + } + + if (defined(invoker.public_deps)) { + public_deps = invoker.public_deps + } + } +} + +embedder_executable("flutter_tizen_unittests") { + unit_test = true + + sources = [ + "flutter_tizen_engine_unittest.cc", + "testing/mock_engine.cc", + ] + + public_deps = [ "//third_party/googletest:gtest" ] + + deps = [ + ":flutter_tizen_fixtures", + "//flutter/shell/platform/embedder:embedder_test_utils", + "//flutter/testing", + ] +} + +embedder_executable("flutter_tizen_shell") { + sources = [ "flutter_tizen_shell.cc" ] + + public_deps = [ ":flutter_engine" ] +} + publish_client_wrapper_core("publish_cpp_client_wrapper") { visibility = [ ":*" ] } @@ -223,4 +343,7 @@ group("tizen") { ":publish_cpp_client_wrapper", ":publish_headers_tizen", ] + if (enable_desktop_embeddings) { + deps += [ ":flutter_tizen_shell" ] + } } diff --git a/shell/platform/tizen/channels/localization_channel.cc b/shell/platform/tizen/channels/localization_channel.cc index e86d904a96fff..883e522f9a083 100644 --- a/shell/platform/tizen/channels/localization_channel.cc +++ b/shell/platform/tizen/channels/localization_channel.cc @@ -3,8 +3,58 @@ // found in the LICENSE file. #include "localization_channel.h" - +#ifndef __X64_SHELL__ #include +#else +typedef enum { + I18N_ERROR_NONE, /**< No error, no warning */ + I18N_ERROR_NOT_SUPPORTED, +} i18n_error_code_e; + +int i18n_ulocale_set_default(const char* locale_id) { + return I18N_ERROR_NONE; +} + +int i18n_ulocale_get_default(const char** locale) { + *locale = "en_US.UTF-8"; + return I18N_ERROR_NONE; +} + +int i18n_ulocale_get_language(const char* locale_id, + char* language, + int32_t language_capacity, + int32_t* buf_size_language) { + return I18N_ERROR_NOT_SUPPORTED; +} + +const char* i18n_ulocale_get_available(int32_t n) { + return "en_US.UTF-8"; +} + +int32_t i18n_ulocale_get_country(const char* locale_id, + char* country, + int32_t country_capacity, + int* error) { + return 0; +} + +int32_t i18n_ulocale_count_available(void) { + return 0; +} + +int32_t i18n_ulocale_get_script(const char* locale_id, + char* script, + int32_t script_capacity) { + return 0; +} + +int32_t i18n_ulocale_get_variant(const char* locale_id, + char* variant, + int32_t variant_capacity) { + return 0; +} + +#endif #include #include "flutter/shell/platform/tizen/flutter_tizen_engine.h" diff --git a/shell/platform/tizen/channels/platform_channel.cc b/shell/platform/tizen/channels/platform_channel.cc index ed1c6a76455d1..f3d8685e34e37 100644 --- a/shell/platform/tizen/channels/platform_channel.cc +++ b/shell/platform/tizen/channels/platform_channel.cc @@ -4,8 +4,65 @@ #include "platform_channel.h" +#ifndef __X64_SHELL__ #include #include +#else + +namespace { + +typedef enum { + FEEDBACK_PATTERN_NONE = -1, + FEEDBACK_PATTERN_TAP = 0, /**< Feedback pattern when general touch */ + FEEDBACK_PATTERN_SIP, /**< Feedback pattern when touch text key */ + FEEDBACK_PATTERN_GENERAL = + 33, /**< Feedback pattern when alert general event */ + FEEDBACK_PATTERN_VIBRATION_ON = + 55, /**< Feedback pattern when turn on vibration mode */ + FEEDBACK_PATTERN_SILENT_OFF, /**< Feedback pattern when turn off silent mode + */ +} feedback_pattern_e; + +typedef enum { + FEEDBACK_TYPE_NONE, /**< Feedback type none */ + FEEDBACK_TYPE_SOUND, /**< Feedback type for sound */ + + FEEDBACK_TYPE_VIBRATION, /**< Feedback type for vibration */ + FEEDBACK_TYPE_END, +} feedback_type_e; + +typedef enum { + FEEDBACK_ERROR_NONE, /**< Successful */ + FEEDBACK_ERROR_OPERATION_FAILED, /**< Operation failed */ + + FEEDBACK_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + FEEDBACK_ERROR_NOT_SUPPORTED, /**< Not supported in this device */ + FEEDBACK_ERROR_PERMISSION_DENIED, /**< Permission denied */ + FEEDBACK_ERROR_NOT_INITIALIZED, /**< Not initialized */ +} feedback_error_e; + +int feedback_initialize(void) { + return 0; +} + +int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern) { + return 0; +} + +int feedback_deinitialize(void) { + return 0; +} + +void ui_app_exit(void) { + exit(0); +} + +char* get_error_message(int err_code) { + return (char*)"NOT SUPPORTED"; +} + +}; // namespace +#endif #include diff --git a/shell/platform/tizen/channels/settings_channel.cc b/shell/platform/tizen/channels/settings_channel.cc index 54daa65c248a1..568ecd48970b2 100644 --- a/shell/platform/tizen/channels/settings_channel.cc +++ b/shell/platform/tizen/channels/settings_channel.cc @@ -6,6 +6,22 @@ #include "flutter/shell/platform/common/json_message_codec.h" +#ifdef __X64_SHELL__ +int system_settings_set_changed_cb(system_settings_key_e key, + system_settings_changed_cb callback, + void* user_data) { + return 0; +} + +int system_settings_unset_changed_cb(system_settings_key_e key) { + return 0; +} + +int system_settings_get_value_bool(system_settings_key_e key, bool* value) { + return 0; +} +#endif + namespace flutter { namespace { diff --git a/shell/platform/tizen/channels/settings_channel.h b/shell/platform/tizen/channels/settings_channel.h index db7af4b5dae4e..51328f1a31d7a 100644 --- a/shell/platform/tizen/channels/settings_channel.h +++ b/shell/platform/tizen/channels/settings_channel.h @@ -5,7 +5,24 @@ #ifndef EMBEDDER_SETTINGS_CHANNEL_H_ #define EMBEDDER_SETTINGS_CHANNEL_H_ +#ifndef __X64_SHELL__ #include +#else +typedef enum { + SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, /**< (bool) Indicates whether + the 24-hour clock is used. If + the value is @c false, the + 12-hour clock is used. */ + SYSTEM_SETTINGS_KEY_MAX, +} system_settings_key_e; + +typedef enum { + SYSTEM_SETTINGS_ERROR_NONE, /**< Successful */ +} system_settings_error_e; + +typedef void (*system_settings_changed_cb)(system_settings_key_e key, + void* user_data); +#endif #include diff --git a/shell/platform/tizen/channels/text_input_channel.cc b/shell/platform/tizen/channels/text_input_channel.cc index 388fe2dbc143d..fb7064ee42507 100644 --- a/shell/platform/tizen/channels/text_input_channel.cc +++ b/shell/platform/tizen/channels/text_input_channel.cc @@ -409,6 +409,8 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* event) { #ifdef WEARABLE_PROFILE // Hardware keyboard not supported on watches. bool is_ime = true; +#elif __X64_SHELL__ + bool is_ime = false; #else bool is_ime = strcmp(ecore_device_name_get(event->dev), "ime") == 0; #endif diff --git a/shell/platform/tizen/external_texture_pixel_gl.cc b/shell/platform/tizen/external_texture_pixel_gl.cc index 846bdb0737422..f0a6e28432082 100644 --- a/shell/platform/tizen/external_texture_pixel_gl.cc +++ b/shell/platform/tizen/external_texture_pixel_gl.cc @@ -6,7 +6,13 @@ #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT + +#ifdef __X64_SHELL__ +#include "tizen_evas_gl_helper.h" +#else #include +#endif + extern Evas_GL* g_evas_gl; EVAS_GL_GLOBAL_GLES3_DECLARE(); #else diff --git a/shell/platform/tizen/external_texture_surface_gl.cc b/shell/platform/tizen/external_texture_surface_gl.cc index cba8bdf277eac..81829cbe2c162 100644 --- a/shell/platform/tizen/external_texture_surface_gl.cc +++ b/shell/platform/tizen/external_texture_surface_gl.cc @@ -6,6 +6,8 @@ #include "flutter/shell/platform/common/public/flutter_texture_registrar.h" +#ifndef __X64_SHELL__ + #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT #include @@ -157,3 +159,32 @@ void ExternalTextureSurfaceGL::OnDestruction() { } } // namespace flutter + +#else +namespace flutter { +ExternalTextureSurfaceGL::ExternalTextureSurfaceGL( + FlutterDesktopGpuBufferTextureCallback texture_callback, + FlutterDesktopGpuBufferDestructionCallback destruction_callback, + void* user_data) + : ExternalTexture(), + texture_callback_(texture_callback), + destruction_callback_(destruction_callback), + user_data_(user_data) { + if (!texture_callback_ && destruction_callback_ && user_data_) { + user_data_ = nullptr; + } +} + +ExternalTextureSurfaceGL::~ExternalTextureSurfaceGL() {} + +bool ExternalTextureSurfaceGL::PopulateTexture( + size_t width, + size_t height, + FlutterOpenGLTexture* opengl_texture) { + return true; +} + +void ExternalTextureSurfaceGL::OnDestruction() {} +} // namespace flutter + +#endif diff --git a/shell/platform/tizen/flutter_tizen_engine_unittest.cc b/shell/platform/tizen/flutter_tizen_engine_unittest.cc new file mode 100644 index 0000000000000..e3e5665471239 --- /dev/null +++ b/shell/platform/tizen/flutter_tizen_engine_unittest.cc @@ -0,0 +1,111 @@ +// Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/tizen/flutter_tizen_engine.h" +#include "gtest/gtest.h" + +namespace flutter { +namespace testing { + +TEST(FlutterTizenEngineTestSimple, Create_Headless) { + flutter::FlutterTizenEngine* tizen_engine = + new flutter::FlutterTizenEngine(false); + EXPECT_TRUE(tizen_engine != nullptr); + delete tizen_engine; +} + +// TODO +TEST(FlutterTizenEngineTestSimple, DISABLED_Create_Headed) { + flutter::FlutterTizenEngine* tizen_engine = + new flutter::FlutterTizenEngine(true); + EXPECT_TRUE(tizen_engine != nullptr); + delete tizen_engine; +} + +class FlutterTizenEngineTest : public ::testing::Test { + public: + FlutterTizenEngineTest() { + std::string tpk_root; + char path[256]; + EXPECT_TRUE(getcwd(path, sizeof(path)) != NULL); + tpk_root = path + std::string("/tpkroot"); + + assets_path_ = tpk_root + "/res/flutter_assets"; + icu_data_path_ = tpk_root + "/res/icudtl.dat"; + aot_lib_path_ = tpk_root + "/lib/libapp.so"; + + switches_.push_back("--disable-observatory"); + // switches_.push_back("--verbose-logging"); + // switches_.push_back("--enable-dart-profiling"); + // switches_.push_back("--enable-checked-mode"); + } + + protected: + void SetUp() { + engine_prop_.assets_path = assets_path_.c_str(); + engine_prop_.icu_data_path = icu_data_path_.c_str(); + engine_prop_.aot_library_path = aot_lib_path_.c_str(); + engine_prop_.switches = switches_.data(); + engine_prop_.switches_count = switches_.size(); + + auto engine = std::make_unique(false); + engine_ = engine.release(); + } + + void TearDown() { + if (engine_) { + delete engine_; + } + engine_ = nullptr; + } + + std::string assets_path_; + std::string icu_data_path_; + std::string aot_lib_path_; + flutter::FlutterTizenEngine* engine_; + FlutterDesktopEngineProperties engine_prop_ = {}; + std::vector switches_; +}; + +TEST_F(FlutterTizenEngineTest, Run) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->RunEngine(engine_prop_)); + EXPECT_TRUE(true); +} + +// TODO +TEST_F(FlutterTizenEngineTest, DISABLED_Run_Twice) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->RunEngine(engine_prop_)); + EXPECT_FALSE(engine_->RunEngine(engine_prop_)); + EXPECT_TRUE(true); +} + +TEST_F(FlutterTizenEngineTest, Stop) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->RunEngine(engine_prop_)); + EXPECT_TRUE(engine_->StopEngine()); +} + +TEST_F(FlutterTizenEngineTest, Stop_Twice) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->RunEngine(engine_prop_)); + EXPECT_TRUE(engine_->StopEngine()); + EXPECT_FALSE(engine_->StopEngine()); +} + +TEST_F(FlutterTizenEngineTest, GetPluginRegistrar) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->GetPluginRegistrar() != nullptr); +} + +// TODO +TEST_F(FlutterTizenEngineTest, DISABLED_GetTextureRegistrar) { + EXPECT_TRUE(engine_ != nullptr); + EXPECT_TRUE(engine_->GetTextureRegistrar() != nullptr); +} + +} // namespace testing +} // namespace flutter \ No newline at end of file diff --git a/shell/platform/tizen/flutter_tizen_shell.cc b/shell/platform/tizen/flutter_tizen_shell.cc new file mode 100644 index 0000000000000..146a2997a1a4c --- /dev/null +++ b/shell/platform/tizen/flutter_tizen_shell.cc @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include + +#include "flutter/shell/platform/tizen/flutter_tizen_engine.h" +#include "flutter/shell/platform/tizen/public/flutter_tizen.h" + +extern int gApp_width; +extern int gApp_height; + +std::string TPK_ROOT_PATH = "/tpkroot"; +std::string LIB_PATH = "/lib"; +std::string RES_PATH = "/res"; + +class FlutterApp { + public: + explicit FlutterApp() {} + virtual ~FlutterApp() {} + + bool OnCreate() { + printf("Launching a Flutter application...\n"); + std::string assets_path; + std::string icu_data_path; + std::string aot_lib_path; + FlutterDesktopEngineProperties engine_prop = {}; + std::vector switches; + + std::string tpk_root; + if (app_path_.empty()) { + char path[256]; + getcwd(path, sizeof(path)); + tpk_root = path + std::string("/tpkroot"); + } else { + tpk_root = app_path_; + } + + assets_path = tpk_root + "/res/flutter_assets"; + icu_data_path = tpk_root + "/res/icudtl.dat"; + aot_lib_path = tpk_root + "/lib/libapp.so"; + + switches.push_back("--disable-observatory"); + switches.push_back("--verbose-logging"); + switches.push_back("--enable-dart-profiling"); + switches.push_back("--enable-checked-mode"); + + engine_prop.assets_path = assets_path.c_str(); + engine_prop.icu_data_path = icu_data_path.c_str(); + engine_prop.aot_library_path = aot_lib_path.c_str(); + engine_prop.switches = switches.data(); + engine_prop.switches_count = switches.size(); + engine_ = reinterpret_cast( + FlutterDesktopRunEngine(engine_prop, true)); + + if (!engine_) { + printf("Could not launch a Flutter application.\n"); + return false; + } + // RegisterPlugins(this); + return true; + } + void OnResume() {} + void OnPause() {} + void OnTerminate() { + printf("Shutting down the application..."); + + FlutterDesktopShutdownEngine( + reinterpret_cast(engine_)); + delete engine_; + engine_ = nullptr; + + ecore_shutdown(); + } + int Run(int argc, char** argv) { + ecore_init(); + elm_init(0, 0); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_config_accel_preference_set("opengl"); + + for (int i = 1; i < argc; i++) { + if (strstr(argv[i], "--width=") == argv[i]) { + gApp_width = std::atoi(argv[i] + strlen("--width=")); + } else if (strstr(argv[i], "--height=") == argv[i]) { + gApp_height = std::atoi(argv[i] + strlen("--height=")); + } else if (strstr(argv[i], "--tpkroot=") == argv[i]) { + app_path_ = argv[i] + strlen("--tpkroot="); + } + } + + ecore_idler_add( + [](void* data) -> Eina_Bool { + FlutterApp* app = (FlutterApp*)data; + app->OnCreate(); + return ECORE_CALLBACK_CANCEL; + }, + this); + ecore_main_loop_begin(); + return 0; + } + + FlutterDesktopPluginRegistrarRef GetRegistrarForPlugin( + const std::string& plugin_name) { + if (engine_) { + return FlutterDesktopGetPluginRegistrar( + reinterpret_cast(engine_), + plugin_name.c_str()); + } + return nullptr; + } + + private: + std::string app_path_ = {}; + flutter::FlutterTizenEngine* engine_ = nullptr; +}; + +int main(int argc, char* argv[]) { + auto app = new FlutterApp(); + return app->Run(argc, argv); +} diff --git a/shell/platform/tizen/key_event_handler.cc b/shell/platform/tizen/key_event_handler.cc index 820a85477a303..2567eba300fbd 100644 --- a/shell/platform/tizen/key_event_handler.cc +++ b/shell/platform/tizen/key_event_handler.cc @@ -4,7 +4,18 @@ #include "key_event_handler.h" +#ifndef __X64_SHELL__ #include +#else + +namespace { + +void ui_app_exit(void) { + exit(0); +} + +}; // namespace +#endif #include "flutter/shell/platform/tizen/flutter_tizen_engine.h" #include "flutter/shell/platform/tizen/tizen_log.h" diff --git a/shell/platform/tizen/key_event_handler.h b/shell/platform/tizen/key_event_handler.h index 07ce8b8615770..662a9d509c4c3 100644 --- a/shell/platform/tizen/key_event_handler.h +++ b/shell/platform/tizen/key_event_handler.h @@ -5,6 +5,10 @@ #ifndef EMBEDDER_KEY_EVENT_HANDLER_H_ #define EMBEDDER_KEY_EVENT_HANDLER_H_ +#ifdef __X64_SHELL__ +#include +#endif + #include #include diff --git a/shell/platform/tizen/testing/mock_engine.cc b/shell/platform/tizen/testing/mock_engine.cc new file mode 100644 index 0000000000000..7ebf8c8e60566 --- /dev/null +++ b/shell/platform/tizen/testing/mock_engine.cc @@ -0,0 +1,334 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include + +#include "flutter/shell/platform/embedder/embedder.h" +#include "gtest/gtest.h" + +const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1; + +struct _FlutterEngine { + bool running; + FlutterPlatformMessageCallback platform_message_callback; + FlutterTaskRunnerPostTaskCallback platform_post_task_callback; + void* user_data; + + _FlutterEngine(FlutterPlatformMessageCallback platform_message_callback, + FlutterTaskRunnerPostTaskCallback platform_post_task_callback, + void* user_data) + : running(false), + platform_message_callback(platform_message_callback), + platform_post_task_callback(platform_post_task_callback), + user_data(user_data) {} +}; + +struct _FlutterPlatformMessageResponseHandle { + FlutterDataCallback data_callback; + void* user_data; + std::string channel; + bool released; + + // Constructor for a response handle generated by the engine. + explicit _FlutterPlatformMessageResponseHandle(std::string channel) + : data_callback(nullptr), + user_data(nullptr), + channel(channel), + released(false) {} + + // Constructor for a response handle generated by the shell. + _FlutterPlatformMessageResponseHandle(FlutterDataCallback data_callback, + void* user_data) + : data_callback(data_callback), user_data(user_data), released(false) {} +}; + +struct _FlutterTaskRunner { + uint64_t task; + std::string channel; + const FlutterPlatformMessageResponseHandle* response_handle; + uint8_t* message; + size_t message_size; + + _FlutterTaskRunner( + uint64_t task, + const std::string& channel, + const FlutterPlatformMessageResponseHandle* response_handle, + const uint8_t* message, + size_t message_size) + : task(task), + channel(channel), + response_handle(response_handle), + message_size(message_size) { + if (message_size > 0) { + this->message = static_cast(malloc(message_size)); + memcpy(this->message, message, message_size); + } else { + this->message = nullptr; + } + } + ~_FlutterTaskRunner() { + if (response_handle != nullptr) { + EXPECT_TRUE(response_handle->released); + delete response_handle; + } + free(message); + } +}; + +// Send a message from the engine. +static void send_message(FLUTTER_API_SYMBOL(FlutterEngine) engine, + const std::string& channel, + const uint8_t* message, + size_t message_size) { + FlutterTask task; + task.runner = + new _FlutterTaskRunner(1234, channel, nullptr, message, message_size); + task.task = task.runner->task; + engine->platform_post_task_callback(task, 0, engine->user_data); +} + +FlutterEngineResult FlutterEngineCreateAOTData( + const FlutterEngineAOTDataSource* source, + FlutterEngineAOTData* data_out) { + *data_out = nullptr; + return kSuccess; +} + +FlutterEngineResult FlutterEngineCollectAOTData(FlutterEngineAOTData data) { + return kSuccess; +} + +FlutterEngineResult FlutterEngineInitialize(size_t version, + const FlutterRendererConfig* config, + const FlutterProjectArgs* args, + void* user_data, + FLUTTER_API_SYMBOL(FlutterEngine) * + engine_out) { + EXPECT_NE(config, nullptr); + + EXPECT_NE(args, nullptr); + EXPECT_NE(args->platform_message_callback, nullptr); + EXPECT_NE(args->custom_task_runners, nullptr); + EXPECT_NE(args->custom_task_runners->platform_task_runner, nullptr); + EXPECT_NE(args->custom_task_runners->platform_task_runner->post_task_callback, + nullptr); + EXPECT_NE(user_data, nullptr); + + *engine_out = new _FlutterEngine( + args->platform_message_callback, + args->custom_task_runners->platform_task_runner->post_task_callback, + user_data); + return kSuccess; +} + +FlutterEngineResult FlutterEngineRunInitialized( + FLUTTER_API_SYMBOL(FlutterEngine) engine) { + engine->running = true; + return kSuccess; +} + +FlutterEngineResult FlutterEngineRun(size_t version, + const FlutterRendererConfig* config, + const FlutterProjectArgs* args, + void* user_data, + FLUTTER_API_SYMBOL(FlutterEngine) * + engine_out) { + EXPECT_NE(config, nullptr); + EXPECT_NE(args, nullptr); + EXPECT_NE(user_data, nullptr); + EXPECT_NE(engine_out, nullptr); + + FlutterEngineResult result = + FlutterEngineInitialize(version, config, args, user_data, engine_out); + if (result != kSuccess) { + return result; + } + return FlutterEngineRunInitialized(*engine_out); +} + +FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) + engine) { + delete engine; + return kSuccess; +} + +FlutterEngineResult FlutterEngineDeinitialize(FLUTTER_API_SYMBOL(FlutterEngine) + engine) { + return kSuccess; +} + +FlutterEngineResult FlutterEngineSendWindowMetricsEvent( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + const FlutterWindowMetricsEvent* event) { + EXPECT_TRUE(engine->running); + return kSuccess; +} + +FlutterEngineResult FlutterEngineSendPointerEvent( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + const FlutterPointerEvent* events, + size_t events_count) { + return kSuccess; +} + +FLUTTER_EXPORT +FlutterEngineResult FlutterEngineSendPlatformMessage( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + const FlutterPlatformMessage* message) { + EXPECT_TRUE(engine->running); + return kSuccess; +} + +FlutterEngineResult FlutterPlatformMessageCreateResponseHandle( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + FlutterDataCallback data_callback, + void* user_data, + FlutterPlatformMessageResponseHandle** response_out) { + EXPECT_TRUE(engine->running); + EXPECT_NE(data_callback, nullptr); + EXPECT_NE(user_data, nullptr); + + _FlutterPlatformMessageResponseHandle* handle = + new _FlutterPlatformMessageResponseHandle(data_callback, user_data); + + *response_out = handle; + return kSuccess; +} + +FlutterEngineResult FlutterPlatformMessageReleaseResponseHandle( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + FlutterPlatformMessageResponseHandle* response) { + EXPECT_NE(engine, nullptr); + EXPECT_NE(response, nullptr); + + EXPECT_TRUE(engine->running); + + EXPECT_FALSE(response->released); + response->released = true; + + return kSuccess; +} + +FlutterEngineResult FlutterEngineSendPlatformMessageResponse( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + const FlutterPlatformMessageResponseHandle* handle, + const uint8_t* data, + size_t data_length) { + EXPECT_NE(engine, nullptr); + EXPECT_NE(handle, nullptr); + + EXPECT_TRUE(engine->running); + + // Send a message so the shell can check the responses received. + if (handle->channel != "test/responses") { + send_message(engine, "test/responses", data, data_length); + } + + EXPECT_FALSE(handle->released); + + delete handle; + + return kSuccess; +} + +FlutterEngineResult FlutterEngineRunTask(FLUTTER_API_SYMBOL(FlutterEngine) + engine, + const FlutterTask* task) { + EXPECT_NE(engine, nullptr); + EXPECT_NE(task, nullptr); + EXPECT_NE(task->runner, nullptr); + + FlutterTaskRunner runner = task->runner; + EXPECT_NE(runner, nullptr); + const FlutterPlatformMessageResponseHandle* response_handle = + runner->response_handle; + if (response_handle != nullptr) { + EXPECT_NE(response_handle->data_callback, nullptr); + response_handle->data_callback(runner->message, runner->message_size, + response_handle->user_data); + } else { + _FlutterPlatformMessageResponseHandle* handle = + new _FlutterPlatformMessageResponseHandle(runner->channel); + + FlutterPlatformMessage message; + message.struct_size = sizeof(FlutterPlatformMessage); + message.channel = runner->channel.c_str(); + message.message = runner->message; + message.message_size = runner->message_size; + message.response_handle = handle; + engine->platform_message_callback(&message, engine->user_data); + } + + delete runner; + + return kSuccess; +} + +bool FlutterEngineRunsAOTCompiledDartCode() { + return false; +} + +FlutterEngineResult FlutterEngineUpdateLocales(FLUTTER_API_SYMBOL(FlutterEngine) + engine, + const FlutterLocale** locales, + size_t locales_count) { + return kSuccess; +} + +FlutterEngineResult FlutterEngineUpdateSemanticsEnabled( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + bool enabled) { + return kSuccess; +} + +FlutterEngineResult FlutterEngineDispatchSemanticsAction( + FLUTTER_API_SYMBOL(FlutterEngine) engine, + uint64_t id, + FlutterSemanticsAction action, + const uint8_t* data, + size_t data_length) { + return kSuccess; +} + +uint64_t FlutterEngineGetCurrentTime() { + const auto elapsed_time = std::chrono::steady_clock::now().time_since_epoch(); + return std::chrono::duration_cast(elapsed_time) + .count(); +} + +FlutterEngineResult FlutterEngineGetProcAddresses( + FlutterEngineProcTable* table) { + if (!table) { + return kInvalidArguments; + } + + FlutterEngineProcTable empty_table = {}; + *table = empty_table; + + table->CreateAOTData = &FlutterEngineCreateAOTData; + table->CollectAOTData = &FlutterEngineCollectAOTData; + table->Run = &FlutterEngineRun; + table->Shutdown = &FlutterEngineShutdown; + table->Initialize = &FlutterEngineInitialize; + table->Deinitialize = &FlutterEngineDeinitialize; + table->RunInitialized = &FlutterEngineRunInitialized; + table->SendWindowMetricsEvent = &FlutterEngineSendWindowMetricsEvent; + table->SendPointerEvent = &FlutterEngineSendPointerEvent; + table->SendPlatformMessage = &FlutterEngineSendPlatformMessage; + table->PlatformMessageCreateResponseHandle = + &FlutterPlatformMessageCreateResponseHandle; + table->PlatformMessageReleaseResponseHandle = + &FlutterPlatformMessageReleaseResponseHandle; + table->SendPlatformMessageResponse = + &FlutterEngineSendPlatformMessageResponse; + table->RunTask = &FlutterEngineRunTask; + table->UpdateLocales = &FlutterEngineUpdateLocales; + table->UpdateSemanticsEnabled = &FlutterEngineUpdateSemanticsEnabled; + table->DispatchSemanticsAction = &FlutterEngineDispatchSemanticsAction; + table->RunsAOTCompiledDartCode = &FlutterEngineRunsAOTCompiledDartCode; + + return kSuccess; +} diff --git a/shell/platform/tizen/tizen_evas_gl_helper.h b/shell/platform/tizen/tizen_evas_gl_helper.h new file mode 100644 index 0000000000000..be5a0d84f36ca --- /dev/null +++ b/shell/platform/tizen/tizen_evas_gl_helper.h @@ -0,0 +1,687 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has same content as tizen's file(Evas_GL_GLES3_Helpers.h). +// https://docs.tizen.org/application/native/api/mobile/6.0/group__Evas__GL__GLES3__Helpers.html + +#ifndef EMBEDDER_TIZEN_EVAS_GL_HELPER_H_ +#define EMBEDDER_TIZEN_EVAS_GL_HELPER_H_ + +/** + * @file Evas_GL_GLES3_Helpers.h + * @defgroup Evas_GL_GLES3_Helpers Evas GL GLES3 helpers + * @ingroup Evas_GL + */ + +/** + * @brief Provides a set of helper functions and macros to use GLES 3.0 with + * @ref Evas_GL "Evas GL". + * + * This file redefines all the OpenGL-ES 2.0 and OpenGL-ES 3.0 functions as +follow: + * @code +#define glFunction __evas_gl_glapi->glFunction + * @endcode + * + * Extension functions can then be checked for existence simply by writing: + * @code +if (glExtensionFunction) + { + ... + glExtensionFunction(...); + ... + } + * @endcode + * + * When using Elementary @ref GLView, please include the header file + * @ref Elementary_GL_Helpers "Elementary_GL_Helpers.h" instead. + * + * This header file should be included when using @ref Evas_GL "Evas GL" + * directly at a low level and with an OpenGL-ES 3.0 context only. + * + * @note When this file is included, all @c glFunctions are now macros, which + * means that the @ref Evas_GL_API struct can't be used anyore. + * + * @see @ref elm_opengl_page + */ +#ifndef _EVAS_GL_GLES3_HELPERS_H +#define _EVAS_GL_GLES3_HELPERS_H + +#include + +// local convenience macros + +/** + * @addtogroup Evas_GL_GLES3_Helpers + * @{ + */ + +/** + * @brief Macro to place at the beginning of any function using GLES 3.0 APIs + * + * Normally, it is necessary to call each function using its pointer as in: + * @code +glapi->glFunction(); + * @endcode + * + * When using this macro, developers can then call all @c glFunctions without + * changing their code: + * @code +EVAS_GL_GLES3_USE(evasgl, context); // Add this at the beginning +glFunction(); // All calls 'look' normal + * @endcode + * + * @note Please use @ref ELEMENTARY_GLVIEW_USE() instead, when possible. + * @since_tizen 2.4 + */ +#define EVAS_GL_GLES3_USE(evasgl, context) \ + Evas_GL_API* __evas_gl_glapi = evas_gl_context_api_get(evasgl, context); + +/** + * @brief Macro to place at the beginning of any function using GLES 3.0 APIs + * + * This is similar to @ref EVAS_GL_GLES3_USE except that it will return from + * the function if the GL API can not be used. + * + * @note Please use @ref ELEMENTARY_GLVIEW_USE() instead, when possible. + * @since_tizen 2.4 + */ +#define EVAS_GL_GLES3_USE_OR_RETURN(evasgl, context, retval) \ + Evas_GL_API* __evas_gl_glapi = evas_gl_context_api_get(evasgl, context); \ + if (!__evas_gl_glapi) \ + return retval; + +// End of the convenience functions + +// Global convenience macros + +/** + * @brief Convenience macro to use the GL helpers in simple applications: +declare + * + * @c EVAS_GL_GLOBAL_GLES3_DECLARE should be used in a global header for the + * application. For example, in a platform-specific compatibility header file. + * + * To be used with OpenGL-ES 3.0 contexts. + * + * Example of a global header file @c main.h: + * @code +#include +// other includes... + +EVAS_GL_GLOBAL_GLES3_DECLARE() + +// ... + * @endcode + * + * @note Please use @ref ELEMENTARY_GLVIEW_USE() instead, when possible. + * + * @see @ref ELEMENTARY_GLVIEW_GLOBAL_DECLARE + * @see @ref EVAS_GL_GLOBAL_GLES3_DEFINE + * @see @ref EVAS_GL_GLOBAL_GLES3_USE + * + * @since_tizen 2.4 + */ +#define EVAS_GL_GLOBAL_GLES3_DECLARE() extern Evas_GL_API* __evas_gl_glapi; + +/** + * @brief Convenience macro to use the GL helpers in simple applications: define + * + * To be used with OpenGL-ES 3.0 contexts. + * + * Example of a file @c glview.c: + * + * @code +#include "main.h" +EVAS_GL_GLOBAL_GLES3_DEFINE() + +// ... + +static inline void +evgl_init(...) +{ + // ... + evasgl = evas_gl_new(canvas); + // ... + ctx = evas_gl_context_version_create(evasgl, NULL, EVAS_GL_GLES_3_X); + EVAS_GL_GLOBAL_GLES3_USE(evasgl, ctx); + // ... +} + +// ... + * @endcode + * + * @see @ref ELEMENTARY_GLVIEW_GLOBAL_DEFINE + * @see @ref EVAS_GL_GLOBAL_GLES3_DECLARE + * @see @ref EVAS_GL_GLOBAL_GLES3_USE + * + * @since_tizen 2.4 + */ +#define EVAS_GL_GLOBAL_GLES3_DEFINE() Evas_GL_API* __evas_gl_glapi = NULL; + +/** + * @brief Convenience macro to use the GL helpers in simple applications: use + * + * This macro will set the global variable holding the GL API so that it's + * available to the application. + * + * It should be used right after setting up the GL context object. + * + * @see @ref ELEMENTARY_GLVIEW_GLOBAL_USE + * @see @ref EVAS_GL_GLOBAL_GLES3_DECLARE + * @see @ref EVAS_GL_GLOBAL_GLES3_DEFINE + * + * @since_tizen 2.4 + */ +#define EVAS_GL_GLOBAL_GLES3_USE(evgl, ctx) \ + do { \ + __evas_gl_glapi = evas_gl_context_api_get(evgl, ctx); \ + } while (0) + +// End of the convenience functions (global) +/** @} */ + +#define glActiveTexture __evas_gl_glapi->glActiveTexture +#define glAttachShader __evas_gl_glapi->glAttachShader +#define glBindAttribLocation __evas_gl_glapi->glBindAttribLocation +#define glBindBuffer __evas_gl_glapi->glBindBuffer +#define glBindFramebuffer __evas_gl_glapi->glBindFramebuffer +#define glBindRenderbuffer __evas_gl_glapi->glBindRenderbuffer +#define glBindTexture __evas_gl_glapi->glBindTexture +#define glBlendColor __evas_gl_glapi->glBlendColor +#define glBlendEquation __evas_gl_glapi->glBlendEquation +#define glBlendEquationSeparate __evas_gl_glapi->glBlendEquationSeparate +#define glBlendFunc __evas_gl_glapi->glBlendFunc +#define glBlendFuncSeparate __evas_gl_glapi->glBlendFuncSeparate +#define glBufferData __evas_gl_glapi->glBufferData +#define glBufferSubData __evas_gl_glapi->glBufferSubData +#define glCheckFramebufferStatus __evas_gl_glapi->glCheckFramebufferStatus +#define glClear __evas_gl_glapi->glClear +#define glClearColor __evas_gl_glapi->glClearColor +#define glClearDepthf __evas_gl_glapi->glClearDepthf +#define glClearStencil __evas_gl_glapi->glClearStencil +#define glColorMask __evas_gl_glapi->glColorMask +#define glCompileShader __evas_gl_glapi->glCompileShader +#define glCompressedTexImage2D __evas_gl_glapi->glCompressedTexImage2D +#define glCompressedTexSubImage2D __evas_gl_glapi->glCompressedTexSubImage2D +#define glCopyTexImage2D __evas_gl_glapi->glCopyTexImage2D +#define glCopyTexSubImage2D __evas_gl_glapi->glCopyTexSubImage2D +#define glCreateProgram __evas_gl_glapi->glCreateProgram +#define glCreateShader __evas_gl_glapi->glCreateShader +#define glCullFace __evas_gl_glapi->glCullFace +#define glDeleteBuffers __evas_gl_glapi->glDeleteBuffers +#define glDeleteFramebuffers __evas_gl_glapi->glDeleteFramebuffers +#define glDeleteProgram __evas_gl_glapi->glDeleteProgram +#define glDeleteRenderbuffers __evas_gl_glapi->glDeleteRenderbuffers +#define glDeleteShader __evas_gl_glapi->glDeleteShader +#define glDeleteTextures __evas_gl_glapi->glDeleteTextures +#define glDepthFunc __evas_gl_glapi->glDepthFunc +#define glDepthMask __evas_gl_glapi->glDepthMask +#define glDepthRangef __evas_gl_glapi->glDepthRangef +#define glDetachShader __evas_gl_glapi->glDetachShader +#define glDisable __evas_gl_glapi->glDisable +#define glDisableVertexAttribArray __evas_gl_glapi->glDisableVertexAttribArray +#define glDrawArrays __evas_gl_glapi->glDrawArrays +#define glDrawElements __evas_gl_glapi->glDrawElements +#define glEnable __evas_gl_glapi->glEnable +#define glEnableVertexAttribArray __evas_gl_glapi->glEnableVertexAttribArray +#define glFinish __evas_gl_glapi->glFinish +#define glFlush __evas_gl_glapi->glFlush +#define glFramebufferRenderbuffer __evas_gl_glapi->glFramebufferRenderbuffer +#define glFramebufferTexture2D __evas_gl_glapi->glFramebufferTexture2D +#define glFrontFace __evas_gl_glapi->glFrontFace +#define glGenBuffers __evas_gl_glapi->glGenBuffers +#define glGenerateMipmap __evas_gl_glapi->glGenerateMipmap +#define glGenFramebuffers __evas_gl_glapi->glGenFramebuffers +#define glGenRenderbuffers __evas_gl_glapi->glGenRenderbuffers +#define glGenTextures __evas_gl_glapi->glGenTextures +#define glGetActiveAttrib __evas_gl_glapi->glGetActiveAttrib +#define glGetActiveUniform __evas_gl_glapi->glGetActiveUniform +#define glGetAttachedShaders __evas_gl_glapi->glGetAttachedShaders +#define glGetAttribLocation __evas_gl_glapi->glGetAttribLocation +#define glGetBooleanv __evas_gl_glapi->glGetBooleanv +#define glGetBufferParameteriv __evas_gl_glapi->glGetBufferParameteriv +#define glGetError __evas_gl_glapi->glGetError +#define glGetFloatv __evas_gl_glapi->glGetFloatv +#define glGetFramebufferAttachmentParameteriv \ + __evas_gl_glapi->glGetFramebufferAttachmentParameteriv +#define glGetIntegerv __evas_gl_glapi->glGetIntegerv +#define glGetProgramiv __evas_gl_glapi->glGetProgramiv +#define glGetProgramInfoLog __evas_gl_glapi->glGetProgramInfoLog +#define glGetRenderbufferParameteriv \ + __evas_gl_glapi->glGetRenderbufferParameteriv +#define glGetShaderiv __evas_gl_glapi->glGetShaderiv +#define glGetShaderInfoLog __evas_gl_glapi->glGetShaderInfoLog +#define glGetShaderPrecisionFormat __evas_gl_glapi->glGetShaderPrecisionFormat +#define glGetShaderSource __evas_gl_glapi->glGetShaderSource +#define glGetString __evas_gl_glapi->glGetString +#define glGetTexParameterfv __evas_gl_glapi->glGetTexParameterfv +#define glGetTexParameteriv __evas_gl_glapi->glGetTexParameteriv +#define glGetUniformfv __evas_gl_glapi->glGetUniformfv +#define glGetUniformiv __evas_gl_glapi->glGetUniformiv +#define glGetUniformLocation __evas_gl_glapi->glGetUniformLocation +#define glGetVertexAttribfv __evas_gl_glapi->glGetVertexAttribfv +#define glGetVertexAttribiv __evas_gl_glapi->glGetVertexAttribiv +#define glGetVertexAttribPointerv __evas_gl_glapi->glGetVertexAttribPointerv +#define glHint __evas_gl_glapi->glHint +#define glIsBuffer __evas_gl_glapi->glIsBuffer +#define glIsEnabled __evas_gl_glapi->glIsEnabled +#define glIsFramebuffer __evas_gl_glapi->glIsFramebuffer +#define glIsProgram __evas_gl_glapi->glIsProgram +#define glIsRenderbuffer __evas_gl_glapi->glIsRenderbuffer +#define glIsShader __evas_gl_glapi->glIsShader +#define glIsTexture __evas_gl_glapi->glIsTexture +#define glLineWidth __evas_gl_glapi->glLineWidth +#define glLinkProgram __evas_gl_glapi->glLinkProgram +#define glPixelStorei __evas_gl_glapi->glPixelStorei +#define glPolygonOffset __evas_gl_glapi->glPolygonOffset +#define glReadPixels __evas_gl_glapi->glReadPixels +#define glReleaseShaderCompiler __evas_gl_glapi->glReleaseShaderCompiler +#define glRenderbufferStorage __evas_gl_glapi->glRenderbufferStorage +#define glSampleCoverage __evas_gl_glapi->glSampleCoverage +#define glScissor __evas_gl_glapi->glScissor +#define glShaderBinary __evas_gl_glapi->glShaderBinary +#define glShaderSource __evas_gl_glapi->glShaderSource +#define glStencilFunc __evas_gl_glapi->glStencilFunc +#define glStencilFuncSeparate __evas_gl_glapi->glStencilFuncSeparate +#define glStencilMask __evas_gl_glapi->glStencilMask +#define glStencilMaskSeparate __evas_gl_glapi->glStencilMaskSeparate +#define glStencilOp __evas_gl_glapi->glStencilOp +#define glStencilOpSeparate __evas_gl_glapi->glStencilOpSeparate +#define glTexImage2D __evas_gl_glapi->glTexImage2D +#define glTexParameterf __evas_gl_glapi->glTexParameterf +#define glTexParameterfv __evas_gl_glapi->glTexParameterfv +#define glTexParameteri __evas_gl_glapi->glTexParameteri +#define glTexParameteriv __evas_gl_glapi->glTexParameteriv +#define glTexSubImage2D __evas_gl_glapi->glTexSubImage2D +#define glUniform1f __evas_gl_glapi->glUniform1f +#define glUniform1fv __evas_gl_glapi->glUniform1fv +#define glUniform1i __evas_gl_glapi->glUniform1i +#define glUniform1iv __evas_gl_glapi->glUniform1iv +#define glUniform2f __evas_gl_glapi->glUniform2f +#define glUniform2fv __evas_gl_glapi->glUniform2fv +#define glUniform2i __evas_gl_glapi->glUniform2i +#define glUniform2iv __evas_gl_glapi->glUniform2iv +#define glUniform3f __evas_gl_glapi->glUniform3f +#define glUniform3fv __evas_gl_glapi->glUniform3fv +#define glUniform3i __evas_gl_glapi->glUniform3i +#define glUniform3iv __evas_gl_glapi->glUniform3iv +#define glUniform4f __evas_gl_glapi->glUniform4f +#define glUniform4fv __evas_gl_glapi->glUniform4fv +#define glUniform4i __evas_gl_glapi->glUniform4i +#define glUniform4iv __evas_gl_glapi->glUniform4iv +#define glUniformMatrix2fv __evas_gl_glapi->glUniformMatrix2fv +#define glUniformMatrix3fv __evas_gl_glapi->glUniformMatrix3fv +#define glUniformMatrix4fv __evas_gl_glapi->glUniformMatrix4fv +#define glUseProgram __evas_gl_glapi->glUseProgram +#define glValidateProgram __evas_gl_glapi->glValidateProgram +#define glVertexAttrib1f __evas_gl_glapi->glVertexAttrib1f +#define glVertexAttrib1fv __evas_gl_glapi->glVertexAttrib1fv +#define glVertexAttrib2f __evas_gl_glapi->glVertexAttrib2f +#define glVertexAttrib2fv __evas_gl_glapi->glVertexAttrib2fv +#define glVertexAttrib3f __evas_gl_glapi->glVertexAttrib3f +#define glVertexAttrib3fv __evas_gl_glapi->glVertexAttrib3fv +#define glVertexAttrib4f __evas_gl_glapi->glVertexAttrib4f +#define glVertexAttrib4fv __evas_gl_glapi->glVertexAttrib4fv +#define glVertexAttribPointer __evas_gl_glapi->glVertexAttribPointer +#define glViewport __evas_gl_glapi->glViewport + +// GLES 2.0 extensions +#define glGetProgramBinaryOES __evas_gl_glapi->glGetProgramBinaryOES +#define glProgramBinaryOES __evas_gl_glapi->glProgramBinaryOES +#define glMapBufferOES __evas_gl_glapi->glMapBufferOES +#define glUnmapBufferOES __evas_gl_glapi->glUnmapBufferOES +#define glGetBufferPointervOES __evas_gl_glapi->glGetBufferPointervOES +#define glTexImage3DOES __evas_gl_glapi->glTexImage3DOES +#define glTexSubImage3DOES __evas_gl_glapi->glTexSubImage3DOES +#define glCopyTexSubImage3DOES __evas_gl_glapi->glCopyTexSubImage3DOES +#define glCompressedTexImage3DOES __evas_gl_glapi->glCompressedTexImage3DOES +#define glCompressedTexSubImage3DOES \ + __evas_gl_glapi->glCompressedTexSubImage3DOES +#define glFramebufferTexture3DOES __evas_gl_glapi->glFramebufferTexture3DOES +#define glBindVertexArrayOES __evas_gl_glapi->glBindVertexArrayOES +#define glDeleteVertexArraysOES __evas_gl_glapi->glDeleteVertexArraysOES +#define glGenVertexArraysOES __evas_gl_glapi->glGenVertexArraysOES +#define glIsVertexArrayOES __evas_gl_glapi->glIsVertexArrayOES +#define glGetPerfMonitorGroupsAMD __evas_gl_glapi->glGetPerfMonitorGroupsAMD +#define glGetPerfMonitorCountersAMD __evas_gl_glapi->glGetPerfMonitorCountersAMD +#define glGetPerfMonitorGroupStringAMD \ + __evas_gl_glapi->glGetPerfMonitorGroupStringAMD +#define glGetPerfMonitorCounterStringAMD \ + __evas_gl_glapi->glGetPerfMonitorCounterStringAMD +#define glGetPerfMonitorCounterInfoAMD \ + __evas_gl_glapi->glGetPerfMonitorCounterInfoAMD +#define glGenPerfMonitorsAMD __evas_gl_glapi->glGenPerfMonitorsAMD +#define glDeletePerfMonitorsAMD __evas_gl_glapi->glDeletePerfMonitorsAMD +#define glSelectPerfMonitorCountersAMD \ + __evas_gl_glapi->glSelectPerfMonitorCountersAMD +#define glBeginPerfMonitorAMD __evas_gl_glapi->glBeginPerfMonitorAMD +#define glEndPerfMonitorAMD __evas_gl_glapi->glEndPerfMonitorAMD +#define glGetPerfMonitorCounterDataAMD \ + __evas_gl_glapi->glGetPerfMonitorCounterDataAMD +#define glCopyTextureLevelsAPPLE __evas_gl_glapi->glCopyTextureLevelsAPPLE +#define glRenderbufferStorageMultisampleAPPLE \ + __evas_gl_glapi->glRenderbufferStorageMultisampleAPPLE +#define glResolveMultisampleFramebufferAPPLE \ + __evas_gl_glapi->glResolveMultisampleFramebufferAPPLE +#define glFenceSyncAPPLE __evas_gl_glapi->glFenceSyncAPPLE +#define glIsSyncAPPLE __evas_gl_glapi->glIsSyncAPPLE +#define glDeleteSyncAPPLE __evas_gl_glapi->glDeleteSyncAPPLE +#define glClientWaitSyncAPPLE __evas_gl_glapi->glClientWaitSyncAPPLE +#define glWaitSyncAPPLE __evas_gl_glapi->glWaitSyncAPPLE +#define glGetInteger64vAPPLE __evas_gl_glapi->glGetInteger64vAPPLE +#define glGetSyncivAPPLE __evas_gl_glapi->glGetSyncivAPPLE +#define glDiscardFramebufferEXT __evas_gl_glapi->glDiscardFramebufferEXT +#define glMapBufferRangeEXT __evas_gl_glapi->glMapBufferRangeEXT +#define glFlushMappedBufferRangeEXT __evas_gl_glapi->glFlushMappedBufferRangeEXT +#define glMultiDrawArraysEXT __evas_gl_glapi->glMultiDrawArraysEXT +#define glMultiDrawElementsEXT __evas_gl_glapi->glMultiDrawElementsEXT +#define glRenderbufferStorageMultisampleEXT \ + __evas_gl_glapi->glRenderbufferStorageMultisampleEXT +#define glFramebufferTexture2DMultisampleEXT \ + __evas_gl_glapi->glFramebufferTexture2DMultisampleEXT +#define glGetGraphicsResetStatusEXT __evas_gl_glapi->glGetGraphicsResetStatusEXT +#define glReadnPixelsEXT __evas_gl_glapi->glReadnPixelsEXT +#define glGetnUniformfvEXT __evas_gl_glapi->glGetnUniformfvEXT +#define glGetnUniformivEXT __evas_gl_glapi->glGetnUniformivEXT +#define glTexStorage1DEXT __evas_gl_glapi->glTexStorage1DEXT +#define glTexStorage2DEXT __evas_gl_glapi->glTexStorage2DEXT +#define glTexStorage3DEXT __evas_gl_glapi->glTexStorage3DEXT +#define glTextureStorage1DEXT __evas_gl_glapi->glTextureStorage1DEXT +#define glTextureStorage2DEXT __evas_gl_glapi->glTextureStorage2DEXT +#define glTextureStorage3DEXT __evas_gl_glapi->glTextureStorage3DEXT +#define glRenderbufferStorageMultisampleIMG \ + __evas_gl_glapi->glRenderbufferStorageMultisampleIMG +#define glFramebufferTexture2DMultisampleIMG \ + __evas_gl_glapi->glFramebufferTexture2DMultisampleIMG +#define glDeleteFencesNV __evas_gl_glapi->glDeleteFencesNV +#define glGenFencesNV __evas_gl_glapi->glGenFencesNV +#define glIsFenceNV __evas_gl_glapi->glIsFenceNV +#define glTestFenceNV __evas_gl_glapi->glTestFenceNV +#define glGetFenceivNV __evas_gl_glapi->glGetFenceivNV +#define glFinishFenceNV __evas_gl_glapi->glFinishFenceNV +#define glSetFenceNV __evas_gl_glapi->glSetFenceNV +#define glGetDriverControlsQCOM __evas_gl_glapi->glGetDriverControlsQCOM +#define glGetDriverControlStringQCOM \ + __evas_gl_glapi->glGetDriverControlStringQCOM +#define glEnableDriverControlQCOM __evas_gl_glapi->glEnableDriverControlQCOM +#define glDisableDriverControlQCOM __evas_gl_glapi->glDisableDriverControlQCOM +#define glExtGetTexturesQCOM __evas_gl_glapi->glExtGetTexturesQCOM +#define glExtGetBuffersQCOM __evas_gl_glapi->glExtGetBuffersQCOM +#define glExtGetRenderbuffersQCOM __evas_gl_glapi->glExtGetRenderbuffersQCOM +#define glExtGetFramebuffersQCOM __evas_gl_glapi->glExtGetFramebuffersQCOM +#define glExtGetTexLevelParameterivQCOM \ + __evas_gl_glapi->glExtGetTexLevelParameterivQCOM +#define glExtTexObjectStateOverrideiQCOM \ + __evas_gl_glapi->glExtTexObjectStateOverrideiQCOM +#define glExtGetTexSubImageQCOM __evas_gl_glapi->glExtGetTexSubImageQCOM +#define glExtGetBufferPointervQCOM __evas_gl_glapi->glExtGetBufferPointervQCOM +#define glExtGetShadersQCOM __evas_gl_glapi->glExtGetShadersQCOM +#define glExtGetProgramsQCOM __evas_gl_glapi->glExtGetProgramsQCOM +#define glExtIsProgramBinaryQCOM __evas_gl_glapi->glExtIsProgramBinaryQCOM +#define glExtGetProgramBinarySourceQCOM \ + __evas_gl_glapi->glExtGetProgramBinarySourceQCOM +#define glStartTilingQCOM __evas_gl_glapi->glStartTilingQCOM +#define glEndTilingQCOM __evas_gl_glapi->glEndTilingQCOM + +// glEvasGL functions +#define glEvasGLImageTargetTexture2DOES \ + __evas_gl_glapi->glEvasGLImageTargetTexture2DOES +#define glEvasGLImageTargetRenderbufferStorageOES \ + __evas_gl_glapi->glEvasGLImageTargetRenderbufferStorageOES + +// Evas GL glue layer +#define evasglCreateImage __evas_gl_glapi->evasglCreateImage +#define evasglCreateImageForContext __evas_gl_glapi->evasglCreateImageForContext +#define evasglDestroyImage __evas_gl_glapi->evasglDestroyImage +#define evasglCreateSync __evas_gl_glapi->evasglCreateSync +#define evasglDestroySync __evas_gl_glapi->evasglDestroySync +#define evasglClientWaitSync __evas_gl_glapi->evasglClientWaitSync +#define evasglSignalSync __evas_gl_glapi->evasglSignalSync +#define evasglGetSyncAttrib __evas_gl_glapi->evasglGetSyncAttrib +#define evasglWaitSync __evas_gl_glapi->evasglWaitSync + +// GLES 3.0 functions +#define glBeginQuery __evas_gl_glapi->glBeginQuery +#define glBeginTransformFeedback __evas_gl_glapi->glBeginTransformFeedback +#define glBindBufferBase __evas_gl_glapi->glBindBufferBase +#define glBindBufferRange __evas_gl_glapi->glBindBufferRange +#define glBindSampler __evas_gl_glapi->glBindSampler +#define glBindTransformFeedback __evas_gl_glapi->glBindTransformFeedback +#define glBindVertexArray __evas_gl_glapi->glBindVertexArray +#define glBlitFramebuffer __evas_gl_glapi->glBlitFramebuffer +#define glClearBufferfi __evas_gl_glapi->glClearBufferfi +#define glClearBufferfv __evas_gl_glapi->glClearBufferfv +#define glClearBufferiv __evas_gl_glapi->glClearBufferiv +#define glClearBufferuiv __evas_gl_glapi->glClearBufferuiv +#define glClientWaitSync __evas_gl_glapi->glClientWaitSync +#define glCompressedTexImage3D __evas_gl_glapi->glCompressedTexImage3D +#define glCompressedTexSubImage3D __evas_gl_glapi->glCompressedTexSubImage3D +#define glCopyBufferSubData __evas_gl_glapi->glCopyBufferSubData +#define glCopyTexSubImage3D __evas_gl_glapi->glCopyTexSubImage3D +#define glDeleteQueries __evas_gl_glapi->glDeleteQueries +#define glDeleteSamplers __evas_gl_glapi->glDeleteSamplers +#define glDeleteSync __evas_gl_glapi->glDeleteSync +#define glDeleteTransformFeedbacks __evas_gl_glapi->glDeleteTransformFeedbacks +#define glDeleteVertexArrays __evas_gl_glapi->glDeleteVertexArrays +#define glDrawArraysInstanced __evas_gl_glapi->glDrawArraysInstanced +#define glDrawBuffers __evas_gl_glapi->glDrawBuffers +#define glDrawElementsInstanced __evas_gl_glapi->glDrawElementsInstanced +#define glDrawRangeElements __evas_gl_glapi->glDrawRangeElements +#define glEndQuery __evas_gl_glapi->glEndQuery +#define glEndTransformFeedback __evas_gl_glapi->glEndTransformFeedback +#define glFenceSync __evas_gl_glapi->glFenceSync +#define glFlushMappedBufferRange __evas_gl_glapi->glFlushMappedBufferRange +#define glFramebufferTextureLayer __evas_gl_glapi->glFramebufferTextureLayer +#define glGenQueries __evas_gl_glapi->glGenQueries +#define glGenSamplers __evas_gl_glapi->glGenSamplers +#define glGenTransformFeedbacks __evas_gl_glapi->glGenTransformFeedbacks +#define glGenVertexArrays __evas_gl_glapi->glGenVertexArrays +#define glGetActiveUniformBlockiv __evas_gl_glapi->glGetActiveUniformBlockiv +#define glGetActiveUniformBlockName __evas_gl_glapi->glGetActiveUniformBlockName +#define glGetActiveUniformsiv __evas_gl_glapi->glGetActiveUniformsiv +#define glGetBufferParameteri64v __evas_gl_glapi->glGetBufferParameteri64v +#define glGetBufferPointerv __evas_gl_glapi->glGetBufferPointerv +#define glGetFragDataLocation __evas_gl_glapi->glGetFragDataLocation +#define glGetInteger64i_v __evas_gl_glapi->glGetInteger64i_v +#define glGetInteger64v __evas_gl_glapi->glGetInteger64v +#define glGetIntegeri_v __evas_gl_glapi->glGetIntegeri_v +#define glGetInternalformativ __evas_gl_glapi->glGetInternalformativ +#define glGetProgramBinary __evas_gl_glapi->glGetProgramBinary +#define glGetQueryiv __evas_gl_glapi->glGetQueryiv +#define glGetQueryObjectuiv __evas_gl_glapi->glGetQueryObjectuiv +#define glGetSamplerParameterfv __evas_gl_glapi->glGetSamplerParameterfv +#define glGetSamplerParameteriv __evas_gl_glapi->glGetSamplerParameteriv +#define glGetStringi __evas_gl_glapi->glGetStringi +#define glGetSynciv __evas_gl_glapi->glGetSynciv +#define glGetTransformFeedbackVarying \ + __evas_gl_glapi->glGetTransformFeedbackVarying +#define glGetUniformBlockIndex __evas_gl_glapi->glGetUniformBlockIndex +#define glGetUniformIndices __evas_gl_glapi->glGetUniformIndices +#define glGetUniformuiv __evas_gl_glapi->glGetUniformuiv +#define glGetVertexAttribIiv __evas_gl_glapi->glGetVertexAttribIiv +#define glGetVertexAttribIuiv __evas_gl_glapi->glGetVertexAttribIuiv +#define glInvalidateFramebuffer __evas_gl_glapi->glInvalidateFramebuffer +#define glInvalidateSubFramebuffer __evas_gl_glapi->glInvalidateSubFramebuffer +#define glIsQuery __evas_gl_glapi->glIsQuery +#define glIsSampler __evas_gl_glapi->glIsSampler +#define glIsSync __evas_gl_glapi->glIsSync +#define glIsTransformFeedback __evas_gl_glapi->glIsTransformFeedback +#define glIsVertexArray __evas_gl_glapi->glIsVertexArray +#define glMapBufferRange __evas_gl_glapi->glMapBufferRange +#define glPauseTransformFeedback __evas_gl_glapi->glPauseTransformFeedback +#define glProgramBinary __evas_gl_glapi->glProgramBinary +#define glProgramParameteri __evas_gl_glapi->glProgramParameteri +#define glReadBuffer __evas_gl_glapi->glReadBuffer +#define glRenderbufferStorageMultisample \ + __evas_gl_glapi->glRenderbufferStorageMultisample +#define glResumeTransformFeedback __evas_gl_glapi->glResumeTransformFeedback +#define glSamplerParameterf __evas_gl_glapi->glSamplerParameterf +#define glSamplerParameterfv __evas_gl_glapi->glSamplerParameterfv +#define glSamplerParameteri __evas_gl_glapi->glSamplerParameteri +#define glSamplerParameteriv __evas_gl_glapi->glSamplerParameteriv +#define glTexImage3D __evas_gl_glapi->glTexImage3D +#define glTexStorage2D __evas_gl_glapi->glTexStorage2D +#define glTexStorage3D __evas_gl_glapi->glTexStorage3D +#define glTexSubImage3D __evas_gl_glapi->glTexSubImage3D +#define glTransformFeedbackVaryings __evas_gl_glapi->glTransformFeedbackVaryings +#define glUniform1ui __evas_gl_glapi->glUniform1ui +#define glUniform1uiv __evas_gl_glapi->glUniform1uiv +#define glUniform2ui __evas_gl_glapi->glUniform2ui +#define glUniform2uiv __evas_gl_glapi->glUniform2uiv +#define glUniform3ui __evas_gl_glapi->glUniform3ui +#define glUniform3uiv __evas_gl_glapi->glUniform3uiv +#define glUniform4ui __evas_gl_glapi->glUniform4ui +#define glUniform4uiv __evas_gl_glapi->glUniform4uiv +#define glUniformBlockBinding __evas_gl_glapi->glUniformBlockBinding +#define glUniformMatrix2x3fv __evas_gl_glapi->glUniformMatrix2x3fv +#define glUniformMatrix3x2fv __evas_gl_glapi->glUniformMatrix3x2fv +#define glUniformMatrix2x4fv __evas_gl_glapi->glUniformMatrix2x4fv +#define glUniformMatrix4x2fv __evas_gl_glapi->glUniformMatrix4x2fv +#define glUniformMatrix3x4fv __evas_gl_glapi->glUniformMatrix3x4fv +#define glUniformMatrix4x3fv __evas_gl_glapi->glUniformMatrix4x3fv +#define glUnmapBuffer __evas_gl_glapi->glUnmapBuffer +#define glVertexAttribDivisor __evas_gl_glapi->glVertexAttribDivisor +#define glVertexAttribI4i __evas_gl_glapi->glVertexAttribI4i +#define glVertexAttribI4iv __evas_gl_glapi->glVertexAttribI4iv +#define glVertexAttribI4ui __evas_gl_glapi->glVertexAttribI4ui +#define glVertexAttribI4uiv __evas_gl_glapi->glVertexAttribI4uiv +#define glVertexAttribIPointer __evas_gl_glapi->glVertexAttribIPointer +#define glWaitSync __evas_gl_glapi->glWaitSync + +// GLES 3.1 +#define glDispatchCompute __evas_gl_glapi->glDispatchCompute +#define glDispatchComputeIndirect __evas_gl_glapi->glDispatchComputeIndirect +#define glDrawArraysIndirect __evas_gl_glapi->glDrawArraysIndirect +#define glDrawElementsIndirect __evas_gl_glapi->glDrawElementsIndirect +#define glFramebufferParameteri __evas_gl_glapi->glFramebufferParameteri +#define glGetFramebufferParameteriv __evas_gl_glapi->glGetFramebufferParameteriv +#define glGetProgramInterfaceiv __evas_gl_glapi->glGetProgramInterfaceiv +#define glGetProgramResourceIndex __evas_gl_glapi->glGetProgramResourceIndex +#define glGetProgramResourceName __evas_gl_glapi->glGetProgramResourceName +#define glGetProgramResourceiv __evas_gl_glapi->glGetProgramResourceiv +#define glGetProgramResourceLocation \ + __evas_gl_glapi->glGetProgramResourceLocation +#define glUseProgramStages __evas_gl_glapi->glUseProgramStages +#define glActiveShaderProgram __evas_gl_glapi->glActiveShaderProgram +#define glCreateShaderProgramv __evas_gl_glapi->glCreateShaderProgramv +#define glBindProgramPipeline __evas_gl_glapi->glBindProgramPipeline +#define glDeleteProgramPipelines __evas_gl_glapi->glDeleteProgramPipelines +#define glGenProgramPipelines __evas_gl_glapi->glGenProgramPipelines +#define glIsProgramPipeline __evas_gl_glapi->glIsProgramPipeline +#define glGetProgramPipelineiv __evas_gl_glapi->glGetProgramPipelineiv +#define glProgramUniform1i __evas_gl_glapi->glProgramUniform1i +#define glProgramUniform2i __evas_gl_glapi->glProgramUniform2i +#define glProgramUniform3i __evas_gl_glapi->glProgramUniform3i +#define glProgramUniform4i __evas_gl_glapi->glProgramUniform4i +#define glProgramUniform1ui __evas_gl_glapi->glProgramUniform1ui +#define glProgramUniform2ui __evas_gl_glapi->glProgramUniform2ui +#define glProgramUniform3ui __evas_gl_glapi->glProgramUniform3ui +#define glProgramUniform4ui __evas_gl_glapi->glProgramUniform4ui +#define glProgramUniform1f __evas_gl_glapi->glProgramUniform1f +#define glProgramUniform2f __evas_gl_glapi->glProgramUniform2f +#define glProgramUniform3f __evas_gl_glapi->glProgramUniform3f +#define glProgramUniform4f __evas_gl_glapi->glProgramUniform4f +#define glProgramUniform1iv __evas_gl_glapi->glProgramUniform1iv +#define glProgramUniform2iv __evas_gl_glapi->glProgramUniform2iv +#define glProgramUniform3iv __evas_gl_glapi->glProgramUniform3iv +#define glProgramUniform4iv __evas_gl_glapi->glProgramUniform4iv +#define glProgramUniform1uiv __evas_gl_glapi->glProgramUniform1uiv +#define glProgramUniform2uiv __evas_gl_glapi->glProgramUniform2uiv +#define glProgramUniform3uiv __evas_gl_glapi->glProgramUniform3uiv +#define glProgramUniform4uiv __evas_gl_glapi->glProgramUniform4uiv +#define glProgramUniform1fv __evas_gl_glapi->glProgramUniform1fv +#define glProgramUniform2fv __evas_gl_glapi->glProgramUniform2fv +#define glProgramUniform3fv __evas_gl_glapi->glProgramUniform3fv +#define glProgramUniform4fv __evas_gl_glapi->glProgramUniform4fv +#define glProgramUniformMatrix2fv __evas_gl_glapi->glProgramUniformMatrix2fv +#define glProgramUniformMatrix3fv __evas_gl_glapi->glProgramUniformMatrix3fv +#define glProgramUniformMatrix4fv __evas_gl_glapi->glProgramUniformMatrix4fv +#define glProgramUniformMatrix2x3fv __evas_gl_glapi->glProgramUniformMatrix2x3fv +#define glProgramUniformMatrix3x2fv __evas_gl_glapi->glProgramUniformMatrix3x2fv +#define glProgramUniformMatrix2x4fv __evas_gl_glapi->glProgramUniformMatrix2x4fv +#define glProgramUniformMatrix4x2fv __evas_gl_glapi->glProgramUniformMatrix4x2fv +#define glProgramUniformMatrix3x4fv __evas_gl_glapi->glProgramUniformMatrix3x4fv +#define glProgramUniformMatrix4x3fv __evas_gl_glapi->glProgramUniformMatrix4x3fv +#define glValidateProgramPipeline __evas_gl_glapi->glValidateProgramPipeline +#define glGetProgramPipelineInfoLog __evas_gl_glapi->glGetProgramPipelineInfoLog +#define glBindImageTexture __evas_gl_glapi->glBindImageTexture +#define glGetBooleani_v __evas_gl_glapi->glGetBooleani_v +#define glMemoryBarrier __evas_gl_glapi->glMemoryBarrier +#define glMemoryBarrierByRegion __evas_gl_glapi->glMemoryBarrierByRegion +#define glTexStorage2DMultisample __evas_gl_glapi->glTexStorage2DMultisample +#define glGetMultisamplefv __evas_gl_glapi->glGetMultisamplefv +#define glSampleMaski __evas_gl_glapi->glSampleMaski +#define glGetTexLevelParameteriv __evas_gl_glapi->glGetTexLevelParameteriv +#define glGetTexLevelParameterfv __evas_gl_glapi->glGetTexLevelParameterfv +#define glBindVertexBuffer __evas_gl_glapi->glBindVertexBuffer +#define glVertexAttribFormat __evas_gl_glapi->glVertexAttribFormat +#define glVertexAttribIFormat __evas_gl_glapi->glVertexAttribIFormat +#define glVertexAttribBinding __evas_gl_glapi->glVertexAttribBinding +#define glVertexBindingDivisor __evas_gl_glapi->glVertexBindingDivisor + +// GLES 3.2 +#define glBlendBarrier __evas_gl_glapi->glBlendBarrier +#define glCopyImageSubData __evas_gl_glapi->glCopyImageSubData +#define glDebugMessageControl __evas_gl_glapi->glDebugMessageControl +#define glDebugMessageInsert __evas_gl_glapi->glDebugMessageInsert +#define glDebugMessageCallback __evas_gl_glapi->glDebugMessageCallback +#define glGetDebugMessageLog __evas_gl_glapi->glGetDebugMessageLog +#define glPushDebugGroup __evas_gl_glapi->glPushDebugGroup +#define glPopDebugGroup __evas_gl_glapi->glPopDebugGroup +#define glObjectLabel __evas_gl_glapi->glObjectLabel +#define glGetObjectLabel __evas_gl_glapi->glGetObjectLabel +#define glObjectPtrLabel __evas_gl_glapi->glObjectPtrLabel +#define glGetObjectPtrLabel __evas_gl_glapi->glGetObjectPtrLabel +#define glGetPointerv __evas_gl_glapi->glGetPointerv +#define glEnablei __evas_gl_glapi->glEnablei +#define glDisablei __evas_gl_glapi->glDisablei +#define glBlendEquationi __evas_gl_glapi->glBlendEquationi +#define glBlendEquationSeparatei __evas_gl_glapi->glBlendEquationSeparatei +#define glBlendFunci __evas_gl_glapi->glBlendFunci +#define glBlendFuncSeparatei __evas_gl_glapi->glBlendFuncSeparatei +#define glColorMaski __evas_gl_glapi->glColorMaski +#define glIsEnabledi __evas_gl_glapi->glIsEnabledi +#define glDrawElementsBaseVertex __evas_gl_glapi->glDrawElementsBaseVertex +#define glDrawRangeElementsBaseVertex \ + __evas_gl_glapi->glDrawRangeElementsBaseVertex +#define glDrawElementsInstancedBaseVertex \ + __evas_gl_glapi->glDrawElementsInstancedBaseVertex +#define glFramebufferTexture __evas_gl_glapi->glFramebufferTexture +#define glPrimitiveBoundingBox __evas_gl_glapi->glPrimitiveBoundingBox +#define glGetGraphicsResetStatus __evas_gl_glapi->glGetGraphicsResetStatus +#define glReadnPixels __evas_gl_glapi->glReadnPixels +#define glGetnUniformfv __evas_gl_glapi->glGetnUniformfv +#define glGetnUniformiv __evas_gl_glapi->glGetnUniformiv +#define glGetnUniformuiv __evas_gl_glapi->glGetnUniformuiv +#define glMinSampleShading __evas_gl_glapi->glMinSampleShading +#define glPatchParameteri __evas_gl_glapi->glPatchParameteri +#define glTexParameterIiv __evas_gl_glapi->glTexParameterIiv +#define glTexParameterIuiv __evas_gl_glapi->glTexParameterIuiv +#define glGetTexParameterIiv __evas_gl_glapi->glGetTexParameterIiv +#define glGetTexParameterIuiv __evas_gl_glapi->glGetTexParameterIuiv +#define glSamplerParameterIiv __evas_gl_glapi->glSamplerParameterIiv +#define glSamplerParameterIuiv __evas_gl_glapi->glSamplerParameterIuiv +#define glGetSamplerParameterIiv __evas_gl_glapi->glGetSamplerParameterIiv +#define glGetSamplerParameterIuiv __evas_gl_glapi->glGetSamplerParameterIuiv +#define glTexBuffer __evas_gl_glapi->glTexBuffer +#define glTexBufferRange __evas_gl_glapi->glTexBufferRange +#define glTexStorage3DMultisample __evas_gl_glapi->glTexStorage3DMultisample + +/** + * @ingroup Evas_GL_GLES3_Helpers + * @brief Macro to check that the GL APIs are properly set (GLES 3.0) + * @since_tizen 2.4 + */ +#define EVAS_GL_GLES3_API_CHECK() \ + ((__evas_gl_glapi != NULL) && \ + (__evas_gl_glapi->version == EVAS_GL_API_VERSION) && (glBeginQuery)) + +/** + * @} + */ + +#endif + +#endif // EMBEDDER_TIZEN_EVAS_GL_HELPER_H_ diff --git a/shell/platform/tizen/tizen_event_loop.cc b/shell/platform/tizen/tizen_event_loop.cc index 33c150b135ae2..cff3003f05363 100644 --- a/shell/platform/tizen/tizen_event_loop.cc +++ b/shell/platform/tizen/tizen_event_loop.cc @@ -18,6 +18,9 @@ TizenEventLoop::TizenEventLoop(std::thread::id main_thread_id, TaskExpiredCallback on_task_expired) : main_thread_id_(main_thread_id), on_task_expired_(std::move(on_task_expired)) { +#ifdef __X64_SHELL__ + ecore_init(); +#endif ecore_pipe_ = ecore_pipe_add(ExcuteTaskEvents, this); } diff --git a/shell/platform/tizen/tizen_event_loop.h b/shell/platform/tizen/tizen_event_loop.h index e275e3bcf940a..013f926d92df1 100644 --- a/shell/platform/tizen/tizen_event_loop.h +++ b/shell/platform/tizen/tizen_event_loop.h @@ -72,6 +72,7 @@ class TizenEventLoop { TizenEventLoop& operator=(const TizenEventLoop&) = delete; static void ExcuteTaskEvents(void* data, void* buffer, unsigned int nbyte); + static Eina_Bool TaskTimerCallback(void* data); static TaskTimePoint TimePointFromFlutterTime( diff --git a/shell/platform/tizen/tizen_log.cc b/shell/platform/tizen/tizen_log.cc index 17a2dcf146e5f..54778eca58dd0 100644 --- a/shell/platform/tizen/tizen_log.cc +++ b/shell/platform/tizen/tizen_log.cc @@ -14,6 +14,16 @@ static pthread_t stderr_thread; static bool is_running = false; static log_priority min_log_priority = DLOG_ERROR; +#ifdef __X64_SHELL__ +int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { + va_list arglist; + va_start(arglist, fmt); + printf(fmt, arglist); + va_end(arglist); + return 0; +} +#endif + namespace flutter { void SetMinLoggingLevel(log_priority p) { @@ -70,5 +80,4 @@ void StartLogging() { } is_running = true; } - } // namespace flutter diff --git a/shell/platform/tizen/tizen_log.h b/shell/platform/tizen/tizen_log.h index f529f36f56052..d266c7167109e 100644 --- a/shell/platform/tizen/tizen_log.h +++ b/shell/platform/tizen/tizen_log.h @@ -5,7 +5,18 @@ #ifndef EMBEDDER_TIZEN_LOG_H_ #define EMBEDDER_TIZEN_LOG_H_ +#ifndef __X64_SHELL__ #include +#else +#include +#define log_priority int +#define DLOG_DEBUG 0 +#define DLOG_WARN 1 +#define DLOG_INFO 2 +#define DLOG_ERROR 3 +#define __MODULE__ "X64_SHELL" +int dlog_print(log_priority prio, const char* tag, const char* fmt, ...); +#endif #include #include @@ -27,7 +38,10 @@ log_priority GetMinLoggingLevel(); #define LOG_TAG "ConsoleMessage" #undef __LOG -#ifdef TV_PROFILE + +#ifdef __X64_SHELL__ +#define __LOG(prio, fmt, args...) dlog_print(prio, LOG_TAG, fmt, ##args) +#elif TV_PROFILE // dlog_print() cannot be used because it implicitly passes LOG_ID_APPS as // a log id, which is ignored by TV devices. Instead, an internal function // __dlog_print() that takes a log id as a parameter is used. diff --git a/shell/platform/tizen/tizen_renderer_ecore_wl2.h b/shell/platform/tizen/tizen_renderer_ecore_wl2.h index 42027bbb7d107..895876a225d23 100644 --- a/shell/platform/tizen/tizen_renderer_ecore_wl2.h +++ b/shell/platform/tizen/tizen_renderer_ecore_wl2.h @@ -72,5 +72,4 @@ class TizenRendererEcoreWl2 : public TizenRenderer { }; } // namespace flutter - #endif // EMBEDDER_TIZEN_RENDERER_ECORE_WL2_H_ diff --git a/shell/platform/tizen/tizen_renderer_evas_gl.cc b/shell/platform/tizen/tizen_renderer_evas_gl.cc index 5dfa505a8a4cc..8eb03cad262bc 100644 --- a/shell/platform/tizen/tizen_renderer_evas_gl.cc +++ b/shell/platform/tizen/tizen_renderer_evas_gl.cc @@ -4,7 +4,13 @@ #include "tizen_renderer_evas_gl.h" +#ifdef __X64_SHELL__ +#include "tizen_evas_gl_helper.h" +int gApp_width = 800; +int gApp_height = 600; +#else #include +#endif Evas_GL* g_evas_gl = nullptr; EVAS_GL_GLOBAL_GLES3_DEFINE(); @@ -601,11 +607,12 @@ bool TizenRendererEvasGL::SetupEvasGL() { gl_config_->depth_bits = EVAS_GL_DEPTH_NONE; gl_config_->stencil_bits = EVAS_GL_STENCIL_NONE; +#ifndef __X64_SHELL__ gl_context_ = evas_gl_context_version_create(evas_gl_, NULL, EVAS_GL_GLES_3_X); gl_resource_context_ = evas_gl_context_version_create(evas_gl_, gl_context_, EVAS_GL_GLES_3_X); - +#endif if (gl_context_ == nullptr) { FT_LOGW( "Failed to create evas gl context with EVAS_GL_GLES_3_X, try to use " @@ -647,6 +654,10 @@ Evas_Object* TizenRendererEvasGL::SetupEvasWindow(int32_t& width, return nullptr; } +#ifdef __X64_SHELL__ + width = gApp_width; + height = gApp_height; +#endif elm_win_alpha_set(evas_window_, EINA_FALSE); evas_object_move(evas_window_, 0, 0); evas_object_resize(evas_window_, width, height); diff --git a/shell/platform/tizen/tizen_vsync_waiter.h b/shell/platform/tizen/tizen_vsync_waiter.h index 4dc97d066f8dc..f11de28cf743e 100644 --- a/shell/platform/tizen/tizen_vsync_waiter.h +++ b/shell/platform/tizen/tizen_vsync_waiter.h @@ -42,5 +42,4 @@ class TizenVsyncWaiter { }; } // namespace flutter - #endif // EMBEDDER_TIZEN_VSYNC_WAITER_H_ diff --git a/shell/platform/tizen/touch_event_handler.h b/shell/platform/tizen/touch_event_handler.h index e5f764af86e9a..8d2a6c6facbb7 100644 --- a/shell/platform/tizen/touch_event_handler.h +++ b/shell/platform/tizen/touch_event_handler.h @@ -5,6 +5,10 @@ #ifndef EMBEDDER_TOUCH_EVENT_HANDLER_H_ #define EMBEDDER_TOUCH_EVENT_HANDLER_H_ +#ifdef __X64_SHELL__ +#include +#endif + #include #include From 484a20fb0d6225dced853130f0932027d54a7418 Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Fri, 2 Jul 2021 14:39:50 +0900 Subject: [PATCH 2/7] Add stubs for LocalizationChannel and PlatformChannel --- shell/platform/tizen/BUILD.gn | 28 ++++++--- .../tizen/channels/localization_channel.cc | 51 +---------------- .../channels/localization_channel_stub.cc | 17 ++++++ .../tizen/channels/platform_channel.cc | 57 ------------------- .../tizen/channels/platform_channel_stub.cc | 30 ++++++++++ 5 files changed, 67 insertions(+), 116 deletions(-) create mode 100644 shell/platform/tizen/channels/localization_channel_stub.cc create mode 100644 shell/platform/tizen/channels/platform_channel_stub.cc diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index 8d6684781ddf5..7ae56aadbcfc6 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -29,9 +29,7 @@ source_set("flutter_engine") { _flutter_tizen_source = [ "channels/key_event_channel.cc", "channels/lifecycle_channel.cc", - "channels/localization_channel.cc", "channels/navigation_channel.cc", - "channels/platform_channel.cc", "channels/platform_view_channel.cc", "channels/settings_channel.cc", "channels/text_input_channel.cc", @@ -130,6 +128,10 @@ template("embedder_for_profile") { public = _public_headers sources = _flutter_tizen_source + sources += [ + "channels/localization_channel.cc", + "channels/platform_channel.cc", + ] libs = _libs_minimum @@ -236,8 +238,11 @@ template("embedder_executable") { public = _public_headers sources = _flutter_tizen_source - - sources += [ "tizen_renderer_evas_gl.cc" ] + sources += [ + "channels/localization_channel_stub.cc", + "channels/platform_channel_stub.cc", + "tizen_renderer_evas_gl.cc", + ] if (defined(invoker.sources)) { sources += invoker.sources @@ -336,14 +341,19 @@ copy("copy_icu") { group("tizen") { deps = [ ":copy_icu", - ":flutter_tizen_common", - ":flutter_tizen_mobile", - ":flutter_tizen_tv", - ":flutter_tizen_wearable", ":publish_cpp_client_wrapper", ":publish_headers_tizen", ] if (enable_desktop_embeddings) { - deps += [ ":flutter_tizen_shell" ] + deps += [ + ":flutter_tizen_shell", + ] + } else { + deps += [ + ":flutter_tizen_common", + ":flutter_tizen_mobile", + ":flutter_tizen_tv", + ":flutter_tizen_wearable", + ] } } diff --git a/shell/platform/tizen/channels/localization_channel.cc b/shell/platform/tizen/channels/localization_channel.cc index 883e522f9a083..4a911cf94e042 100644 --- a/shell/platform/tizen/channels/localization_channel.cc +++ b/shell/platform/tizen/channels/localization_channel.cc @@ -3,58 +3,9 @@ // found in the LICENSE file. #include "localization_channel.h" -#ifndef __X64_SHELL__ -#include -#else -typedef enum { - I18N_ERROR_NONE, /**< No error, no warning */ - I18N_ERROR_NOT_SUPPORTED, -} i18n_error_code_e; - -int i18n_ulocale_set_default(const char* locale_id) { - return I18N_ERROR_NONE; -} - -int i18n_ulocale_get_default(const char** locale) { - *locale = "en_US.UTF-8"; - return I18N_ERROR_NONE; -} - -int i18n_ulocale_get_language(const char* locale_id, - char* language, - int32_t language_capacity, - int32_t* buf_size_language) { - return I18N_ERROR_NOT_SUPPORTED; -} - -const char* i18n_ulocale_get_available(int32_t n) { - return "en_US.UTF-8"; -} -int32_t i18n_ulocale_get_country(const char* locale_id, - char* country, - int32_t country_capacity, - int* error) { - return 0; -} - -int32_t i18n_ulocale_count_available(void) { - return 0; -} - -int32_t i18n_ulocale_get_script(const char* locale_id, - char* script, - int32_t script_capacity) { - return 0; -} - -int32_t i18n_ulocale_get_variant(const char* locale_id, - char* variant, - int32_t variant_capacity) { - return 0; -} +#include -#endif #include #include "flutter/shell/platform/tizen/flutter_tizen_engine.h" diff --git a/shell/platform/tizen/channels/localization_channel_stub.cc b/shell/platform/tizen/channels/localization_channel_stub.cc new file mode 100644 index 0000000000000..66c4f19f0fad3 --- /dev/null +++ b/shell/platform/tizen/channels/localization_channel_stub.cc @@ -0,0 +1,17 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "localization_channel.h" + +namespace flutter { + +LocalizationChannel::LocalizationChannel(FlutterTizenEngine* engine) { + engine_ = nullptr; +} + +LocalizationChannel::~LocalizationChannel() {} + +void LocalizationChannel::SendLocales() {} + +} // namespace flutter diff --git a/shell/platform/tizen/channels/platform_channel.cc b/shell/platform/tizen/channels/platform_channel.cc index f3d8685e34e37..ed1c6a76455d1 100644 --- a/shell/platform/tizen/channels/platform_channel.cc +++ b/shell/platform/tizen/channels/platform_channel.cc @@ -4,65 +4,8 @@ #include "platform_channel.h" -#ifndef __X64_SHELL__ #include #include -#else - -namespace { - -typedef enum { - FEEDBACK_PATTERN_NONE = -1, - FEEDBACK_PATTERN_TAP = 0, /**< Feedback pattern when general touch */ - FEEDBACK_PATTERN_SIP, /**< Feedback pattern when touch text key */ - FEEDBACK_PATTERN_GENERAL = - 33, /**< Feedback pattern when alert general event */ - FEEDBACK_PATTERN_VIBRATION_ON = - 55, /**< Feedback pattern when turn on vibration mode */ - FEEDBACK_PATTERN_SILENT_OFF, /**< Feedback pattern when turn off silent mode - */ -} feedback_pattern_e; - -typedef enum { - FEEDBACK_TYPE_NONE, /**< Feedback type none */ - FEEDBACK_TYPE_SOUND, /**< Feedback type for sound */ - - FEEDBACK_TYPE_VIBRATION, /**< Feedback type for vibration */ - FEEDBACK_TYPE_END, -} feedback_type_e; - -typedef enum { - FEEDBACK_ERROR_NONE, /**< Successful */ - FEEDBACK_ERROR_OPERATION_FAILED, /**< Operation failed */ - - FEEDBACK_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - FEEDBACK_ERROR_NOT_SUPPORTED, /**< Not supported in this device */ - FEEDBACK_ERROR_PERMISSION_DENIED, /**< Permission denied */ - FEEDBACK_ERROR_NOT_INITIALIZED, /**< Not initialized */ -} feedback_error_e; - -int feedback_initialize(void) { - return 0; -} - -int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern) { - return 0; -} - -int feedback_deinitialize(void) { - return 0; -} - -void ui_app_exit(void) { - exit(0); -} - -char* get_error_message(int err_code) { - return (char*)"NOT SUPPORTED"; -} - -}; // namespace -#endif #include diff --git a/shell/platform/tizen/channels/platform_channel_stub.cc b/shell/platform/tizen/channels/platform_channel_stub.cc new file mode 100644 index 0000000000000..22a1ffdbbd090 --- /dev/null +++ b/shell/platform/tizen/channels/platform_channel_stub.cc @@ -0,0 +1,30 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform_channel.h" + +namespace flutter { + +PlatformChannel::PlatformChannel(BinaryMessenger* messenger, + TizenRenderer* renderer) { + renderer_ = nullptr; +} + +PlatformChannel::~PlatformChannel() {} + +void PlatformChannel::HandleMethodCall( + const MethodCall& call, + std::unique_ptr> result) {} + +namespace clipboard { + +void GetData(const MethodCall& call, + std::unique_ptr> result) {} + +void SetData(const MethodCall& call, + std::unique_ptr> result) {} + +} // namespace clipboard + +} // namespace flutter From 01650b74194b817312b9f656f5b9ba172cd81356 Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Fri, 2 Jul 2021 15:35:32 +0900 Subject: [PATCH 3/7] Add SettingsChannel stub --- shell/platform/tizen/BUILD.gn | 3 ++- .../platform/tizen/channels/settings_channel.cc | 16 ---------------- .../platform/tizen/channels/settings_channel.h | 17 ++--------------- .../tizen/channels/settings_channel_stub.cc | 13 +++++++++++++ 4 files changed, 17 insertions(+), 32 deletions(-) create mode 100644 shell/platform/tizen/channels/settings_channel_stub.cc diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index 7ae56aadbcfc6..ab2526f84c12d 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -31,7 +31,6 @@ _flutter_tizen_source = [ "channels/lifecycle_channel.cc", "channels/navigation_channel.cc", "channels/platform_view_channel.cc", - "channels/settings_channel.cc", "channels/text_input_channel.cc", "external_texture_pixel_gl.cc", "external_texture_surface_gl.cc", @@ -131,6 +130,7 @@ template("embedder_for_profile") { sources += [ "channels/localization_channel.cc", "channels/platform_channel.cc", + "channels/settings_channel.cc", ] libs = _libs_minimum @@ -241,6 +241,7 @@ template("embedder_executable") { sources += [ "channels/localization_channel_stub.cc", "channels/platform_channel_stub.cc", + "channels/settings_channel_stub.cc", "tizen_renderer_evas_gl.cc", ] diff --git a/shell/platform/tizen/channels/settings_channel.cc b/shell/platform/tizen/channels/settings_channel.cc index 568ecd48970b2..54daa65c248a1 100644 --- a/shell/platform/tizen/channels/settings_channel.cc +++ b/shell/platform/tizen/channels/settings_channel.cc @@ -6,22 +6,6 @@ #include "flutter/shell/platform/common/json_message_codec.h" -#ifdef __X64_SHELL__ -int system_settings_set_changed_cb(system_settings_key_e key, - system_settings_changed_cb callback, - void* user_data) { - return 0; -} - -int system_settings_unset_changed_cb(system_settings_key_e key) { - return 0; -} - -int system_settings_get_value_bool(system_settings_key_e key, bool* value) { - return 0; -} -#endif - namespace flutter { namespace { diff --git a/shell/platform/tizen/channels/settings_channel.h b/shell/platform/tizen/channels/settings_channel.h index 51328f1a31d7a..b99a03126c9f3 100644 --- a/shell/platform/tizen/channels/settings_channel.h +++ b/shell/platform/tizen/channels/settings_channel.h @@ -7,21 +7,6 @@ #ifndef __X64_SHELL__ #include -#else -typedef enum { - SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, /**< (bool) Indicates whether - the 24-hour clock is used. If - the value is @c false, the - 12-hour clock is used. */ - SYSTEM_SETTINGS_KEY_MAX, -} system_settings_key_e; - -typedef enum { - SYSTEM_SETTINGS_ERROR_NONE, /**< Successful */ -} system_settings_error_e; - -typedef void (*system_settings_changed_cb)(system_settings_key_e key, - void* user_data); #endif #include @@ -38,11 +23,13 @@ class SettingsChannel { virtual ~SettingsChannel(); private: +#ifndef __X64_SHELL__ static void OnSettingsChangedCallback(system_settings_key_e key, void* user_data); void SendSettingsEvent(); std::unique_ptr> channel_; +#endif }; } // namespace flutter diff --git a/shell/platform/tizen/channels/settings_channel_stub.cc b/shell/platform/tizen/channels/settings_channel_stub.cc new file mode 100644 index 0000000000000..10809f2d919db --- /dev/null +++ b/shell/platform/tizen/channels/settings_channel_stub.cc @@ -0,0 +1,13 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "settings_channel.h" + +namespace flutter { + +SettingsChannel::SettingsChannel(BinaryMessenger* messenger) {} + +SettingsChannel::~SettingsChannel() {} + +} // namespace flutter From 058f962492df49928c5771265dfb2d7ea3e29188 Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Fri, 2 Jul 2021 16:42:55 +0900 Subject: [PATCH 4/7] Remove ExternalTexturePixelGL and ExternalTextureSurfaceGL from destkop shell depdendencies --- shell/platform/tizen/BUILD.gn | 4 +-- .../tizen/external_texture_pixel_gl.cc | 6 ---- .../tizen/external_texture_surface_gl.cc | 31 ------------------- .../tizen/flutter_tizen_texture_registrar.cc | 9 +++++- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index ab2526f84c12d..385d3538a24bd 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -32,8 +32,6 @@ _flutter_tizen_source = [ "channels/navigation_channel.cc", "channels/platform_view_channel.cc", "channels/text_input_channel.cc", - "external_texture_pixel_gl.cc", - "external_texture_surface_gl.cc", "flutter_tizen.cc", "flutter_tizen_engine.cc", "flutter_tizen_texture_registrar.cc", @@ -131,6 +129,8 @@ template("embedder_for_profile") { "channels/localization_channel.cc", "channels/platform_channel.cc", "channels/settings_channel.cc", + "external_texture_pixel_gl.cc", + "external_texture_surface_gl.cc", ] libs = _libs_minimum diff --git a/shell/platform/tizen/external_texture_pixel_gl.cc b/shell/platform/tizen/external_texture_pixel_gl.cc index f0a6e28432082..846bdb0737422 100644 --- a/shell/platform/tizen/external_texture_pixel_gl.cc +++ b/shell/platform/tizen/external_texture_pixel_gl.cc @@ -6,13 +6,7 @@ #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT - -#ifdef __X64_SHELL__ -#include "tizen_evas_gl_helper.h" -#else #include -#endif - extern Evas_GL* g_evas_gl; EVAS_GL_GLOBAL_GLES3_DECLARE(); #else diff --git a/shell/platform/tizen/external_texture_surface_gl.cc b/shell/platform/tizen/external_texture_surface_gl.cc index 81829cbe2c162..cba8bdf277eac 100644 --- a/shell/platform/tizen/external_texture_surface_gl.cc +++ b/shell/platform/tizen/external_texture_surface_gl.cc @@ -6,8 +6,6 @@ #include "flutter/shell/platform/common/public/flutter_texture_registrar.h" -#ifndef __X64_SHELL__ - #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT #include @@ -159,32 +157,3 @@ void ExternalTextureSurfaceGL::OnDestruction() { } } // namespace flutter - -#else -namespace flutter { -ExternalTextureSurfaceGL::ExternalTextureSurfaceGL( - FlutterDesktopGpuBufferTextureCallback texture_callback, - FlutterDesktopGpuBufferDestructionCallback destruction_callback, - void* user_data) - : ExternalTexture(), - texture_callback_(texture_callback), - destruction_callback_(destruction_callback), - user_data_(user_data) { - if (!texture_callback_ && destruction_callback_ && user_data_) { - user_data_ = nullptr; - } -} - -ExternalTextureSurfaceGL::~ExternalTextureSurfaceGL() {} - -bool ExternalTextureSurfaceGL::PopulateTexture( - size_t width, - size_t height, - FlutterOpenGLTexture* opengl_texture) { - return true; -} - -void ExternalTextureSurfaceGL::OnDestruction() {} -} // namespace flutter - -#endif diff --git a/shell/platform/tizen/flutter_tizen_texture_registrar.cc b/shell/platform/tizen/flutter_tizen_texture_registrar.cc index c7620ed0465f2..e84cd4d68a49d 100644 --- a/shell/platform/tizen/flutter_tizen_texture_registrar.cc +++ b/shell/platform/tizen/flutter_tizen_texture_registrar.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/platform/tizen/flutter_tizen_texture_registrar.h" +#include "flutter_tizen_texture_registrar.h" #include #include +#ifndef __X64_SHELL__ #include "flutter/shell/platform/tizen/external_texture_pixel_gl.h" #include "flutter/shell/platform/tizen/external_texture_surface_gl.h" +#endif #include "flutter/shell/platform/tizen/flutter_tizen_engine.h" #include "flutter/shell/platform/tizen/tizen_log.h" @@ -88,6 +90,10 @@ bool FlutterTizenTextureRegistrar::PopulateTexture( std::unique_ptr FlutterTizenTextureRegistrar::CreateExternalTexture( const FlutterDesktopTextureInfo* texture_info) { +#ifdef __X64_SHELL__ + FT_UNIMPLEMENTED(); + return nullptr; +#else switch (texture_info->type) { case kFlutterDesktopPixelBufferTexture: return std::make_unique( @@ -104,6 +110,7 @@ FlutterTizenTextureRegistrar::CreateExternalTexture( FT_LOGE("Invalid texture type."); return nullptr; } +#endif } } // namespace flutter From 553bdccdfd7a74aa5d7585782804b52687ef66f4 Mon Sep 17 00:00:00 2001 From: MuHong Byun Date: Mon, 5 Jul 2021 13:00:07 +0900 Subject: [PATCH 5/7] Fix minor thing * Add log stub Signed-off-by: MuHong Byun --- shell/platform/tizen/BUILD.gn | 7 ++--- .../tizen/channels/settings_channel.h | 6 ++-- .../tizen/channels/settings_channel_stub.cc | 5 ++++ shell/platform/tizen/tizen_log.cc | 10 ------- shell/platform/tizen/tizen_log.h | 5 +--- shell/platform/tizen/tizen_log_stub.cc | 28 +++++++++++++++++++ 6 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 shell/platform/tizen/tizen_log_stub.cc diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index 385d3538a24bd..bd33143429e3a 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -37,7 +37,6 @@ _flutter_tizen_source = [ "flutter_tizen_texture_registrar.cc", "key_event_handler.cc", "tizen_event_loop.cc", - "tizen_log.cc", "tizen_renderer.cc", "touch_event_handler.cc", ] @@ -131,6 +130,7 @@ template("embedder_for_profile") { "channels/settings_channel.cc", "external_texture_pixel_gl.cc", "external_texture_surface_gl.cc", + "tizen_log.cc", ] libs = _libs_minimum @@ -242,6 +242,7 @@ template("embedder_executable") { "channels/localization_channel_stub.cc", "channels/platform_channel_stub.cc", "channels/settings_channel_stub.cc", + "tizen_log_stub.cc", "tizen_renderer_evas_gl.cc", ] @@ -346,9 +347,7 @@ group("tizen") { ":publish_headers_tizen", ] if (enable_desktop_embeddings) { - deps += [ - ":flutter_tizen_shell", - ] + deps += [ ":flutter_tizen_shell" ] } else { deps += [ ":flutter_tizen_common", diff --git a/shell/platform/tizen/channels/settings_channel.h b/shell/platform/tizen/channels/settings_channel.h index b99a03126c9f3..17f23203b28c6 100644 --- a/shell/platform/tizen/channels/settings_channel.h +++ b/shell/platform/tizen/channels/settings_channel.h @@ -7,6 +7,10 @@ #ifndef __X64_SHELL__ #include +#else +typedef enum { + SYSTEM_SETTINGS_KEY_MAX, +} system_settings_key_e; #endif #include @@ -23,13 +27,11 @@ class SettingsChannel { virtual ~SettingsChannel(); private: -#ifndef __X64_SHELL__ static void OnSettingsChangedCallback(system_settings_key_e key, void* user_data); void SendSettingsEvent(); std::unique_ptr> channel_; -#endif }; } // namespace flutter diff --git a/shell/platform/tizen/channels/settings_channel_stub.cc b/shell/platform/tizen/channels/settings_channel_stub.cc index 10809f2d919db..0f38c29a48516 100644 --- a/shell/platform/tizen/channels/settings_channel_stub.cc +++ b/shell/platform/tizen/channels/settings_channel_stub.cc @@ -10,4 +10,9 @@ SettingsChannel::SettingsChannel(BinaryMessenger* messenger) {} SettingsChannel::~SettingsChannel() {} +void SettingsChannel::SendSettingsEvent() {} + +void SettingsChannel::OnSettingsChangedCallback(system_settings_key_e key, + void* user_data) {} + } // namespace flutter diff --git a/shell/platform/tizen/tizen_log.cc b/shell/platform/tizen/tizen_log.cc index 54778eca58dd0..17cb8e735369d 100644 --- a/shell/platform/tizen/tizen_log.cc +++ b/shell/platform/tizen/tizen_log.cc @@ -14,16 +14,6 @@ static pthread_t stderr_thread; static bool is_running = false; static log_priority min_log_priority = DLOG_ERROR; -#ifdef __X64_SHELL__ -int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { - va_list arglist; - va_start(arglist, fmt); - printf(fmt, arglist); - va_end(arglist); - return 0; -} -#endif - namespace flutter { void SetMinLoggingLevel(log_priority p) { diff --git a/shell/platform/tizen/tizen_log.h b/shell/platform/tizen/tizen_log.h index d266c7167109e..17bcb7e3fb174 100644 --- a/shell/platform/tizen/tizen_log.h +++ b/shell/platform/tizen/tizen_log.h @@ -8,7 +8,6 @@ #ifndef __X64_SHELL__ #include #else -#include #define log_priority int #define DLOG_DEBUG 0 #define DLOG_WARN 1 @@ -39,9 +38,7 @@ log_priority GetMinLoggingLevel(); #undef __LOG -#ifdef __X64_SHELL__ -#define __LOG(prio, fmt, args...) dlog_print(prio, LOG_TAG, fmt, ##args) -#elif TV_PROFILE +#ifdef TV_PROFILE // dlog_print() cannot be used because it implicitly passes LOG_ID_APPS as // a log id, which is ignored by TV devices. Instead, an internal function // __dlog_print() that takes a log id as a parameter is used. diff --git a/shell/platform/tizen/tizen_log_stub.cc b/shell/platform/tizen/tizen_log_stub.cc new file mode 100644 index 0000000000000..a6e4f8bf63767 --- /dev/null +++ b/shell/platform/tizen/tizen_log_stub.cc @@ -0,0 +1,28 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "tizen_log.h" +#include + +int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { + va_list arglist; + va_start(arglist, fmt); + printf(fmt, arglist); + va_end(arglist); + return 0; +} + +namespace flutter { + +void SetMinLoggingLevel(log_priority p) { +}; + +log_priority GetMinLoggingLevel() { + return DLOG_ERROR; +}; + +void StartLogging() { +} + +} // namespace flutter From 719fd2407c477c93114bd7a68df655cb1c9bdc72 Mon Sep 17 00:00:00 2001 From: MuHong Byun Date: Mon, 5 Jul 2021 14:31:51 +0900 Subject: [PATCH 6/7] Apply review's comment Signed-off-by: MuHong Byun --- .../tizen/flutter_tizen_engine_unittest.cc | 14 +++++++++----- shell/platform/tizen/flutter_tizen_shell.cc | 18 +++++++----------- shell/platform/tizen/testing/mock_engine.cc | 7 ++----- shell/platform/tizen/tizen_event_loop.cc | 3 --- shell/platform/tizen/tizen_log.h | 5 ++++- shell/platform/tizen/tizen_log_stub.cc | 8 +++----- .../platform/tizen/tizen_renderer_ecore_wl2.h | 1 + shell/platform/tizen/tizen_vsync_waiter.h | 1 + 8 files changed, 27 insertions(+), 30 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen_engine_unittest.cc b/shell/platform/tizen/flutter_tizen_engine_unittest.cc index e3e5665471239..42e3b18dc9846 100644 --- a/shell/platform/tizen/flutter_tizen_engine_unittest.cc +++ b/shell/platform/tizen/flutter_tizen_engine_unittest.cc @@ -9,7 +9,12 @@ namespace flutter { namespace testing { -TEST(FlutterTizenEngineTestSimple, Create_Headless) { +class FlutterTizenEngineTestSimple : public ::testing::Test { + protected: + void SetUp() { ecore_init(); } +}; + +TEST_F(FlutterTizenEngineTestSimple, Create_Headless) { flutter::FlutterTizenEngine* tizen_engine = new flutter::FlutterTizenEngine(false); EXPECT_TRUE(tizen_engine != nullptr); @@ -17,7 +22,7 @@ TEST(FlutterTizenEngineTestSimple, Create_Headless) { } // TODO -TEST(FlutterTizenEngineTestSimple, DISABLED_Create_Headed) { +TEST_F(FlutterTizenEngineTestSimple, DISABLED_Create_Headed) { flutter::FlutterTizenEngine* tizen_engine = new flutter::FlutterTizenEngine(true); EXPECT_TRUE(tizen_engine != nullptr); @@ -27,6 +32,8 @@ TEST(FlutterTizenEngineTestSimple, DISABLED_Create_Headed) { class FlutterTizenEngineTest : public ::testing::Test { public: FlutterTizenEngineTest() { + ecore_init(); + std::string tpk_root; char path[256]; EXPECT_TRUE(getcwd(path, sizeof(path)) != NULL); @@ -37,9 +44,6 @@ class FlutterTizenEngineTest : public ::testing::Test { aot_lib_path_ = tpk_root + "/lib/libapp.so"; switches_.push_back("--disable-observatory"); - // switches_.push_back("--verbose-logging"); - // switches_.push_back("--enable-dart-profiling"); - // switches_.push_back("--enable-checked-mode"); } protected: diff --git a/shell/platform/tizen/flutter_tizen_shell.cc b/shell/platform/tizen/flutter_tizen_shell.cc index 146a2997a1a4c..1c6749b3439c3 100644 --- a/shell/platform/tizen/flutter_tizen_shell.cc +++ b/shell/platform/tizen/flutter_tizen_shell.cc @@ -50,8 +50,7 @@ class FlutterApp { engine_prop.aot_library_path = aot_lib_path.c_str(); engine_prop.switches = switches.data(); engine_prop.switches_count = switches.size(); - engine_ = reinterpret_cast( - FlutterDesktopRunEngine(engine_prop, true)); + engine_ = FlutterDesktopRunEngine(engine_prop, true); if (!engine_) { printf("Could not launch a Flutter application.\n"); @@ -60,18 +59,16 @@ class FlutterApp { // RegisterPlugins(this); return true; } - void OnResume() {} - void OnPause() {} + void OnTerminate() { printf("Shutting down the application..."); - FlutterDesktopShutdownEngine( - reinterpret_cast(engine_)); - delete engine_; + FlutterDesktopShutdownEngine(engine_); engine_ = nullptr; ecore_shutdown(); } + int Run(int argc, char** argv) { ecore_init(); elm_init(0, 0); @@ -96,22 +93,21 @@ class FlutterApp { }, this); ecore_main_loop_begin(); + OnTerminate(); return 0; } FlutterDesktopPluginRegistrarRef GetRegistrarForPlugin( const std::string& plugin_name) { if (engine_) { - return FlutterDesktopGetPluginRegistrar( - reinterpret_cast(engine_), - plugin_name.c_str()); + return FlutterDesktopGetPluginRegistrar(engine_, plugin_name.c_str()); } return nullptr; } private: std::string app_path_ = {}; - flutter::FlutterTizenEngine* engine_ = nullptr; + FlutterDesktopEngineRef engine_ = nullptr; }; int main(int argc, char* argv[]) { diff --git a/shell/platform/tizen/testing/mock_engine.cc b/shell/platform/tizen/testing/mock_engine.cc index 7ebf8c8e60566..7dbe9e19d75f1 100644 --- a/shell/platform/tizen/testing/mock_engine.cc +++ b/shell/platform/tizen/testing/mock_engine.cc @@ -1,9 +1,6 @@ +// Copyright 2021 Samsung Electronics Co., Ltd. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. + #include #include "flutter/shell/platform/embedder/embedder.h" diff --git a/shell/platform/tizen/tizen_event_loop.cc b/shell/platform/tizen/tizen_event_loop.cc index cff3003f05363..33c150b135ae2 100644 --- a/shell/platform/tizen/tizen_event_loop.cc +++ b/shell/platform/tizen/tizen_event_loop.cc @@ -18,9 +18,6 @@ TizenEventLoop::TizenEventLoop(std::thread::id main_thread_id, TaskExpiredCallback on_task_expired) : main_thread_id_(main_thread_id), on_task_expired_(std::move(on_task_expired)) { -#ifdef __X64_SHELL__ - ecore_init(); -#endif ecore_pipe_ = ecore_pipe_add(ExcuteTaskEvents, this); } diff --git a/shell/platform/tizen/tizen_log.h b/shell/platform/tizen/tizen_log.h index 17bcb7e3fb174..8411acd0577e5 100644 --- a/shell/platform/tizen/tizen_log.h +++ b/shell/platform/tizen/tizen_log.h @@ -13,7 +13,6 @@ #define DLOG_WARN 1 #define DLOG_INFO 2 #define DLOG_ERROR 3 -#define __MODULE__ "X64_SHELL" int dlog_print(log_priority prio, const char* tag, const char* fmt, ...); #endif @@ -36,6 +35,10 @@ log_priority GetMinLoggingLevel(); // This is the only valid log tag that TV devices can understand. #define LOG_TAG "ConsoleMessage" +#ifndef __MODULE__ +#define __MODULE__ strrchr("/" __FILE__, '/') + 1 +#endif + #undef __LOG #ifdef TV_PROFILE diff --git a/shell/platform/tizen/tizen_log_stub.cc b/shell/platform/tizen/tizen_log_stub.cc index a6e4f8bf63767..cb0adf239245f 100644 --- a/shell/platform/tizen/tizen_log_stub.cc +++ b/shell/platform/tizen/tizen_log_stub.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "tizen_log.h" #include +#include "tizen_log.h" int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { va_list arglist; @@ -15,14 +15,12 @@ int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { namespace flutter { -void SetMinLoggingLevel(log_priority p) { -}; +void SetMinLoggingLevel(log_priority p){}; log_priority GetMinLoggingLevel() { return DLOG_ERROR; }; -void StartLogging() { -} +void StartLogging() {} } // namespace flutter diff --git a/shell/platform/tizen/tizen_renderer_ecore_wl2.h b/shell/platform/tizen/tizen_renderer_ecore_wl2.h index 895876a225d23..42027bbb7d107 100644 --- a/shell/platform/tizen/tizen_renderer_ecore_wl2.h +++ b/shell/platform/tizen/tizen_renderer_ecore_wl2.h @@ -72,4 +72,5 @@ class TizenRendererEcoreWl2 : public TizenRenderer { }; } // namespace flutter + #endif // EMBEDDER_TIZEN_RENDERER_ECORE_WL2_H_ diff --git a/shell/platform/tizen/tizen_vsync_waiter.h b/shell/platform/tizen/tizen_vsync_waiter.h index f11de28cf743e..4dc97d066f8dc 100644 --- a/shell/platform/tizen/tizen_vsync_waiter.h +++ b/shell/platform/tizen/tizen_vsync_waiter.h @@ -42,4 +42,5 @@ class TizenVsyncWaiter { }; } // namespace flutter + #endif // EMBEDDER_TIZEN_VSYNC_WAITER_H_ From b7f4c43e6c703ca15db16b115a200a1c7d2bd734 Mon Sep 17 00:00:00 2001 From: MuHong Byun Date: Tue, 6 Jul 2021 07:37:46 +0900 Subject: [PATCH 7/7] Apply review's comment #2 Signed-off-by: MuHong Byun --- shell/platform/tizen/flutter_tizen_engine_unittest.cc | 2 +- shell/platform/tizen/tizen_log_stub.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen_engine_unittest.cc b/shell/platform/tizen/flutter_tizen_engine_unittest.cc index 42e3b18dc9846..4acce271181b7 100644 --- a/shell/platform/tizen/flutter_tizen_engine_unittest.cc +++ b/shell/platform/tizen/flutter_tizen_engine_unittest.cc @@ -112,4 +112,4 @@ TEST_F(FlutterTizenEngineTest, DISABLED_GetTextureRegistrar) { } } // namespace testing -} // namespace flutter \ No newline at end of file +} // namespace flutter diff --git a/shell/platform/tizen/tizen_log_stub.cc b/shell/platform/tizen/tizen_log_stub.cc index cb0adf239245f..b248a4bb464a4 100644 --- a/shell/platform/tizen/tizen_log_stub.cc +++ b/shell/platform/tizen/tizen_log_stub.cc @@ -8,8 +8,9 @@ int dlog_print(log_priority prio, const char* tag, const char* fmt, ...) { va_list arglist; va_start(arglist, fmt); - printf(fmt, arglist); + vprintf(fmt, arglist); va_end(arglist); + printf("\n"); return 0; }