Commit Graph

122 Commits

Author SHA1 Message Date
Naseer Ahmed
76e313c901 hwc: Disable mixed mode composition for secure videos
Also make sure layer cache is used correctly when
we're not using MDP composition

Bug: 7643563
Change-Id: I4dcd70c2da128b2dcbe0b72dc14031983649719d
Signed-off-by: Iliyan Malchev <malchev@google.com>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
2012-12-03 15:35:44 -05:00
Naseer Ahmed
768619ecdf libgralloc: Discontinue allocating FB buffers from carveout.
Don't allocate primary framebuffer from carveout.
Allocate them from IOMMU heap just like the external framebuffer.

Bug: 7626586
Change-Id: I52a8db1a34d19856302b38d2c30c1290d1f2f060
Signed-off-by: Saurabh Shah <saurshah@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-12-03 15:35:26 -05:00
Naseer Ahmed
54821fe3a2 libhwcomposer: Add support for 4 layer MDP Comp
This change extends MDP composition to support
upto 4 layers by making border fill as base pipe and
using all MDP h/w pipes in overlay mode.

Conflicts:

	libhwcomposer/hwc.cpp
	libhwcomposer/hwc_utils.cpp
	libhwcomposer/hwc_utils.h

Bug: 7626586
Change-Id: I01a0e53ddfbcf3ed46734f6f3bb0ef7d912ceac6
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-12-03 15:34:07 -05:00
Naseer Ahmed
758bfc5b50 hwc/overlay: Dynamic pipe tracking.
Remove state based pipe handling and make pipes tracked dynamically.
Add the configStart, configDone, nextPipe availablePipes APIs.
Remove setState API.

-configStart marks all pipes available.
-configDone garbage-collects unused pipe objects.
-nextPipe returns the index of next available pipe and create a corresponding
pipe object if not present
-availablePipes returns total of "unallocated" pipes. (Pipes could be allocated
but unused)

Changes in hwc adapt to the new overlay APIs.
Compile out MDP comp.
Remove unused files in overlay and hwc.
Update licenses.

Conflicts:

	libhwcomposer/hwc.cpp
	libhwcomposer/hwc_utils.cpp

Bug: 7626586
Change-Id: Id8e56901d34e5dc0fd088260d05e3e46f68ff090
Signed-off-by: Saurabh Shah <saurshah@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-12-03 15:33:29 -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
b1c7632ec5 hwc: cache layers on framebuffer
In the cases where all the layers that are marked as HWC_FRAMEBUFFER did not
change, we can mark them as HWC_OVERLAY since their contents are already on the
framebuffer and do not need any additional processing.

This optimization shows power improvement for video playback.

Bug: 7623741
Change-Id: Ia178a926e6f56a3ec9291250a22a66f212c30b14
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-12-03 15:32:29 -05:00
Saurabh Shah
09549f6d75 display: Add support for flip operation in MDP comp
This change adds support for flip operation during MDP composition. This
enables frames to get MDP composited during 270 degree orientation too (with
pre rotation doing 90 degree rotation) or even with layers with just h flip or
v flip.

Bug: 7435860
Change-Id: I7fd18226d8337b2cd9341d709c2bd030eff881f7
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-12-03 15:32:19 -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
c21013b084 overlay: Compile MDSS rotator even when headers not present
Change-Id: Ifc74531b6d73ab5d752441d1a0e7d3b0d0d658e0
(cherry picked from commit e76f183710272f02149e003357107c85bc74914b)
2012-11-19 12:44:41 -05:00
Anh Nguyen
4844e43e0f Merge remote-tracking branch 'remotes/quic/partner-android/jb-mr1-dev' into mybranch
* remotes/quic/partner-android/jb-mr1-dev:
  chmod uga-x
2012-11-09 16:21:44 -08:00
Iliyan Malchev
2edd033225 chmod uga-x
find -type f -perm +111 -name \*.[ch]\* -exec chmod uga-x {} \;

Bug: 7428209
Change-Id: I3ae3c236f5b0bfcca57b57ea67e279fac79d02d0
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-27 14:21:12 -07:00
Shruthi Krishna
fea70fc821 Merge remote-tracking branch 'remotes/quic/partner-android/jb-mr1-dev' into HEAD
* remotes/quic/partner-android/jb-mr1-dev: (27 commits)
  hwc: Open sysfs node when thread is initialized.
  hwc: Return failure code if hwc_set fails to draw
  hwc: Create releaseFd even if no HWC layers
  hwc: clean up overlay for external from the draw thread only
  HWC: Protect hwc_set from async events
  hwc: external: Add screen-fitting to external panel.
  hwc: add some logging
  hwc: utils: Include orientation while screen-fitting.
  overlay: mdprot: Call rotator start only on config change.
  hwc: fix for not ignoring framebuffer
  hwc: don't open sysfs on every iteration
  hwc/overlay: Add premultiplied alpha support.
  hwc: external: Cleanup overlay objects on external disconnect.
  display/libhwcomposer: fix potential memory leak
  hwc: more error checks
  hwc: Remove call to glFinish
  hwc: Skip secure buffers in non secure mode
  hwc: move enable disable ioctls to vsync thread
  hwc: fix some race conditions
  don't call vsync-ctrl ioctl for same enable value
  ...
2012-10-18 14:35:47 -07: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
Saurabh Shah
eaf679142b hwc: Return failure code if hwc_set fails to draw
Check for errors while drawing the layers in hwc_set.

Return -1 in the error case so that framework doesn't wait on fences.

Bug: 7284105
Change-Id: I024f9ca07faf64d6b90d4f483164dc15c0d7992c
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-15 16:47:08 -07:00
Kinjal Bhavsar
40a1cc58d2 hwc: Create releaseFd even if no HWC layers
Change-Id: Ic12807d47391d7a48b5db118299aaa3e8b9d8625
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-15 15:25:32 -07:00
Saurabh Shah
1a8cda0b2c hwc: clean up overlay for external from the draw thread only
Cleanup overlay for external from the draw thread. If done from the uevent
thread, its possible that the object being used by draw thread is deleted by
uevent thread.

This also removes unnecessary side-effects where libexternal sets states in
hwc, whereas, it could be set from hwc itself. There should be no need for
libexternal to modify states in hwc.

Bug: 7335863 (partial fix)
Change-Id: If07483e640abae2ced2418e0d5c8f278f8c6ec33
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-15 12:02:33 -07:00
Kinjal Bhavsar
f83d4480f2 HWC: Protect hwc_set from async events
Wait for hwc_set completion if already in progress before processing
the async events.

Bug: 7288769
Change-Id: Ibdd0ee82f079df566b899c94df19f6bb1031d686
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-12 16:15:31 -07:00
Saurabh Shah
541b59d155 hwc: external: Add screen-fitting to external panel.
Screen fitting for out-of-bounds videos (with overlays) exists for primary
panel. Add this same support for external panels, so that GPU won't be needed
in panning use-cases.

Bug: 7313955
Change-Id: I274a821264d87098227b144752f4d0b89d342cd9
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-11 15:46:37 -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
Saurabh Shah
27c1d65113 hwc: utils: Include orientation while screen-fitting.
MDP doesn't like out-of-screen-bounds parameters. So based on the position of
the layer, we adjust the portion of layer the MDP should pick.

However, this did not factor in orientation, so far. This patch does that and
allows panning to work in other orientations, without having to use GPU.

Bug: 7313955
Change-Id: Ice17ad144abcd60279c2ef9ad87fc617a1bd3621
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-10 23:04:28 -07:00
Saurabh Shah
c23b380f5c overlay: mdprot: Call rotator start only on config change.
Call ROTATOR_START ioctl only if the rotator config changes.
Save the last good config when the start succeeds.

Make getSessId()'s return type uint32_t from int to match the member's.
This was causing all methods to think the rotator session id is a negative
invalid number. This ensures ROTATOR_FINISH is called.

Bug: 7320914
Change-Id: I5ca048ea866316f18d8df14dc08218fca2c82bdf
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-10 13:39:18 -07:00
Saurabh Shah
150806ae0e hwc: fix for not ignoring framebuffer
If the FB is not used, because all the app layers are overlays, then set the
flag to have the driver not fetch from the FB pipe.

Bug: 7183992
Change-Id: I96ecc1610ac052e8512158d189b0614ecf82d139
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-09 18:22:04 -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
91a6a994e8 hwc/overlay: Add premultiplied alpha support.
Add premultiplied alpha belnding support while using MDP for composition.
Layers could have PMA blending which was missing from hwc1.1
This change just handles the PMA case.

Bug: 7301436
Change-Id: I7d83169831b40943b2b595723fefc3a95a177137
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-08 14:49:49 -07:00
Saurabh Shah
e4f3f721b5 hwc: external: Cleanup overlay objects on external disconnect.
Cleanup overlay objects and close fds when external is disconnected.  Without
this, the external does not come on when cable connected-disconnected multiple
times when device is in suspended state.

Bug: 7150885 (part of the fix)
Bug: 7295979
Bug: 7150885 (partial)
Change-Id: I1ae2ce7220b9928dde332ce3644dbe671d25c7e6
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-08 14:08:58 -07:00
Naseer Ahmed
52ca6d2747 display/libhwcomposer: fix potential memory leak
This changes fixes a memory leak, by freeing up the pipe alloc structure
everytime before parsing the current frame.

related-to-bug: 7301196
Change-Id: I23edefca71ec0209291be24ee9d629b4a80f0a25
Acked-by: Jeykumar Sankaran<jsanka@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-08 13:18:40 -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
Saurabh Shah
6d9d168b0a hwc: Remove call to glFinish
It had a glFinish which is not needed anymore on HWC 1.1

Bug: 7274951
Change-Id: I1389802a0ed3f0199d7d7ba0110a343b2f571106
Acked-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-07 17:20:17 -07:00
Naseer Ahmed
cb5f25b58d hwc: Skip secure buffers in non secure mode
Bug: 7283255
Change-Id: Ia4ca0ef4ad4c57deea25c82dfdef009a2c1f82d6
Acked-by: Amara Venkata Mastan Manoj Kumar<manojavm@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-04 16:02:44 -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
Omprakash Dhyade
1ef881ceed don't call vsync-ctrl ioctl for same enable value
Bug: 7274951
Change-Id: Ib21f1ddd623b36a20f195483236ba6cd4bc87c8d
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-03 10:29:12 -07:00
Saurabh Shah
c4d034f4b8 hwc: enable dual display on hwc 1.1
Enable dual display on HWC 1.1; video uses overlay.

Bug: 7124159
Change-Id: I8333e46cfc74072f6259fba2b82368f0dd52b6df
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-02 23:46:58 -07:00
Saurabh Shah
d80a52cbf9 gralloc: Send first 2 FB buffers to carveout and next to IOMMU
Gralloc uses the GRALLOC_USAGE_HW_FB flag to allocate memory from carveout.
This is fine for primary framebuffer, but for external framebuffer we need IOMMU
heap buffers, since the ioctls for external work with those.

Ideally, the primary buffers also need to come from IOMMU heap, which is ongoing
work. This patch allocates the first 2 FB buffer requests (assuming they are for
primary) from carveout and allocates all subsequent buffers from IOMMU heap.

Bug: 7124159
Change-Id: Ie53b2e1e7fcac136acd2d251f39cefe367fc7125
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-02 23:43:31 -07:00
Naseer Ahmed
32aa90fc54 hwc: Use asynchronous commit ioctl for display post
bug: 7274951

Change-Id: I70b2a00d6a2558f533bd87c92038774126434f03
2012-10-02 22:42:22 -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
Naseer Ahmed
68b88cf211 hwc: Handle non secure buffers
When secure mode is on, skip overlay composition for
non secure buffers.

Bug: 7216266
Change-Id: I5fb1f3a26505bb69305e7d359bdb3a020baf193f
Acked-by: Amara Venkata Mastan Manoj Kumar<manojavm@codeaurora.org>
2012-10-02 16:54:14 -07:00
Naseer Ahmed
32ff225e6d hwc: Make blank wait for set to complete
Bug: 7217641
Change-Id: Ie25c9caa7a4c6a256c0f35fc40cbae2ef4572f5d
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-01 22:24:41 -07:00
Saurabh Shah
3825f25827 libexternal: Call new IOCTL to commit on external display
From post() for external call the new ioctl MSMFB_OVERLAY_COMMIT
to update the external display.

The new IOCTL is faster than the default PAN and waits for DMAE to finish before
returning. This fixes tearing.

Bug: 7249589

Acked-by: Arun Kumar K.R <akumarkr@codeaurora.org>
Change-Id: Ic755e634d5f141a567c7d93f39c74bb087cd7044
2012-09-28 13:37:53 -07:00
Naseer Ahmed
aee5e6ecca hwc: Close unused pipes before PAN
If the pipes are closed after PAN a blank screen is
seen when when we transition from MDP composition
to GLES composition.
We close the unused pipes at the beginning of the set
since the decision has already been made in prepare.

Bug: 7188473
Change-Id: I6f946fa3d02f1c84fb2bb8d3b8e5c823c1151fd5
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-27 14:29:53 -07:00
Saurabh Shah
8c8bfd2f82 hwc: Call sync before draw.
Call sync before draw since draw could use rotator which reads out of the
buffer.  For that to happen cleanly, the buffer should not be in use.  Calling
sync before draw makes sure, the buffer is free to be used.

[TEMP]
Enable rotator for external video, since sync-pt is not used for external yet.

Bug: 7227220
Change-Id: I25fec8ecc158e28801f238d2829af4d635f3e2c9
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-27 14:22:52 -07:00
Saurabh Shah
3d2a790a1f hwc: Fix tearing on HDMI. Call glFinish()
When rotator is rotating GPU writes into it causing tearing.  With hwc1.1,
framework doesnt use fbDev, which had a call to glFinish().  Consequently, this
was missed out. Adding this missing code to hwc1.1

Related-to-Bug: 7227220
Change-Id: I7287d3d73b839fef818e31c1c8a783f1fb96d9f1
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-27 14:20:39 -07:00
Naseer Ahmed
6282c95645 hwc: Check for the validity of the fb layer
Need to check if this is valid before doing anything
Extra NULL checks all around to prevent any invalid
lists from SurfaceFlinger

Change-Id: I57ca97167e469910bcaaa68672ae70b41a061ded
2012-09-26 18:18:44 -07:00
Naseer Ahmed
7b80d9c8cb hwc: Fix dpi values reported
HWC 1.1 expects DPI multiplied by 1000

Bug 7241591

Change-Id: I680da8769f53f8a18d942a3b292d96a16885ebfa
2012-09-26 17:43:38 -07:00
Saurabh Shah
86623d7d51 (TEMP) hwc: external: Enable default mirroring on hwc1.1
Related to bug: 7124159

UI Mirror works with tearing because sync operates at primary vsync.  Need
kernel patch to wait on external post.

Change-Id: I77116ef40ae25a2207feb5ca3cd9065ef0da6e4a
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-25 22:55:14 -07:00
Saurabh Shah
3e858ebde3 hwc: hwc 1.1 implementation
Bug: 7124159

--External disabled
--MDP comp coded but disabled.
--Videos via overlay, so that secure videos can work.

Change-Id: Ie48b264143d5e4237ab9724e28930e3f68ba49ee
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-25 22:51:14 -07:00
Naseer Ahmed
52fc4cdb4d hwc: qservice: Pass through binder calls
Pass through binder calls for non qservice calls.

Change-Id: I9cae0d40b8377bda9627fbc3e6f90d5aed1f1e0f
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-25 21:54:19 -07:00
Kinjal Bhavsar
2dd04a873b hwc: sync-point implementation.
Add sync pt implementation.
Add genlock and sync pt under conditional compilation flags.

Change-Id: I32fb7f6051ccc706662152e90ac15b6b6743f897
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-21 17:18:44 -07:00
Kinjal Bhavsar
0a03dd8b11 genlock: conditionally enable genlock from Android.mk for msm8960
Change-Id: I671e227a3b442bc22c53335614832e37324d7cac
2012-09-18 19:32:35 -07:00
Saurabh Shah
35712cb639 hwc: Use overlay for video even during popups.
Continue using overlays for videos even during popup animations.

Change-Id: I6e3b1a2dc3328312f6f1745eded6f18a83fda1cd
2012-09-18 10:49:10 -07:00