Skip to content

Commit

Permalink
Enable Evas GL renderer for all profiles (#312)
Browse files Browse the repository at this point in the history
For devices other than wearable, we can use either ElmFlutterView or EcoreWl2Window,
depending on apps. This commit is to avoid being device dependent.

Remove the use_evas_gl_renderer build flag and use the WEARABLE_PROFILE macro if necessary.
Before creating the engine, the embedding can select the renderer type in the engine property.
At runtime, it selects an appropriate renderer and external texture
according to the renderer type and renders to it.
  • Loading branch information
JSUYA authored and swift-kim committed Aug 5, 2022
1 parent 902aab1 commit e50535b
Show file tree
Hide file tree
Showing 33 changed files with 365 additions and 399 deletions.
42 changes: 11 additions & 31 deletions shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,15 @@ config("rootstrap_include_dirs") {
]
}

config("evas_gl_renderer") {
defines = [ "TIZEN_RENDERER_EVAS_GL" ]
}

# Template for the embedder build. Used to generate embedders for different
# device profiles.
#
# If use_evas_gl_renderer is provided as true, the Evas_GL renderer is used,
# otherwise the Ecore_Wl2 renderer is used.
# If the target profile is wearable, only the Evas GL renderer is supported.
# Otherwise, both the Evas GL and EGL renderers are supported.
template("embedder") {
forward_variables_from(invoker,
[
"target_type",
"use_evas_gl_renderer",
"defines",
])

Expand All @@ -120,10 +115,10 @@ template("embedder") {
"channels/settings_channel.cc",
"channels/text_input_channel.cc",
"channels/window_channel.cc",
"external_texture_pixel_gl.cc",
"external_texture_surface_gl.cc",
"external_texture_surface_evas_gl.cc",
"flutter_project_bundle.cc",
"flutter_tizen.cc",
"flutter_tizen_elementary.cc",
"flutter_tizen_engine.cc",
"flutter_tizen_texture_registrar.cc",
"flutter_tizen_view.cc",
Expand All @@ -132,6 +127,9 @@ template("embedder") {
"tizen_event_loop.cc",
"tizen_input_method_context.cc",
"tizen_renderer.cc",
"tizen_renderer_evas_gl.cc",
"tizen_view_elementary.cc",
"tizen_window_elementary.cc",
]

if (target_name != "flutter_tizen_wearable") {
Expand All @@ -152,12 +150,14 @@ template("embedder") {
"capi-ui-efl-util",
"dlog",
"ecore",
"ecore_evas",
"ecore_imf",
"ecore_imf_evas",
"ecore_input",
"efl-extension",
"eina",
"elementary",
"evas",
"feedback",
"tbm",
"tdm-client",
Expand Down Expand Up @@ -187,24 +187,9 @@ template("embedder") {
"//flutter:config",
]

if (use_evas_gl_renderer) {
sources += [
"flutter_tizen_elementary.cc",
"tizen_renderer_evas_gl.cc",
"tizen_view_elementary.cc",
"tizen_window_elementary.cc",
]

libs += [
"ecore_evas",
"elementary",
"evas",
]

public_configs += [ ":evas_gl_renderer" ]
} else {
if (target_name != "flutter_tizen_wearable") {
sources += [
"flutter_tizen_ecore.cc",
"external_texture_surface_egl.cc",
"tizen_renderer_egl.cc",
"tizen_vsync_waiter.cc",
"tizen_window_ecore_wl2.cc",
Expand Down Expand Up @@ -235,35 +220,30 @@ template("embedder") {

embedder("flutter_tizen_mobile") {
target_type = "shared_library"
use_evas_gl_renderer = false

defines = [ "MOBILE_PROFILE" ]
}

embedder("flutter_tizen_wearable") {
target_type = "shared_library"
use_evas_gl_renderer = true

defines = [ "WEARABLE_PROFILE" ]
}

embedder("flutter_tizen_tv") {
target_type = "shared_library"
use_evas_gl_renderer = false

defines = [ "TV_PROFILE" ]
}

embedder("flutter_tizen_common") {
target_type = "shared_library"
use_evas_gl_renderer = false

defines = [ "COMMON_PROFILE" ]
}

embedder("flutter_tizen_source") {
target_type = "source_set"
use_evas_gl_renderer = false

defines = []
}
Expand Down
22 changes: 10 additions & 12 deletions shell/platform/tizen/channels/window_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ void WindowChannel::HandleMethodCall(
map[EncodableValue("height")] = EncodableValue(geometry.height);
result->Success(EncodableValue(map));
} else if (method_name == "setWindowGeometry") {
#ifdef TIZEN_RENDERER_EVAS_GL
FT_LOG(Error) << "setWindowGeometry is not supported on Evas GL.";
result->NotImplemented();
#else
const auto* arguments = std::get_if<EncodableMap>(method_call.arguments());
if (!arguments) {
result->Error("Invalid arguments");
Expand All @@ -58,14 +54,16 @@ void WindowChannel::HandleMethodCall(
EncodableValueHolder<int32_t> height(arguments, "height");

TizenGeometry geometry = window_->GetGeometry();
window_->SetGeometry({
x ? *x : geometry.left,
y ? *y : geometry.top,
width ? *width : geometry.width,
height ? *height : geometry.height,
});
result->Success();
#endif
if (window_->SetGeometry({
x ? *x : geometry.left,
y ? *y : geometry.top,
width ? *width : geometry.width,
height ? *height : geometry.height,
})) {
result->Success();
} else {
result->NotImplemented();
}
} else if (method_name == "getScreenGeometry") {
TizenGeometry geometry = window_->GetScreenGeometry();
EncodableMap map;
Expand Down
9 changes: 1 addition & 8 deletions shell/platform/tizen/external_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,17 @@
#include "flutter/shell/platform/common/public/flutter_texture_registrar.h"
#include "flutter/shell/platform/embedder/embedder.h"

#ifdef TIZEN_RENDERER_EVAS_GL
#include <Evas_GL.h>
#else
#include <GLES2/gl2.h>
#endif

namespace flutter {

enum class ExternalTextureExtensionType { kNone, kNativeSurface, kDmaBuffer };

struct ExternalTextureGLState {
GLuint gl_texture;
uint32_t gl_texture;
ExternalTextureExtensionType gl_extension;
};

static std::atomic_long next_texture_id = {1};

// An adaptation class of flutter engine and external texture interface.
class ExternalTexture {
public:
ExternalTexture(ExternalTextureExtensionType gl_extension =
Expand Down
77 changes: 0 additions & 77 deletions shell/platform/tizen/external_texture_pixel_gl.cc

This file was deleted.

38 changes: 0 additions & 38 deletions shell/platform/tizen/external_texture_pixel_gl.h

This file was deleted.

Loading

0 comments on commit e50535b

Please sign in to comment.