Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Issue 2201483002: Improve transition between opaque and translucent compositor views. (Closed)

Created:
4 years, 4 months ago by liberato (no reviews please)
Modified:
3 years, 9 months ago
CC:
aelias_OOO_until_Jul13, boliu, chromium-reviews, Jinsuk Kim, Khushal, klausw, steimel
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve transition between opaque and translucent compositor views. [Re-land after revert] On Android, when we'd like to use a SurfaceView for video playback, we must enable the alpha channel on the CompositorView. Otherwise, we cannot draw a hole to see the video's SurfaceView. We can't keep transparency enabled all the time since it can cause power regressions on some hardware. However, because SurfaceView destroys and recreates the surface when changing the pixel format, there is a visible flash during the transition. This CL removes that. It causes the CompositorView to have two SurfaceView child views, rather than extending SurfaceView directly. When a request is made to switch the output format, it makes the change to the background SurfaceView, and swaps it to the front. It also keeps the outgoing SurfaceView around until the new one is in use by the compositor. There are a few interesting bits: - SurfaceViews are invisible until the first buffer is posted. So, we can continue to see the outgoing view until the compositor is ready to use the new one. - All buffers are released by the outgoing SurfaceView when its visibility is set to Gone. 'dumpsys SurfaceFlinger' shows that the same amount of gralloc memory is used in steady state. - No power regression was observed on a Nexus 5. - Unfortunately, new SurfaceViews are z-ordered behind existing ones, which makes it critical that we guess when to delete the outgoing (topmost) SurfaceView. We currently time one frame, and then hide it. Empirically, this works fine. - This might seem like a more natural extension to CompositorViewHolder, but the CompositorView currently owns the native compositor. Since CompositorViewHolder is already fairly complicated, it wasn't clear that it would be a good idea to refactor that into CVH. Another approach is to use EGL to change the buffer format to include an alpha channel, or not. This avoids the power regression, since opaque surfaces and buffers without alpha channels are treated the same by SurfaceFlinger. However, it causes problems for virtualized contexts. In particular, the off-screen contexts will have an alpha channel at all times, so they cannot be shared with the compositor context without one. For some hardware (e.g., QC) that requires the use of virtualized GL contexts rather than share groups, this may have a stability regression. So, we don't try it. Please see https://goo.gl/aAmQzR for the design doc. BUG=629130 Review-Url: https://codereview.chromium.org/2201483002 Cr-Original-Commit-Position: refs/heads/master@{#456142} Committed: https://chromium.googlesource.com/chromium/src/+/1e87636c63028418b779dadeaadbe4e5f487c76e Review-Url: https://codereview.chromium.org/2201483002 Cr-Commit-Position: refs/heads/master@{#458486} Committed: https://chromium.googlesource.com/chromium/src/+/3fbc8b7641ee4665f400dee3641e7362b581d09a

Patch Set 1 #

Patch Set 2 : started sending background / will draw #

Total comments: 4

Patch Set 3 : switched TRANSPARENT => TRANSLUCENT #

Patch Set 4 : mCurrentView => mForegroundView #

Patch Set 5 : rebased, removed unused var #

Total comments: 8

Patch Set 6 : lowmem => no extra surface #

Patch Set 7 : removed CompositorSurfaceView #

Total comments: 14

Patch Set 8 : refactored #

Patch Set 9 : copyright #

Patch Set 10 : removed redundant guard #

Total comments: 36

Patch Set 11 : cl feedback #

Patch Set 12 : moved 565 logic into CompositorView #

Patch Set 13 : replaced hide logic with one counter #

Total comments: 4

Patch Set 14 : PixelFormat.UNKNOWN and link to the design doc. #

Total comments: 8

Patch Set 15 : started saving old surface format #

Patch Set 16 : rebase (only) #

Total comments: 2

Patch Set 17 : added surfaceCreated #

Patch Set 18 : fixed else #

Patch Set 19 : removed some unused variables #

Patch Set 20 : unit tests #

Total comments: 18

Patch Set 21 : cl feedback #

Total comments: 12

Patch Set 22 : rebased #

Patch Set 23 : fixed tests, rebase fixes. #

Patch Set 24 : rebased #

Patch Set 25 : now without VR-breaking badness #

Messages

Total messages: 109 (36 generated)
liberato (no reviews please)
sievers, watk: it doesn't look like you own any of these files, but i'd value ...
4 years, 3 months ago (2016-08-25 22:31:23 UTC) #4
watk
I'll wait for sievers to comment on the idea before doing a full review, but ...
4 years, 3 months ago (2016-08-25 23:16:09 UTC) #5
liberato (no reviews please)
https://codereview.chromium.org/2201483002/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java (right): https://codereview.chromium.org/2201483002/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java#newcode228 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java:228: setBackgroundColor(Color.WHITE); On 2016/08/25 23:16:09, watk wrote: > I wonder ...
4 years, 3 months ago (2016-08-25 23:35:30 UTC) #6
no sievers
I mainly wanted to understand a little better why we have to do this. For ...
4 years, 3 months ago (2016-08-30 23:01:20 UTC) #7
liberato (no reviews please)
On 2016/08/30 23:01:20, sievers wrote: > I mainly wanted to understand a little better why ...
4 years, 3 months ago (2016-08-31 14:41:30 UTC) #8
liberato (no reviews please)
ps3 fixes a bug -- i accidentally used TRANSPARENT instead of TRANSLUCENT in one spot. ...
4 years, 3 months ago (2016-09-01 16:31:14 UTC) #9
liberato (no reviews please)
@tedc: PTAL. Primary goal is to get rid of the black flash that shows up ...
4 years, 3 months ago (2016-09-06 18:32:59 UTC) #11
Ted C
+aelias, Are you at all familiar with the compositor layout such that you could do ...
4 years, 3 months ago (2016-09-07 23:04:01 UTC) #13
aelias_OOO_until_Jul13
I could, but since sievers@ has already given this some thought and this is due ...
4 years, 3 months ago (2016-09-07 23:19:29 UTC) #14
liberato (no reviews please)
mostly just a rebase. boliu: i forgot to add you to this one. sorry about ...
4 years, 2 months ago (2016-10-05 16:35:52 UTC) #16
boliu
So.. I'm learning all of this for like the first time too \o/ cc khushalsagar ...
4 years, 2 months ago (2016-10-05 18:03:38 UTC) #17
liberato (no reviews please)
thanks for the feedback. replies inline. On 2016/10/05 18:03:38, boliu wrote: > So.. I'm learning ...
4 years, 2 months ago (2016-10-05 19:03:52 UTC) #19
boliu
So from the internal thread, I guess we won't bother with fixing the glitch on ...
4 years, 2 months ago (2016-10-05 22:30:48 UTC) #20
liberato (no reviews please)
On 2016/10/05 22:30:48, boliu wrote: > So from the internal thread, I guess we won't ...
4 years, 2 months ago (2016-10-12 18:57:30 UTC) #21
liberato (no reviews please)
On 2016/10/05 22:30:48, boliu wrote: > So from the internal thread, I guess we won't ...
4 years, 2 months ago (2016-10-12 19:00:07 UTC) #22
liberato (no reviews please)
now with good transitions and no extra memory on low-end devices! thanks -fl https://codereview.chromium.org/2201483002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java File ...
4 years, 2 months ago (2016-10-12 19:00:40 UTC) #23
aelias_OOO_until_Jul13
On 2016/10/12 at 19:00:07, liberato wrote: > It turns out that we can avoid the ...
4 years, 2 months ago (2016-10-12 19:12:34 UTC) #24
liberato (no reviews please)
On 2016/10/12 19:12:34, aelias wrote: > On 2016/10/12 at 19:00:07, liberato wrote: > > It ...
4 years, 2 months ago (2016-10-12 19:59:23 UTC) #25
boliu
Still just replying to comments.. On 2016/10/12 18:57:30, liberato wrote: > On 2016/10/05 22:30:48, boliu ...
4 years, 2 months ago (2016-10-12 21:02:12 UTC) #26
boliu
On 2016/10/12 21:02:12, boliu wrote: > Still just replying to comments.. > > On 2016/10/12 ...
4 years, 2 months ago (2016-10-12 21:03:24 UTC) #27
liberato (no reviews please)
On 2016/10/12 21:03:24, boliu wrote: > On 2016/10/12 21:02:12, boliu wrote: > > Still just ...
4 years, 2 months ago (2016-10-12 21:34:51 UTC) #28
boliu
On 2016/10/12 21:34:51, liberato wrote: > it's an interesting idea. i hadn't considered it. > ...
4 years, 2 months ago (2016-10-12 22:09:42 UTC) #29
liberato (no reviews please)
On 2016/10/12 22:09:42, boliu wrote: > On 2016/10/12 21:34:51, liberato wrote: > > it's an ...
4 years, 2 months ago (2016-10-12 22:20:49 UTC) #30
boliu
Approach is ok. Moving on to actual looking at the code. So I don't actually ...
4 years, 2 months ago (2016-10-12 23:33:35 UTC) #31
Ted C
On 2016/10/12 23:33:35, boliu wrote: > Approach is ok. Moving on to actual looking at ...
4 years, 2 months ago (2016-10-17 19:39:09 UTC) #32
liberato (no reviews please)
On 2016/10/17 19:39:09, Ted C wrote: > On 2016/10/12 23:33:35, boliu wrote: > > Approach ...
4 years, 2 months ago (2016-10-17 20:42:30 UTC) #33
liberato (no reviews please)
i factored out all of the new code from CompositorView, since it made it easier ...
4 years, 1 month ago (2016-11-14 22:12:35 UTC) #34
liberato (no reviews please)
does anybody have any comments on this? methinks we may have deadlocked :) thanks -fl
4 years ago (2016-12-12 22:17:46 UTC) #35
boliu
moving aelias and me to cc, +mdjones for chrome compositor owners fwiw, aelias and I ...
4 years ago (2016-12-12 22:26:17 UTC) #37
liberato (no reviews please)
On 2016/12/12 22:26:17, boliu wrote: > moving aelias and me to cc, +mdjones for chrome ...
3 years, 11 months ago (2017-01-06 16:58:40 UTC) #39
mdjones
lgtm % suggestion https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java (right): https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java#newcode69 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java:69: private int mFramesUntilHide; Will this be ...
3 years, 11 months ago (2017-01-09 18:41:46 UTC) #40
Ted C
SurfaceView is not something I'm in any way familiar with, so I'm commenting more on ...
3 years, 11 months ago (2017-01-10 22:10:26 UTC) #41
liberato (no reviews please)
thanks for the feedback! tedc - there's a WDYT hidden in there somewhere, which i ...
3 years, 11 months ago (2017-01-10 23:39:26 UTC) #42
Ted C
https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode50 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:50: mSurfaceView = new SurfaceView(context); does holding onto a surfaceview ...
3 years, 11 months ago (2017-01-11 17:18:56 UTC) #43
liberato (no reviews please)
https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode50 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:50: mSurfaceView = new SurfaceView(context); On 2017/01/11 17:18:56, Ted C ...
3 years, 11 months ago (2017-01-11 17:52:46 UTC) #44
liberato (no reviews please)
mdjones: i put back mFramesUntilHide, but removed two boolean flags in the process. turns out ...
3 years, 11 months ago (2017-01-11 21:38:50 UTC) #45
aelias_OOO_until_Jul13
https://codereview.chromium.org/2201483002/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode18 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:18: * Manage multiple SurfaceViews for the compositor, so that ...
3 years, 11 months ago (2017-01-12 21:46:06 UTC) #47
liberato (no reviews please)
aelias: thanks for the feedback. tedc: do you prefer the 565 logic moved around as ...
3 years, 11 months ago (2017-01-19 18:12:34 UTC) #49
David Trainor- moved to gerrit
drive by review :D! Just had some questions on overlay mode and a few nits. ...
3 years, 11 months ago (2017-01-19 22:08:22 UTC) #51
liberato (no reviews please)
dtrainor: thanks for the comments! -fl https://codereview.chromium.org/2201483002/diff/260001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/260001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode66 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:66: private SurfaceState mTranslucent; ...
3 years, 11 months ago (2017-01-20 17:50:46 UTC) #52
Ted C
https://codereview.chromium.org/2201483002/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/300001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode306 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:306: state.destroyPending = true; Should we set this in postSurfaceDestruction? ...
3 years, 11 months ago (2017-01-20 21:59:01 UTC) #53
liberato (no reviews please)
the most recent PS aims to make the many different cases more explicit and easier ...
3 years, 11 months ago (2017-01-24 23:25:49 UTC) #54
David Trainor- moved to gerrit
On 2017/01/24 23:25:49, liberato wrote: > the most recent PS aims to make the many ...
3 years, 11 months ago (2017-01-25 18:18:39 UTC) #55
liberato (no reviews please)
On 2017/01/25 18:18:39, David Trainor wrote: > On 2017/01/24 23:25:49, liberato wrote: > > the ...
3 years, 11 months ago (2017-01-25 18:36:52 UTC) #56
Ted C
On 2017/01/25 18:36:52, liberato wrote: > On 2017/01/25 18:18:39, David Trainor wrote: > > On ...
3 years, 10 months ago (2017-01-27 04:19:21 UTC) #57
liberato (no reviews please)
On 2017/01/27 04:19:21, Ted C wrote: > On 2017/01/25 18:36:52, liberato wrote: > > On ...
3 years, 10 months ago (2017-01-27 06:20:46 UTC) #58
liberato (no reviews please)
On 2017/01/27 06:20:46, liberato wrote: > On 2017/01/27 04:19:21, Ted C wrote: > > On ...
3 years, 10 months ago (2017-01-28 00:21:08 UTC) #59
Ted C
a few last questions and then I think this is ok for me https://codereview.chromium.org/2201483002/diff/380001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File ...
3 years, 10 months ago (2017-01-31 23:17:51 UTC) #60
liberato (no reviews please)
https://codereview.chromium.org/2201483002/diff/380001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java (right): https://codereview.chromium.org/2201483002/diff/380001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java#newcode169 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorSurfaceManager.java:169: // Send a notification about any owned surface. Note ...
3 years, 10 months ago (2017-02-01 19:19:48 UTC) #61
liberato (no reviews please)
dtrainor: any concerns about the latest PS? thanks -fl
3 years, 10 months ago (2017-02-03 21:10:38 UTC) #62
Ted C
lgtm ... let's dtrainor@ give one final look though. https://codereview.chromium.org/2201483002/diff/400001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java (right): https://codereview.chromium.org/2201483002/diff/400001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java#newcode339 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java:339: ...
3 years, 10 months ago (2017-02-06 18:44:17 UTC) #63
David Trainor- moved to gerrit
lgtm thanks! https://codereview.chromium.org/2201483002/diff/400001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java File chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java (right): https://codereview.chromium.org/2201483002/diff/400001/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java#newcode88 chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java:88: * native library is properly loaded. Move ...
3 years, 10 months ago (2017-02-07 19:36:16 UTC) #64
liberato (no reviews please)
thanks for the feedback, everybody. sorry for the delay in getting back to this. dtrainor: ...
3 years, 10 months ago (2017-02-14 17:22:25 UTC) #65
David Trainor- moved to gerrit
On 2017/02/14 17:22:25, liberato wrote: > thanks for the feedback, everybody. sorry for the delay ...
3 years, 10 months ago (2017-02-17 17:41:59 UTC) #66
David Trainor- moved to gerrit
On 2017/02/17 17:41:59, David Trainor wrote: > On 2017/02/14 17:22:25, liberato wrote: > > thanks ...
3 years, 10 months ago (2017-02-17 17:42:37 UTC) #67
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201483002/420001
3 years, 10 months ago (2017-02-17 17:49:10 UTC) #70
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/367316)
3 years, 10 months ago (2017-02-17 18:09:54 UTC) #72
liberato (no reviews please)
aelias: PTAL @ compositor_impl_android. thanks -fl
3 years, 10 months ago (2017-02-22 19:13:14 UTC) #73
aelias_OOO_until_Jul13
lgtm
3 years, 10 months ago (2017-02-22 22:29:36 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201483002/420001
3 years, 10 months ago (2017-02-22 22:31:15 UTC) #76
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/237475)
3 years, 10 months ago (2017-02-23 01:11:41 UTC) #78
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201483002/440001
3 years, 9 months ago (2017-03-10 17:41:44 UTC) #85
commit-bot: I haz the power
Failed to apply patch for chrome/android/java_sources.gni: While running git apply --index -p1; error: patch failed: ...
3 years, 9 months ago (2017-03-10 18:31:53 UTC) #87
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201483002/460001
3 years, 9 months ago (2017-03-10 18:42:11 UTC) #90
commit-bot: I haz the power
Committed patchset #24 (id:460001) as https://chromium.googlesource.com/chromium/src/+/1e87636c63028418b779dadeaadbe4e5f487c76e
3 years, 9 months ago (2017-03-10 20:01:30 UTC) #93
klausw
On 2017/03/10 20:01:30, commit-bot: I haz the power wrote: > Committed patchset #24 (id:460001) as ...
3 years, 9 months ago (2017-03-11 01:20:41 UTC) #94
klausw
A revert of this CL (patchset #24 id:460001) has been created in https://codereview.chromium.org/2742133002/ by klausw@chromium.org. ...
3 years, 9 months ago (2017-03-11 01:26:32 UTC) #95
klausw
On 2017/03/11 01:26:32, klausw wrote: > A revert of this CL (patchset #24 id:460001) has ...
3 years, 9 months ago (2017-03-11 01:29:45 UTC) #96
liberato (no reviews please)
Hi folks sorry to re-open this, but I broke VR with the version that i ...
3 years, 9 months ago (2017-03-15 21:19:37 UTC) #98
liberato (no reviews please)
On 2017/03/15 21:19:37, liberato wrote: > Hi folks > > sorry to re-open this, but ...
3 years, 9 months ago (2017-03-20 21:53:09 UTC) #100
David Trainor- moved to gerrit
rubberstamp lgtm
3 years, 9 months ago (2017-03-21 16:30:36 UTC) #101
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201483002/480001
3 years, 9 months ago (2017-03-21 17:06:40 UTC) #106
commit-bot: I haz the power
3 years, 9 months ago (2017-03-21 18:39:19 UTC) #109
Message was sent while issue was closed.
Committed patchset #25 (id:480001) as
https://chromium.googlesource.com/chromium/src/+/3fbc8b7641ee4665f400dee3641e...

Powered by Google App Engine
This is Rietveld 408576698