OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
6 years agoHwclayer: Don't transform when full damage
Harish Krupo [Mon, 9 Jul 2018 08:44:36 +0000 (14:14 +0530)]
Hwclayer: Don't transform when full damage

When the surface damage rects set are 0, the surface_damage_
is equal to the display_frame_. Dont apply transformations in
this case.

Jira: None
Test: Cube test in ApiDemos on android renders correctly

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoMosaicMode: return more reliable fences
Harish Krupo [Fri, 29 Jun 2018 05:34:49 +0000 (11:04 +0530)]
MosaicMode: return more reliable fences

Currently we pick a display with the maximum refresh rate
as the preferred display and return its fence.
Instead, merge the fences from all the displays and return it.
Such merged fences are signaled only when all the individual
fences are signaled.

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

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix Klockwork indirect path traversal issue.
Harish Krupo [Fri, 29 Jun 2018 04:11:19 +0000 (09:41 +0530)]
Fix Klockwork indirect path traversal issue.

Jira: None
Test: File path on
      Android: /vendor/etc/hwc_display.ini
      Linux: {prefix}/etc/hwc_display.ini

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoHwcLayer: Apply rotation transformation to damage.
Harish Krupo [Tue, 12 Jun 2018 20:58:26 +0000 (02:28 +0530)]
HwcLayer: Apply rotation transformation to damage.

This enables us to remove the workaround in Overlaylayer.

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

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix missing mapping for display_transform
Harish Krupo [Sun, 24 Jun 2018 11:21:21 +0000 (16:51 +0530)]
Fix missing mapping for display_transform

Currently the display transform set in the hwc_display.ini file
is according to the HWCRotation enums but the values expected in
Validate transfrom are 0,4,8,16. Instead of directly mapping 0..3
to 0,4,8,16, accept 0..3 as inputs as it simplifies the calculation
of the final plane rotation because 0..3 forms a circulant matrix
over modulo 4 arithmetic.

Jira: None
Tests: If the requested layer rotation if 0 degree and the display
       rotation set in ini file is 90 then the final rotation should
       be 90 degrees.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoAdd option to disable video vpp if va driver is not ready.
Lin Johnson [Thu, 21 Jun 2018 02:55:36 +0000 (10:55 +0800)]
Add option to disable video vpp if va driver is not ready.

For certain reason on some platform the va driver is not enabled,
then video vpp path should be disabled.

Test: video playback normal and no other side effect.
Signed-off-by: Yuanjun Huang <yuanjun.huang@intel.com>
Singed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoignore interlace modes
Liu Zhiquan [Wed, 6 Jun 2018 03:15:58 +0000 (11:15 +0800)]
ignore interlace modes

In AOSP PPR1.180528.001 version code, connector mode config list
reported to SurfaceFlinger are changed to unsorted.
Interlace mode config will be chosen and set in display. This will cause
display shake issue. Interlace mode configs are not requirement on
android, so we ignore them(the flags with DRM_MODE_FLAG_INTERLACE).

Change-Id: I2397045ce127046b942b974f30f1d4d8618a3f80
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-64528
Signed-off-by: Liu Zhiquan <zhiquan.liu@intel.com>
6 years agoWeston: Don't use vblank for frame completion.
Harish Krupo [Sun, 10 Jun 2018 11:02:28 +0000 (16:32 +0530)]
Weston: Don't use vblank for frame completion.

For some reason when using vblank callback as an indication
of frame completion the weston-simple-egl app reports a fps
of ~30-40. Thus instead of using the vblank callback, use the
received release fence.
This patch adds the release fence to the fds polled in the main
loop to use as an indication of frame completion.

Jira: None
Test: The weston-simple-egl app should report ~60 FPS

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoGpudevice: Return total_displays_ as reference.
Harish Krupo [Tue, 5 Jun 2018 04:01:16 +0000 (09:31 +0530)]
Gpudevice: Return total_displays_ as reference.

This is to avoid un-necessary copies of the vector.

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

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix compilation Errors for Nested Display
Kishore Kadiyala [Thu, 7 Jun 2018 05:34:56 +0000 (11:04 +0530)]
Fix compilation Errors for Nested Display

Jira: None
Test: Compilation with Nested Display enabled should PASS

Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
6 years agoUpdate README.md
kalyan kondapally [Tue, 5 Jun 2018 18:24:13 +0000 (11:24 -0700)]
Update README.md

6 years agoFix compilation warnings.
Harish Krupo [Mon, 4 Jun 2018 08:38:12 +0000 (14:08 +0530)]
Fix compilation warnings.

As a consequence of this change, linux_test app doesn't
crash when compiled using gcc 8.1.0

Jira: None
Test: Compile the test app with gcc 8.1.0 and run. It shouldn't
      crash.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agolinux: Only build against Mesa GBM
Kevin Strasser [Fri, 27 Apr 2018 20:42:30 +0000 (13:42 -0700)]
linux: Only build against Mesa GBM

Remove minigbm bindings from the Linux platform code and make Mesa GBM the
only target. This will simplify the build process on the Linux side and
drops an untested build configuration.

Jira: GSE-1565
Test: Try demo apps on Linux

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFix Mesa GBM support
Kevin Strasser [Fri, 11 May 2018 22:35:29 +0000 (15:35 -0700)]
Fix Mesa GBM support

With the introduction of RBC support in commit 45e7bb0 the Mesa GBM Linux
build has been hitting an error. It seems that this path was just left
behind. Add handling for Mesa GBM with modifiers.

GH-351
Jira: GSE-1565
Test: Configure with '--enable-gbm' and try demo apps on Linux

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoApply damage transformations in GetLayerDamage
Harish Krupo [Fri, 1 Jun 2018 08:32:22 +0000 (14:02 +0530)]
Apply damage transformations in GetLayerDamage

This patch drops UpdateRenderingDamage() call and
instead applies the required transformations in
GetLayerDamage() and intersects it with the visible
region (if set) to calculate the layer's damage.

Jira: None
Test: The full ball is rendered correctly when
      weston-simple-damage application is run.
      No regressions on Android and Linux.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix dump information
Harish Krupo [Fri, 1 Jun 2018 13:38:18 +0000 (19:08 +0530)]
Fix dump information

Currently the ReflectY property is being dumped twice instead
of the Transform90.

Jira: None
Test: When ENABLE_DISPLAY_DUMP is enabled, the information is
      properly dumped.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoSet lock file path at build time.
Harish Krupo [Thu, 31 May 2018 09:36:03 +0000 (15:06 +0530)]
Set lock file path at build time.

Jira: None
Test: File path on
      Android: /vendor/etc/hwc.lock
      Linux: {prefix}/etc/hwc.lock

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFrameBufferManager Instance owned by GPUDevice
Richard Avelar [Mon, 21 May 2018 18:50:42 +0000 (11:50 -0700)]
FrameBufferManager Instance owned by GPUDevice

This patch addresses issue #303 and has the GpuDevice take ownership
of the FrameBufferManager Instance which then gets passed to all
displays on initialization to pass to the drmbuffer and the
compositorthread as needed in place of calling the instances from
FrameBufferManager directly.

Jira: None
Test: HWC build passes without errors
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agoFix crash in SetCloneMode.
Kalyan Kondapally [Fri, 1 Jun 2018 06:23:10 +0000 (23:23 -0700)]
Fix crash in SetCloneMode.

We might be calling into this API during initialization, even
if display is disconnected. This means DisplayQueue is not
fully initialized during this time. Let's check if all objects
are properly initialized before using them.

Jira: None.
Test: No crash seen during boot up.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoStop assuming that enums is a valid pointer when count_enums > 0
Kevin Strasser [Tue, 29 May 2018 23:03:40 +0000 (16:03 -0700)]
Stop assuming that enums is a valid pointer when count_enums > 0

If libdrm fails to allocate enums for some reason it will still give us a
value in count_enums that it meant to allocate. This would be a rare
condition but we ought to handle it.

Test: Build and boot on Android
Bug: GSE-1586

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFixed the HWC crash due to improper thread initialization sequence.
Wan Shuang [Mon, 28 May 2018 11:45:18 +0000 (19:45 +0800)]
Fixed the HWC crash due to improper thread initialization sequence.

The thread of GpuDevice is started before DRM Display Manager's
Initialization method, there is a chance that GpuDevice thread
call method of display manager but underlying DRM display manager
implementation still not fully initialized yet. This will lead
HWC crash.

JIRA: OAM-63288
Test: Switch clone & mosaic mode and no crash during boot.

Signed-off-by: Wan Shuang <shuang.wan@intel.com>
6 years agoPartial revert of c72b95e622cf0c5a31f258851425070e24bf1f3c.
Kalyan Kondapally [Mon, 28 May 2018 07:12:52 +0000 (00:12 -0700)]
Partial revert of c72b95e622cf0c5a31f258851425070e24bf1f3c.

Jira: None.
Test: Fixes crash during boot up when u have more than 1
      app holding the lock.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnable surface damage support for cloned display.
Kalyan Kondapally [Sun, 27 May 2018 21:44:33 +0000 (14:44 -0700)]
Enable surface damage support for cloned display.

We always invalidated all layers in case of cloned display.
Instead we could track the damage of any gpu composited layers
and only re-render those layers even in case of cloned
display.

Jira: None.
Test: No rendering artifacts seen with cloned display on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack Surface Damage as part of OverlayLayer only.
Kalyan Kondapally [Sat, 26 May 2018 22:10:35 +0000 (15:10 -0700)]
Track Surface Damage as part of OverlayLayer only.

We had this in both places NativeSurface and OverlayLayer.
Let's track this in overlaylayer only.

Jira: None.
Test: No new flickers/artifacts seen on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support to dynamically disable last overlay usage.
Kalyan Kondapally [Sun, 27 May 2018 08:45:07 +0000 (01:45 -0700)]
Add support to dynamically disable last overlay usage.

Jira: None.
Test: APL boards don't reboot when multi monitors are connected
      and all planes are in use.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure DisplayManager is initialized before accessing it.
Kalyan Kondapally [Fri, 25 May 2018 18:18:52 +0000 (11:18 -0700)]
Ensure DisplayManager is initialized before accessing it.

Jira: None.
Test: No crash observed when IgnoreUpdates is called from
      Worker Thread.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDon't compose Nesteddisplay surface while no SOS side connection.
xue.yifei [Thu, 24 May 2018 01:36:23 +0000 (09:36 +0800)]
Don't compose Nesteddisplay surface while no SOS side connection.

Nesteddisplay leverage SurfaceFlinger do composition, skip it
while no SOS side buffer sharing request to optimize GPU
consumption.

Jira: None
Test: Tested on android
Signed-off-by: xue.yifei <yifei.xue@intel.com>
6 years agoFix warning.
Kalyan Kondapally [Thu, 24 May 2018 06:43:37 +0000 (23:43 -0700)]
Fix warning.

Jira: None.
Test: Build passes without any warnings.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoMove display fence polling to DrmDisplay.
Kalyan Kondapally [Wed, 23 May 2018 07:39:35 +0000 (00:39 -0700)]
Move display fence polling to DrmDisplay.

This should give us bit extra time to populate things like
plane properties needed for that given commit.

Jira: None.
Test: No new commit failures on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDon't clear surface if only src rect has changed.
Kalyan Kondapally [Wed, 23 May 2018 07:31:53 +0000 (00:31 -0700)]
Don't clear surface if only src rect has changed.

We clear surface as needed depending on Display rect
changes. This should be enough to handle all cases.

Jira: None.
Test: No new regressions seen on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFixed HWC crash caused by index out of range.
Wan Shuang [Thu, 24 May 2018 02:41:26 +0000 (10:41 +0800)]
Fixed HWC crash caused by index out of range.

HWC run into crash if physical display numbers defined in
  hwc_config.ini large than the displays enumerated from DRM API.

JIRA: OAM-63201
Test: Boot into Android UI home screen.

Signed-off-by: Wan Shuang <shuang.wan@intel.com>
6 years agoAdd README file.
Kalyan Kondapally [Wed, 23 May 2018 22:55:54 +0000 (15:55 -0700)]
Add README file.

Jira: None.
Test: None.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoVarenderer should call vaSyncSurface before commit.
Lin Johnson [Wed, 23 May 2018 08:32:10 +0000 (01:32 -0700)]
Varenderer should call vaSyncSurface before commit.

This seems needed to ensure we have a consistent FPS
as we don't have fence support when using VPP.

Jira: https://jira01.devtools.intel.com/browse/OAM-63127
Test: We hit 60 fps with Video Playback.

Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoAdd explicit type to HWCTransform enum
Kevin Strasser [Mon, 21 May 2018 23:55:14 +0000 (16:55 -0700)]
Add explicit type to HWCTransform enum

There are several places in the code where we make an assumption about the
data type of this enum. Lets make it official in the definition.

Jira: GSE-1599
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoHwcDisplay: disable assignment operator
Kevin Strasser [Mon, 21 May 2018 22:38:24 +0000 (15:38 -0700)]
HwcDisplay: disable assignment operator

Given that we have already disabled the default copy constructor, we probably
don't want assignment operator.

Jira: GSE-1599
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoCompositor: disable assignment operator
Kevin Strasser [Mon, 21 May 2018 22:27:31 +0000 (15:27 -0700)]
Compositor: disable assignment operator

Given that we have already disabled the default copy constructor, we probably
don't want assignment operator.

Jira: GSE-1599
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoVirtualDisplay: disable copy constructor and assignment operator
Kevin Strasser [Mon, 21 May 2018 22:17:27 +0000 (15:17 -0700)]
VirtualDisplay: disable copy constructor and assignment operator

Otherwise the destructor could cause double free.

Jira: GSE-1599
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFix buffer creation check
Kevin Strasser [Thu, 17 May 2018 23:10:09 +0000 (16:10 -0700)]
Fix buffer creation check

We should be checking the result of the second CreateBuffer call,
otherwise this check is redundant. Also, taking the opportunity
to avoid binding handles in error paths.

Jira: GSE-1597
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoDrop unused variable
Kevin Strasser [Thu, 17 May 2018 23:27:09 +0000 (16:27 -0700)]
Drop unused variable

configIndex is never accessed, just drop it.

Jira: GSE-1597
Test: Build and boot to graphics on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoBeginFrame should have void return type
Kevin Strasser [Thu, 17 May 2018 22:43:04 +0000 (15:43 -0700)]
BeginFrame should have void return type

This function can only return true so just drop the return type and
stop checking for false at call sites.

Jira: GSE-1597
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoCalculateRenderState should have void return type
Kevin Strasser [Thu, 17 May 2018 22:01:18 +0000 (15:01 -0700)]
CalculateRenderState should have void return type

This function can only return true so just drop the return type and
stop checking for false at call sites.

Jira: GSE-1597
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFix flicker during boot up.
Wan Shuang [Thu, 17 May 2018 10:05:06 +0000 (18:05 +0800)]
Fix flicker during boot up.

Skip rendering Android system UI if /vendor/hwc.lock
is present and exclusively locked by another process.
This is to avoid screen flash if earlyEVS and HWC both
rendering content into DRM. The Android system UI will
be rendered once we get the exclusive clock.

JIRA: OAM-60710
Test: Boot into home screen in normal boot flow;
      Show earlyEVS camera content if boot with showing rear view
        camera mode;
      Show Android system UI if exit showing rear view camera mode.
      Unplug/Plug the HDMI displays several times

Signed-off-by: Wan Shuang <shuang.wan@intel.com>
6 years agoFix Klockwork NULL pointer dereference issue
Michele Lim [Wed, 16 May 2018 16:40:32 +0000 (09:40 -0700)]
Fix Klockwork NULL pointer dereference issue

Results of function that can return NULL may be dereferenced and
cause catastrophic failure.

Jira: GSE-1592
Test: Builds on Android

Signed-off-by: Michele Lim <michele.lim@intel.com>
[strassek: cleanup 1 NULL check]
Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFree drm objects before returning
Kevin Strasser [Thu, 17 May 2018 20:37:46 +0000 (13:37 -0700)]
Free drm objects before returning

This memory needs to be freed before we return or it will be a leak.

Jira: GSE-1595
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoAdd fourcc defines.
Kalyan Kondapally [Thu, 17 May 2018 06:33:51 +0000 (23:33 -0700)]
Add fourcc defines.

This removes need to carry extra patches in libdrm side.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAlso ensure blob data field is non-null
Kevin Strasser [Thu, 17 May 2018 00:33:31 +0000 (17:33 -0700)]
Also ensure blob data field is non-null

The kernel is allowed to return blob.length=0, and so the data
field would be unallocated. Add a check for that too.

Jira: GSE-1593
Test: Build and boot on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoFix uninitialized variables
Kevin Strasser [Wed, 16 May 2018 23:24:30 +0000 (16:24 -0700)]
Fix uninitialized variables

Initialize member variables found in Klocwork scan. Also, do all
initialization in constructor init list.

Jira: GSE-1594
Test: Build and boot to graphics on Android

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agova: Avoid storing references to local variables outside of scope
Kevin Strasser [Mon, 14 May 2018 22:45:56 +0000 (15:45 -0700)]
va: Avoid storing references to local variables outside of scope

The member variable 'param_' gets a couple of its fields set to the
addresses of local stack memory, which become dangling pointers once the
Draw() call completes. This currently doesn't cause any issues as that
memory doesn't get accessed outside of the Draw() function, but lets take
the opportunity to improve our book keeping and don't allow invalid
references.

Also, simplify the process of getting the filter_flags field.

KW-122240
KW-122241

Jira: GSE-1587
Test: Build and try media demo apps

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoEnsure property blob pointer is non-null
Kevin Strasser [Mon, 14 May 2018 21:14:48 +0000 (14:14 -0700)]
Ensure property blob pointer is non-null

If something goes wrong in drmModeGetPropertyBlob() the blob pointer gets
set to NULL and then it is dereferenced. Add a check and fail out on NULL.

KW-41317
KW-41318

Jira: GSE-1587
Test: Check that the build passes and demo apps keep running

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agoDon't invalidate the whole cache in case layer z-order has changed.
Kalyan Kondapally [Tue, 15 May 2018 07:34:13 +0000 (00:34 -0700)]
Don't invalidate the whole cache in case layer z-order has changed.

Instead let's revalidate and ensure the new layer-plane combination
is valid first. If this fails, we anyway fall back to re-validate
the whole cache.

Jira: None.
Test: No commit failures seen when moving between views/apps on
      Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid redundant test commits in case layer z-order has changed.
Kalyan Kondapally [Tue, 15 May 2018 07:23:32 +0000 (00:23 -0700)]
Avoid redundant test commits in case layer z-order has changed.

We can avoid redundant test commit in case previous layer is
GPU Composited. Instead, we can damage the display frame of
previous layer along with current layer damage to ensure
both regions are updated.

Jira: None.
Test: Launch different apps on Android and ensure no new rendering
      artifacts.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agocompositor thread: adding corner case check before wait in Draw.
Yuanjun Huang [Fri, 4 May 2018 08:09:11 +0000 (16:09 +0800)]
compositor thread: adding corner case check before wait in Draw.

Adding the check to avoid compositor thread not responsing in some
corner case and leads to UIWDT that found in android stability test.

Jira: https://jira01.devtools.intel.com/browse/OAM-61985
Test: stability test

Signed-off-by: Yuanjun Huang <yuanjun.huang@intel.com>
6 years agoRemove DAMAGE_THRESHOLD work around
Harish Krupo [Tue, 15 May 2018 02:36:08 +0000 (08:06 +0530)]
Remove DAMAGE_THRESHOLD work around

Jira: None
Test: Content is rendered correctly on Android when u have status
      bar displayed with any applications.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoTransform surface damage to global co-ordinates
Harish Krupo [Fri, 4 May 2018 17:22:56 +0000 (22:52 +0530)]
Transform surface damage to global co-ordinates

Surface damage for a layer is set in the layer local
co-ordintates. The surface damage has to be converted to the
display global co-ordinates before assigning it to the
current_rendering_damage variable.

Jira: None
Test: With the surface damage work around removed the contents of
      weston terminal should be updated properly for each frame.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoOverlaylayer: Dump more information
Harish Krupo [Sun, 6 May 2018 06:49:32 +0000 (12:19 +0530)]
Overlaylayer: Dump more information

Dump Source crop, display frame and surface damage
when ENABLE_DISPLAY_DUMP is enabled.

Jira: None
Test: When ENABLE_DISPLAY_DUMP is defined, each layer's
      surface damage, souce crop and display frame rects
      are dumped.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agotravis-ci update: Add cppcheck run on codebase
Richard Avelar [Thu, 26 Apr 2018 19:58:02 +0000 (12:58 -0700)]
travis-ci update: Add cppcheck run on codebase

This patch adds a cppcheck install and execution command to
run cppcheck on each pull request to make sure that there is
no resulting errors.

Jira: None
Test: Travis fails if cppcheck finds errors and passes otherwise.
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agovk: Fix building with Vulkan backend
Kalyan Kondapally [Mon, 30 Apr 2018 03:38:57 +0000 (20:38 -0700)]
vk: Fix building with Vulkan backend

The internal APIs have changed considerably which has caused breakages in
the Vulkan enabled build. Make changes needed to get it building cleanly
again.

Note: While this change gets vk building again, it does not fully restore
its functionality. More work is needed to solve rendering issues.

GH-283
Jira: None
Test: Configure with --enable-vulkan and check that build passes

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
6 years agotravis: Run clang-format
Harish Krupo [Thu, 26 Apr 2018 03:37:14 +0000 (09:07 +0530)]
travis: Run clang-format

Make travis run clang-format on the pull request to check
if the patch requires formatting.

Jira: None
Test: travis build stops if patch requires formatting.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoVA: rotation should be reversed when mirror is used
Lin Johnson [Thu, 26 Apr 2018 05:24:37 +0000 (22:24 -0700)]
VA: rotation should be reversed when mirror is used

It is because VA is using rotation + mirror, while
camera expecting mirror + rotation. Reverse the rotation
will make sure identical result instead of diffrent
processing order.

Jira:  https://jira01.devtools.intel.com/browse/OAM-61084
Tests: CTS Camera orientation verifier
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoWeston: Enable DPMS
Harish Krupo [Thu, 26 Apr 2018 05:17:41 +0000 (22:17 -0700)]
Weston: Enable DPMS

This patch adds code to enable dpms in the linux frontend and implements
the set_dpms hook in the iahwc backend.

Jira: None
Test: Display turns off after an idle period and is powered
      back on when input is received.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoRemove various dead code
Richard Avelar [Wed, 18 Apr 2018 19:12:28 +0000 (12:12 -0700)]
Remove various dead code

utils_alios.h had an unnecessary assignment

yallocbufferhandler.h had an unused member

gralloc1bufferhandler.h had an unused member

iahwc2.cpp and .h had a color_mode_ that was not used anywhere

gbmbufferhandler.cpp needs a fixme note since I am not sure why
the mod variable is being used outside of the if statement when it
isn't initialized to begin with.

Jira: None
Test: HWC build passes without errors
Signed-off-by: Richard Avelar <richard.avelar@intel.com>
6 years agoFix build error for missing header file.
Randy Xu [Tue, 30 Jan 2018 09:12:46 +0000 (17:12 +0800)]
Fix build error for missing header file.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Randy Xu <randy.xu@intel.com>
Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
6 years agoReformat files with clang-format
Richard Avelar [Wed, 25 Apr 2018 20:03:29 +0000 (13:03 -0700)]
Reformat files with clang-format

This patch is the last in a series to get all cpp/h files across
the hwc project to adhear to the clang formatting standards.
This patch focuses specifically on the os directory.

Jira: None
Test: HWC build passes without errors.

Signed-off-by: Richard Avelar <richard.avelar@intel.com>
6 years agoSpecify pointer alignment in .clang-format
Richard Avelar [Tue, 24 Apr 2018 18:42:56 +0000 (11:42 -0700)]
Specify pointer alignment in .clang-format

Add line in .clang-format to right align pointer and leave a
comment to avoid using older clang-format version than 5.
Clang is available up to version 7 currently.

Jira: None
Test: Running clang with the modified .clang-format now right aligns pointers
Signed-off-by: Richard Avelar <richard.avelar@intel.com>
6 years agoReformat files with clang-format
Richard Avelar [Thu, 19 Apr 2018 18:22:50 +0000 (11:22 -0700)]
Reformat files with clang-format

Ran a clang-format on multiple directories. This align formatting once
and for all to avoid having to run clang-format and get a bunch of
formatting changes that aren't relevant to the patch you're working on
but end up sticking around.

Jira: None
Test: HWC build passes without errors
Signed-off-by: Richard Avelar <csravelar@gmail.com>
6 years agoWeston: Fix window animation
Harish Krupo [Sun, 22 Apr 2018 08:46:57 +0000 (14:16 +0530)]
Weston: Fix window animation

Weston animates the opening of new windows in a spring like motion.
This is achieved by setting src_{w,h} of the buffer smaller than
the actual buffer width/height and varying the dest_{w,h}.
Previously we were fixing the source buffer dimentions to the acutal
buffer dimentions. This patch uses the dimentions provided by weston
instead of the actual buffer dimentions.

Jira: None
Test: Windows should open with a spring like animation.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoFix warnings on Android.
Kalyan Kondapally [Sun, 22 Apr 2018 18:56:14 +0000 (11:56 -0700)]
Fix warnings on Android.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agousing built-in prebuilt shader binaries (v3)
Dongwon Kim [Fri, 20 Apr 2018 19:16:54 +0000 (12:16 -0700)]
using built-in prebuilt shader binaries (v3)

with configure option,

--with-prebuilt-shader-pci-id=[PCI ID of target GPU]

The build script tries to generate, compile and link shaders to generate
header files with shader program binary using the resources under
'common/compositor/gl/gl_shader_pre_built/'

These header files are automatically included in glprogram.cpp so the
program can try to load this before trying other methods (loading files
or compiling-linking from source).

v2: rebased

v3: minor code-format adjustment

Jira: None.
Test: Linux tests continue to work as now.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
6 years agoextra resources required for generating shader program binary (v3)
Dongwon Kim [Wed, 28 Mar 2018 22:57:45 +0000 (15:57 -0700)]
extra resources required for generating shader program binary (v3)

Collection of resources needed for pre-processing of prebuilt shader
programs. Its final goal is to generate program binary in the form of
header file that can be included when HWC is built.

'generate_c_arrays.sh' is the starting point of this process. It first
generates shader_test files with given shader source code then passes
those to the 'shader-db' ('shader-db' directory or a symbolic link to
it is required to be in the same directory as this script) to get them
compiled and linked then creates header files with the shader program
binary.

Subsequential patch(es) on gl compostor code will add the option to use
this built-in binaries in generated header files.

v2: more error checks on file stream ptrs and binary_sz in bin_to_c_array.c

v3: 1. bin_to_c_array.c code format adjustment using clang-format
    2. change year to 2018 in license phrase
    3. not printing out usage help (print_usage()) when not needed

Jira: None.
Test: Linux tests continue to work as now.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
6 years agoPre-built shader program support (v4)
Dongwon Kim [Wed, 28 Mar 2018 21:32:11 +0000 (14:32 -0700)]
Pre-built shader program support (v4)

gl-program now tries to use pre-built shader program if available
to save time by skipping run-time build.

pre-built shader file name accepted by the program is,

'hwc_shader_prog_<number of layers>.shader_test.bin'

And these files are expected to be located at '/vendor/etc/'

v2: 1. using get_proc to map glProgramBinaryOES
    2. null checking on binary_prog
    3. making sure freeing binary_prog only once

v3: 1. removed extension check on GL_MESA_program_binary_formats
       since it's not exposed now in MESA driver
    2. define PREBUILT_SHADER_FILE_PATH in the build script

v4: 1. file loading is tried only if LOAD_PREBUILT_SHADER_FILE is defined
    2. adjusted code formats using clang-format
    3. use goto instead of having multi-level nested if-else
    4. limit the size of shader program binary file to 10MB

Jira: None.
Test: Linux tests continue to work as now.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
6 years agoWeston: Use system clock for timestamps
Harish Krupo [Thu, 19 Apr 2018 18:56:40 +0000 (00:26 +0530)]
Weston: Use system clock for timestamps

Few applications depend on the timestamp sent in the
frame callback for deciding their animation rate.
This timestamp is in turn calculated from the timestamp sent
to the compositor in the weston_output_finish_frame call. Big
differences between two vblank timestamps causes sudden jerks
in the application's animation. So, instead of the vblank
timestamps use the system clock for the timestamp.

Jira: None
Test: Sudden jumps in the animation of weston-simple-damage
      should not be seen.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Upload only damaged region.
Harish Krupo [Tue, 17 Apr 2018 12:14:44 +0000 (17:44 +0530)]
Weston: Upload only damaged region.

Take the surface damage into account when uploading shm
memory. This patch also reorders the layer's state setting
so that the damage, layer usage properties are set before
setting the damage.

Jira: None
Test: Weston-simple-damage still renders correctly

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoRemove unused file.
Kalyan Kondapally [Wed, 18 Apr 2018 03:59:33 +0000 (20:59 -0700)]
Remove unused file.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid swap in case Damage and Display Rect are same.
samiuddi [Fri, 13 Apr 2018 07:28:31 +0000 (12:58 +0530)]
Avoid swap in case Damage and Display Rect are same.

After 90/270 degree rotation is done,the source layer
dimensions are already updated, so swap is not required here.

Jira: 59439
Test: Rendering works fine when displays are rotated 90/270

Signed-off-by: samiuddi sami.uddin.mohammad@intel.com
6 years agovarenderer: Calculate mirror state.
Lin Johnson [Wed, 18 Apr 2018 03:28:34 +0000 (20:28 -0700)]
varenderer: Calculate mirror state.

We only applied rotation but didn't take into
account if we need to mirror things horizontally or
vertically in case transform in 90/270. This patch fixes
it.

Jira:https://jira01.devtools.intel.com/browse/OAM-61084
Tests: Camera Orientation works correctly.
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoFix crash in UpdateDisplayConfig.
Kalyan Kondapally [Sat, 14 Apr 2018 07:11:34 +0000 (00:11 -0700)]
Fix crash in UpdateDisplayConfig.

We tried to access modes_, without checking if it was empty
or not. Just return in case modes are empty.

Jira: None.
Test: No crash running Media cts tests on Android IA.

6 years agolinux_frontend: Inital plumbing for hotplug enablement
Harish Krupo [Mon, 16 Apr 2018 15:03:27 +0000 (20:33 +0530)]
linux_frontend: Inital plumbing for hotplug enablement

This patch adds the required code so that multi-display support can
be enabled in weston. It also takes care of starting/killing the
pixel uploader thread on display connected/disconnected events,
respectively.

Jira: None
Test: As this commit doesn't change much in weston. Weston is expected
      to work as before.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoCleanup code in core
Richard Avelar [Tue, 17 Apr 2018 16:47:43 +0000 (09:47 -0700)]
Cleanup code in core

Jira: None
Test: Builds without error
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agoFix bug where assignment has no effect
Richard Avelar [Tue, 17 Apr 2018 20:22:57 +0000 (13:22 -0700)]
Fix bug where assignment has no effect

Jira: None
Test: Builds without error
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agoWeston: Ensure we have only one texture upload at a time.
Kalyan Kondapally [Mon, 16 Apr 2018 07:40:46 +0000 (00:40 -0700)]
Weston: Ensure we have only one texture upload at a time.

We queue up buffers needing texture uploads.However, if the buffer
is too far away in the queue, we may not be able to notify that
we are in process of accessing it. Now, let's make sure we atleast
notify about the buffer access in UpdateLayerPixelData.

Jira: None.
Test: No tearing seen with more than 3 terminals opened.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agolinux_frontend: Destroy handle
Harish Krupo [Mon, 16 Apr 2018 03:49:26 +0000 (09:19 +0530)]
linux_frontend: Destroy handle

Destroy handle when releasing the buffer.

Jira: None
Test: weston-simple-egl works

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Ignore events with time stamps less than refresh rate.
Kalyan Kondapally [Mon, 16 Apr 2018 00:08:45 +0000 (17:08 -0700)]
Weston: Ignore events with time stamps less than refresh rate.

Jira: None.
Test: Less layers are invalid during plane assignment.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd DisplayPlaneManager check.
Caiwen Zhang [Sun, 15 Apr 2018 21:38:26 +0000 (14:38 -0700)]
Add DisplayPlaneManager check.

Ensure DisplayPlaneManager object is valid before
trying to use it in HandleExit. This might be scenario
where DisplayQueue is not initialized before powermode
is called.

Jira: None.
Test: Fixes seg faults when trying to power off
      disconnected display.

Signed-off-by: Caiwen Zhang <caiwen.zhang@intel.com>
6 years agoAlios: Remove commented out code.
Caiwen Zhang [Sun, 15 Apr 2018 21:34:03 +0000 (14:34 -0700)]
Alios: Remove commented out code.

Jira: None.
Test: Build succeeds.

Signed-off-by: Caiwen Zhang <caiwen.zhang@intel.com>
6 years agoPopulate ids in reverse order.
Kalyan Kondapally [Sun, 15 Apr 2018 11:59:38 +0000 (04:59 -0700)]
Populate ids in reverse order.

In InitializeLayerHashGenerator we add layer id's from
0 to size. However, when assigning id to layer we start
from the back (i.e. size -1). This is confusing when
trying to map layer id and place of the layer in the
stack. Instead we populate the layer id's in reverse
order now.

Jira: None.
Test: Android boots up to home screen and weston launches.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Try deleting layers only if current layers < previous.
Kalyan Kondapally [Sun, 15 Apr 2018 11:56:18 +0000 (04:56 -0700)]
Weston: Try deleting layers only if current layers < previous.

Goal here is only to delete any excess layers we have.
We where looping through all layers even though current
frame might be showing more layers than previous one.
This is not needed and this patch fixes it.

Jira: None.
Test: iahwc_overlay_destroy is not called in case we are
      rendering more layers this frame than previous one.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Remove redundant comments.
Kalyan Kondapally [Sun, 15 Apr 2018 08:55:15 +0000 (01:55 -0700)]
Weston: Remove redundant comments.

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Clear Overlay damage after present is called.
Kalyan Kondapally [Sun, 15 Apr 2018 08:20:50 +0000 (01:20 -0700)]
Weston: Clear Overlay damage after present is called.

We should have already updated all layers by now. Clear
any old damage rects of overlay and primary to avoid
redundant paintings.

Jira: None.
Test: Weston tests demos still work.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Remove un-used planes.
Kalyan Kondapally [Sun, 15 Apr 2018 08:08:46 +0000 (01:08 -0700)]
Weston: Remove un-used planes.

We never used these planes after initializing them. Remove
redundant code.

Jira: None.
Test: Build passes on Linux.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Rename d_plane as overlay_plane.
Kalyan Kondapally [Sun, 15 Apr 2018 08:00:14 +0000 (01:00 -0700)]
Weston: Rename d_plane as overlay_plane.

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Dont move layers to primary.
Kalyan Kondapally [Sun, 15 Apr 2018 07:50:25 +0000 (00:50 -0700)]
Weston: Dont move layers to primary.

We don't use this plane and thus their is no value in moving
the layers to this plane.

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Remove redundant calculations.
Kalyan Kondapally [Sun, 15 Apr 2018 07:39:12 +0000 (00:39 -0700)]
Weston: Remove redundant calculations.

We didn't use these while setting overlays.

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Enable Damage support.
Kalyan Kondapally [Sun, 15 Apr 2018 06:29:18 +0000 (23:29 -0700)]
Weston: Enable Damage support.

We where using source_crop as the damage of layer every
frame instead of union of buffer, surface damage. This also
avoids re-uploading same buffer content in case of pixel buffers.
In future we can use buffer damage to optmize texture uploads.

Jira: None.
Test: Weston demos work as now.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Clean up weston implementation.
Kalyan Kondapally [Sun, 15 Apr 2018 01:42:28 +0000 (18:42 -0700)]
Weston: Clean up weston implementation.

Commit does the following:
1)Removes unused code.
2)Adds run time support to enable/disable overlays.
3)Recycle layers.

Jira: None.
Test: Weston still launches.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Set meta_data_ to zero on initialization.
Harish Krupo [Sat, 14 Apr 2018 18:35:24 +0000 (00:05 +0530)]
Weston: Set meta_data_ to zero on initialization.

Jira: None
Test: weston-simple-egl apps works properly

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Re-work Cursor view.
Harish Krupo [Sat, 14 Apr 2018 09:51:55 +0000 (02:51 -0700)]
Weston: Re-work Cursor view.

Instead of having separate logic for cursor layer, combine it
with overlay layer.

Jira: None.
Test: Cursor still shows up with weston.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Move texture upload sync to Display Queue.
Kalyan Kondapally [Sat, 14 Apr 2018 09:09:57 +0000 (02:09 -0700)]
Weston: Move texture upload sync to Display Queue.

This would make it possible to parallely handle texture uploads
while layer validation is being done.

Jira: None.
Test: Weston demos can be run as now.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Add api to set layer index
Harish Krupo [Sat, 14 Apr 2018 07:29:49 +0000 (12:59 +0530)]
Weston: Add api to set layer index

In the case where the number of layers requested is more than
the value with which the LayerHashGenerator is initialized,
the layers get reordered in the map and thus are incorrectly
rendered.
To solve this, we let the compositor set a particular layer's index
or z-order with the following assumption:
The layer index set by the compositor is numbered from bottom -> top,
i.e. the bottom most layer has the index of 0 and increases upwards.

Jira: None.
Test: Weston demos show up correctly.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Don't set alpha value for layers
Harish Krupo [Thu, 12 Apr 2018 14:26:46 +0000 (19:56 +0530)]
Weston: Don't set alpha value for layers

The raw pixel data that we get is has alpha value premultipled
so set blending premultiplied instead.

Jira: None.
Test: Background shows correctly when weston is launched.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Do not use primary_plane
Harish Krupo [Thu, 12 Apr 2018 14:05:42 +0000 (19:35 +0530)]
Weston: Do not use primary_plane

Currently the primary plane in weston is only used for buffers
which do not have any buffer reference. So, disable the usage of
this plane and its rendering in the plugin.

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>