Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3b7f88c
Add platfrom surface buffer structor
xiaowei-guan May 8, 2021
f6d12da
Texture api change(draft)
xiaowei-guan May 11, 2021
7874e37
Merge branch 'flutter-2.0.1-tizen' into flutter-2.0.1-tizen-texture-2
xiaowei-guan May 11, 2021
3f7dabf
Revert code to original
xiaowei-guan May 11, 2021
08aaed6
Support GPU buffer texture
xiaowei-guan May 13, 2021
f3bf70f
Change file permission
xiaowei-guan May 13, 2021
4abc488
Add FlutterDesktopGpuBufferTextureConfig in FlutterDesktopTextureInfo.
xiaowei-guan May 14, 2021
77442be
Add buffer parameter at Destruction callback
xiaowei-guan May 18, 2021
4b8106c
Change class name ExternalTextureGL to ExternalTextureSurfaceGL
xiaowei-guan May 19, 2021
18ab87f
Remove not used code
xiaowei-guan May 20, 2021
f792f4e
Fix wild pointer issue
xiaowei-guan May 21, 2021
3576fd8
Convert unique_ptr to shared_ptr when create external texture
xiaowei-guan May 24, 2021
624b0d7
Merge branch 'flutter-2.0.1-tizen' into flutter-2.0.1-tizen-texture-2
xiaowei-guan May 24, 2021
0f5f923
Code format
xiaowei-guan May 24, 2021
240302a
Fix arm64 build error
xiaowei-guan May 24, 2021
c6b1970
Remove not used file
xiaowei-guan May 24, 2021
275201f
Remove unnecessary headers
xiaowei-guan May 25, 2021
4a56f3a
Refactor based on comments
xiaowei-guan May 25, 2021
d662053
Refactor based on comments
xiaowei-guan May 25, 2021
b91ffe3
Fix code review issue
xiaowei-guan May 26, 2021
a7cda29
Fix code review issue
xiaowei-guan May 26, 2021
4849389
Fix code review issue
xiaowei-guan May 26, 2021
00afe06
Remove warning log
xiaowei-guan May 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Texture api change(draft)
1.Delete tizen texture api, use common api, add GpuBufferTexture for gpu
buffer.

2.Delete ref/unref tbm_surface code in engine, add destructioncall for
delete tbm_surface.

3.Support pixel buffer texture.
  • Loading branch information
xiaowei-guan committed May 11, 2021
commit f6d12da7998a5c4ebb6e019aa787533df66202cf
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,15 @@ int64_t TextureRegistrarImpl::RegisterTexture(TextureVariant* texture) {
[](size_t width, size_t height,
void* user_data) -> const FlutterDesktopGpuBuffer* {
auto texture = static_cast<GpuBufferTexture*>(user_data);
auto buffer = texture->CopyGpuBuffer(width, height);
auto buffer = texture->GetGpuBuffer(width, height);
return buffer;
};

info.pixel_buffer_config.destructionCallback = [](void* user_data) -> void {
auto texture = static_cast<GpuBufferTexture*>(user_data);
texture->Destruction();
};

int64_t texture_id = FlutterDesktopTextureRegistrarRegisterExternalTexture(
texture_registrar_ref_, &info);
return texture_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,34 @@ class GpuBufferTexture {
public:
// A callback used for retrieving pixel buffers.
typedef std::function<const FlutterDesktopGpuBuffer*(size_t width,
size_t height)>
size_t height)>
CopyBufferCallback;

typedef std::function<void()> DestructionCallback;

// Creates a pixel buffer texture that uses the provided |copy_buffer_cb| to
// retrieve the buffer.
// As the callback is usually invoked from the render thread, the callee must
// take care of proper synchronization. It also needs to be ensured that the
// returned buffer isn't released prior to unregistering this texture.
GpuBufferTexture(CopyBufferCallback copy_buffer_callback)
: copy_buffer_callback_(copy_buffer_callback) {}
GpuBufferTexture(CopyBufferCallback copy_buffer_callback,
DestructionCallback destruction_callback)
: copy_buffer_callback_(copy_buffer_callback),
destruction_callback_(destruction_callback) {}

// Returns the callback-provided FlutterDesktopPixelBuffer that contains the
// actual pixel data. The intended surface size is specified by |width| and
// |height|.
const FlutterDesktopGpuBuffer* CopyGpuBuffer(size_t width,
size_t height) const {
const FlutterDesktopGpuBuffer* GetGpuBuffer(size_t width,
size_t height) const {
return copy_buffer_callback_(width, height);
}

void Destruction() { destruction_callback_(); }

private:
const CopyBufferCallback copy_buffer_callback_;
const DestructionCallback destruction_callback_;
};


Expand Down
7 changes: 6 additions & 1 deletion shell/platform/common/cpp/public/flutter_texture_registrar.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ typedef struct FlutterDesktopTextureRegistrar*
typedef enum {
// A Pixel buffer-based texture.
kFlutterDesktopPixelBufferTexture,
kFlutterDesktopGpuBufferTexture
kFlutterDesktopGpuBufferTexture,
kFlutterDesktopTextureNone
} FlutterDesktopTextureType;

// An image buffer object.
Expand Down Expand Up @@ -66,13 +67,17 @@ typedef const FlutterDesktopGpuBuffer* (
size_t height,
void* user_data);

typedef void (*FlutterDesktopDestructionCallback)(void* user_data);

// An object used to configure pixel buffer textures.
typedef struct {
// The callback used by the engine to copy the pixel buffer object.
FlutterDesktopPixelBufferTextureCallback callback;

FlutterDesktopGpuBufferTextureCallback gbCallback;

FlutterDesktopDestructionCallback destructionCallback;

// Opaque data that will get passed to the provided |callback|.
void* user_data;
} FlutterDesktopPixelBufferTextureConfig;
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ source_set("flutter_engine") {

_public_headers = [
"public/flutter_platform_view.h",
"public/flutter_tizen_texture_registrar.h",
"public/flutter_tizen.h",
]

Expand Down Expand Up @@ -94,7 +93,9 @@ template("embedder_for_profile") {
"channels/settings_channel.cc",
"channels/text_input_channel.cc",
"external_texture_gl.cc",
"external_texture_pixel_gl.cc",
"flutter_tizen.cc",
"flutter_tizen_texture_registrar.cc",
"key_event_handler.cc",
"tizen_embedder_engine.cc",
"tizen_event_loop.cc",
Expand Down
55 changes: 55 additions & 0 deletions shell/platform/tizen/external_texture.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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.

#ifndef FLUTTER_SHELL_PLATFORM_TIZEN_EXTERNAL_TEXTURE_H_
#define FLUTTER_SHELL_PLATFORM_TIZEN_EXTERNAL_TEXTURE_H_

#include <stdint.h>
#include <memory>
#include <mutex>

#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/common/cpp/public/flutter_texture_registrar.h"

#ifdef TIZEN_RENDERER_EVAS_GL
#undef EFL_BETA_API_SUPPORT
#include <Ecore.h>
#include <Elementary.h>
#include <Evas_GL_GLES3_Helpers.h>
extern Evas_GL* g_evas_gl;
EVAS_GL_GLOBAL_GLES3_DECLARE();
#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl32.h>
#endif

struct ExternalTextureGLState {
GLuint gl_texture;
};

// An adaptation class of flutter engine and external texture interface.
class ExternalTexture {
public:
ExternalTexture();

virtual ~ExternalTexture() = default;

/**
* Returns the unique id for the ExternalTextureGL instance.
*/
int64_t TextureId() { return (int64_t)texture_id_; }

virtual bool PopulateTexture(size_t width, size_t height,
FlutterOpenGLTexture* opengl_texture) = 0;

protected:
std::unique_ptr<ExternalTextureGLState> state_;
private:
const long texture_id_{0};
};

#endif // FLUTTER_SHELL_PLATFORM_TIZEN_EXTERNAL_TEXTURE_GL_H_
Loading