Hi,

This is regarding SurfaceFlinger’s performance. If you think I have a
point here please let me know.

I have observed during my Camera application SurfaceFlinger consumes
too much of cpu (>80%).
Tried to know its cause, its found out that it is actually drawing the
“clip” region twice consecutively. By drawing twice I mean, the
coordinates values are same for the 2 clip regions which gets drawn in
sequence.
The “clip” region is calculated from Layer’s visibleRegion and dirty
region. So in this case 2 layers in the currentstate are such that
they are calculating similar clip region.

I tried a hack not to draw the clip twice in
SurfaceFlinger::composeSurfaces() if it has same coordinates value,
before it calls layer->draw(clip) . It worked with no visible side
effects and cpu performance improved. That makes me think that it
might be a bug or scope of improvement in surfaceflinger.

Log showing 2 consecutive Layers calculating same region to draw:

E/SurfaceFlinger(  976): + LayerBuffer 0x3b3920
E/SurfaceFlinger(  976):       z=    21010
D/Region  (  976):   Region visibleRegionScreen (this=0x3b3930,
count=1)
D/Region  (  976):     [ 32,  26, 208, 261]
D/Region  (  976):   Region clipDUMP (this=0x44fa19c4, count=1)
D/Region  (  976):     [ 32,  26, 208, 261]
E/SurfaceFlinger(  976): composeSurfaces layer->draw()
E/SurfaceFlinger(  976): + Layer 0x3e3110
E/SurfaceFlinger(  976):       z=    21015
D/Region  (  976):   Region visibleRegionScreen (this=0x3e3120,
count=1)
D/Region  (  976):     [  0,   0, 240, 320]
D/Region  (  976):   Region clipDUMP (this=0x44fa19c4, count=1)
D/Region  (  976):     [ 32,  26, 208, 261]
E/SurfaceFlinger(  976): composeSurfaces layer->draw()

Any suggestions will be highly appreaciated..

Thanks,
Naruka

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to