Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd11bd59 authored by Hendrik Wagenaar's avatar Hendrik Wagenaar
Browse files

Discard invisible surfaces

* Jiwen found that we would try to post invisible layers, and this
  would cause a hang.
* Check to see if the surface is invisible, and if so, discard it

Test: Manually tested with particles
Change-Id: Id4a0813cb30bd48c3cfa4d13dcee59fcb5f58a8d
parent 2572bd4f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -381,6 +381,15 @@ void DisplaySurface::OnPostConsumer(
  ATRACE_NAME("DisplaySurface::OnPostConsumer");
  std::lock_guard<std::mutex> autolock(lock_);

  if (!IsVisible()) {
    ALOGD_IF(TRACE,
             "DisplaySurface::OnPostConsumer: Discarding buffer_id=%d on "
             "invisible surface.",
             consumer->id());
    consumer->Discard();
    return;
  }

  if (posted_buffers_.IsFull()) {
    ALOGE("Error: posted buffers full, overwriting");
    posted_buffers_.PopBack();