Skip to content

Commit

Permalink
[ozone/wayland] rely on implicit sync for Broadcom and Intel GPUs.
Browse files Browse the repository at this point in the history
The issue with fences was identified a long time ago, but it did not
concern Linux before. As long as we use surfaceless drawing and
insert fences between each buffer swap, we noticed some perf
regression.

On a powerful laptop (dell 9560) with Intel 630 graphics, gpu::AsyncSwap
took ~8ms with fences and ~1ms without fences.

On Raspberry Pi3 with Broadcom GPU, swap took ~105ms and
after the applied workaround it took 77ms. The FPS rate
became 16-17FPS instead of 11-12FPS in aquarium webgl demo.

https://docs.google.com/spreadsheets/d/1dKLIQ6dkql-X0ppdc5s5y-ws2hPM-RLgqgGzkFpgUe0/edit?usp=sharing

Bug: 938286
Change-Id: I9fc616976a6ee3f9b4544ad7d8effc41e3ad4a91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1503576
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Robert Kroeger <rjkroege@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638037}
  • Loading branch information
msisov authored and Commit Bot committed Mar 6, 2019
1 parent 8a908bf commit 9624aab
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gpu/config/gpu_driver_bug_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -3183,6 +3183,30 @@
"features": [
"disable_direct_composition_layers"
]
},
{
"id": 295,
"description": "Avoid waiting on a egl fence before swapping buffers and rely on implicit sync on Intel GPUs",
"cr_bugs": [938286],
"os": {
"type": "linux"
},
"gl_vendor": "Intel.*",
"features": [
"rely_on_implicit_sync_for_swap_buffers"
]
},
{
"id": 296,
"description": "Avoid waiting on a egl fence before swapping buffers and rely on implicit sync on Broadcom GPUs",
"cr_bugs": [938286],
"os": {
"type": "linux"
},
"gl_vendor": "Broadcom.*",
"features": [
"rely_on_implicit_sync_for_swap_buffers"
]
}
]
}
10 changes: 10 additions & 0 deletions ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ void GbmSurfacelessWayland::SwapBuffersAsync(
frame->presentation_callback = std::move(presentation_callback);
unsubmitted_frames_.push_back(std::make_unique<PendingFrame>());

if (!use_egl_fence_sync_) {
frame->ready = true;
SubmitFrame();
return;
}

// TODO: the following should be replaced by a per surface flush as it gets
// implemented in GL drivers.
EGLSyncKHR fence = InsertFence(has_implicit_external_sync_);
Expand Down Expand Up @@ -156,6 +162,10 @@ EGLConfig GbmSurfacelessWayland::GetConfig() {
return config_;
}

void GbmSurfacelessWayland::SetRelyOnImplicitSync() {
use_egl_fence_sync_ = false;
}

GbmSurfacelessWayland::~GbmSurfacelessWayland() {
surface_factory_->UnregisterSurface(widget_);
}
Expand Down
2 changes: 2 additions & 0 deletions ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class GbmSurfacelessWayland : public gl::SurfacelessEGL {
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback) override;
EGLConfig GetConfig() override;
void SetRelyOnImplicitSync() override;

private:
~GbmSurfacelessWayland() override;
Expand Down Expand Up @@ -95,6 +96,7 @@ class GbmSurfacelessWayland : public gl::SurfacelessEGL {
std::unique_ptr<PendingFrame> submitted_frame_;
bool has_implicit_external_sync_;
bool last_swap_buffers_result_ = true;
bool use_egl_fence_sync_ = true;

base::WeakPtrFactory<GbmSurfacelessWayland> weak_factory_;

Expand Down

0 comments on commit 9624aab

Please sign in to comment.