Skip to content

Commit

Permalink
[display] Disallow simultaneous use of wait events
Browse files Browse the repository at this point in the history
Having multiple images simultaneous wait on the same event requires
defining interactions between different events and resolving race
conditions around events being reset. Synchronization between layers
can be achieved through other parts of the API, and creating/importing
new events isn't particularly expensive, so just disallow simultaneous
use of wait events.

This can be re-examined at a later point if a fence object is added to
fuchsia.

Test: locally modifications to display test
Change-Id: I0464f39165ef5f41fe401a26c4a90b2ef7e9400a
  • Loading branch information
dgstevens authored and CQ bot account: [email protected] committed Oct 12, 2018
1 parent 14c1cd1 commit 6f2e3c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion system/dev/display/display/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,14 @@ void Client::HandleApplyConfig(const fuchsia_display_ControllerApplyConfigReques
}

if (layer->pending_image_) {
auto wait_fence = GetFence(layer->pending_wait_event_id_);
if (wait_fence && wait_fence->InContainer()) {
zxlogf(ERROR, "Tried to wait with a busy event\n");
TearDown();
return;
}
layer_node.layer->pending_image_->PrepareFences(
GetFence(layer->pending_wait_event_id_),
fbl::move(wait_fence),
GetFence(layer->pending_signal_event_id_));
{
fbl::AutoLock lock(controller_->mtx());
Expand Down
3 changes: 2 additions & 1 deletion system/fidl/fuchsia-display/display-controller.fidl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ interface Controller {
// call it on a color layer, or to call it with an image and layer whose
// ImageConfigs do not match. It is illegal to apply a configuration
// with an image layer that has no image (note that is is not illegal to
// validate such a configuration).
// validate such a configuration). It is illegal to reuse a wait event which
// another layer that has not been presented is waiting on.
17: SetLayerImage(uint64 layer_id, uint64 image_id, uint64 wait_event_id, uint64 signal_event_id);

// Attempts to validate the current configuration.
Expand Down

0 comments on commit 6f2e3c4

Please sign in to comment.