OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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.

7 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.

7 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>
7 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

7 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>
7 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.

7 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>
7 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>
7 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>
7 years agoRemove width_ and height_ from displayplanemanager.
Kalyan Kondapally [Thu, 29 Jun 2017 23:39:26 +0000 (19:39 -0400)]
Remove width_ and height_ from displayplanemanager.

These are no longer needed.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAllocate buffers of size we need.
Kalyan Kondapally [Thu, 29 Jun 2017 23:35:02 +0000 (19:35 -0400)]
Allocate buffers of size we need.

Currently, we always allocate buffer equal to the resolution of
screen when ever we create an offscreen surface(Native Surface).
Instead, lets allocate buffer of size we really need to show.

Jira: None.
Test: No graphics regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSplit z_order and index of layer.
Kalyan Kondapally [Thu, 29 Jun 2017 21:59:57 +0000 (17:59 -0400)]
Split z_order and index of layer.

Each overlaylayer represents an hwclayer. We may ignore some
hwclayers depending on visible area and other filters in future.
Hence, Let's store the z_order of overlaylayer and index of hwclayer
it represents separately.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRevert "Remove position change tracking."
Kalyan Kondapally [Thu, 29 Jun 2017 17:18:28 +0000 (13:18 -0400)]
Revert "Remove position change tracking."

This reverts commit ef1f65fe0e05e77dd6825f0182178f1864d36d74.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoInitial plumbing needed to update areas which have only changed.
Kalyan Kondapally [Thu, 29 Jun 2017 08:52:47 +0000 (04:52 -0400)]
Initial plumbing needed to update areas which have only changed.

We get surface damage for each layer every frame, we can use this
to track which layer regions need to be updated instead of
updating everything every time. This patch adds the needed initial
plumbing but doesnt enable the support itself.

Jira: None.
Test: No graphics regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDefine Rotation property fields.
Kalyan Kondapally [Mon, 26 Jun 2017 23:11:49 +0000 (19:11 -0400)]
Define Rotation property fields.

We may be on platforms which dont have support for these
fields in libdrm. Define them in HWC if they are not
already defined.

Jira: None.
Test: Build passes on Linux with latest libdrm.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRefactor: Make it easy for adding different backends.
Kalyan Kondapally [Sun, 25 Jun 2017 01:10:46 +0000 (18:10 -0700)]
Refactor: Make it easy for adding different backends.

This patch refactors code to make it easy to add new backends
in future. No functional change.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSplit Framebuffer format and texture format.
Kalyan Kondapally [Sat, 24 Jun 2017 01:06:50 +0000 (18:06 -0700)]
Split Framebuffer format and texture format.

We sometimes ignore alpha value for primary when  hardware doesnt
support RGBA. However, when sampling from the texture we need to
ensure we are not ignoring alpha. This patch splits framebuffer format
and texture format.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSegmentation fault fix with only one cursor layer
Pallavi G [Fri, 23 Jun 2017 08:50:29 +0000 (14:20 +0530)]
Segmentation fault fix with only one cursor layer

In case where we have total no of layers as 1 and ie cursor,
we end up with segmentation fault and the surfaceflinger crashes.
Fixed that one cursor layer handling in the presentdisplay.

Jira: IAHWC-75
Test: Tested on Android no crash is observed when we move from full screen to
normal screen during youtube video playback in the chrome browser

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoFix the cursor assignment with the layer size of 2
Pallavi G [Thu, 22 Jun 2017 10:21:28 +0000 (15:51 +0530)]
Fix the cursor assignment with the layer size of 2

when the total no of input layers is 2 we end up assigning the cursor
to the overlay plane and fixed that corner case also to assign the
cursor layer to the cursor plane

Jira: IAHWC-74
Test: Tested on Android now no blank image behind the cursor in the fullscreen Video or Image

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoEnsure we release fences always.
Kalyan Kondapally [Wed, 21 Jun 2017 15:32:00 +0000 (08:32 -0700)]
Ensure we release fences always.

GetReleaseFences was not always getting called for some reason,
to be safe lets reset the release fence in SetReleaseFence call.

Jira: None.
Test: No crashes as a result of running out of fds.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd initial plumbing to handle cursor gpu composition separately.
Kalyan Kondapally [Tue, 20 Jun 2017 20:27:09 +0000 (13:27 -0700)]
Add initial plumbing to handle cursor gpu composition separately.

This doesnot change any behaviour but does the necessary plumbing
needed to handle gpu rendering of cursor separately in case we
need it.

Jira: None.
Test: No regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure we always have a offscreen target during validation.
Kalyan Kondapally [Tue, 20 Jun 2017 10:25:40 +0000 (03:25 -0700)]
Ensure we always have a offscreen target during validation.

When falling back to GPU we need to ensure we always have offscreen
buffer set for the plane, otherwise all subsequent validations will
also fail.

Jira: None.
Test: When using NV12 buffer we still have Video in a separate plane.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix for cursor source crop position
Pallavi G [Tue, 20 Jun 2017 09:25:03 +0000 (14:55 +0530)]
Fix for cursor source crop position

Sometimes the Android framework sets the source crop
position coordinates x and y to some non zero value.
Due to that the drm kernel plane check is failing and
the cursor is falling back to the gpu path.

Irrespective of the x and y value make it to zero,
anyway we allocate the cursor buffer size bigger then
the required size.

Jira : IAHWC-73
Test : Tested on Android, no cursor layer falling back to gpu

Change-Id: I953e5f1e39e9474e6920fd625346e2f7d47671f5
Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoRemove position change tracking.
Kalyan Kondapally [Tue, 20 Jun 2017 09:46:13 +0000 (02:46 -0700)]
Remove position change tracking.

This should be already covered by surface damage and visible
region tracking and is unnecessary to be tracked separately.

Jira: None.
Test: No rendering artifacts on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUpdate display with known configs.
Mingwei Wang [Mon, 19 Jun 2017 10:08:36 +0000 (18:08 +0800)]
Update display with known configs.

This change was missing in the path where we try to find
encoder for the connector.

Jira: None.
Test: Comes up to UI on APL platform.

Signed-off-by: Xu, Randy <randy.xu@intel.com>
Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
7 years agoRemove previous_layers_ in DisplayQueue.
Kalyan Kondapally [Mon, 19 Jun 2017 02:52:12 +0000 (19:52 -0700)]
Remove previous_layers_ in DisplayQueue.

DisplayQueue in Android can discard old buffers any time, we where
seeing lot of errors while closing handles in our side in this case.
Let's only hold on to the current buffers on screen and the new
ones being scanned out.

Jira: None.
Test: Errors related to "Failed to close gem handle -1" are minimised.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
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>