OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
6 years agoFix the issue that the HWCLock thread will not exit.
Zhongmin Wu [Mon, 30 Oct 2017 07:40:23 +0000 (15:40 +0800)]
Fix the issue that the HWCLock thread will not exit.

The displaymanager thread is blocked in "read" call,
so it will never get chance to disable HWClock.

As we already use "select" to receive the "POLL IN" event of
the fd, we had better to set the "Non Blocking" flag on.

Jira: None.
Test: HWCLock thread is closed on Android after booting to
      homescreen.
Signed-off-by: Zhongmin Wu <zhongmin.wu@intel.com>
6 years agoEnsure we handle hotplug notifications even if primary is disconnected.
Kalyan Kondapally [Sat, 28 Oct 2017 05:18:23 +0000 (22:18 -0700)]
Ensure we handle hotplug notifications even if primary is disconnected.

We handle hotplug notifications of extended displays only in
case primary is connected. Let's ensure we handle these even
when primary is disconnected.

Jira: None.
Test: No hot plug related regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAndroid: Enable color correction and inversion
Gao Chun [Thu, 26 Oct 2017 15:47:21 +0000 (23:47 +0800)]
Android: Enable color correction and inversion

Add setColorTransform to HWC2. Get 4x4 color transform matrix (CTM)
from SurfaceFlinger, and convert the matrix to 3x3 DRM CSC matrix
and DRM CSC post offset.

Jira: OAM-49721,OAM-50246
Test: Go to Settings-Accessibility-Color correction, set it to On
and choose the Correction mode; Go to Settings-Accessibility-Color
inversion, set it to On.

Signed-off-by: Gao Chun <chun.gao@intel.com>
6 years agoSuppress compile warnings on Android
renchenglei [Fri, 27 Oct 2017 05:29:17 +0000 (13:29 +0800)]
Suppress compile warnings on Android

Jira: None.
Test: Build passes on Android and no warnings reported.

6 years agoEnsure to install everything to vendor partition
Mingwei Shi [Mon, 23 Oct 2017 06:03:49 +0000 (14:03 +0800)]
Ensure to install everything to vendor partition

For shared library, ensure to install everything to vendor partition.
For static library, declare the module as vendor module also.

Jira: None.
Test: Build passes on Android.
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
6 years agojsonlayerstest: Restore vt on exit
Harish Krupo [Sun, 22 Oct 2017 02:24:09 +0000 (07:54 +0530)]
jsonlayerstest: Restore vt on exit

Exit and restore vt on SIGINT and other signals.

Jira: None
Test: On SIGINT the app should exit properly and restore
      the vt.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix the typo
Fan, Yugang [Wed, 25 Oct 2017 22:40:58 +0000 (18:40 -0400)]
Fix the typo

Jira: None.
Test: Test case run normally just like before, especially for logical
      and mosaic mode.

Signed-off-by: Fan, Yugang <yugang.fan@intel.com>
6 years agoUpdate the HWC config path
Kishore Kadiyala [Tue, 24 Oct 2017 18:44:01 +0000 (00:14 +0530)]
Update the HWC config path

Let's have everything under vendor/.

Jira: None.
Test: Verified Mosaic mode works for Android.
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
6 years agoRemove Redundant code.
Kalyan Kondapally [Tue, 24 Oct 2017 02:35:48 +0000 (19:35 -0700)]
Remove Redundant code.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont hardcode virtual display id.
Kalyan Kondapally [Tue, 24 Oct 2017 02:15:50 +0000 (19:15 -0700)]
Dont hardcode virtual display id.

When AOSP framework has support for two external displays, let's
ensure we can handle in in our side. We assume all physical display
id's supported by surface flinger are less than HWC_DISPLAY_VIRTUAL.

Jira: None.
Test: Dual display support is not broken and Virtual display works
      as expected on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDon't assume primary display if pipe_ == 0.
Kalyan Kondapally [Tue, 24 Oct 2017 02:11:30 +0000 (19:11 -0700)]
Don't assume primary display if pipe_ == 0.

We support re-odering displays from settings file which may
or may not match the physical pipe order. Take this into
account when determining primary display.

Jira: None.
Test: Check external display shows Android logo first in case
      PHYSICAL_DISPLAY="1:0:2" is set in hwc_display.ini.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAlign rotation enums with 4.14 headers.
Kalyan Kondapally [Mon, 23 Oct 2017 03:47:11 +0000 (20:47 -0700)]
Align rotation enums with 4.14 headers.

Now, that these are merged upstream let's move to the new
defines. Also, move this to drmplane, so the core doesn't
need to know about them.

Jira: None.
Test: Build passes on Android and Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Android Oreo build error
Qiming Shi [Wed, 20 Sep 2017 07:13:12 +0000 (15:13 +0800)]
Fix Android Oreo build error

Jira: None.
Test: Pass build on Android Oreo

Signed-off-by: Qiming Shi <qiming.shi@intel.com>
6 years agoAdd support to re-order physical displays.
Kalyan Kondapally [Sat, 21 Oct 2017 09:37:31 +0000 (02:37 -0700)]
Add support to re-order physical displays.

We may want to change the order of physical display, extended
display etc reported to Surface Flinger on certain platforms.
Let's add an option to our setting file to be able to do this.
This order is not expected to change dynamically after boot
up. We now add a new setting "PHYSICAL_DISPLAY" to be able
to configure this.

Jira: None.
Test: Displays are ordered in GPUDevice based on hwc_display.ini
      settings.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix build for Linux
Xiaosong Wei [Thu, 19 Oct 2017 11:38:52 +0000 (19:38 +0800)]
Fix build for Linux

Fix va support for Linux

Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd missing unlock.
Tong Bo [Tue, 17 Oct 2017 04:33:19 +0000 (10:03 +0530)]
Add missing unlock.

We forgot to call unlock here, causing us to wait on this lock
for ever in other places.

Jira: None.
Test: System should not get stuck
Signed-off-by: Tong Bo <bo.tong@intel.com>
6 years agoAdd config handling for logical and mosiac.
Fan, Yugang [Thu, 12 Oct 2017 21:08:23 +0000 (17:08 -0400)]
Add config handling for logical and mosiac.

The HWC will read the display config for logical and mosiac, the
config file will be pointed out by ENV var HWC_DISPLAY_CONFIG, and
use default path /etc/hwc_display.ini if no HWC_DISPLAY_CONFIG found.

Pls see comments of the config for detailed config format and usages.

Jira: None.
Test: Change the config file and connect some displays, the cube test
      can show logical and mosiac normally according to the config
      parameters.

Signed-off-by: Fan, Yugang <yugang.fan@intel.com>
6 years agoAdd P010 support
Lin Johnson [Mon, 16 Oct 2017 07:49:50 +0000 (00:49 -0700)]
Add P010 support

P010 is need for HEVC 10 bit
Jira: https://jira01.devtools.intel.com/browse/GSE-390
Test: H265_4K2K_10bit playback successfuly

Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoReport maximum virtual displays as 2.
Kalyan Kondapally [Sun, 15 Oct 2017 11:52:28 +0000 (04:52 -0700)]
Report maximum virtual displays as 2.

Jira: None.
Test: Goto Developer Options and simulate secondary display. Device
      shouldn't reboot with options for 2 virtual display.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoW/A: Disable cursor plane usage on APL platforms.
Kalyan Kondapally [Fri, 13 Oct 2017 08:33:30 +0000 (01:33 -0700)]
W/A: Disable cursor plane usage on APL platforms.

This is causing lot of rendering issues, for now let's squash
cursor layer rendering with last layer when this WA
is enabled.

Jira: None.
Test: Multi display renders without any issues.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix build for Android
Xiaosong Wei [Fri, 13 Oct 2017 00:52:04 +0000 (08:52 +0800)]
Fix build for Android

This is needed to find VA header files.

Jira: None.
Test: Build passes on linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoRemove vaSyncSurface
Xiaosong Wei [Thu, 12 Oct 2017 08:53:29 +0000 (16:53 +0800)]
Remove vaSyncSurface

vaSyncSurface is not required on intel h/w and it's incompatible with
vpg's driver.

Jira: None.
Test: Build passes on linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoLinux: Get Mosiac mode working on Linux.
Fan, Yugang [Tue, 10 Oct 2017 08:30:57 +0000 (01:30 -0700)]
Linux: Get Mosiac mode working on Linux.

During start up we always check for the connected displays
and present content for these displays in tests. In MosiacDisplay,
we expect a hot plug event, before we query for the connected
displays. Instead, let's force atleast once that we populate
connected displays.

Jira: None.
Test: Linux apps work with Logical and Mosiac Display Support
      Enabled.

Signed-off-by: Fan, Yugang <yugang.fan@intel.com>
6 years agoRe-work cursor layer tracking in DisplayPlaneState.
Kalyan Kondapally [Tue, 10 Oct 2017 06:57:11 +0000 (23:57 -0700)]
Re-work cursor layer tracking in DisplayPlaneState.

We don't use cursor layer index anymore, this can be replaced
with a bool to check if a plane has a cursor layer or not.

Jira: None.
Test: No graphics regression seen when using Logical Displays.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoCheck if layer is actually cursor before removing it.
Kalyan Kondapally [Tue, 10 Oct 2017 00:50:00 +0000 (17:50 -0700)]
Check if layer is actually cursor before removing it.

We tracked indexs so far which was fine in normal cases.
However, with logcal display we have double the layers and
cause confusion with index. Instead of index, let's explicitly
check from layer itself.

Jira: None.
Test: No flicker occurs when Logical display is enabled and Video
      is running.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove redundant code.
Kalyan Kondapally [Tue, 10 Oct 2017 00:19:30 +0000 (17:19 -0700)]
Remove redundant code.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoPass false in case layer is not cursor.
Kalyan Kondapally [Mon, 9 Oct 2017 23:39:16 +0000 (16:39 -0700)]
Pass false in case layer is not cursor.

Most of the IsCursorLayer() checks are redundant as these
are done early on and cursor layers are tracked separately.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure VA processing the buffer with correct crop/frame
Xiaosong Wei [Mon, 9 Oct 2017 08:33:34 +0000 (16:33 +0800)]
Ensure VA processing the buffer with correct crop/frame

The surface region for VA input must be from layer's SourceCrop
and the output region for VA output must be from layer's DisplayFrame

Jira: None.
Test: Video uses packed YUV formats and is displayed correctly on Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoInitial Mosiac Display support.
Kalyan Kondapally [Sun, 8 Oct 2017 00:11:38 +0000 (17:11 -0700)]
Initial Mosiac Display support.

This support is disabled by default. We also move
logicaldisplay* to common/core.

Jira: None.
Test: Framebuffer is scaled across multiple monitors when
      more than one monitor is connected.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support for Logical Displays.
Kalyan Kondapally [Thu, 5 Oct 2017 09:14:06 +0000 (02:14 -0700)]
Add support for Logical Displays.

This patch adds support to split Primary Display into two
logical displays. Eventually, we want to be able to configure
the Physical display and the no of logical displays it need's
to be split into. Support is disabled by default.

Jira: None.
Test: Primary display is split into two logical displays and
      content is shown.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove implicit assumption of 1 Cursor layer.
Kalyan Kondapally [Sat, 7 Oct 2017 04:02:06 +0000 (21:02 -0700)]
Remove implicit assumption of 1 Cursor layer.

We want to enable support for spliting 1 physical display to
"n" logical displays. Each logical display can have it's own
cursor layer. Currently, we always assume 1 Cursor per physical
display, remove this assumption.

Jira: None.
Test: No regressions on Android with and without Logical Display.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove redundant logs.
Kalyan Kondapally [Thu, 5 Oct 2017 04:25:23 +0000 (21:25 -0700)]
Remove redundant logs.

Jira: None.
Test: Build passes on Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we don't refresh if display is not on.
Kalyan Kondapally [Tue, 3 Oct 2017 22:23:37 +0000 (15:23 -0700)]
Ensure we don't refresh if display is not on.

Jira: None.
Test: We don't send refresh request for disconnected displays on
      Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoImprove Cursor plane tracking.
Kalyan Kondapally [Tue, 3 Oct 2017 18:27:41 +0000 (11:27 -0700)]
Improve Cursor plane tracking.

We ignored setting the right state in certain cases, this patch
fixes it.

Jira: None.
Test: Primary plane doesn't get disabled when cursor plane is disabled
      on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoMove HWCLock to DrmDisplayManager.
Kalyan Kondapally [Wed, 27 Sep 2017 08:02:57 +0000 (01:02 -0700)]
Move HWCLock to DrmDisplayManager.

Instead of having this per display, let's move it
to displaymanager and inform Displays as needed.

Jira: None.
Test: Applications are still able to block HWC updates as needed
     on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd needed changes for travis.
Kalyan Kondapally [Tue, 3 Oct 2017 01:50:00 +0000 (18:50 -0700)]
Add needed changes for travis.

Add support to build with and without libva support enabled.

Jira: None.
Test: All builds pass on TravisCI.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReset cursor plane as needed.
Kalyan Kondapally [Mon, 2 Oct 2017 23:48:08 +0000 (16:48 -0700)]
Reset cursor plane as needed.

We reset all planes when cursor is removed/added. Instead,
we can just reset the plane which actully has Cursor.

Jira: None.
Test: Moving cursor doesn't leave any rendering artifacts when
      in Landscape mode.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd initial support to convert Media buffers to packed formats.
Xiaosong Wei [Mon, 2 Oct 2017 23:20:14 +0000 (16:20 -0700)]
Add initial support to convert Media buffers to packed formats.

This patch basically enables needed support in CompositorThread,
DisplayPlaneManager to enable support to convert Media buffers
to a preferred Packed/Planar format rather that RGB always.
This will be enabled only when BOARD_USES_LIBVA is set to
true. Video output sometimes shows frames from previous frames
which needs to be fixed before enabling this by default. Also,
changes are needed in Vaapi driver, fixing some of the wrong
asserts in there. These issues will be fixed in followup patches.

Jira: None.
Test: Video output continues to work fine when BOARD_USES_LIBVA is
      not set. Video doesn't crash when BOARD_USES_LIBVA is set to
      true on Android.

Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoUse HWCLayerType to keep track of layer type in OverlayLayer.
Kalyan Kondapally [Mon, 2 Oct 2017 19:10:00 +0000 (12:10 -0700)]
Use HWCLayerType to keep track of layer type in OverlayLayer.

Jira: None.
Test: Video is still composited on a separate plane on Android and
      Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support to track VideoPlanes.
Xiaosong Wei [Mon, 2 Oct 2017 18:55:12 +0000 (11:55 -0700)]
Add support to track VideoPlanes.

Add support to keep track of planes which are compositing only
Media content. This is used in later patches to allocate
appropriate buffers  for this plane.

Jira: None.
Test: Video and other content play fine on Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd support to query supported format from DisplayPlane.
Xiaosong Wei [Mon, 2 Oct 2017 07:22:49 +0000 (00:22 -0700)]
Add support to query supported format from DisplayPlane.

When unable to directly use Display Composition for layers,
we want to fall back to a optimal format which can be scanned out.
This information needs to be queried from DisplayPlane. We now
add the needed support and use this format when creating offscreen
buffers, rather than hardcoding it like now.

Jira: None.
Test: Build passes on Linux and Android. No regressions on Linux
      and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd API to initialize Media Renderer/Back buffer in Factory.
Xiaosong Wei [Mon, 2 Oct 2017 06:45:07 +0000 (23:45 -0700)]
Add API to initialize Media Renderer/Back buffer in Factory.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoIntroduce VaRenderer.
Xiaosong Wei [Mon, 2 Oct 2017 06:22:57 +0000 (23:22 -0700)]
Introduce VaRenderer.

VaRenderer represents Media renderer backend used to
convert Media buffers to different formats. This will
be taken into use in future patches. For, now this files
will be compiled only when BOARD_USES_LIBVA is set to
TRUE.

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

Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoIntroduce VASurface.
Xiaosong Wei [Mon, 2 Oct 2017 05:54:37 +0000 (22:54 -0700)]
Introduce VASurface.

VASurface represents Media offscreen surface. This
will be taken into use in followup patches.

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

Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoFix indentation of DUMP_CURRENT_COMPOSITION_PLANES.
Xiaosong Wei [Mon, 2 Oct 2017 05:30:56 +0000 (22:30 -0700)]
Fix indentation of DUMP_CURRENT_COMPOSITION_PLANES.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd support to query needed buffer data from OverlayBuffer.
Xiaosong Wei [Mon, 2 Oct 2017 05:23:01 +0000 (22:23 -0700)]
Add support to query needed buffer data from OverlayBuffer.

We need information Like pitches, prime handle etc when converting
content from one format to another. Let's expose needed API's
in OverlayBuffer.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd support to query supported Media format from DisplayPlane.
Xiaosong Wei [Mon, 2 Oct 2017 05:17:27 +0000 (22:17 -0700)]
Add support to query supported Media format from DisplayPlane.

We want to fall back to a optimal packed/planar format, when
Display Plane is unable to handle a given Media buffer. This
information needs to be queried from DisplayPlane. We add
an API in DisplayPlane to query this information, this will
be used in followup patches to convert Media content to a
format which can be scanned out directly.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoInitial Plumbing to provide Media Renderer.
Xiaosong Wei [Mon, 2 Oct 2017 05:04:45 +0000 (22:04 -0700)]
Initial Plumbing to provide Media Renderer.

Currently, we always convert Media content to RGB if YUV/NV12
formats cannot be directly scanned out. Instead of converting
to RGB, we can use VAAPI to convert it to a packed/planar YUV
format's supported by Display. This patch adds initial support
in Factory to provide a Media Renderer implementation.

Jira: None.
Test: Build passes on Linux and Android.
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
6 years agoAdd implementation for grallochandler Map, Unmap functions
Jeevaka Prabu Badrappan [Fri, 8 Sep 2017 08:11:55 +0000 (13:41 +0530)]
Add implementation for grallochandler Map, Unmap functions

Jira: None
Test: Build passes.

Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan@intel.com>
6 years agoAdd null ptr checks for callbacks.
Mingwei Wang [Mon, 25 Sep 2017 07:20:31 +0000 (15:20 +0800)]
Add null ptr checks for callbacks.

This can be null in cases like adb shell stop is called.

Jira: None.
Test: adb shell stop, start doesn't crash the system.
Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
6 years agoDo not dup the acquire fence from surfaceflinger
Zhongmin Wu [Wed, 5 Jul 2017 08:50:54 +0000 (16:50 +0800)]
Do not dup the acquire fence from surfaceflinger

such fence is already dupped by SurfaceFlinger.
We can use it directly, otherwise it will cause
"fd leak" of SurfaceFlinger.

Jira: None.
Test: No fd leaks with latest Mesa upstream.
Signed-off-by: Zhongmin Wu <zhongmin.wu@intel.com>
6 years agoSplit detecting displays for connectors which need to find an encoder.
Kalyan Kondapally [Sun, 24 Sep 2017 07:05:17 +0000 (00:05 -0700)]
Split detecting displays for connectors which need to find an encoder.

Current, logic would map displays to diferent connectors depending
on which Display would be re-connected. For consistency, let's
first map displays for a connected encoder.

Jira: None.
Test: Hot plugging external monitors in any order should bring up all
      displays on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove HeadLess.
Kalyan Kondapally [Sat, 23 Sep 2017 09:35:01 +0000 (02:35 -0700)]
Remove HeadLess.

This is now handled by Physical Display itself.

Jira: None.
Test: Build compiles and Virtual Display still works.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReturn status in HWCPoll.
Munish Bhardwaj [Wed, 20 Sep 2017 01:46:54 +0000 (07:16 +0530)]
Return status in HWCPoll.

Jira: None
Test: poll status is available to caller
Signed-off-by: Munish Bhardwaj <munishx.bhardwaj@intel.com>
6 years agoFix External monitor detection during boot up.
Kalyan Kondapally [Fri, 22 Sep 2017 11:15:25 +0000 (04:15 -0700)]
Fix External monitor detection during boot up.

We where notifying the display status during intialization
phase of GPUDevice, which resets all state in Physical
Display. Thus, we didnt end up notifying SF about the
connection status when all services where initialized.

Jira: None.
Test: External monitor is detected on Android O.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix crash when no display is connected.
Kalyan Kondapally [Fri, 22 Sep 2017 09:30:56 +0000 (02:30 -0700)]
Fix crash when no display is connected.

We might be running in headless mode, if display modes are not
set let's assume we are in this mode. In this case we use
default mode configuration.

Jira: None.
Test: Boot up Joule with no displays attached and ensure we dont
      see any crashes during bootup.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Display frame change check
Lin Johnson [Wed, 20 Sep 2017 07:02:10 +0000 (15:02 +0800)]
Fix Display frame change check

Include top/bottom to detect display frame change

Jira: OAM-49818
Tests: WebView Browser Tester with number keyboard
rendered correctly without any issue

Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoWorkaround: Force refresh primary display when connection status changes.
Kalyan Kondapally [Tue, 19 Sep 2017 22:02:55 +0000 (15:02 -0700)]
Workaround: Force refresh primary display when connection status changes.

As SF expects Primary to be always connected, we donot inform
in case it is physically disconnected. Hence, SF doesn't know
when to update the display in case Primary has been re-connected.
Let's force refresh of primary in this case.

Jira: None.
Test: Primary shows content after being re-connected.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWorkaround: Notify SF of primary display status change only first time.
Kalyan Kondapally [Tue, 19 Sep 2017 05:36:17 +0000 (22:36 -0700)]
Workaround: Notify SF of primary display status change only first time.

SF expects primary display to be always present and not disconnected.
Let's not notify any status changes related to Primary display
after the initial notification.

Jira: None.
Test: Hotplug doesn't cause issues with Primary.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFixed the display pipe power off
Pallavi G [Mon, 18 Sep 2017 08:42:47 +0000 (14:12 +0530)]
Fixed the display pipe power off

DPMS off is enough to turn off the display.
with this patch Hotplug works fine.

Jira: None
Test: Hotplug works fine in Android. Tried 10-15 times.
Signed-off-by: Pallavi G <pallavi.g@intel.com>
6 years agoWorkaround: Fix hotplug issues on Android O.
Kalyan Kondapally [Sun, 17 Sep 2017 04:59:04 +0000 (21:59 -0700)]
Workaround: Fix hotplug issues on Android O.

Looks like SF doesn't cleanup old layers of external display,
thus we end up importing obsolete buffers. Workaround this for
now by cleaning up layers ourselves when an external display
get's disconnected.

Jira: None.
Test: Hotplug brings up external display.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we delete the context of Compositor Thread.
Kalyan Kondapally [Sun, 17 Sep 2017 02:56:57 +0000 (19:56 -0700)]
Ensure we delete the context of Compositor Thread.

We where calling delete from Main thread instead of from
Compositor thread,

Jira: None.
Test: Don't see GL errors after power mode is set to off and
      than On.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDifferentiate between physical disconnect and PowerMode state kOff.
Kalyan Kondapally [Sun, 17 Sep 2017 02:53:49 +0000 (19:53 -0700)]
Differentiate between physical disconnect and PowerMode state kOff.

In Disconnect, we where re-setting the power mode to off. This
had a counter effect when re-connecting the display as we want
to continue maintaining the same power mode as previous i.e. off,
doze etc. Let's not reset the power mode state tracker in
PhysicalDisplay, instead just call into DisplayQueue. This should
ensure we always power on to the correct power mode.

Jira: None.
Test: Enable HotPlugEvent traces and ensure we dont power off a
      re-connected display.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix connected boot in android.
Harish Krupo [Fri, 15 Sep 2017 04:54:27 +0000 (10:24 +0530)]
Fix connected boot in android.

Don't unset kNotifyClient state for the external display as we are not
going to notify Surface Flinger about it during RegisterHotPlugCallback.

Jira: None
Test: The external display is also detected works when connected during
  boot.
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix the external display not init when start Android UI.
Fan, Yugang [Tue, 12 Sep 2017 12:23:04 +0000 (20:23 +0800)]
Fix the external display not init when start Android UI.

Jira: GSE-35
Test: Connect more than one display of Android platform and
      boot the device, the all display will show same cloned
      content.

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