Skip to content

Commit d074a8d

Browse files
committed
Revert "Make the context current before accessing GL in MakeSkiaGpuImage"
This reverts commit c7894a6.
1 parent 6531113 commit d074a8d

File tree

4 files changed

+7
-83
lines changed

4 files changed

+7
-83
lines changed

shell/common/BUILD.gn

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,5 @@ if (enable_unittests) {
325325
sources += [ "shell_io_manager_unittests.cc" ]
326326
deps += [ "//third_party/swiftshader" ]
327327
}
328-
329-
if (shell_enable_gl) {
330-
deps += [
331-
"//third_party/angle:libEGL_static",
332-
"//third_party/angle:libGLESv2_static",
333-
"//third_party/swiftshader",
334-
]
335-
}
336328
}
337329
}

shell/common/fixtures/shell_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ void scene_with_red_box() {
354354
PlatformDispatcher.instance.scheduleFrame();
355355
}
356356

357-
@pragma('vm:external-name', 'NativeOnBeforeToImageSync')
358-
external void onBeforeToImageSync();
359-
360357

361358
@pragma('vm:entry-point')
362359
Future<void> toImageSync() async {
@@ -365,7 +362,6 @@ Future<void> toImageSync() async {
365362
canvas.drawPaint(Paint()..color = const Color(0xFFAAAAAA));
366363
final Picture picture = recorder.endRecording();
367364

368-
onBeforeToImageSync();
369365
final Image image = picture.toImageSync(20, 25);
370366
void expect(Object? a, Object? b) {
371367
if (a != b) {

shell/common/rasterizer.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,27 +294,24 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
294294
TRACE_EVENT0("flutter", "Rasterizer::MakeGpuImage");
295295
FML_DCHECK(display_list);
296296

297+
// TODO(dnfield): the Linux embedding is in a rough state right now and
298+
// I can't seem to get the GPU path working on it.
299+
// https://github.com/flutter/flutter/issues/108835
300+
#if FML_OS_LINUX
301+
return MakeBitmapImage(display_list, image_info);
302+
#endif
303+
297304
std::unique_ptr<SnapshotDelegate::GpuImageResult> result;
298305
delegate_.GetIsGpuDisabledSyncSwitch()->Execute(
299306
fml::SyncSwitch::Handlers()
300307
.SetIfTrue([&result, &image_info, &display_list] {
301-
// TODO(dnfield): This isn't safe if display_list contains any GPU
302-
// resources like an SkImage_gpu.
303308
result = MakeBitmapImage(display_list, image_info);
304309
})
305310
.SetIfFalse([&result, &image_info, &display_list,
306311
surface = surface_.get(),
307312
gpu_image_behavior = gpu_image_behavior_] {
308313
if (!surface ||
309314
gpu_image_behavior == MakeGpuImageBehavior::kBitmap) {
310-
// TODO(dnfield): This isn't safe if display_list contains any GPU
311-
// resources like an SkImage_gpu.
312-
result = MakeBitmapImage(display_list, image_info);
313-
return;
314-
}
315-
316-
auto context_switch = surface->MakeRenderContextCurrent();
317-
if (!context_switch->GetResult()) {
318315
result = MakeBitmapImage(display_list, image_info);
319316
return;
320317
}

shell/common/shell_unittests.cc

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#include <utility>
1212
#include <vector>
1313

14-
#if SHELL_ENABLE_GL
15-
#include <EGL/egl.h>
16-
#endif // SHELL_ENABLE_GL
17-
1814
#include "assets/directory_asset_bundle.h"
1915
#include "common/graphics/persistent_cache.h"
2016
#include "flutter/flow/layers/backdrop_filter_layer.h"
@@ -3959,11 +3955,6 @@ TEST_F(ShellTest, PictureToImageSync) {
39593955
ShellTestPlatformView::BackendType::kGLBackend //
39603956
);
39613957

3962-
AddNativeCallback("NativeOnBeforeToImageSync",
3963-
CREATE_NATIVE_ENTRY([&](auto args) {
3964-
// nop
3965-
}));
3966-
39673958
fml::CountDownLatch latch(2);
39683959
AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY([&](auto args) {
39693960
// Teardown and set up rasterizer again.
@@ -4033,58 +4024,6 @@ TEST_F(ShellTest, PictureToImageSyncImpellerNoSurface) {
40334024
DestroyShell(std::move(shell));
40344025
}
40354026

4036-
#if SHELL_ENABLE_GL
4037-
// This test uses the GL backend and refers to symbols in egl.h
4038-
TEST_F(ShellTest, PictureToImageSyncWithTrampledContext) {
4039-
// make it easier to trample the GL context by running on a single task
4040-
// runner.
4041-
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
4042-
ThreadHost::Type::Platform);
4043-
auto task_runner = thread_host.platform_thread->GetTaskRunner();
4044-
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
4045-
task_runner);
4046-
4047-
auto settings = CreateSettingsForFixture();
4048-
std::unique_ptr<Shell> shell =
4049-
CreateShell(settings, //
4050-
task_runners, //
4051-
false, //
4052-
nullptr, //
4053-
false, //
4054-
ShellTestPlatformView::BackendType::kGLBackend //
4055-
);
4056-
4057-
AddNativeCallback(
4058-
"NativeOnBeforeToImageSync", CREATE_NATIVE_ENTRY([&](auto args) {
4059-
// Trample the GL context. If the rasterizer fails
4060-
// to make the right one current again, test will
4061-
// fail.
4062-
::eglMakeCurrent(::eglGetCurrentDisplay(), NULL, NULL, NULL);
4063-
}));
4064-
4065-
fml::CountDownLatch latch(2);
4066-
AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY([&](auto args) {
4067-
// Teardown and set up rasterizer again.
4068-
PlatformViewNotifyDestroyed(shell.get());
4069-
PlatformViewNotifyCreated(shell.get());
4070-
latch.CountDown();
4071-
}));
4072-
4073-
ASSERT_NE(shell, nullptr);
4074-
ASSERT_TRUE(shell->IsSetup());
4075-
auto configuration = RunConfiguration::InferFromSettings(settings);
4076-
PlatformViewNotifyCreated(shell.get());
4077-
configuration.SetEntrypoint("toImageSync");
4078-
RunEngine(shell.get(), std::move(configuration));
4079-
PumpOneFrame(shell.get());
4080-
4081-
latch.Wait();
4082-
4083-
PlatformViewNotifyDestroyed(shell.get());
4084-
DestroyShell(std::move(shell), task_runners);
4085-
}
4086-
#endif // SHELL_ENABLE_GL
4087-
40884027
TEST_F(ShellTest, PluginUtilitiesCallbackHandleErrorHandling) {
40894028
auto settings = CreateSettingsForFixture();
40904029
std::unique_ptr<Shell> shell =

0 commit comments

Comments
 (0)