Pass onVsync() callbacks from vr flinger back to surface flinger

When vr flinger is active we weren't returning onVsync() callbacks to
surface flinger from vr_hwc, which caused surface flinger frame
scheduling to drift with respect to display vsync, causing system
latency and performance to be less predictable than expected. Since
actual display vsync periods are usually slightly different than the
reported vsync period from hardware composer, the lack of vsync feedback
would also cause surface flinger to occasionally either miss a frame or
produce an extra frame during a vsync period.

This CL adds a new vsync service in vr flinger. Vr_hwc registers to
receive vsync callbacks from that service, and it forwards the vsync
events on to surface flinger. I confirmed using systrace this fixes the
scheduling drift in surface flinger.

I also removed the old PDX vsync service, which exposed obsolete
information and is no longer used anywhere.

The DispSync code in surface flinger needed to be updated as
well. DispSync uses the hardware composer present fence timestamps to
make vsync predictions, and when the present fence-based prediction
is close enough to the actual vsync times, it turns off the vysnc
callbacks. However the present fences returned from vr_hwc are not
correlated in any way to vsync times, so I changed the code to ignore
present fences when vr flinger is active.

Bug: 72890037

Test: - Used systrace to confirm surface flinger scheduling no longer
drifts with respect to the real vsync.

- Added new traces to confirm the vsync callbacks don't take a lot of
  cpu time.

- Confirmed that hardware vsync events in surface flinger are turned off
  when DispSync's predictions align with the present fence timestamp, as
  was previously the case.

- Confirmed hardware vsync events in surface flinger are turned off when
  the display is turned off.

- Confirmed that hardware vsync events are turned off as normal even
  when the zero phase tracer is turned on in DispSync.cpp.

- Confirmed that when we enter vr flinger, we turn usage of the present
  fence off in DispSync, and when we exit vr flinger, we turn usage of
  the present fence back on.

- Confirmed that I can't bind to the new vsync service from a normal
  Android application, and system processes (other than vr_hwc) are
  prevented from connecting by selinux.

- All tests mentioned above were done on a Pixel 2 (non-XL).

Change-Id: Ie009040e125f4d31958a1575b2e2bbe3e601a0f4
23 files changed