You shouldn't have surfaces with the same Z order value. The window manager makes sure of this. What are you doing to get in a situation where two surfaces get assigned the same Z order?
On Tue, Jun 19, 2012 at 10:23 AM, Inan Top <[email protected]> wrote: > Hi all, > > I've been trying to track down a rendering issue in our application, > and I'm considering z-fighting as a potential root cause. I've tracked > the z-ordering logic from SurfaceFlinger.h down to LayerBase.cpp. Here > are my findings, please correct me if I'm wrong: > > SurfaceFlinger.h composites the layers in z-order, which is determined > by the ViewParent classes. In the case that two elements have the same > z-value their *sequence* is used as the comparison for ordering > purposes. Sequence appears to be an attempt at a UID for each > LayerBase instance. > > Sequence is initialized to an incremented sSequence, which is a static > member of the LayerBase class. This guarantees that no two instances > of LayerBase begin with the same sequence. So far so good. > > However each of the transformation operations within LayerBase, i.e. > setAlpha, setPosition, etc. increment this sequence value. This means > (as far as I understand) that I can create two LayerBase objects A and > B, with sequence 1 and 2 respectively to begin with, and then do some > sort of transformation onto A causing it to increment its sequence to > 2 also. > > This could potentially result in a situation where A and B share the > same z-order AND the same sequence, in which case ordering is not sane > and z-fighting issues can occur. > > Am I correct in that assessment or am I completely misunderstanding > this system? I'm completely new to Android so don't worry about > hurting my feelings if I'm completely wrong. > > -- > unsubscribe: [email protected] > website: http://groups.google.com/group/android-porting > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting
