OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
7 years agoRemove OverlayBufferManager.
Kalyan Kondapally [Mon, 19 Jun 2017 01:59:01 +0000 (18:59 -0700)]
Remove OverlayBufferManager.

OverlayBuffer lifetime is owned by OverlayLayer. Overlaylayer
now manager the lifetime of buffer and releases it.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRelease surfaces when not in use.
Kalyan Kondapally [Sun, 18 Jun 2017 10:34:54 +0000 (03:34 -0700)]
Release surfaces when not in use.

We held onto surface with an assumption that they might be re-used
in subsequent frames. However, with composition caching we might
never never need them for a while until screen composition has
really changed. Let's release the surfaces which are not in use.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd initial support to query if a separate plane is needed for a layer.
Kalyan Kondapally [Sun, 18 Jun 2017 08:42:35 +0000 (01:42 -0700)]
Add initial support to query if a separate plane is needed for a layer.

In future we would need to force layers on to separate layers,
depending on how frequrently they are updated, if its Media related
etc. This patch adds minimum needed support for now with Video
case.

Jira: None.
Test: Check that Media related layers get a separate plane.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove redundant code related to idle mode.
Kalyan Kondapally [Sun, 18 Jun 2017 07:34:06 +0000 (00:34 -0700)]
Remove redundant code related to idle mode.

Jira: No.
Test: Build passes on Android and Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support to fall back to single plane in idle mode.
Kalyan Kondapally [Sun, 18 Jun 2017 07:11:24 +0000 (00:11 -0700)]
Add support to fall back to single plane in idle mode.

We now register Refresh call back from Surface Flinger to
force a refresh when detect we are not doing any updates
but using more than one plane. We currently have a
threshold of 100 vblank callbacks before doing this. This
no can be made configurable in future. Also, once in
idle mode we wait for 10 continues frame updates before
trying to use planes unless layer validation is triggered
by change in layer compositions of a given frame. This no
can also be made configurable in future.

Jira: None.
Test: Check that we use single plane when we dont have continuous
      updates and when playing Video for example automatically
      switch to multi plane scenario.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont use ScopedSpinLock if not needed.
Kalyan Kondapally [Sun, 18 Jun 2017 07:10:29 +0000 (00:10 -0700)]
Dont use ScopedSpinLock if not needed.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove waits on Acquire Fences.
Kalyan Kondapally [Sat, 17 Jun 2017 11:35:08 +0000 (04:35 -0700)]
Remove waits on Acquire Fences.

Kernel does implicit synchronization for us, we can rely on
that rather than waiting on fences in HWC.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTrack when cursor is GPU Rendered.
Kalyan Kondapally [Wed, 14 Jun 2017 20:04:03 +0000 (13:04 -0700)]
Track when cursor is GPU Rendered.

If cursor is GPU Rendered, than we need to ensure any change
is alpha is taken into account in subsequent frames.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure Media gets a separate plane.
Kalyan Kondapally [Wed, 14 Jun 2017 19:21:24 +0000 (12:21 -0700)]
Ensure Media gets a separate plane.

This will ensure we dont render Media related content due
to any changes to 3D.

Jira: None.
Test: No Graphics regression on Android. Check that Video buffers
      get a separate plane in both full and non full screen cases.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd VirtualDisplay support.
Kalyan Kondapally [Fri, 16 Jun 2017 19:27:39 +0000 (12:27 -0700)]
Add VirtualDisplay support.

Enable Virtual display support using HWC. We no longer depend
on Client composition to handle this.

Jira: None.
Test: Enable Secondary display and see right content in the
      simulated secondary display.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMake it bit more verbose to check FramebufferStatus errors.
Kalyan Kondapally [Fri, 16 Jun 2017 19:23:17 +0000 (12:23 -0700)]
Make it bit more verbose to check FramebufferStatus errors.

I was finding it bit hard to track down why Makecurrent was
failing when virtual display support was enabled. This helped
to have bit more information and track down what is happening.

Jira: None.
Test: Get appropriate error messages when bindframebuffer calls
      failed in logcat.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoLinux: Fix Multiple layers test.
Kalyan Kondapally [Thu, 15 Jun 2017 02:48:27 +0000 (19:48 -0700)]
Linux: Fix Multiple layers test.

We didnt set the surface damage appropriately, causing the demo
to not update the content after first frame.

Jira: None.
Test: Run multiplelayer tests and check that frames are updated
      correctly.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoChange definition place to fix assignment issue
Yugang [Tue, 13 Jun 2017 18:42:09 +0000 (02:42 +0800)]
Change definition place to fix assignment issue

Move layer_parameter definition to outside of for to avoid the
assignment issue which will cause the render init failure.

Jira: None.
Test: Test app works normally without render init issue.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoAdded Test case for MultiMode Display support Usage cmd: ./tests/testlayers --display...
Poornima [Tue, 13 Jun 2017 08:01:37 +0000 (13:31 +0530)]
Added Test case for MultiMode Display support Usage cmd: ./tests/testlayers --displaymode <print/forcemode displayconfigindex>

To get supported display modes
cmd:./tests/testlayers --displaymode print

To test particular display mode (forcemode)
For ex. To test 9th display config, command would be,
./tests/testlayers --displaymode forcemode 9

Jira:IAHWC-34
Tests: Able to set displaymode as per user choice
Signed-off-by: N, Poornima Y <poornima.y.n@intel.com>
7 years agoImplementation of getActiveConfig(),returns the active display mode index.
Poornima [Tue, 13 Jun 2017 07:59:59 +0000 (13:29 +0530)]
Implementation of getActiveConfig(),returns the active display mode index.

Jira:IAHWC-34
Tests: No regression on Android and linux
Signed-off-by: N, Poornima Y <poornima.y.n@intel.com>
7 years agoSupport to set the display Mode Implementation of SetActiveConfig()
Poornima [Tue, 13 Jun 2017 07:57:08 +0000 (13:27 +0530)]
Support to set the display Mode Implementation of SetActiveConfig()

Jira:IAHWC-34
Tests: Android boot up as expected with preferred mode
Signed-off-by: N, Poornima Y <poornima.y.n@intel.com>
Signed-off-by: G, Pallavi <pallavi.g@intel.com>
7 years agoGet All Supported Display Modes
Poornima [Mon, 12 Jun 2017 13:05:02 +0000 (18:35 +0530)]
Get All Supported Display Modes

Implementation of  GetDisplayConfig() and support to get all the
display modes supported.

Jira:IAHWC-34
Tests: No regression on Android and linux
Signed-off-by: N, Poornima Y <poornima.y.n@intel.com>
7 years agoConvert right format when importing buffer.
Kalyan Kondapally [Tue, 13 Jun 2017 07:22:29 +0000 (00:22 -0700)]
Convert right format when importing buffer.

In Overlay Layer we check if format of buffer has changed to
check with Kernel if the format can be supported by hardware.
We where going back to kernel everytime in case of
Video since at this point we didnt handle the format conversion
(we did this when we created egl image for first time). Now, we do
the format conversion and store it while importing the buffer.

Jira: None.
Test: Check that when playing video we dont trigger a full validation
      on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd libhwcservice.
Kalyan Kondapally [Tue, 13 Jun 2017 02:20:04 +0000 (19:20 -0700)]
Add libhwcservice.

This is imported from VPG HWC code base.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure we close all the gem handles.
Kalyan Kondapally [Mon, 12 Jun 2017 18:29:43 +0000 (11:29 -0700)]
Ensure we close all the gem handles.

We create gem handles in our side which need to be closed
when releasing buffer. This was not an issue on Linux as
minigbm takes care of it.

Jira: None.
Test: shmem doesn't grow when switching between apps on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agofix compilation error when BOARD_USES_GRALLOC1 is set
Tapani Pälli [Mon, 12 Jun 2017 11:40:54 +0000 (14:40 +0300)]
fix compilation error when BOARD_USES_GRALLOC1 is set

Jira: None.
Test: Code compiles without errors on Android when
      BOARD_USES_GRALLOC1 is set

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoAndroid: Fix the cursor reorder issue
Poornima [Fri, 9 Jun 2017 10:35:39 +0000 (16:05 +0530)]
Android: Fix the cursor reorder issue

Sometimes cursor layer comes as the lowest zorder and we end up
assigning to the primary plane.
Made a change in PresentDisplay to handle the condition.

Jira: https://jira01.devtools.intel.com/browse/OAM-46186
Tests: Android boots up and issue is not see
Signed-off-by: N, Poornima Y <poornima.y.n@intel.com>
7 years agoCache composition results
Kalyan Kondapally [Mon, 12 Jun 2017 01:27:47 +0000 (18:27 -0700)]
Cache composition results

If no layer attributes and buffer attributes have changed we can
just replay the last frame composition (i.e. ALl layers where
we falled back to 3D). In future we can finetune things based
on surface damage of each layer.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove attribute change calculations to HwcLayer.
Kalyan Kondapally [Mon, 12 Jun 2017 00:03:51 +0000 (17:03 -0700)]
Move attribute change calculations to HwcLayer.

Instead of calculating if attributes like display frame, src rect
changed every frame in OverlayLayer, lets detect any changes in
HwcLayer. This is also helps us detect the case where a layer was
re-created for some reason and will force us to invalidate the
cache in display queue. Buffer related checks are still done
in OverlayLayer.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support for Visible Region.
Kalyan Kondapally [Sun, 11 Jun 2017 22:25:41 +0000 (15:25 -0700)]
Add support for Visible Region.

For now we just use this to track if layer is visible or not.
In future we might use this to determine if previous composition
results can be reused.

Jira: None.
Test: No regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoStore surfacedamage in vector.
Kalyan Kondapally [Sun, 11 Jun 2017 21:50:15 +0000 (14:50 -0700)]
Store surfacedamage in vector.

This would ease up calculating damage rect, visible rect in coming up
patches.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure we dup all fences passed outside HWC.
Kalyan Kondapally [Sun, 11 Jun 2017 05:18:10 +0000 (22:18 -0700)]
Ensure we dup all fences passed outside HWC.

This makes sure we can close our fences independent of the life
time of the client.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoManage NativeFence passed to each plane in DisplayPlane.
Kalyan Kondapally [Sun, 11 Jun 2017 05:00:10 +0000 (22:00 -0700)]
Manage NativeFence passed to each plane in DisplayPlane.

We pass fence retrieved from 3D driver to kernel to ensure those
are signalled before scanning out the buffer for plane. We manage
these fences in NativeSurface and can close them if we need to
handle 3D composition for next frame. Lets dup the fence and
ensure it's open till the plane is updated next time.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoInitial support for Gralloc1.0
Kalyan Kondapally [Fri, 9 Jun 2017 23:21:01 +0000 (16:21 -0700)]
Initial support for Gralloc1.0

This is not enabled by default yet.

Jira: None.
Test: Build passes on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont go through all layers when checking for cursor layer.
Kalyan Kondapally [Fri, 9 Jun 2017 23:05:13 +0000 (16:05 -0700)]
Dont go through all layers when checking for cursor layer.

Currently, we go through all layers to figure out the cursor layer,
instead we could just use layer_begin and layer_end to detect
this as they should the current valid starting and end position.

Jira: None.
Test: No regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRework handle lifetime.
Kalyan Kondapally [Fri, 9 Jun 2017 22:14:51 +0000 (15:14 -0700)]
Rework handle lifetime.

We hold on to the handle passed by application which may be
deleted behind the scenes. Lets clone the handle in our side
and delete it when no more needed to ensure we always have
valid handle till we are using it.

Jira: None.
Test: Linux apps still work and no regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove NativeFence and ScopedFD usage.
Kalyan Kondapally [Sun, 4 Jun 2017 10:41:59 +0000 (03:41 -0700)]
Remove NativeFence and ScopedFD usage.

These are used only in OverlayLayer and HWCLayer. We could manage
the ownership of fd within these structs itself instead of having
to depend on NativeFence and ScopedFD. This is unnecessary
indirection and can be removed.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove NativeSync.
Kalyan Kondapally [Sat, 3 Jun 2017 03:43:53 +0000 (20:43 -0700)]
Remove NativeSync.

We dont use this anymore.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse ScopedFD only if needed.
Kalyan Kondapally [Mon, 8 May 2017 01:30:47 +0000 (18:30 -0700)]
Use ScopedFD only if needed.

In GPUDevice, we open the fd in constructor and only close it
in destructor. Instead of using scopedfd we can manually manage
this.

Jira: None.
Tests: No regression on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse fence as expected by HWC2.0 specification.
Kalyan Kondapally [Sat, 3 Jun 2017 03:41:35 +0000 (20:41 -0700)]
Use fence as expected by HWC2.0 specification.

From https://source.android.com/devices/graphics/implement-hwc:
"In HWC 2.0, release and retire fences are non-speculative.
A release or retire fence retrieved in frame N will signal
as soon as the content of the associated buffers replaces
the contents of the buffers from frame N - 1, or in other
words, the meaning of the fence is "the content of the buffer
you provided for frame N has now replaced the previous content."
This is non-speculative, since this fence should signal shortly
after presentDisplay is called as soon as the hardware presents
this frame's content."

This means we can just use NativeFence for layers also. We dont
have support to get native fence per plane to have per layer
granularity. This also means we can get rid of sw fences.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoREVERTME: Disable idle composition for now.
Kalyan Kondapally [Tue, 30 May 2017 05:29:16 +0000 (22:29 -0700)]
REVERTME: Disable idle composition for now.

This patch disables composition to fall back to single plane when
system is idle instead of using multiple planes. We want to eventually
enable this but this is causing flicker and background disappears
which need to be investigated. However, with the changes we are able
to get rid of an extra thread and hence we can merge the remaining
bits now while fixing the remaining issues.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove KMSFenceHandler.
Kalyan Kondapally [Sun, 28 May 2017 10:08:28 +0000 (03:08 -0700)]
Remove KMSFenceHandler.

We mainly relied on this to signal fences of buffers. Now, we can do this
in HandleIdleCase. Lets remove this as we can get rid of one extra
thread now.

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

7 years agoFall back to single plane composition in Idle case.
Kalyan Kondapally [Sun, 28 May 2017 08:14:12 +0000 (01:14 -0700)]
Fall back to single plane composition in Idle case.

There is no need to continue using different planes for composition
in case the system is not really updating any new content. We now
track this and if we haven't updated content for the previous three
vblanks, we fall back to single plane composition for the current
content on screen.

Jira: None.
Test: Power consumption is minimum in idle case scenarious.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUpdate bo map function for build support of gbm or mingbm.
Yugang [Fri, 26 May 2017 16:06:00 +0000 (00:06 +0800)]
Update bo map function for build support of gbm or mingbm.

Mesa gbm has no plane parameter defined, so add build option
for mesa gbm.

Jira: None.
Tests: Build and run testlayers normally with or without mingbm.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoCall glFinish when explicit fence support is disabled.
Kalyan Kondapally [Sun, 28 May 2017 23:15:35 +0000 (16:15 -0700)]
Call glFinish when explicit fence support is disabled.

When Explicit fence support is disabled, we need to ensure
all rendering is flushed before flip.

Jira: None.
Test: No rendering artifacts on Android with explicit fence disabled.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove eglmakecurrent during initialization.
Kalyan Kondapally [Sun, 28 May 2017 23:12:11 +0000 (16:12 -0700)]
Remove eglmakecurrent during initialization.

There is no need to make current here as context will be made current
during draw.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove VBlankEventHandler to DisplayQueue.
Kalyan Kondapally [Sun, 28 May 2017 07:18:12 +0000 (00:18 -0700)]
Move VBlankEventHandler to DisplayQueue.

This helps in followup patches which enable support for handling
composition during Idletime.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnabling HWC standalone test for Android
Kedar [Mon, 8 May 2017 05:04:25 +0000 (10:34 +0530)]
Enabling HWC standalone test for Android

Jira: None.
Test: Able to compile tests on Android.

Signed-off-by: Kedar <kedar.j.karanje@intel.com>
Signed-off-by: Yogesh <yogesh.marathe@intel.com>
7 years agoMove color correction auto tests to testlayers as a manual test.
Yugang [Mon, 22 May 2017 10:15:36 +0000 (18:15 +0800)]
Move color correction auto tests to testlayers as a manual test.

Deleted igt test lib as the manual test no need compare the CRCs.

Jira: None.
Tests: Run testlayers with tests/jsonconfigs/colorcorrection.json,
       the disolays will show solid Red, Green and Blue rectangles.
       Users can update the gamma value to show different levels of
       gradient RGB colors.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoFix build.
Kalyan Kondapally [Tue, 23 May 2017 16:38:19 +0000 (09:38 -0700)]
Fix build.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix error when initializing virtual display.
Kalyan Kondapally [Mon, 8 May 2017 03:27:42 +0000 (20:27 -0700)]
Fix error when initializing virtual display.

SurfaceFlinger expects SetActiveConfig to pass but we returned
false here.

Jira: None.
Test: Dont see any HWC failures when initializing Virtual Display.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd Travis CI support with packaged depends.
Yugang [Wed, 17 May 2017 17:00:03 +0000 (01:00 +0800)]
Add Travis CI support with packaged depends.

Only build HWC and use Travis docker to build and collect headers
and libs, then Travis will install the headers and libs to CI system,
and do HWC config and build. travisci/travisci.md also hosts the steps
about how to build and collect headers and libs.

Jira: None.
Tests: Enable Travis CI for the branch and check if can process build
       for new commmits.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoEnable Systrace for Android platform
Zhongmin Wu [Mon, 15 May 2017 00:58:15 +0000 (08:58 +0800)]
Enable Systrace for Android platform

For Android platform, we can make CTRACE output the
atrace logs which can be shown in systrace.

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

Signed-off-by: Zhongmin Wu <zhongmin.wu@intel.com>
7 years agoUse NativeBufferHandler for allocating buffers in Tests.
Kalyan Kondapally [Sat, 6 May 2017 06:55:32 +0000 (23:55 -0700)]
Use NativeBufferHandler for allocating buffers in Tests.

This is first step to get tests working on Android.

Jira: None.
Tests: Build passes on Linux and no new regressions.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse int32_t instead of 64 bit for OUT_FENCE_PTR.
Kalyan Kondapally [Sun, 7 May 2017 01:00:31 +0000 (18:00 -0700)]
Use int32_t instead of 64 bit for OUT_FENCE_PTR.

OUT_FENCE_PTR was changed to int32_t with this patch:
https://patchwork.kernel.org/patch/9515719/

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTests: Removed unused code.
Kalyan Kondapally [Sat, 6 May 2017 06:02:10 +0000 (23:02 -0700)]
Tests: Removed unused code.

Jira: None.
Tests: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRevert "HWC: Add spinlock for scopedfd"
Kalyan Kondapally [Mon, 8 May 2017 02:55:01 +0000 (19:55 -0700)]
Revert "HWC: Add spinlock for scopedfd"

Caused performance drop and doesn't seem to be needed
with latest code.

This reverts commit d54cb7e43d34df5b8ca29d827ab3238e9c7fc747.

7 years agoEnable HWC as a shared library instead of static library
Shobhit Kumar [Wed, 22 Mar 2017 08:34:20 +0000 (14:04 +0530)]
Enable HWC as a shared library instead of static library

use ./configure --prefix==$WLD
make
make install

This will install all HWC related headers and shared library in the
default path ($WLD) for use. Alternative for testing you can also do
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./libs if you run test from HWC
base folder

Jira: None
Test: Build and test installtion. All headers and library should be
      installed as per above instructions.
      testlayers -j jsonconfigs/kmscube1layer.json should work

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
7 years agoUpdate Makefile.am to install public header files as well
Shobhit Kumar [Wed, 22 Mar 2017 05:06:43 +0000 (10:36 +0530)]
Update Makefile.am to install public header files as well

These can then be included in target application code

Jira: None
Test: make install should install headers in prefix header path

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
7 years agoDisable build for color autotests if building with gbm
Shobhit Kumar [Fri, 5 May 2017 08:03:30 +0000 (13:33 +0530)]
Disable build for color autotests if building with gbm

This fixes build break when --enable-gbm is used introduced by following
patch -

commit 7f8ab5f7f0e25757aae3237ce1a535a29cb1c810
Author: Yugang, Fan <yugang.fan@intel.com>
Date:   Wed Mar 29 00:52:23 2017 +0800

    Add color correction tests to check gamma color remap

Jira: None
Test: Do build with GBM using ./configure --enable-gbm

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
7 years agoLinux: Remove unused test app.
Kalyan Kondapally [Sat, 6 May 2017 05:45:06 +0000 (22:45 -0700)]
Linux: Remove unused test app.

Jira: None.
Tests: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoParital Revert of SurfaceDamage.
Kalyan Kondapally [Fri, 28 Apr 2017 08:28:08 +0000 (01:28 -0700)]
Parital Revert of SurfaceDamage.

We failed to take into account alpha changes of layers here.
Instead of reverting the whole commit, disabling this optimization
for now.

Jira: IAHWC-51.
Tests: No regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix ownership of ImportedBuffer in NativeSurface.
Kalyan Kondapally [Fri, 28 Apr 2017 04:01:07 +0000 (21:01 -0700)]
Fix ownership of ImportedBuffer in NativeSurface.

OverlayLayer takes ownership of the buffer when ImportedBuffer
assigned to a particular layer. However, we where still tracking
ImportedBuffer in NativeSurface and deleting it. This caused
double deletion issues.

Jira:IAHWC-70
Tests: Linux test multiplelayersnovideo_powermode doesn't crash.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd surface damage support
Pallavi G [Sun, 23 Apr 2017 09:59:53 +0000 (02:59 -0700)]
Add surface damage support

Added the basic support to avoid complete validation
if the given layers are same as previous one.

Jira: IAHWC-51
Test: No regressions with Linux app and Android.

Signed-off-by: Pallavi G <pallavi.g@intel.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSupport DRM_FORMAT_YVU420_ANDROID enum
Tapani Pälli [Tue, 25 Apr 2017 10:00:57 +0000 (13:00 +0300)]
Support DRM_FORMAT_YVU420_ANDROID enum

Support minigbm specific format by switching it to standard
one when importing image.

Jira: None.
Test: Working video playback after minigbm rebase.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoRelease surfaces before disabling pipe in DisplayQueue.
Kalyan Kondapally [Tue, 25 Apr 2017 06:03:01 +0000 (23:03 -0700)]
Release surfaces before disabling pipe in DisplayQueue.

We release all surfaces in DisplayPlaneManager once pipe is
disabled. In DisplayQueue however, we where trying to SetInUse
flag to false after disabling the pipe. Instead, just clear
the in_flight_surfaces before disabling the pipe in
HandleExit Call.

Jira: None.
Test: No crash after resuming system from Doze mode.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd null pointer check
Ragha Khandenahally [Fri, 21 Apr 2017 00:43:43 +0000 (17:43 -0700)]
Add null pointer check

Broadcast RGB properties are not defined for DSI display panel

Jira: AIA-109.
Test: MIPI DSI panel works.
Signed-off-by: Ragha Khandenahally <Ragha.Khandenahally@intel.com>
7 years agoAdd support to toggle Explicit Sync support runtime.
Mingwei Wang [Tue, 25 Apr 2017 01:11:36 +0000 (09:11 +0800)]
Add support to toggle Explicit Sync support runtime.

Jira: None
Test: pass test with AndroidIA and Android Things

Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
7 years agoHot plug event handler modified to reduce cycles consumed
Aravindan M [Fri, 21 Apr 2017 10:21:55 +0000 (15:51 +0530)]
Hot plug event handler modified to reduce cycles consumed

HotPlugEventHandler is in runtime path for all usecases and hence matters for performance.

Moved memset and fd query out of the loop
Reduced buffer size to 256

Test:Device boots to home screen
     Perf bench marks with AIA

Result: Improves performance.

Signed-off-by: Aravindan M <aravindan.muthukumar@intel.com>
Signed-off-by: Yogesh Marathe <yogesh.marathe@intel.com>
7 years agoDont call Compositor related APIS when not falling back to 3D.
Kalyan Kondapally [Mon, 24 Apr 2017 08:02:57 +0000 (01:02 -0700)]
Dont call Compositor related APIS when not falling back to 3D.

These API's dont need to be called when we are not falling back
to 3D composition.

Jira: None.
Test: No regressions on Android and Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDecrease lock wait time in KmsFenceHandler.
Kalyan Kondapally [Mon, 24 Apr 2017 07:18:37 +0000 (00:18 -0700)]
Decrease lock wait time in KmsFenceHandler.

Instead of holding the lock in HandleRoutine, we can make a copy
of the data and release the lock. This ensures we dont wait
unnecesarily in WaitFence.

Jira: None.
Test: Enable Function call trace and check time spent in WaitFence
      and EnsureReadyForNextFrame has decreased.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove DISABLE_EXPLICIT_SYNC usage.
Kalyan Kondapally [Sun, 23 Apr 2017 20:23:34 +0000 (13:23 -0700)]
Remove DISABLE_EXPLICIT_SYNC usage.

Instead lets make this a run time decision, we try to use
Explicit sync support only if OUT_FENCE_PTR is supported.

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

7 years agoRemove usage of DISABLE_OVERLAY_USAGE.
Kalyan Kondapally [Sun, 23 Apr 2017 19:35:14 +0000 (12:35 -0700)]
Remove usage of DISABLE_OVERLAY_USAGE.

Instead lets make this a run time decision, we try to use
Overlays only if OUT_FENCE_PTR is supported.

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

7 years agoCleanup: Remove unused API.
Kalyan Kondapally [Sun, 23 Apr 2017 19:19:37 +0000 (12:19 -0700)]
Cleanup: Remove unused API.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUnRegister Buffers in DisplayQueue.
Kalyan Kondapally [Sun, 23 Apr 2017 05:34:35 +0000 (22:34 -0700)]
UnRegister Buffers in DisplayQueue.

We unregister buffers in KmsFenceHandler Thread, forcing lock to be
held in overlay manager for every API call. Instead, lets release
these buffers by calling DisplayQueue as we can have much finer
control on when we are calling APIS associated with BufferManager
here and remove all the locks in OverlayBufferManager.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCheck for OUT_FENCE_PTR support during runtime.
Kalyan Kondapally [Sun, 23 Apr 2017 04:45:19 +0000 (21:45 -0700)]
Check for OUT_FENCE_PTR support during runtime.

Explicit sync support contains two parts:
1) 3D driver support
2) KMS support.

With this patch we let kms property support queried during run
time rather than having it enabled/disabled by a build option.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove ValidateCachedLayers to DisplayQueue.
Kalyan Kondapally [Sun, 23 Apr 2017 04:37:49 +0000 (21:37 -0700)]
Move ValidateCachedLayers to DisplayQueue.

Simplifies logic in DisplayPlaneManager, now we either query for
cached layers or ask display plane manager to validate layers
based on the initial result.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTrack if layer has changed over frames within OverlayLayer.
Kalyan Kondapally [Sun, 23 Apr 2017 03:48:02 +0000 (20:48 -0700)]
Track if layer has changed over frames within OverlayLayer.

Currently, we check in displayplanemanager if layer attributes
have changed over frames and decide if we can use previous frame
test results. We move all these calculations into overlaylayer
itself and provide API to query if layer attributes, position has
changed compared to previous frame. This helps optimize these
checks when surface damage support is added and also move building
retrieving cached layers from planemanager to display queue in
follow up patch.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoReset inflight surfaces appropriately.
Kalyan Kondapally [Fri, 21 Apr 2017 16:06:57 +0000 (09:06 -0700)]
Reset inflight surfaces appropriately.

When HandleExit is called we should reset state of everything we
keep a track of in DisplayQueue. We missed resetting the state of
in_flight_surfaces_. This patch fixes it.

Jira: None.
Test: No regressions with apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAvoid virtual display error prints
Pallavi G [Fri, 21 Apr 2017 10:30:10 +0000 (16:00 +0530)]
Avoid virtual display error prints

In android we dont compose the virtual display output all the
layers are marked as client and surafceflinger does the composition.
so just return from present display call otherwise we end up with
unnecessary error logs

Jira: None
Test: Able to dump the screenrecord output

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoLet native surface track its buffer.
Kalyan Kondapally [Thu, 20 Apr 2017 06:43:16 +0000 (23:43 -0700)]
Let native surface track its buffer.

Currently, these are tracked by overlaybuffermanager. However, we
dont ever delete these buffers till NativeSurface is destroyed.
Also, this would reduce the look ups everytime a buffer needs
to be destroyed/refcounted.

Jira: None.
Tests: No regressions with Linux test apps and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSquash BeginFrameUpdate into CommitFrame.
Kalyan Kondapally [Thu, 20 Apr 2017 03:41:45 +0000 (20:41 -0700)]
Squash BeginFrameUpdate into CommitFrame.

We where basically setting cursor/Overlay plane to be disabled
in BeginFrameUpdate and nothing else. This can be handled as
part of commit instead of having a separate call.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoThe string comparision must check for zero for equality.
Harish Krupo [Thu, 20 Apr 2017 08:14:32 +0000 (13:44 +0530)]
The string comparision must check for zero for equality.

Jira: AIA-386
Tests: Board boots to home screen.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
Signed-off-by: Yogesh Marathe <yogesh.marathe@intel.com>
7 years agoDo not build PIC code for Android
Terry Heo [Wed, 19 Apr 2017 06:38:00 +0000 (15:38 +0900)]
Do not build PIC code for Android

The recent Android platform doesn't allow to have text relocations.
https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23
To comply the rule, removed "-fPIC, -fPIE" options.
Also added LOG_TAG definition to show module name on Android logcat.

Bug: 37487613
Change-Id: Id5278b2e131d2a635546595ef38f154c238f7c9d

7 years agoRemove wait for each layer used for 3D Composition.
Kalyan Kondapally [Thu, 20 Apr 2017 01:53:44 +0000 (18:53 -0700)]
Remove wait for each layer used for 3D Composition.

In this case, We already pass aquire fence to the kernel which
should ensure all 3D jobs related to the nativesurface are handled
before it's scanned out. Let's remove this extra waits here and
handle it in kernel side.

Jira: IAHWC-69
Tests: No tearing on Linux/Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoStore size of the static buffer in a variable
Harish Krupo [Wed, 19 Apr 2017 17:54:56 +0000 (23:24 +0530)]
Store size of the static buffer in a variable

As the buffer is statically allocated, store the size in a variable.
Also, doing a strlen after memset would always return 0. This also fixes the
over heating issue addressed in the below jira.

Jira: IAHWC-69
Tests: Board should boot to home screen and in idle state temperature should
be between 40 to 50 degrees. check /sys/class/thermal/thermal_zone0/temp for
cpu temperature

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
7 years agoModified the nativesurface handling
Pallavi G [Wed, 12 Apr 2017 09:52:54 +0000 (15:22 +0530)]
Modified the nativesurface handling

Added the release of the nativesurface as part of the display queue.

Jira: None
Test: Android is booting fine and did basic sanity of opening & switching
      mutiple apps

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoUse Poll in EnsureReadyForNextFrame.
Kalyan Kondapally [Mon, 17 Apr 2017 14:33:04 +0000 (07:33 -0700)]
Use Poll in EnsureReadyForNextFrame.

Currently, we check if we are able to acquire lock in this
function and use that to ensure kms_fence has been signalled.
This consumes cpu cycles, instead of that we now use poll on
kms_fence fd from previous commit also here and wait for it
to be signalled before going ahead with a new commit.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove "DOUBLE_BUFFERED" option.
Kalyan Kondapally [Mon, 17 Apr 2017 14:07:00 +0000 (07:07 -0700)]
Remove "DOUBLE_BUFFERED" option.

Seems un-necessary with latest code base.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRename PageFlipEventHandler as VblankEventHandler.
Kalyan Kondapally [Mon, 17 Apr 2017 13:54:11 +0000 (06:54 -0700)]
Rename PageFlipEventHandler as VblankEventHandler.

This missed out in commit f79b6ea.

Jira: None.
Test: Build passes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove SignalBuffersIfReady.
Kalyan Kondapally [Mon, 17 Apr 2017 13:29:53 +0000 (06:29 -0700)]
Remove SignalBuffersIfReady.

This simplifies buffer tracking and ensuring that we dont have a
case where signal might already be signalled for a buffer. This
also ensures we dont accidently write to a buffer while it might
still be reading from it.

Jira: None.
Test: No regressions in benchmarks.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMark pointers const.
Kalyan Kondapally [Mon, 17 Apr 2017 12:44:38 +0000 (05:44 -0700)]
Mark pointers const.

This is to ensure we dont change the memory location pointed to
accidently or manipulate the data when we shouldn't.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCleanup: Remove unused API.
Kalyan Kondapally [Mon, 17 Apr 2017 11:37:00 +0000 (04:37 -0700)]
Cleanup: Remove unused API.

Jira: None.
Test: Builds on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix for the blank shade behind the cursor
Pallavi G [Fri, 7 Apr 2017 05:22:30 +0000 (10:52 +0530)]
Fix for the blank shade behind the cursor

Pushed the cursor plane to the end of the composition planes
submitted for the flip solved the issue.

Regression introduced by the cursor plane 3d fallback fix

Jira: IAHWC-67
Tests: No Shade observed during mouse movement on Android

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoHWC: Add spinlock for scopedfd
Randy Xu [Wed, 5 Apr 2017 03:48:43 +0000 (11:48 +0800)]
HWC: Add spinlock for scopedfd

The fence fd will be accessed/udpated by surfaceflinger main and
binder thread, and race condition may cause binder sessin crash

Test: run 3d gles and vulkan app without tearing
JIRA: https://01.org/jira/browse/AIA-332

Signed-off-by: Randy Xu <randy.xu@intel.com>
7 years agoRevert "Add surface damage support"
Pallavi G [Wed, 5 Apr 2017 10:10:52 +0000 (15:40 +0530)]
Revert "Add surface damage support"

with the HWcursor fix the surfacedamge is not working.
Hang in the Animation itself. Need to debug

This reverts commit 3323f07aa3d70c5bd2910a3fbcbd59e8a17127ce.

7 years agoAdd surface damage support
Pallavi G [Mon, 6 Mar 2017 10:06:16 +0000 (15:36 +0530)]
Add surface damage support

Added the basic support to avoid the complete validate and present
if the given layers are same as previous one.

Jira: IAHWC-51
Test: No regressions with Linux app and on Android

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoFix the cursor handling if the HW cursor is not working
Pallavi G [Tue, 4 Apr 2017 03:01:53 +0000 (08:31 +0530)]
Fix the cursor handling if the HW cursor is not working

Cursor is not positioned correctly when we fall back to the
3D composition fixed it by moving the cursor as a normal layer
and also handle like rest of input layers.

Now cursor can be assigned to overlay plane or 3D composition based
on the available input layers which will avoid unnecessary composition
due to cursor change every time.

Jira: AIA-334/IAHWC-64
Test: Now cursor and navigation bar is visible as expected in most of the apps

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoUpdate parameter type of gamma to float.
Yugang, Fan [Fri, 31 Mar 2017 09:44:53 +0000 (17:44 +0800)]
Update parameter type of gamma to float.

Fixed wrong parameter type of gamma even though it isn't impact
the test.

JIRA: IAHWC-55
Test: Build and run colorcorrection_autotest, it can get "PASSED"
      result as before.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoAdd color correction and broadcast rgb test to layers test app.
Yugang, Fan [Fri, 31 Mar 2017 09:41:38 +0000 (17:41 +0800)]
Add color correction and broadcast rgb test to layers test app.

Moved test parameters of color correction APIs, broadcast rgb API
and power mode APIs to json file. test parameters of color correction
APIs, broadcast rgb API and power mode APIs will use initialized value
if the json doesn't include those parameters.
For new way to enable power mode test (Previously it was passing "-p"),
using "power_mode" key in json file to accept "on/off/doze/dozesuspend",
e.g. tests/jsonconfigs/powermode.json
Updated the original layerfromjson.cpp/.h to jsonhandlers.cpp/.h for
common using.
Updated and formated the json files for testing.

JIRA: IAHWC-55
Test: Build hwc and update the parameters of the json to check if the
      test app testlayers runs normally and effect shows normally
      following the parameters. No different with old json for old tests.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoBuild fix with display dump enable
Pallavi G [Fri, 31 Mar 2017 08:09:12 +0000 (13:39 +0530)]
Build fix with display dump enable

Jira: None
Test: Build Passed with Display dump enable

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agovk: Free vk objects after use
Kevin Strasser [Wed, 29 Mar 2017 15:41:58 +0000 (08:41 -0700)]
vk: Free vk objects after use

It is the application's responsibility to track the lifetime of all the
objects that are allocated through Vulkan and explicitly destroy them before
their handles are lost.

These changes are needed to satisfy that requirement:
  * Rework the image import api so we can keep a reference to the image
    memory.
  * Hoist all local handles to class member variables so they can be
    tracked, and subsequently destroyed in the destructor.
  * Make sure to clean up local allocations in the Draw() path.

These changes are especially important as we do a fair bit of object
creation on a per-frame basis, consistantly leaking memory.

Jira: IAHWC-40
Test: Run demo apps for several minutes and monitor memory consumption

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agovk: Disable explicit sync
Kevin Strasser [Wed, 29 Mar 2017 16:57:31 +0000 (09:57 -0700)]
vk: Disable explicit sync

There doesn't seem to be any way of handling the native fence object with
the current Vulkan API. This results in the test apps hitting a
`gpu_fence_fd != -1` assertion after creating too many unhandled fence
objects. For now disable explicit sync when using the Vulkan backend.

Jira: IAHWC-40
Test: Run demo app for a minute and make sure it doesn't hit an assert

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoFix warnings on Android.
Kalyan Kondapally [Thu, 30 Mar 2017 03:38:41 +0000 (20:38 -0700)]
Fix warnings on Android.

Jira: None.
Test: No warnings like "unused parameter" seen on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoBuild fix.
Kalyan Kondapally [Thu, 30 Mar 2017 03:31:35 +0000 (20:31 -0700)]
Build fix.

Jira: None.
Test: Build passes on Android.

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