Commit Graph

22 Commits

Author SHA1 Message Date
Mathias Agopian
8630320433 split HWComposer out of DisplayHardware
we will only ever have a single instance of HWComposer, so
it's now an attribute of SurfaceFlinger, instead of being part
of DisplayHardware.

DisplayHardware now just represents a "display" (it should be renamed).

Change-Id: Iec191e57686868e1df6daa8b880a286c9fefde56
2012-07-24 22:49:49 -07:00
Mathias Agopian
921e6ac4b7 SurfaceFlinger cleanup
mostly refactored SurfaceFlinger.h, but also removed dead code.
cleaned-up a few includes as well.

Change-Id: Ib15f4ffe567912b61ee98aa076c6a283b72811b5
2012-07-24 00:09:35 -07:00
Mathias Agopian
1b03149f35 get rid of GraphicPlane
its functionality is now folded into DisplayHardware
there will be more changes in that area.
2012-06-28 17:27:19 -07:00
Mathias Agopian
7d88647473 SF could get stuck waiting for vsync when turning the screen off
When turning the screen off we could have 2 waiters on the
vsync condition: The main vsync waiter as well as one in
onScreenReleased(). We were only signaling the condition though,
so it it would be possible to wake onScreenReleased() without waking
the main vsync thread which would then be stuck in .wait().

We fix this by just using broadcast() when receiving a vsync event.

We also add a broadcast() to signal when the state of
mUseSoftwareVSync changes.  This is important particularly for
the transition from hardware to software vsync because the main
vsync waiter might have observed mUseSoftwareVSync == false
and decided to block indefinitely pending a hardware vsync
signal that will never arrive.

Removed a potentially deadlocking wait for a signal in
onScreenReleased().  The function was trying to wait for the last
vsync event from the hardware to be delivered to clients but there
was no guarantee that another thread would signal it to wake up
again afterwards.  (As far as I can tell, the only other other
thread that might wake it up at this point would be a client
application issuing a vsync request.)  We don't really need to wait
here anyhow.  It's enough to set the mUseSoftwareVSync flag,
wake up the thread loop and go.  If there was a pending vsync
timestamp from the hardware, then the thread loop will grab
it and use it then start software vsync on the next iteration.

Bug: 6672102
Change-Id: I7c6abc23bb021d1dfc94f101bd3ce18e3a81a73e
2012-06-15 14:59:31 -07:00
Mathias Agopian
03e407270c set vsync power hint
Change-Id: I28c2faf9ff584df3e74392712971cbcf75eb9e98
2012-04-26 19:52:22 -07:00
Mathias Agopian
fca660cf73 don't wake-up eventthread every 16ms if there are no vsync requests
Bug: 6332534
Change-Id: Idf79ad913770c6180969f6c95a9b125fff580231
2012-04-12 20:43:16 -07:00
Mathias Agopian
22ffb117b0 make sure to disable VSYNC while screen is off
Change-Id: If1894c43b0a39a2851e1280a35ae77bccd6d9abd
2012-04-11 15:31:40 -07:00
Mathias Agopian
e2c4f4ec23 Added vsync debugging information in dumpsys log
Change-Id: I20ef05a73d89caaf6a70dc9ca25ada6e6a1f6ff9
2012-04-10 21:04:12 -07:00
Mathias Agopian
2965b26022 VSYNC handling cleanup
Change-Id: I1376bf864c4e03c11fb6d1333a8b7cfdda08c9e4
2012-04-08 20:54:47 -07:00
Mathias Agopian
d94d3b890a avoid turning vsync off/on at each frame
always keep vsync active for an extra frame before
deciding if it should be turned off.

Change-Id: I55b03265b7851b33a595e46a013f2ab55e66c964
2012-04-08 15:01:31 -07:00
Mathias Agopian
3eb38cb33e SurfaceFlinger now uses the new VSYNC HAL API.
If h/w composer doesn't support vsync (version < 0.3) we
"fake" it with a timer.

Change-Id: I1e3be79f43c9631d1293ad7d6cf52f9bfc42d65b
2012-04-04 19:01:20 -07:00
Mathias Agopian
cb9732a951 refactor / simplify EventThread
Change-Id: I3981c6fba93b7b985174b2a7045e24db2c0b4428
2012-04-03 18:28:25 -07:00
Mathias Agopian
841cde5554 add more ATRACE
Change-Id: I6cc5759fb0a05427680488fd12ae797e77644f3d
2012-03-01 20:16:39 -08:00
Mathias Agopian
3cf199aef6 fix an issue with vsync event delivery
vsync events were sometimes delivered to connected
client who didn't request them. this happened if
another client requested the delivery and that client
was first in the client list.

also fix the vsync test which didn't request any events as
well as DisplayEventReveiver documentation which was misleading
about the necessity to request vsync events.

Change-Id: Ie990fda3f337f8f0042745c4b2cde67936c45686
2012-01-31 16:42:54 -08:00
Mathias Agopian
8aedd4737d SF now synchronizes to VSYNC
Change-Id: Ic5e4f2ea9927ce133eef9499c03161325e9d02c5
2012-01-30 15:21:23 -08:00
Mathias Agopian
82d7ab6c7e improve SurfaceFlinger dumpsys
It is now possible to say:

dumpsys SurfaceFlinger --latency

to print latency information about all windows

dumpsys SurfaceFlinger --latency window-name

to print the latency stats of the specified window

for instance: dumpsys SurfaceFlinger --latency SurfaceView

The data consists of one line containing global stats, followed by
128 lines of tab separated timestamps in nanosecond.

The first line currently contains the refresh period in nanosecond.
Each 128 following line contains 3 timestamps, of respectively
the app draw time, the vsync timestamp just prior the call to set and
the timestamp of the call to set.

Change-Id: Ib6b6da1d7e2e6ba49c282bdbc0b56a7dc203343a
2012-01-24 18:22:56 -08:00
Mathias Agopian
616c0cdf2c fix a bug with vsync management
this bug was introduced recently. we were signaling *all* clients
regardless of the vsync rate.

Change-Id: I2ae8a6c820a390f602382596ba75e8ed737fb2ef
2012-01-12 16:13:54 -08:00
Mathias Agopian
a72d0db292 Fix an issue with VSYNC
one-shot VSYNC listeners could miss a VSYNC event if
scheduled while in waitForVsync().

Change-Id: I720485784aecfea6cc7a23c77081d7af3c9c71db
2012-01-11 22:03:40 -08:00
Steve Block
a19954ab37 Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
2012-01-04 20:05:49 +00:00
Mathias Agopian
478ae5eb5a Improve the VSYNC api a bit.
- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.

- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.

Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
2011-12-06 22:43:10 -08:00
Mathias Agopian
23748668d3 fix a deadlock when removing a DisplayEventConnection
the deadlock would happen when the pipe became invalid and SF
trying to remove the connection from its list.

we know make sure to process events without holding a lock.

Change-Id: I39927ed8824fc7811e16db3c7608a2ebc72d9642
2011-12-05 19:58:47 -08:00
Mathias Agopian
d0566bc26f Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: Ia720f64d1b950328b47b22c6a86042e481d35f09
2011-11-29 13:10:25 -08:00