sf: avoid lock on main thread during luma calc

The luma calculation operation was previously done while holding
a lock that was also used to protect the request to collect the
next sample. When the main thread would request the next sample,
it could stall waiting on the longer luma calculation to complete.

This patch refactors the sampling request locking mechanisms so
sampling request signalling is protected by one lock, and the members
needed during the sampling thread operations are protected by another
lock.

Fixes: http://b/132110951
Test: collect traces during during problematic animation (agsa
initial query for info) and verify problem went away
Test: visually inspect jank during agsa continued conversation
Test: libgui#RegionSamplingTest
Test: monkey 6000 event inject
Change-Id: I291d6bcb80d0588f2e1f3689bfdd4b3434132e90
2 files changed