OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
6 years agoDon't force client composition when layer color is black and opaque.
Kalyan Kondapally [Sun, 13 Aug 2017 21:31:47 +0000 (14:31 -0700)]
Don't force client composition when layer color is black and opaque.

If no content is available for enabled plane, it defaults to black.
Instead of forcing SurfaceFlinger to blend this together, lets
ignore this.

Jira: None.
Test: No graphics regressions.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we re-validate layers when more than 1 layer has been destroyed.
Kalyan Kondapally [Sun, 13 Aug 2017 20:43:18 +0000 (13:43 -0700)]
Ensure we re-validate layers when more than 1 layer has been destroyed.

Jira: None.
Test: No crash when powering off the device.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRework idle state detection logic.
Kalyan Kondapally [Sun, 13 Aug 2017 20:12:33 +0000 (13:12 -0700)]
Rework idle state detection logic.

With current logic, we have following issues:

1) We go into idle state, any change to time/status bar forces
  us to re-validate layers. Than we force ourselves immediately
  to idle mode and cycle continues.
2) Our threshold is too low forcing us to go to single plane
   composition in some of the offscreen benchmarks.

To address 1:
If we have continuous 5 frames, we reset idle frame counter
to zero. If updates are not continuous, we wait for same
no of frames before increasing idle frame counter.

To address 2:
Increased the threshold to 4000 vblank events of no activity
before assuming we are in idle mode.

Jira: None.
Test: We don't trigger unwanted idle frame updates.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoUse flags instead of bool to track Cursor state.
Kalyan Kondapally [Sun, 13 Aug 2017 20:08:23 +0000 (13:08 -0700)]
Use flags instead of bool to track Cursor state.

Jira: None.
Test: Build passes and we don't invalidate layers when only cursor
      visibility state has changed.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we fall back to GPU Composition when commit fails.
Kalyan Kondapally [Sun, 13 Aug 2017 08:52:07 +0000 (01:52 -0700)]
Ensure we fall back to GPU Composition when commit fails.

If only cursor layer is added and rest of layers remain same, we
add it to current set of planes to be composited. However, if the
test commit fails, we need to render cursor along with last layer
using GPU composition.

Jira: None.
Test: Cursor is visible on screen, even when test commit fails.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support to initialize Overlaylayer from HWCLayer.
Kalyan Kondapally [Sun, 13 Aug 2017 04:25:27 +0000 (21:25 -0700)]
Add support to initialize Overlaylayer from HWCLayer.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont invalidate Cache when cursor plane visibility state has changed.
Kalyan Kondapally [Sun, 13 Aug 2017 09:30:37 +0000 (02:30 -0700)]
Dont invalidate Cache when cursor plane visibility state has changed.

Unless Cursor is GPU rendered, we have it in a separate plane.
There is no need to invalidate caches of all planes, in case only
cursor state has changed and nothing else.

Jira: None.
Test: Check that we dont invalidate cache when cursor becomes invisible/visible
      and all other layers are same.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont use MultiDisplayManager.
Kalyan Kondapally [Thu, 10 Aug 2017 11:08:02 +0000 (04:08 -0700)]
Dont use MultiDisplayManager.

For some unknown reason surface flinger is failing to register
a new display for External ones. We where working around the
problem here which was fine for clone mode but extended mode
didn't work. Thus, remove this work around.

Jira: None.
Test: With changes in SurfaceFlinger, Extended and Cloned mode
      both work.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
6 years agoEnsure we dont set primary as clone for itself.
Kalyan Kondapally [Thu, 10 Aug 2017 09:29:03 +0000 (02:29 -0700)]
Ensure we dont set primary as clone for itself.

We where checking for type of display instead of the handle
to determine if display was primary or not. Type could be
same for primary and external displays. Let's ensure we use
handle to determine if display is primary or not.

Jira: None.
Test: Multi monitor cloned mode still works on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we pick up the first connected display as Primary.
Kalyan Kondapally [Thu, 10 Aug 2017 04:29:18 +0000 (21:29 -0700)]
Ensure we pick up the first connected display as Primary.

We pickup display randomly, instead we should check if it's connected
before choosing it as primary. If no display is connected, we
choose the first in list.

Jira: IAHWC-80
Test: Both displays come up on Android and Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDisable SetCursorPosition usage
Harish Krupo [Wed, 9 Aug 2017 06:11:29 +0000 (11:41 +0530)]
Disable SetCursorPosition usage

According to the spec setting the cursor composition to
device disables the use SetCursorPosition by SurfaceFlinger.
For now we are not using this so inform SurfaceFlinger
about the same

Jira: None
Tests: System doesn't crash when moving the mouse

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoPartial revert of "Clear Surface when display/src rect has changed".
Lattannavar, Sameer [Wed, 9 Aug 2017 05:30:31 +0000 (22:30 -0700)]
Partial revert of "Clear Surface when display/src rect has changed".

Caused performance degration when panning/scrolling.

Jira: None.
Test: No garbage shown when moving virtual display.

Mostly in this case, we are either scrolling or panning.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Lattannavar, Sameer <sameer.lattannavar@intel.com>
6 years agoMove all 3D rendering to a separate thread.
Kalyan Kondapally [Wed, 9 Aug 2017 02:25:04 +0000 (19:25 -0700)]
Move all 3D rendering to a separate thread.

We might have different threads calling Present call. As, we
initialize context first time required, making it current on a
different thread will cause EGL_BAD_ACCESS errors.

Jira: None.
Test: System doesn't hang when using Virtual display (simulated display)
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoAdd lock for mode setters/getters.
Kishore Kadiyala [Mon, 7 Aug 2017 05:52:53 +0000 (22:52 -0700)]
Add lock for mode setters/getters.

We set modes to drmdisplay in a separate thread and query these
values in a separate thread. Let's have a lock to ensure we handle
these operations in a synchronized fashion.

Jira: None.
Test: Boots to home screen without any crashes.
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
6 years agoFix flicker when moving layer position.
Kalyan Kondapally [Sun, 6 Aug 2017 08:29:01 +0000 (01:29 -0700)]
Fix flicker when moving layer position.

We where not saving the calculated surface damage in NativeSurface
but instead the one passed from DisplayQueue. This is not
correct as calculated one in NativeSurface might differ.

Jira: None.
Test: Simulate Secondary Display from Developer options on Android.
      Moving secondary display around should not cause any flicker.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoInsert acquire fences into 3D pipeline as needed.
Kalyan Kondapally [Sun, 6 Aug 2017 07:50:08 +0000 (00:50 -0700)]
Insert acquire fences into 3D pipeline as needed.

When we fallback to 3D composition, we need to wait
for acquire fences to be signalled before reading from
the buffer. Instead of polling let's insert fence into the
3D queue.

Jira: None.
Test: Reduced flickering when launching applications

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRelease surfaces after updating the state of current frame.
Kalyan Kondapally [Sun, 6 Aug 2017 07:20:13 +0000 (00:20 -0700)]
Release surfaces after updating the state of current frame.

We currently release surfaces before setting appropriate state
for current frame. Releasing surfaces after this would ensure
we free surfaces which are freed in the current frame.

Jira: None.
Test: No flicker observed on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack Scissor rect separately in RenderState.
Kalyan Kondapally [Sun, 6 Aug 2017 04:42:18 +0000 (21:42 -0700)]
Track Scissor rect separately in RenderState.

Scissor rect should be clamped to surface damage in case
we are not clearing the surface. Calculate this in render
state seprately and set that as scissor rect when drawing
the layer.

Jira: None.
Test: No rendering artifacts on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoUse SurfaceDamage of layer instead of DisplayFrame Rect.
Kalyan Kondapally [Sun, 6 Aug 2017 04:28:16 +0000 (21:28 -0700)]
Use SurfaceDamage of layer instead of DisplayFrame Rect.

Jira: None.
Test: No graphics regression on Android and Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid creating render states for layers not part of surface damage.
Kalyan Kondapally [Sun, 6 Aug 2017 01:55:51 +0000 (18:55 -0700)]
Avoid creating render states for layers not part of surface damage.

We where rejecting these layers during draw call but we can already
do this during render state calculations.

Jira: None.
Test: No graphics regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont mark display as cloned when type == VirtualDisplay.
Kalyan Kondapally [Sun, 6 Aug 2017 01:25:11 +0000 (18:25 -0700)]
Dont mark display as cloned when type == VirtualDisplay.

Jira: None.
Test: System doesn't hang when selecting secondary display from settings.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove unused variables.
Kalyan Kondapally [Sat, 5 Aug 2017 06:26:26 +0000 (23:26 -0700)]
Remove unused variables.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoUnify cpp flags with rest of stack.
Kalyan Kondapally [Sat, 5 Aug 2017 06:21:12 +0000 (23:21 -0700)]
Unify cpp flags with rest of stack.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix hang during boot up
Harish Krupo [Mon, 31 Jul 2017 16:49:57 +0000 (22:19 +0530)]
Fix hang during boot up

Jira: None
Tests: Boots to home screen.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoPartial revert of 86099e12ed6b94b8f913c715da533a4156dc4dfd
Kalyan Kondapally [Fri, 28 Jul 2017 17:40:30 +0000 (13:40 -0400)]
Partial revert of 86099e12ed6b94b8f913c715da533a4156dc4dfd

Looks like this is causing issues on platforms
like Baytrail.

Jira: https://01.org/jira/browse/AIA-430
Test: Display comes back up when powering back on.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix screen-off problem.
Michael Goffioul [Fri, 28 Jul 2017 16:54:46 +0000 (12:54 -0400)]
Fix screen-off problem.

There's a missing drmModeAtomicCommit call when disabling the display.
This can lead to display freeze when turning the screen back on.

Jira: https://01.org/jira/browse/AIA-430
Test: Display comes back up when powering back on.

Signed-off-by: Michael Goffioul <michael.goffioul@gmail.com>
6 years agoEnsure we release any GL resources before shutting down display.
Kalyan Kondapally [Wed, 26 Jul 2017 21:17:13 +0000 (17:17 -0400)]
Ensure we release any GL resources before shutting down display.

Jira: None.
Test: No regressions found on Android with SKL device.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRename HwcLayer to Hwc2Layer.
Kalyan Kondapally [Tue, 25 Jul 2017 07:08:52 +0000 (03:08 -0400)]
Rename HwcLayer to Hwc2Layer.

This is to avoid confusion between HWCLayer in core/
and in iahwc2.

Jira: None
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove MarkBackBuffersForReUse.
Kalyan Kondapally [Mon, 24 Jul 2017 02:50:35 +0000 (22:50 -0400)]
Remove MarkBackBuffersForReUse.

We might end up re-using buffers for rendering which are being
scanned out. Remove this.

Jira: None.
Test: Flickers are minimized on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix for stack corruption and solve Multi-Mode config enumeration issue.
Poornima [Wed, 26 Jul 2017 09:32:53 +0000 (15:02 +0530)]
Fix for stack corruption and solve Multi-Mode config enumeration issue.

Multi-Mode config enumeration got broken in the commit ID
deb0866. Fixed the same.
Also stack corruption introduced while enabling HWC1.5 is
resolved by reverting usage of local var to store number
of config.

Jira: IAHWC-81
Test: No Stack corruption during HWC init on Android boot-up

Signed-off-by: Poornima <poornima.y.n@intel.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDoing fresh clone for libdrm, mesa and minigbm for Travis CI
nkumarch [Mon, 17 Jul 2017 09:27:51 +0000 (14:57 +0530)]
Doing fresh clone for libdrm, mesa and minigbm for Travis CI

Jira: None.
Test: Travis CI build passes.

Signed-off-by: nkumarch <naveen.kumar.chaudhary@intel.com>
6 years agoComment out hwc-val include for now.
Kalyan Kondapally [Mon, 24 Jul 2017 17:12:15 +0000 (13:12 -0400)]
Comment out hwc-val include for now.

This broke eng builds as the files are not part of the
repo yet.

Jira: None.
Test: Eng build passes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHWC1.5: Skip layer if composition type is HWC_FRAMEBUFFER_TARGET.
Kalyan Kondapally [Sun, 23 Jul 2017 08:05:37 +0000 (04:05 -0400)]
HWC1.5: Skip layer if composition type is HWC_FRAMEBUFFER_TARGET.

From documentation:
" Always set by the caller before calling (*prepare)(), this value
  indicates this layer is the framebuffer surface used as the target of
  OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY
  or HWC_BACKGROUND, then no OpenGL ES composition will be done, and
  this layer should be ignored during set()."

Jira: None.
Test: Check that we dont have garbage rendered when we have only
      one layer which is being scanned out directly on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReplace BOARD_USES_HWC1 with TARGET_USES_HWC2.
Kalyan Kondapally [Sun, 23 Jul 2017 07:26:06 +0000 (03:26 -0400)]
Replace BOARD_USES_HWC1 with TARGET_USES_HWC2.

Jira: None.
Test: Build passes on Android with HWC2 support enabled and disabled.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHWC1.5: Add dummy implementation for setCursorPositionAsync.
Kalyan Kondapally [Sun, 23 Jul 2017 04:48:40 +0000 (00:48 -0400)]
HWC1.5: Add dummy implementation for setCursorPositionAsync.

Jira: None.
Test: Build passes on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHWC1.5: Enable Surface damage support.
Kalyan Kondapally [Sun, 23 Jul 2017 04:19:14 +0000 (00:19 -0400)]
HWC1.5: Enable Surface damage support.

If handle of a given layer remains same over two consecutive Set calls,
we assume surface damage as Null.

Jira: None.
Test: No graphics regressions on Android with HWC 1.5.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove redundant code.
Kalyan Kondapally [Sun, 23 Jul 2017 02:40:13 +0000 (22:40 -0400)]
Remove redundant code.

Jira: None.
Test: Build passes on Android and Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHWC 1.5: Ensure we set overlay composition for layers as supported.
Kalyan Kondapally [Sun, 23 Jul 2017 00:33:06 +0000 (20:33 -0400)]
HWC 1.5: Ensure we set overlay composition for layers as supported.

We should be able to handle all layers except for Background
and Sideband. Let's set that correctly in Prepare.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnable support to opt for Double/tripple buffering.
Kalyan Kondapally [Sat, 22 Jul 2017 23:10:33 +0000 (19:10 -0400)]
Enable support to opt for Double/tripple buffering.

Android M seems to use double buffering while with 2.0 we expect
triple buffering. Also, our linux tests use double buffering.
Let's have an option for systems to define what they use, this
basically changes the way we wait on kms fence i.e. with double
buffering we poll on it once commit has been done.

Jira: None.
Test: No tearing seen with apps on Linux and HWC1.5.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAndroid: Add HWC 1.5 support.
Kalyan Kondapally [Sat, 22 Jul 2017 08:15:44 +0000 (04:15 -0400)]
Android: Add HWC 1.5 support.

We want to enable Android M support but M only supports
version <2.0 HWC. Let's enable support for HWC 1.5.
Support is enabled only if BOARD_USES_HWC1 is set to
true in BoardConfig.

Jira: None.
Test: System boots up to Home screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoInitial patch to enable HWC Validation code
Munish Bhardwaj [Fri, 21 Jul 2017 06:52:04 +0000 (12:22 +0530)]
Initial patch to enable HWC Validation code

This will use HWCService eventually to run the tests.

Jira: IAHWC-78.
Test: Build passes.
Signed-off-by: Munish Bhardwaj <munishx.bhardwaj@intel.com>
6 years agoUpdate the HWC ebuild file to support .so and binary installation.
Fan, Yugang [Wed, 19 Jul 2017 08:36:26 +0000 (16:36 +0800)]
Update the HWC ebuild file to support .so and binary installation.

Latest HWC will install shared lib .so files and testlayers binary
will be generated after the "make install", to align with latest
HWC source, this commit will support .so files and testlayers
installation(not install test json example files).

Jira: None
Tests: Build HWC in Chrome OS SDK with this ebuild file without
       error, and deploy the HWC package to Chrome OS device
       without error, the testlayers can be executed normally
       with the shared the libhwcomposer.so.* installed.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
6 years agoAdded Support to test displayModes related APIs using HWC service
Poornima [Tue, 18 Jul 2017 05:41:31 +0000 (11:11 +0530)]
Added Support to test displayModes related APIs using HWC service

Usage:
/system/bin/hwcmode [displayId <print/get/set <displayconfigindex>>]

Jira: IAHWC-78.
Test: Able to test all the display mode related APIs.

Signed-off-by: poornima.y.n@intel.com
6 years agoFix tearing issue in multi display mode
Harish Krupo [Tue, 18 Jul 2017 07:33:26 +0000 (03:33 -0400)]
Fix tearing issue in multi display mode

Jira: IAHWC-80
Tests: No tearing is observed on all the displays

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoREVERTME: Android: Don't register more than one display for hot plug event.
Kalyan Kondapally [Tue, 18 Jul 2017 07:26:00 +0000 (03:26 -0400)]
REVERTME: Android: Don't register more than one display for hot plug event.

For some reason this is causing tearing during scrolling.

Jira: IAHWC-80
Test: No tearing seen during scrolling.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd Basic DisplayManagement for Android.
Kalyan Kondapally [Tue, 18 Jul 2017 01:21:06 +0000 (21:21 -0400)]
Add Basic DisplayManagement for Android.

This tracks down for displays in extended mode and ensuring we
fall back to cloned mode as needed.

Jira: IAHWC-80
Test: No regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove unneeded break if encoder is found
Harish Krupo [Mon, 17 Jul 2017 16:29:11 +0000 (21:59 +0530)]
Remove unneeded break if encoder is found

When an encoder is found for the first connector, the
variable found_encoder is set to true which then causes
the loop to terminate unnecessarily. This causes only one
connector to be detected at boot time.

Jira: IAHWC-80
Tests: On boot, more than one connected displays are identified.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoAndroid: Enable support for Extended mode.
Kalyan Kondapally [Mon, 17 Jul 2017 01:09:03 +0000 (21:09 -0400)]
Android: Enable support for Extended mode.

There seems to be no definitive way to track extended and cloned
mode here. What we do is if we get a ValidateDisplay request
for a display in cloned mode, we assume we will have a separate
update request for this display and disable the cloned mode.

Jira: IAHWC-80
Test: Extended mode works as expected on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDisable Idle frame tracking for displays in cloned mode.
Kalyan Kondapally [Mon, 17 Jul 2017 01:01:51 +0000 (21:01 -0400)]
Disable Idle frame tracking for displays in cloned mode.

This should be coming from display owning the presentation
of these cloned displays.

Jira: IAHWC-80.
Test: Multiple displays work fine on Android and Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support for clone Mode.
Kalyan Kondapally [Sun, 16 Jul 2017 22:57:32 +0000 (18:57 -0400)]
Add support for clone Mode.

Not sure how to determine if we want to be in extended
or cloned mode in multi montior case. For now we default
to Cloned mode and this will need finetuning when we
have a better understanding of extended mode on Android.
There is a known issue that if external display is not
connected during boot up of Android, than it is never
recognized after that for some reason.

Jira: IAHWC-80
Test: Linux test apps and Android switches to clone mode
      automatically when multiple display are connected.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support for scaling layers.
Kalyan Kondapally [Sun, 16 Jul 2017 18:15:30 +0000 (14:15 -0400)]
Add support for scaling layers.

External display might have a difference resolution compared to
primary and when in clone mode we would need to scale layers to
match the resolution. For now this results in gpu composition of
all layers but in future we could use pipe scalar to scale the
layers.

Jira: IAHWC-80
Test: Linux test apps scale layers automatically when external
      display and primary display resolutions don't match.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Linux builds.
Kalyan Kondapally [Sat, 15 Jul 2017 07:43:16 +0000 (03:43 -0400)]
Fix Linux builds.

Jira: None.
Test: Build passes on Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoInitial plumbing to enable multi display support.
Kalyan Kondapally [Fri, 14 Jul 2017 09:58:24 +0000 (05:58 -0400)]
Initial plumbing to enable multi display support.

Android relies on HotPlug event call back to determine if certain
display is connected or disconnected. Hook this up to notify
Android as and when Display connection status change.

Jira: IAHWC-80
Test: Linux tests work fine in multi monitor case
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd missing license.
Kalyan Kondapally [Sat, 15 Jul 2017 03:39:59 +0000 (23:39 -0400)]
Add missing license.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRename drmhwctwo to iahwc2.
Kalyan Kondapally [Fri, 14 Jul 2017 08:13:46 +0000 (04:13 -0400)]
Rename drmhwctwo to iahwc2.

Jira: None.
Test: Build compiles on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRevert "Rename drmhwctwo to iahwc2."
Kalyan Kondapally [Fri, 14 Jul 2017 08:20:24 +0000 (04:20 -0400)]
Revert "Rename drmhwctwo to iahwc2."

This reverts commit 7315927a01fc6619bd03e25562b3dbe26ddf8e4e.

6 years agoUse flags instead of bool to track state in DisplayQueue.
Kalyan Kondapally [Thu, 13 Jul 2017 23:41:50 +0000 (19:41 -0400)]
Use flags instead of bool to track state in DisplayQueue.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support for other apps to control display during startup.
Kalyan Kondapally [Thu, 13 Jul 2017 22:46:05 +0000 (18:46 -0400)]
Add support for other apps to control display during startup.

On certain platforms, there is a need to give applications
control of display during boot up and ignore updates in hwc

Jira: None.
Test: Boot to home screen with and without hwc.lock present.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRename drmhwctwo to iahwc2.
Kalyan Kondapally [Wed, 12 Jul 2017 22:19:28 +0000 (18:19 -0400)]
Rename drmhwctwo to iahwc2.

Jira: None.
Test: Build compiles on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove redundant z_order variable in drmhwctwo.
Kalyan Kondapally [Wed, 12 Jul 2017 08:13:20 +0000 (04:13 -0400)]
Remove redundant z_order variable in drmhwctwo.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove redundant code.
Kalyan Kondapally [Wed, 12 Jul 2017 07:59:42 +0000 (03:59 -0400)]
Remove redundant code.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoResize viewport when display rect has changed.
Kalyan Kondapally [Tue, 11 Jul 2017 06:54:03 +0000 (02:54 -0400)]
Resize viewport when display rect has changed.

We assumed that display rect of a given surface would never
change. However, this is not true with caching since, we re-use
the same surface and in case of 3D Composition we need to ensure
the viewport is updated to be same as Display frame rect.

Jira: IAHWC-79
Test: When resized to full screen, we don't see any intermediate
      frames with old size.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReplace Mutex with SpinLock
Jeevaka Prabu Badrappan [Fri, 7 Jul 2017 09:21:55 +0000 (14:51 +0530)]
Replace Mutex with SpinLock

Jira: IAHWC-78
Test: Build compiles.
Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan@intel.com>
6 years agoReset continuous frames to 0 when we have idle frame.
Kalyan Kondapally [Mon, 10 Jul 2017 05:57:47 +0000 (01:57 -0400)]
Reset continuous frames to 0 when we have idle frame.

When system is idle, we may still have update coming in every time
system time changes etc. Re-validating layers in this case is
redundant operation, instead let's reset continuous frame counter
to "0" in case we have a idle frame. This will ensure we dont
un-necessarily re-validate layers.

Jira: None.
Test: Check that we dont re-validate layers after going to idle mode
       unless really needed.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRelease GPU Resources after rendering layers.
Kalyan Kondapally [Sun, 9 Jul 2017 22:09:58 +0000 (18:09 -0400)]
Release GPU Resources after rendering layers.

Instead of releasing GPU resources in DisplayQueue, handle it
in Compositor itself.

Jira: None.
Test: SHmem doesn't grow when u launch and close applications.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoClose Buffer handle when we are done using it.
Kalyan Kondapally [Sun, 9 Jul 2017 21:37:16 +0000 (17:37 -0400)]
Close Buffer handle when we are done using it.

Jira: None.
Test: Gralloc handle is closed when NativeBufferHandler is closed.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoSet correct state to layer when we fall back to GPU Composition.
Kalyan Kondapally [Sat, 8 Jul 2017 22:43:00 +0000 (18:43 -0400)]
Set correct state to layer when we fall back to GPU Composition.

We didn't set the correct state for overlay layer in case primary
layer had to go through GPU composition before being shown on
display. This patch fixes this.

Jira: None.
Test: Check that we dont re-validate layers during start up.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReset surface damage when ever layer dimension changes.
Kalyan Kondapally [Sat, 8 Jul 2017 08:45:45 +0000 (04:45 -0400)]
Reset surface damage when ever layer dimension changes.

Instead of complicating surface damage logic, if any layer position
changes let's reset the surface damage and clear the whole surface.

Jira: None.
Test: Check that bluetooth icon don't flicker during update.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoVirtualDisplay: Render layers only if content has changed.
Kalyan Kondapally [Sat, 8 Jul 2017 05:34:00 +0000 (01:34 -0400)]
VirtualDisplay: Render layers only if content has changed.

Currently, we composite layers even though nothing might have
changed, instead lets continue to show previous composition
results in case nothing has changed.

Jira: None.
Test: No rendering artifacts with secondary display enabled

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoIgnore idle refresh when power mode is set to off.
Kalyan Kondapally [Thu, 6 Jul 2017 21:14:02 +0000 (17:14 -0400)]
Ignore idle refresh when power mode is set to off.

Surfaceflinger doesn't expect any updates to happen when system
goes to idle mode as it has already cleared buffer queue in this
case. We might end up calling idle refresh as we detect no
activity for last few frames, to avoid competing with Surface
flinger lets avoid requesting display refresh in case system is
in the process of being powered off.

Jira: None.
Test: From developer options enable secondary display and let system
      go to idle mode. Ensure that system doesnt reboot but we can
      bring it back to active state by moving cursor.

6 years agoExplicitly delete GPU Resources with offscreen rendering.
Kalyan Kondapally [Thu, 6 Jul 2017 19:42:05 +0000 (15:42 -0400)]
Explicitly delete GPU Resources with offscreen rendering.

We could fail offscreen rendering for various reasons, let's make
sure we are doing proper cleanup of GPU resources in this case.

Jira: None.
Test: System doesnt restart itself within 1-5 mins when simulating
      secondary display.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont update VirtualDisplay when powermode state is not kon.
Kalyan Kondapally [Thu, 6 Jul 2017 10:37:16 +0000 (06:37 -0400)]
Dont update VirtualDisplay when powermode state is not kon.

We can be doze mode or off mode. In these cases we should ignore
any update requests in virtual display.

Jira: None.
Test: When going to idle mode, we dont see any EGLContext related
      errors in logcat eventually leading to system reboot.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoClear surface when display/src rect has changed.
Kalyan Kondapally [Thu, 6 Jul 2017 08:46:55 +0000 (04:46 -0400)]
Clear surface when display/src rect has changed.

We track width/height changes as part of surface damage but dont
accurately track position changes causing rendering issues with
cursor. Let's ignore surface damage when position has changed till
we are able to accurately track this.

Jira: None.
Test: Cursor renders fine when GPU composited.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAlign Surfacedamage semantics with Android.
Kalyan Kondapally [Wed, 5 Jul 2017 00:20:47 +0000 (20:20 -0400)]
Align Surfacedamage semantics with Android.

From Android hwc2 documentation:
"Once set through this function, the damage region remains
 the same until a subsequent call to this function."

Let's align to this expectation and lot easier as there
should be no need to update Surfacedamage if it hasn't
changed over frames.

Jira: None.
Test: This is more for API alignment.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont re-validate layes if display/src rects/content attributes have changed.
Kalyan Kondapally [Tue, 4 Jul 2017 16:37:25 +0000 (12:37 -0400)]
Dont re-validate layes if display/src rects/content attributes have changed.

We might be rendering layers using 3D or Display composition. In
case of 3D we don't have to worry re-validating the layers as we
blit them to an offscreen surface before scanning out.

Jira: None.
Test: No graphics regression on Android and Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRelease GPU resources agressively.
Kalyan Kondapally [Tue, 4 Jul 2017 13:53:50 +0000 (09:53 -0400)]
Release GPU resources agressively.

We now track all fb, texture resources and explicitly delete them
when surface is being deleted instead of how we do it today which
is after couple of frames.

Jira: None.
Test: Check that shmem doesn't increase dramatically when moving
      between applications.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRelease unused memory when commit is ignored.
Kalyan Kondapally [Tue, 4 Jul 2017 12:49:06 +0000 (08:49 -0400)]
Release unused memory when commit is ignored.

Let's release any free surfaces when we ignore commits, so we
dont hold on to unnecessary memory.

Jira: None.
Test: Memory doesn't increase when commits are ignored.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTake into consideration previous layer damage.
Kalyan Kondapally [Tue, 4 Jul 2017 11:08:45 +0000 (07:08 -0400)]
Take into consideration previous layer damage.

Jira: None.
Test: When cursor is gpu rendered, one should not see the image
      still in old position when it's being moved around.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoCopy hwc_buffer state when copying buffer.
Kalyan Kondapally [Tue, 4 Jul 2017 10:50:22 +0000 (06:50 -0400)]
Copy hwc_buffer state when copying buffer.

This information is needed to decided if the buffer is to be
released by HWC or not.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack DisplayFrame changes separately.
Kalyan Kondapally [Tue, 4 Jul 2017 09:27:46 +0000 (05:27 -0400)]
Track DisplayFrame changes separately.

This is useful in case of cursor layer and can avoid re-validating
layers when cursor is moved. This can be extended to other
GL composited layers in future.

Jira: None.
Test: Memory doesnt increase when cursor changes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoREVERT [PARTIAL] : Disable invoking of hwc.info service
Kishore Kadiyala [Tue, 4 Jul 2017 04:59:05 +0000 (10:29 +0530)]
REVERT [PARTIAL] : Disable invoking of hwc.info service

In User debug builds, while Joule board boots via ColdBoot or ALT+CTRL+DEL,
it loops in for a while between Android TEXT and Android Animation before
reaching the home screen.
This patch disables invoking of hwc.info service which fixes the issue.

Jira: IAHWC-76
Test: Boot the Joule Board with Power ON/OFF or ALT+CTRL+DEL with
USERDEBUG build

Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
6 years agoFix crash when we connect external monitor after bootup.
Kalyan Kondapally [Tue, 4 Jul 2017 02:08:28 +0000 (22:08 -0400)]
Fix crash when we connect external monitor after bootup.

DisplayQueue may not be initialized in SetPowerMode if display
is not connected. We delay setting power mode until Display
is actually connected.

Jira: None.
Test: Connect external monitor after edp is up and running. Ensure
      system does not crash.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTests: Clip display frame, source rect to resolution.
Kalyan Kondapally [Tue, 4 Jul 2017 00:46:29 +0000 (20:46 -0400)]
Tests: Clip display frame, source rect to resolution.

Jira: None.
Test: Linux tests run on resolutions lesser than what is specified
      in test config files.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHandle HDMI-change notification also.
Kalyan Kondapally [Mon, 3 Jul 2017 23:56:48 +0000 (19:56 -0400)]
Handle HDMI-change notification also.

Jira: None.
Test: Hot plug event notifications are still handled correctly.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoBe more aggressive in releasing used memory.
Kalyan Kondapally [Mon, 3 Jul 2017 20:55:21 +0000 (16:55 -0400)]
Be more aggressive in releasing used memory.

We try to re-cycle surfaces whenever possible and hold on to
surfaces till not needed. This caused ANR on low memory
platforms. We now release memory as soon as it's
free and not needed by any planes being currently used.

Jira: None.
Test: Check memory usage doesnt continue to increase by closing
      and launching application.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove surface damage related things from displayplanestate.
Kalyan Kondapally [Mon, 3 Jul 2017 03:56:33 +0000 (23:56 -0400)]
Remove surface damage related things from displayplanestate.

Each native surface maintains it's own surface damage state.
We can remove this from DisplayPlaneState as no body uses this
information.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRe-render layers which are part of Viewport only.
Kalyan Kondapally [Mon, 3 Jul 2017 04:02:30 +0000 (00:02 -0400)]
Re-render layers which are part of Viewport only.

We accurately maintain viewport to encapsulate all regions
which have actually changed. When surfaces are not cleared,
can can ignore layers which are outside the viewport.

Jira: None.
Test: Check that when time/battery is updated only top layer
      is updated on Android and nothing else.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoPopulate display frame rects only when rendering.
Kalyan Kondapally [Mon, 3 Jul 2017 00:02:58 +0000 (20:02 -0400)]
Populate display frame rects only when rendering.

Most of the time we get away with composition play back, we use
display frame rects only when we need to re-render any thing.
Let's populate display frame rects only in this case.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack if plane surface needs to be cleared via displayplanestate.
Kalyan Kondapally [Sun, 2 Jul 2017 20:14:03 +0000 (16:14 -0400)]
Track if plane surface needs to be cleared via displayplanestate.

Displayplaestate tracks the offscreen targets being used to show
on screen. Let's also track if the offscreen surface needs to be
cleared, so we can avoid unnecessary clear operations.

Jira: None.
Test: No graphics artifacts seen on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove kLayerPositionChanged usage.
Kalyan Kondapally [Sun, 2 Jul 2017 19:46:35 +0000 (15:46 -0400)]
Remove kLayerPositionChanged usage.

This is already covered by content change tracking.

Jira: None.
Test: Popups are still rendered correctly.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRevert "Remove width_ and height_ from displayplanemanager."
Kalyan Kondapally [Sat, 1 Jul 2017 06:15:23 +0000 (02:15 -0400)]
Revert "Remove width_ and height_ from displayplanemanager."

This reverts commit 7e6ae2837645ca07a37f66667ef315cb69c42f41.

6 years agoRevert "Allocate buffers of size we need."
Kalyan Kondapally [Sat, 1 Jul 2017 06:15:00 +0000 (02:15 -0400)]
Revert "Allocate buffers of size we need."

Broke Video when played in fullscreen.

This reverts commit 7ae89ef1018718a24e5d6d9daac11b40c1c41183.

6 years agoIgnore commits in case nothing has changed.
Kalyan Kondapally [Sat, 1 Jul 2017 02:48:38 +0000 (22:48 -0400)]
Ignore commits in case nothing has changed.

Jira: None.
Test: No graphics regressions on Linux and Android.

6 years agoCleanup hwcservice API naming.
Kalyan Kondapally [Fri, 30 Jun 2017 22:36:18 +0000 (18:36 -0400)]
Cleanup hwcservice API naming.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdded libhwcservice - getHwcVersion().
Poornima [Tue, 27 Jun 2017 09:15:23 +0000 (14:45 +0530)]
Added libhwcservice - getHwcVersion().

Basic implementation to check hwc.info service working
Currently added implemenation to get HWC version

Usage:In the device shell, use below command
service call hwc.info 1

Jira: None.
Test: Build passes on Android and able to get HWC info

6 years agoEnsure all layers have a release fence.
Kalyan Kondapally [Fri, 30 Jun 2017 19:48:02 +0000 (15:48 -0400)]
Ensure all layers have a release fence.

It is expected that hwc waits on acquire fence and buffer queue
would wait on release fence of each layer. In case we are just
recycling the buffer, let's reset acquire fence of the layer as
it's release fence.

Jira: None.
Test: No regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRevert "Use kms fence as release fence."
Kalyan Kondapally [Fri, 30 Jun 2017 19:50:30 +0000 (15:50 -0400)]
Revert "Use kms fence as release fence."

We are working around a problem in BufferQueue.

This reverts commit 993387aa93f0eeb717a094ad0afea79595ceb958.

6 years agoUse kms fence as release fence.
Kalyan Kondapally [Fri, 30 Jun 2017 08:45:10 +0000 (04:45 -0400)]
Use kms fence as release fence.

Jira: None.
Test: No regressions on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoClear surface only as needed.
Kalyan Kondapally [Fri, 30 Jun 2017 01:25:04 +0000 (21:25 -0400)]
Clear surface only as needed.

In GLRenderer we always clear the surface, instead we should ask
the surface if this operation is needed.

Jira: None.
Test: No regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoMark backbuffers to be re-used when revalidating cache.
Kalyan Kondapally [Thu, 29 Jun 2017 23:53:45 +0000 (19:53 -0400)]
Mark backbuffers to be re-used when revalidating cache.

This should avoid the situation where we allocate more memory
when backbuffers are available for re-use.

Jira: None.
Test: Check that we dont allocate buffers when things are available
      for re-use.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>