From 56a0b9ac6a951053e283cf42e245a48d28d2624c Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 4 Dec 2017 16:06:13 -0800 Subject: Avoid unnecessary calls to updateTransformHint It was observed that this could start to take noticeable time with high layer counts, I guess due to the acquisition of one mutex per layer per call. Anyway it looks like there's no need to call it if a display transaction didn't occur. Test: Existing tests pass. Change-Id: I1918d326a6d0ed32a0a5fea4008a746d328b335d --- services/surfaceflinger/SurfaceFlinger.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 142892e874..03a9df762b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2338,16 +2338,19 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) } } } - if (disp == NULL) { - // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to - // redraw after transform hint changes. See bug 8508397. - - // could be null when this layer is using a layerStack - // that is not visible on any display. Also can occur at - // screen off/on times. - disp = getDefaultDisplayDeviceLocked(); + + if (transactionFlags & eDisplayTransactionNeeded) { + if (disp == NULL) { + // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to + // redraw after transform hint changes. See bug 8508397. + + // could be null when this layer is using a layerStack + // that is not visible on any display. Also can occur at + // screen off/on times. + disp = getDefaultDisplayDeviceLocked(); + } + layer->updateTransformHint(disp); } - layer->updateTransformHint(disp); first = false; }); @@ -4613,4 +4616,4 @@ void SurfaceFlinger::traverseLayersInDisplay(const sp& hw, #if defined(__gl2_h_) #error "don't include gl2/gl2.h in this file" -#endif \ No newline at end of file +#endif -- cgit v1.2.3-59-g8ed1b