Commit Graph

22 Commits

Author SHA1 Message Date
Praveena Pachipulusu
d9443c7e81 hwc: Use proper typecasts
- Remove compiler warnings
- Use proper typecasts

Change-Id: I7391f32ae31283239f5cebb93b02f3ce3a5c99f3
2014-03-28 09:17:43 +05:30
Naseer Ahmed
3fdb2eb668 hwc: Handle more events from driver
In certain cases, such as the shutdown sequence, the driver may
blank itself without any direction from SurfaceFlinger.
In such cases the HWC should make sure that no further updates on
the display occur.
Handle events from driver in a more generic way to include blank
events and leave room for any other events that need to be polled
on from the driver.

Change-Id: Iabc91a70e71b42d3a7319504ae70b96908acbffe
CRs-fixed: 627814
2014-03-20 10:01:32 -07:00
Arun Kumar K.R
2aa44c66fa hwc: resolve compiler warnings
- remove unused variables.
- fix incorrect castings.

Change-Id: I7661edb4539a3ffc7d4aedbb9f633bc5ba1dc149
2014-02-03 09:20:36 -08:00
Naseer Ahmed
8aface0438 hwc: Empty first read to avoid stale data at boot
When an fd is opened for the first time, poll always succeeds
without a notify from the driver. This gives us invalid data from
the driver, which actually has the right value only when it calls
sysfs_notify. Do a first read for the vsync fds to avoid this.

Change-Id: I47e7bb0a3f91ccb90b1cf36fe5e7d75de1085b62
2013-08-27 14:35:27 -04:00
Jeykumar Sankaran
27dee264f7 display: External display refactor
- cleans up external library
- add separate library for virtual display
- process virtual updates in its separate path
  in hwc.
- Acquire blank mutex lock for one complete drawing
  cycle

Change-Id: Ib984c578464a131ecdb27ee48960f58d68b7a5a7
2013-08-14 13:19:37 -07:00
Naseer Ahmed
e13a60016d hwc: Add support for HDMI vsync
SurfaceFlinger can enable HDMI vsync through event control.
Poll for HDMI vsync events and report them to SurfaceFlinger.

Change-Id: I301f1dffbab56b3b5a3dda5a59c37721688d7849
2013-07-12 12:56:48 -04:00
Naseer Ahmed
8fec5c360f hwc: poll for vsync event
poll on the vsync file descriptor. This prepares the ground for
multiple vsync updates without adding additional threads.

Change-Id: I30ef0fb34816d438501475cd3e4967775fcb1d19
2013-06-13 17:13:30 -07:00
Naseer Ahmed
8bb8f9de3b hwc: Simplify vsync code
Handle the wait properly in the kernel and remove unnecessary
thread signaling.

Change-Id: Iff05825a7a85d0353f3feb64e7f9a06cedab7869
2013-05-13 17:38:26 -04:00
Naseer Ahmed
b19be57c15 hwc: Check vsync state before sending it up
The vsync enable ioctl is called in  a separate thread in a
recent change
Hence it was now possible that vsync could be disabled but
SurfaceFlinger still received a vsync. With this check we make
sure that doesn't happen.

Change-Id: I459c0b98ab9ce972d86a361c5ecdfe0c1a2d0e74
2013-03-20 13:00:21 -07:00
Naseer Ahmed
56601cd508 hwc: Check for correct screen state before enabling vsync
Sometimes vsync would not be disabled before the display is
blanked.
This was due to the vsync disable ioctl being kicked off in a
thread different from the event control which surfaceflinger
called. So, while the calls from surfaceflinger are in order, the
order of execution wasn't always the same. Hence, making sure
ioctls are called in the same context to ensure order.

Also
- Make blanking/unblanking logs show the operation as a string.
- Add a debug property to dump vsync timestamps (needs framework
reboot)
- Remove a log which showed delay in reading vsync. This log was
unreliable when vsync is disabled and we're still reading from
the sysfs node.

Change-Id: Ibec04e9ffebd0ac6e1d32b7031e3668abd9390ff
CRs-fixed: 443113
2013-03-11 15:45:33 -07:00
Naseer Ahmed
24f20059ec hwc: Log if vsync read takes more than 2 expected vsyncs
Change-Id: Id1daffa9d1d3521f42d121634bf5b00757f3609f
2013-02-13 12:45:28 -05:00
Duy Truong
73d36df685 Update copyright to The Linux Foundation
Change-Id: I145b66896159ff9886ed73507f17b3165ba0266d
2013-02-09 20:33:23 -08:00
Naseer Ahmed
92fc1309f0 hwc: Retry vsync on EBUSY
The driver returns EBUSY if it is unable to complete the frame
within a timeout - this is a recoverable error

Change-Id: Ifde01c1d7515598a82d032c0ba869fa658b050a9
2012-12-19 16:00:13 -05:00
Naseer Ahmed
da10c14304 hwc: Add support for faking vsync
Can be set for debugging, valgrind, board bringup etc.
Also - we fail reading the sysfs vsync, we fall back and fake it.

Bug: 7301591
Change-Id: I9509fd7aa8862d5af7d521e29fe32bef9654168c
Signed-off-by: Iliyan Malchev <malchev@google.com>

Conflicts:

	libhwcomposer/hwc_vsync.cpp
2012-12-03 15:33:01 -05:00
Naseer Ahmed
276e9f5146 hwc: dont return from vsync thread when read fails.
Read can return fail when the panel is off.
When read fails do not exit from the vsync thread,
continue with the vsync signal, as later there will
be correct vsync event from the driver

Change-Id: I0f145b93fe5d365eafb6b9e7661160f00f84db40
Acked-by: Arun Kumar K.R<akumarkr@codeaurora.org>
(cherry picked from commit ef93ede83eba15252a5e902981c491bf8ed228cc)
2012-11-19 12:45:39 -05:00
Naseer Ahmed
08212c04d2 hwc: Open sysfs node when thread is initialized.
Earlier, the sysfs node was created in the driver for the
first time in dsi_video_on. This has now been moved to probe
so this node can be opened to the start of the thread.

Bug: 7305728
Change-Id: I01230e4fdc2bddd160ce0d84e153f1f8c179b8df
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-17 18:47:07 -07:00
Iliyan Malchev
0f9c397181 hwc: add some logging
We are seeing errors where a device's hwcVsyncThread is not present for some
reason.  The surface flinger has not crashed, so either the thread never got
created, or it exited withouth throwing an error.  This patch adds some more
verbose on-error logging to the HWC as an attempt to verify the theory that the
thread does not get created, or fails in pthread_create.  While we're at it, we
add the same logging at pthread_create() for hwcUeventThread, as well.

Also, replace the lseek()+read() with a pread() combo in the vsync thread.

Change-Id: I555d786a7d66ff4ef1dbfd95947a7d9341e56f11
related-to-bug: 7305728
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-11 15:45:38 -07:00
Naseer Ahmed
4014777bab hwc: don't open sysfs on every iteration
Also, read again if vsync read is interrupted

Bug: 7305728
Bug: 7274951
Change-Id: I563a4c4cacab8f124ac988ad98640b57a3d09813
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-08 14:55:58 -07:00
Saurabh Shah
ae823e7735 hwc: more error checks
-- numHwLayers==1 means that there is only the FB_TARGET which HWC shouldn't
   draw. Also check for blank in set.  Checking for this in prepare prevents us
   from acquiring pipes.
-- add null check for private handle
-- print out vsync timestamp data on error

bug: 7274417
related-to-bug: 7288769
Change-Id: I8dae0d0748c5226fdc33ed8f5cc5259835dec2de
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-07 17:20:17 -07:00
Naseer Ahmed
c7faa70f4a hwc: move enable disable ioctls to vsync thread
This patch stabilized the vsync signal.

Bug: 7274951
Change-Id: Ieb6396c67d4dfb20cfde39a63a45ab6742d9ec5b
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-04 14:03:41 -07:00
Iliyan Malchev
eac8965bf4 hwc: fix some race conditions
Fix some race conditions between hwc_eventControl and the hwcVsyncThread.

Bug: 7274951
Change-Id: Ic71d65918303b4cef6a379ff5397702b2b578373
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-04 14:03:23 -07:00
Naseer Ahmed
ff4f0254be hwcomposer : Use sysfs to read vysnc information
* Read sysfs entries to get vsync timestamp from kernel.
* External display continues to use uevents for hotplug events
* A new thread, vsyncThread is created to read and send vsync
  timestamps to HAL.
* Disable H/W VSYNC for MDP 5.x targets until kernel changes are
  complete.
* Synchronization is needed to make sure read() is not called
by hwcVsyncThread when VSYNC is disabled.

Change-Id: Iab0a94a3cfce9142b8867859f2a7d9bcaecb0996
Acked-by:  Neti Ravi Kumar <ravineti@codeaurora.org>
2012-10-02 16:54:14 -07:00