From 5f3dd22450ed83526efbf82af325129b6a76cc59 Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Tue, 3 Aug 2021 17:00:15 +0900 Subject: [PATCH 1/2] Remove ExternalTexture stub files --- shell/platform/tizen/BUILD.gn | 4 +- .../tizen/external_texture_pixel_gl.cc | 2 +- .../tizen/external_texture_pixel_gl_stub.cc | 29 -------------- .../tizen/external_texture_surface_gl.cc | 2 +- .../tizen/external_texture_surface_gl_stub.cc | 38 ------------------- .../tizen/flutter_tizen_texture_registrar.cc | 4 ++ shell/platform/tizen/tizen_evas_gl_helper.h | 13 +------ .../platform/tizen/tizen_renderer_evas_gl.cc | 4 -- 8 files changed, 9 insertions(+), 87 deletions(-) delete mode 100644 shell/platform/tizen/external_texture_pixel_gl_stub.cc delete mode 100644 shell/platform/tizen/external_texture_surface_gl_stub.cc diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index e210a6c2a2777..f13844905e9f5 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -117,6 +117,7 @@ template("embedder") { "channels/navigation_channel.cc", "channels/platform_view_channel.cc", "channels/text_input_channel.cc", + "external_texture_pixel_gl.cc", "flutter_project_bundle.cc", "flutter_tizen.cc", "flutter_tizen_engine.cc", @@ -153,7 +154,6 @@ template("embedder") { "channels/platform_channel.cc", "channels/settings_channel.cc", "channels/settings_channel_tizen.cc", - "external_texture_pixel_gl.cc", "external_texture_surface_gl.cc", "system_utils_tizen.cc", ] @@ -177,8 +177,6 @@ template("embedder") { "channels/platform_channel_stub.cc", "channels/settings_channel.cc", "channels/settings_channel_linux.cc", - "external_texture_pixel_gl_stub.cc", - "external_texture_surface_gl_stub.cc", "system_utils_linux.cc", ] } diff --git a/shell/platform/tizen/external_texture_pixel_gl.cc b/shell/platform/tizen/external_texture_pixel_gl.cc index 7d3ab6b2c42c6..b50f88ce3776e 100644 --- a/shell/platform/tizen/external_texture_pixel_gl.cc +++ b/shell/platform/tizen/external_texture_pixel_gl.cc @@ -6,7 +6,7 @@ #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT -#include +#include "tizen_evas_gl_helper.h" extern Evas_GL* g_evas_gl; EVAS_GL_GLOBAL_GLES3_DECLARE(); #else diff --git a/shell/platform/tizen/external_texture_pixel_gl_stub.cc b/shell/platform/tizen/external_texture_pixel_gl_stub.cc deleted file mode 100644 index e956879f13103..0000000000000 --- a/shell/platform/tizen/external_texture_pixel_gl_stub.cc +++ /dev/null @@ -1,29 +0,0 @@ -// 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 "external_texture_pixel_gl.h" - -namespace flutter { - -ExternalTexturePixelGL::ExternalTexturePixelGL( - FlutterDesktopPixelBufferTextureCallback texture_callback, - void* user_data) - : ExternalTexture(), - texture_callback_(texture_callback), - user_data_(user_data) {} - -bool ExternalTexturePixelGL::PopulateTexture( - size_t width, - size_t height, - FlutterOpenGLTexture* opengl_texture) { - return CopyPixelBuffer(width, height); -} - -bool ExternalTexturePixelGL::CopyPixelBuffer(size_t& width, size_t& height) { - if (texture_callback_ && user_data_) { - return true; - } - return false; -} -} // namespace flutter diff --git a/shell/platform/tizen/external_texture_surface_gl.cc b/shell/platform/tizen/external_texture_surface_gl.cc index 0bce628f77a38..56f837bf7b18b 100644 --- a/shell/platform/tizen/external_texture_surface_gl.cc +++ b/shell/platform/tizen/external_texture_surface_gl.cc @@ -6,7 +6,7 @@ #ifdef TIZEN_RENDERER_EVAS_GL #undef EFL_BETA_API_SUPPORT -#include +#include "tizen_evas_gl_helper.h" extern Evas_GL* g_evas_gl; EVAS_GL_GLOBAL_GLES3_DECLARE(); #else diff --git a/shell/platform/tizen/external_texture_surface_gl_stub.cc b/shell/platform/tizen/external_texture_surface_gl_stub.cc deleted file mode 100644 index 07f21e8673ae6..0000000000000 --- a/shell/platform/tizen/external_texture_surface_gl_stub.cc +++ /dev/null @@ -1,38 +0,0 @@ -// 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 "external_texture_surface_gl.h" - -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) {} - -ExternalTextureSurfaceGL::~ExternalTextureSurfaceGL() { - state_.release(); -} - -bool ExternalTextureSurfaceGL::PopulateTexture( - size_t width, - size_t height, - FlutterOpenGLTexture* opengl_texture) { - if (texture_callback_ && destruction_callback_ && user_data_) { - return true; - } - return false; -} - -void ExternalTextureSurfaceGL::OnDestruction() { - if (destruction_callback_) { - destruction_callback_(user_data_); - } -} - -} // namespace flutter diff --git a/shell/platform/tizen/flutter_tizen_texture_registrar.cc b/shell/platform/tizen/flutter_tizen_texture_registrar.cc index 5eb15ef2e0eae..53ad51616e2c9 100644 --- a/shell/platform/tizen/flutter_tizen_texture_registrar.cc +++ b/shell/platform/tizen/flutter_tizen_texture_registrar.cc @@ -8,7 +8,9 @@ #include #include "flutter/shell/platform/tizen/external_texture_pixel_gl.h" +#ifndef __X64_SHELL__ #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/logger.h" @@ -94,12 +96,14 @@ FlutterTizenTextureRegistrar::CreateExternalTexture( texture_info->pixel_buffer_config.callback, texture_info->pixel_buffer_config.user_data); break; +#ifndef __X64_SHELL__ case kFlutterDesktopGpuBufferTexture: return std::make_unique( texture_info->gpu_buffer_config.callback, texture_info->gpu_buffer_config.destruction_callback, texture_info->gpu_buffer_config.user_data); break; +#endif default: FT_LOG(Error) << "Invalid texture type."; return nullptr; diff --git a/shell/platform/tizen/tizen_evas_gl_helper.h b/shell/platform/tizen/tizen_evas_gl_helper.h index be5a0d84f36ca..6994c19033114 100644 --- a/shell/platform/tizen/tizen_evas_gl_helper.h +++ b/shell/platform/tizen/tizen_evas_gl_helper.h @@ -1,12 +1,5 @@ -// 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_ +// This file is a copy of Tizen's Evas_GL_GLES3_Helpers.h file. +// https://docs.tizen.org/application/native/api/wearable/5.5/group__Evas__GL__GLES3__Helpers.html /** * @file Evas_GL_GLES3_Helpers.h @@ -683,5 +676,3 @@ evgl_init(...) */ #endif - -#endif // EMBEDDER_TIZEN_EVAS_GL_HELPER_H_ diff --git a/shell/platform/tizen/tizen_renderer_evas_gl.cc b/shell/platform/tizen/tizen_renderer_evas_gl.cc index fef794a6e51a9..282d9c2fd98d2 100644 --- a/shell/platform/tizen/tizen_renderer_evas_gl.cc +++ b/shell/platform/tizen/tizen_renderer_evas_gl.cc @@ -4,11 +4,7 @@ #include "tizen_renderer_evas_gl.h" -#ifdef __X64_SHELL__ #include "tizen_evas_gl_helper.h" -#else -#include -#endif Evas_GL* g_evas_gl = nullptr; EVAS_GL_GLOBAL_GLES3_DEFINE(); From 6afcb6a91cfff55efce9e12646655a0bffa57f3c Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Wed, 4 Aug 2021 15:06:40 +0900 Subject: [PATCH 2/2] Create a dummy external_texture_surface_gl_linux.cc --- shell/platform/tizen/BUILD.gn | 3 +- .../external_texture_surface_gl_linux.cc | 39 +++++++++++++++++++ ...c => external_texture_surface_gl_tizen.cc} | 1 - .../tizen/flutter_tizen_texture_registrar.cc | 4 -- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 shell/platform/tizen/external_texture_surface_gl_linux.cc rename shell/platform/tizen/{external_texture_surface_gl.cc => external_texture_surface_gl_tizen.cc} (98%) diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index f13844905e9f5..935eb4668ea74 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -154,7 +154,7 @@ template("embedder") { "channels/platform_channel.cc", "channels/settings_channel.cc", "channels/settings_channel_tizen.cc", - "external_texture_surface_gl.cc", + "external_texture_surface_gl_tizen.cc", "system_utils_tizen.cc", ] @@ -177,6 +177,7 @@ template("embedder") { "channels/platform_channel_stub.cc", "channels/settings_channel.cc", "channels/settings_channel_linux.cc", + "external_texture_surface_gl_linux.cc", "system_utils_linux.cc", ] } diff --git a/shell/platform/tizen/external_texture_surface_gl_linux.cc b/shell/platform/tizen/external_texture_surface_gl_linux.cc new file mode 100644 index 0000000000000..bced5d8446036 --- /dev/null +++ b/shell/platform/tizen/external_texture_surface_gl_linux.cc @@ -0,0 +1,39 @@ +// 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. + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-private-field" +#include "external_texture_surface_gl.h" +#pragma clang diagnostic pop + +#include "flutter/shell/platform/tizen/logger.h" + +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) {} + +ExternalTextureSurfaceGL::~ExternalTextureSurfaceGL() { + FT_UNIMPLEMENTED(); +} + +bool ExternalTextureSurfaceGL::PopulateTexture( + size_t width, + size_t height, + FlutterOpenGLTexture* opengl_texture) { + FT_UNIMPLEMENTED(); + return false; +} + +void ExternalTextureSurfaceGL::OnDestruction() { + FT_UNIMPLEMENTED(); +} + +} // namespace flutter diff --git a/shell/platform/tizen/external_texture_surface_gl.cc b/shell/platform/tizen/external_texture_surface_gl_tizen.cc similarity index 98% rename from shell/platform/tizen/external_texture_surface_gl.cc rename to shell/platform/tizen/external_texture_surface_gl_tizen.cc index 56f837bf7b18b..737e1ae57ee6c 100644 --- a/shell/platform/tizen/external_texture_surface_gl.cc +++ b/shell/platform/tizen/external_texture_surface_gl_tizen.cc @@ -18,7 +18,6 @@ EVAS_GL_GLOBAL_GLES3_DECLARE(); #include -#include "flutter/shell/platform/common/public/flutter_texture_registrar.h" #include "flutter/shell/platform/tizen/logger.h" namespace flutter { diff --git a/shell/platform/tizen/flutter_tizen_texture_registrar.cc b/shell/platform/tizen/flutter_tizen_texture_registrar.cc index 53ad51616e2c9..5eb15ef2e0eae 100644 --- a/shell/platform/tizen/flutter_tizen_texture_registrar.cc +++ b/shell/platform/tizen/flutter_tizen_texture_registrar.cc @@ -8,9 +8,7 @@ #include #include "flutter/shell/platform/tizen/external_texture_pixel_gl.h" -#ifndef __X64_SHELL__ #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/logger.h" @@ -96,14 +94,12 @@ FlutterTizenTextureRegistrar::CreateExternalTexture( texture_info->pixel_buffer_config.callback, texture_info->pixel_buffer_config.user_data); break; -#ifndef __X64_SHELL__ case kFlutterDesktopGpuBufferTexture: return std::make_unique( texture_info->gpu_buffer_config.callback, texture_info->gpu_buffer_config.destruction_callback, texture_info->gpu_buffer_config.user_data); break; -#endif default: FT_LOG(Error) << "Invalid texture type."; return nullptr;