OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
6 years agoFix libhwcomposer relink issue when static libs been updated.
Fan, Yugang [Mon, 11 Sep 2017 14:46:39 +0000 (10:46 -0400)]
Fix libhwcomposer relink issue when static libs been updated.

The workaround of whole static link didn't use the .la file in
section of "la_LIBADD", which caused the libhwcomposer didn't
build when the two static libs got updates. Now, added the .la
to the let libtool aware timestamp changed in two static libs.
Android didn't use this WA as Android mk file has its own var
LOCAL_WHOLE_STATIC_LIBRARIES.

Jira: GSE-19
Test: Build HWC for Linux, then do some changes in common or wsi,
      and build again(just do make) to check if the new changes
      be applied in libhwcomposer and testlayers.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
6 years agoUse DisplayFrameRect when calculating update regions.
Kalyan Kondapally [Tue, 12 Sep 2017 11:53:06 +0000 (04:53 -0700)]
Use DisplayFrameRect when calculating update regions.

SurfaceDamage doesn't seem to be precise on Android for
animations involving multiple overlapped regions. Let's
just use the display frame rect for now till we understand
why we are getting wrong values with Surface Damage.

Jira: None.
Test: Progress bar plays smoothly with Audio Applications.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack CursorLayer in hwc2.
Kalyan Kondapally [Sun, 10 Sep 2017 04:20:55 +0000 (21:20 -0700)]
Track CursorLayer in hwc2.

We change composition type of cursor to HWC2::Composition::Device
in ValidateDisplay. However, expectation in Present call is that
this is of type HWC2::Composition::Cursor. Instead of relying on
composition type, we keep track of cursor layer and ensure this is
having highest z_order.

Jira: None.
Test: Cursor is still visible when playing Video content.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we swap surface when region has changed.
Kalyan Kondapally [Sun, 10 Sep 2017 02:49:54 +0000 (19:49 -0700)]
Ensure we swap surface when region has changed.

We don't set content_changed to true if region has changed as
we omit the whole damage region calculations in this case.
Let's ensure content_changed is set true if region area has
changed, reset or surface has been cleared. This should ensure
we don't update the surface which is on screen.

Jira: None.
Test: No flicker seen when initialzing Video player on Linux and
      Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDisable implicit clone mode by default on Android.
Kalyan Kondapally [Sun, 10 Sep 2017 02:35:39 +0000 (19:35 -0700)]
Disable implicit clone mode by default on Android.

We added support in HWC to handle clone mode implicitly when
more than 1 display is connected. However, Surface Flinger
handles both clone & Extended mode as desired. Let's
disable this by default on Android. On Linux this is still
enabled for tests.

Jira: None.
Test: Build passes on Linux and Android. Multi Display support
      works as today.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd an option to disable Hot Plug Notifications.
Kalyan Kondapally [Sun, 10 Sep 2017 00:56:26 +0000 (17:56 -0700)]
Add an option to disable Hot Plug Notifications.

Not everyone needs hot plug support. In these cases, monitoring
for physical connect/disconnection of displays is not needed.
Add an option to disable hot plug support if not really
needed.

Pass --disable-hotplug-support on Linux.
One has to set DISABLE_HOTPLUG_SUPPORT in BoardConfig file in
Android.

Jira: None.
Test: Build passes and hot plug support works as today as today.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoInitialize default values in OverlayLayer and HWCBuffer.
Kalyan Kondapally [Sat, 9 Sep 2017 22:52:14 +0000 (15:52 -0700)]
Initialize default values in OverlayLayer and HWCBuffer.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Segfault when display is powered on after Doze modes.
Kalyan Kondapally [Sat, 9 Sep 2017 22:45:38 +0000 (15:45 -0700)]
Fix Segfault when display is powered on after Doze modes.

release_all_resources_ in Compositor thread was never re-set
once set, causing us to delete NativeGpuResourceHandler. This
patch fixes it.

Jira: IAHWC-83
Test: PowerMode related tests dont crash on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoUse ceilf when converting from float to int.
Kalyan Kondapally [Sat, 9 Sep 2017 21:33:12 +0000 (14:33 -0700)]
Use ceilf when converting from float to int.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoBuild common and wsi as static library.
Fan, Yugang [Wed, 6 Sep 2017 08:26:48 +0000 (16:26 +0800)]
Build common and wsi as static library.

Updated the config and Makefile.am/Android.mk to support build
common and wsi as single static library for external using. Still
built libhwc which only included platform code as dynamic library
and link to whole common and wsi static lib files.

Jira: GSE-19
Test: Build and run hwc normally as before, and the common
      and wsi can be used for static linking.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
6 years agoPartial revert of 9c9c704
Kalyan Kondapally [Sat, 9 Sep 2017 04:49:24 +0000 (21:49 -0700)]
Partial revert of 9c9c704

This broke scaling of Video layers.

Jira: None.
Test: Video layers are scaled according to the passed src and display rects.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid sending duplicate hotplug notifications.
Kalyan Kondapally [Thu, 7 Sep 2017 08:02:05 +0000 (01:02 -0700)]
Avoid sending duplicate hotplug notifications.

We should notify clients only when physical connection
status has actually changed, instead of everytime we check which
displays are actually connected /disconnected.

Jira: None.
Test: No duplicate hot plug notifications sent to SurfaceFlinger.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure Layer using 3DComposition re-renders when source position has changed.
Kalyan Kondapally [Wed, 6 Sep 2017 10:38:48 +0000 (03:38 -0700)]
Ensure Layer using 3DComposition re-renders when source position has changed.

Jira: None.
Test: No left over content when transitioning from one view to another
      on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont send callback if hook is null
Harish Krupo [Wed, 6 Sep 2017 04:34:28 +0000 (10:04 +0530)]
Dont send callback if hook is null

Jira: None.
Test: No crash during hot plug.
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoLet's limit max size of buffer to resolution of screen.
Kalyan Kondapally [Wed, 6 Sep 2017 09:21:43 +0000 (02:21 -0700)]
Let's limit max size of buffer to resolution of screen.

When we fallback to 3D composition, we create a buffer
equal to display rect of plane. Let's make sure we dont
exceed the size to be greater than the resolution.

Jira: None.
Test: Linux tests pass.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFinetune threshold for idle mode detection.
Kalyan Kondapally [Tue, 5 Sep 2017 05:41:46 +0000 (22:41 -0700)]
Finetune threshold for idle mode detection.

On some platforms current threshold decreased power savings
in idle mode scenario.This patch fine tunes the threshold
where we dont loose on power savings as well as dont toggle
too much between single/multi plane compositions.

Jira: None.
Test: We get same power savings as before on Joule platform
      in idle mode case scenario.

Change-Id: Ic89789c57f29248d81471eec4d3913c2db2c552c
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we update surface when cursor layer is added/removed.
Kalyan Kondapally [Tue, 5 Sep 2017 11:30:29 +0000 (04:30 -0700)]
Ensure we update surface when cursor layer is added/removed.

We cannot continue to use same surface and not clear it
when cursor layer has been added/removed. We didn't do this
when cursor layer was added causing rendering artifacts when
cursor was gpu rendered. This patch fixes it.

Jira: None.
Test: We dont see any flicker/garbage when cursor is gpu rendered.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid re-calculating composition regions if regions haven't changed.
Kalyan Kondapally [Tue, 5 Sep 2017 10:45:38 +0000 (03:45 -0700)]
Avoid re-calculating composition regions if regions haven't changed.

Jira: None.
Test: No new graphics artifacts on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove Disconnect API from NativeDisplay.
Kalyan Kondapally [Tue, 5 Sep 2017 02:12:51 +0000 (19:12 -0700)]
Remove Disconnect API from NativeDisplay.

This should be only used when display has been physically
disconnected. We already have SetPowerMode to update power
modes and can cause confusion with usage of this API.
Let's remove it and make it internal to PhysicalDisplay.

Jira: None.
Test: Build passes and all Linux power mode related tests pass.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoPostpone initial hot plug registration till Present call.
Kalyan Kondapally [Sun, 3 Sep 2017 09:26:28 +0000 (02:26 -0700)]
Postpone initial hot plug registration till Present call.

Seems like on Android O, we need to wait for registering hot
plug events till the initial Present else these notifications
are getting ignored. Also, add more logs.

Jira: None.
Test: Two displays are recognized during boot up and show the
      right content.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRe-work hot plug event handling.
Kalyan Kondapally [Sun, 3 Sep 2017 04:34:53 +0000 (21:34 -0700)]
Re-work hot plug event handling.

This patch re-works code to make sure we can handle
hot plug notifications after all related book keeping
has been done when we have hot plug notification rather
than in between. Also, adds logs to easliy check state
in future.

Jira: None.
Test: Display connect and disconnect are recieved by
      SurfaceFlinger appropriately,

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
7 years agoFix segfault when shutting down.
Kalyan Kondapally [Fri, 1 Sep 2017 23:22:57 +0000 (16:22 -0700)]
Fix segfault when shutting down.

DisplayQueue was calling a virtual function of Display in
SetPowerMode, which was getting called from destructor after
the object has been deleted. Let's make sure all the power off
operations are handled before display is destroyed.

Jira: None.
Test: No segfault during destruction of test apps on Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFormats: Add HAL_PIXEL_FORMAT_YCbCr_422_888
Johnson Lin [Fri, 1 Sep 2017 07:31:37 +0000 (15:31 +0800)]
Formats: Add HAL_PIXEL_FORMAT_YCbCr_422_888

Previously the format is not tested
Jira: None
Test: All formats from 61 to 77 are tested; YUV formats rendered correctly

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoFix wrong NV21 and ycbcr_444_888 lineBytes/height issue in video test.
Fan, Yugang [Fri, 1 Sep 2017 14:04:22 +0000 (10:04 -0400)]
Fix wrong NV21 and ycbcr_444_888 lineBytes/height issue in video test.

Updated NV21 lineBytes and ycbcr_444_888 height to show test images
normally.
Rename the test image generated by ffmpeg with the same name style.

Jira: None
Test: Use video1layer_ycrcb_420_sp.json and video1layer_ycbcr_444_888.json
      as the test json file to render the test images, the rendering shows
      normally.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoFix wrong NV16 lineBytes issue in video test.
Fan, Yugang [Fri, 1 Sep 2017 10:48:57 +0000 (06:48 -0400)]
Fix wrong NV16 lineBytes issue in video test.

NV16 have the same lineBytes with NV12, this commit just fixed old
wrong lineBytes.

Jira: None
Test: Use video1layer_yuv422sp.json as the test json file to render
the NV16 test image, the rendering shows normally.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoAdd missing support for packed and planar YUV formats.
johnson.lin [Thu, 31 Aug 2017 20:02:42 +0000 (13:02 -0700)]
Add missing support for packed and planar YUV formats.

We where missing basic handling of some of these formats, which
this patch adds. We are now passing 8 tests related to Media format
handling.

Jira: None
Test: Run Format related tests on Linux and Android and check tests
      related to NV* formats are all passing.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoAdd tool to generate test example images
Fan, Yugang [Thu, 24 Aug 2017 07:06:26 +0000 (15:06 +0800)]
Add tool to generate test example images

This tool can be used to generate the test image for testlayers and
includes command lines examples for users reference.

Jira: None
Test: Follow the README.md to build and generate the test images which
can be used by testlayers for memory format testing.

Signed-off-by: Yugang Fan <yugang.fan@intel.com>
7 years agoAdd tests for YUV formats.
johnson.lin [Thu, 31 Aug 2017 07:49:26 +0000 (00:49 -0700)]
Add tests for YUV formats.

This patch adds support for testing YUV formats.

Jira: None.
Test: Build passes on Linux and Android. Test apps using
      NV12 buffers is about to show content on screen.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTest: Fix data upload to bo.
johnson.lin [Thu, 31 Aug 2017 07:46:24 +0000 (00:46 -0700)]
Test: Fix data upload to bo.

Instead of using bo widht/height which may be different with source
width/height due to alignment, origin source width/height should be
remembered and used when upload data

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoLinux: correct logic for get fd for multiple planes format
johnson.lin [Tue, 4 Jul 2017 08:38:05 +0000 (16:38 +0800)]
Linux: correct logic for get fd for multiple planes format

Each plane should have it is own fd instead of only use
the first plane fd. Multiple plane format include NV12,
YUV420 etc

Jira: None.
Test: Importing YUV buffers succeds on Linux.
Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoRe-calculate size after populating layers.
Kalyan Kondapally [Wed, 30 Aug 2017 22:26:07 +0000 (15:26 -0700)]
Re-calculate size after populating layers.

We may have skipped layers which are not visible and hence
size should be updated once we populate all OverlayLayers.

Jira: None.
Test: Build passes and no regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix SurfaceDamage tracking.
Kalyan Kondapally [Mon, 28 Aug 2017 06:47:40 +0000 (23:47 -0700)]
Fix SurfaceDamage tracking.

We always marked the whole surface damaged as we used to
save lastsurfacedamage same as surface_damage_ in NativeSurface.
Instead, it should have been equal to current surface damage.
This patch fixes it.

Jira: None.
Test: Check the unnecessary layers are not re-rendered when moving
      cursor.

Change-Id: Ic15c71dc90c56695fc833d15be03e37b7f3db247
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoLet's hold on to buffers for an extra frame before releasing them.
Kalyan Kondapally [Sat, 26 Aug 2017 20:39:17 +0000 (13:39 -0700)]
Let's hold on to buffers for an extra frame before releasing them.

In cases where layers are changing in consecutive frames, we ended
up releasing and allocating memory. Instead let's hold onto back
buffers till we have frames where validation is not needed. This
way we are able to re-use already allocated buffers than ending
up in this loop of release/re-allocate memory.

Jira: None.
Test: Check that we dont do unnecessary reallocations when content
      changes on screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove un-used refresh variable.
Kalyan Kondapally [Sat, 26 Aug 2017 03:25:35 +0000 (20:25 -0700)]
Remove un-used refresh variable.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure display rect has changed before allocating new buffers.
Kalyan Kondapally [Sat, 26 Aug 2017 09:23:09 +0000 (02:23 -0700)]
Ensure display rect has changed before allocating new buffers.

Sometimes, displayframe position is changed but doesn't affect
the size. Let's ensure we don't re-allocate buffers in this
case.

Jira: None.
Test: No regressions with tests on Linux
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove ValidatePreviousFrameState internal to OverlayLayer.
Kalyan Kondapally [Fri, 25 Aug 2017 22:08:26 +0000 (15:08 -0700)]
Move ValidatePreviousFrameState internal to OverlayLayer.

We can handle this during InitializeFromHwcLayer call and
can make it private.

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMark back buffers free to be recycled.
Kalyan Kondapally [Fri, 25 Aug 2017 20:02:56 +0000 (13:02 -0700)]
Mark back buffers free to be recycled.

When validating layers, let's mark any allocated back buffers free
to be re-cycled. This helps avoid un-necessary memory allocations.

Jira: None.
Test: No flickers on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove redundant calculations to hwclayer.
Kalyan Kondapally [Fri, 25 Aug 2017 07:10:14 +0000 (00:10 -0700)]
Move redundant calculations to hwclayer.

Displayframe, transforms might not change for every update, let's
cache them in hwclayer instead of re-calculating them every time
in Overlay Layer.

Change-Id: If2703449bc6e317cdd5b2d235982c08a74eafb1c
Jira: None.
Test: All tests on Linux pass as before.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAllocate buffers of needed size only.
Kalyan Kondapally [Fri, 25 Aug 2017 05:03:49 +0000 (22:03 -0700)]
Allocate buffers of needed size only.

Currently, when falling back to 3D Composition, we allocate
buffers equal to that of resolution. Instead, let's allocate
buffer equal to size of the display rect of plane.

Change-Id: Ifb26a9d45af47926e0b0791aac191ad08243bddc
Jira: None.
Test: No graphics regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoGet source layers from current plane.
Kalyan Kondapally [Tue, 22 Aug 2017 19:50:51 +0000 (12:50 -0700)]
Get source layers from current plane.

We can ignore cursor layer when populating current planes.
Let's take this into account when calculating surface damage
for the current frame.

Jira: None.
Test: No graphics artifacts on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd color format mapping from native format to vulkan
Gao Chun [Tue, 30 May 2017 07:03:43 +0000 (15:03 +0800)]
Add color format mapping from native format to vulkan

Only add the vulkan corlor formats that has corresponding
gbm and drm formats.

Jira: IAHWC-40
Test: Build passes on Linux and Android.
Signed-off-by: Gao Chun <chun.gao@intel.com>
7 years agoAndroid: Build with vulkan source files
Gao Chun [Thu, 25 May 2017 05:55:15 +0000 (13:55 +0800)]
Android: Build with vulkan source files

To compile with vulkan backend, edit device/intel/android_ia/androidia_
64/BoardConfig.mk, and add the following content:
BOARD_USES_VULKAN := true

Jira: IAHWC-40
Test: Build passes on Linux and Android.
Signed-off-by: Gao Chun <chun.gao@intel.com>
7 years agoChange the init_frames place to load test json firstly.
Yugang [Thu, 10 Aug 2017 11:17:20 +0000 (19:17 +0800)]
Change the init_frames place to load test json firstly.

Old place of init_frames() will load json after setting the display
mode/color correction, that causes testlayers always use the default
parameters.

Jira: None.
Test: Change the value of test json files (e.g. gamma*, power_mode*),
      the testlayers will change the effects accordingly.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

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