Skip to content

Commit ebff771

Browse files
committed
Revert "Move UseGpuVsync out of PassThroughImageTransport"
Reason for revert: see #101 This reverts commit e2f6d5d.
1 parent 4097ae8 commit ebff771

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

gpu/ipc/service/gles2_command_buffer_stub.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include "ui/gfx/switches.h"
4747
#include "ui/gl/gl_bindings.h"
4848
#include "ui/gl/gl_context.h"
49-
#include "ui/gl/gl_features.h"
5049
#include "ui/gl/gl_implementation.h"
5150
#include "ui/gl/gl_surface_egl.h"
5251
#include "ui/gl/gl_switches.h"
@@ -202,9 +201,6 @@ gpu::ContextResult GLES2CommandBufferStub::Initialize(
202201
LOG(ERROR) << "ContextResult::kSurfaceFailure: Failed to create surface.";
203202
return gpu::ContextResult::kSurfaceFailure;
204203
}
205-
if (!features::UseGpuVsync()) {
206-
surface_->SetVSyncEnabled(false);
207-
}
208204
} else
209205
#endif
210206
{

gpu/ipc/service/image_transport_surface_android.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "gpu/command_buffer/service/feature_info.h"
1818
#include "gpu/config/gpu_finch_features.h"
1919
#include "gpu/ipc/common/gpu_surface_lookup.h"
20-
#include "gpu/ipc/service/image_transport_surface_delegate.h"
20+
#include "gpu/ipc/service/pass_through_image_transport_surface.h"
2121
#include "third_party/abseil-cpp/absl/types/variant.h"
2222
#include "ui/gl/android/scoped_a_native_window.h"
2323
#include "ui/gl/gl_surface_egl.h"
@@ -125,7 +125,8 @@ scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeGLSurface(
125125
if (!initialize_success)
126126
return scoped_refptr<gl::GLSurface>();
127127

128-
return surface;
128+
return scoped_refptr<gl::GLSurface>(
129+
new PassThroughImageTransportSurface(delegate, surface.get(), false));
129130
}
130131

131132
} // namespace gpu

gpu/ipc/service/image_transport_surface_fuchsia.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "gpu/ipc/service/image_transport_surface.h"
66

7+
#include "gpu/ipc/service/pass_through_image_transport_surface.h"
78
#include "ui/gl/gl_surface.h"
89
#include "ui/gl/gl_surface_stub.h"
910
#include "ui/gl/init/gl_factory.h"
@@ -29,7 +30,13 @@ scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeGLSurface(
2930
return new gl::GLSurfaceStub;
3031
}
3132

32-
return gl::init::CreateViewGLSurface(display, surface_handle);
33+
scoped_refptr<gl::GLSurface> surface =
34+
gl::init::CreateViewGLSurface(display, surface_handle);
35+
36+
if (!surface)
37+
return surface;
38+
return base::MakeRefCounted<PassThroughImageTransportSurface>(
39+
delegate, surface.get(), false);
3340
}
3441

3542
} // namespace gpu

gpu/ipc/service/pass_through_image_transport_surface.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,15 @@ void PassThroughImageTransportSurface::TrackMultiSurfaceSwap() {
139139

140140
void PassThroughImageTransportSurface::UpdateVSyncEnabled() {
141141
if (is_gpu_vsync_disabled_) {
142+
SetVSyncEnabled(false);
142143
return;
143144
}
144145

146+
bool should_override_vsync = false;
145147
if (is_multi_window_swap_vsync_override_enabled_) {
146-
SetVSyncEnabled(!multiple_surfaces_swapped_);
148+
should_override_vsync = multiple_surfaces_swapped_;
147149
}
150+
SetVSyncEnabled(!should_override_vsync);
148151
}
149152

150153
void PassThroughImageTransportSurface::StartSwapBuffers() {

ui/gl/gl_surface.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,11 @@ scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat(
497497
return surface;
498498
}
499499

500+
scoped_refptr<GLSurface> InitializeGLSurface(scoped_refptr<GLSurface> surface) {
501+
if (!surface->Initialize(GLSurfaceFormat())) {
502+
return nullptr;
503+
}
504+
return surface;
505+
}
506+
500507
} // namespace gl

0 commit comments

Comments
 (0)