OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
7 years agoHot plug event handler modified to reduce cycles consumed
Aravindan M [Fri, 21 Apr 2017 10:21:55 +0000 (15:51 +0530)]
Hot plug event handler modified to reduce cycles consumed

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

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

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

Result: Improves performance.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Jira: None
Test: Able to dump the screenrecord output

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

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

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

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

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

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

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

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

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

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

Bug: 37487613
Change-Id: Id5278b2e131d2a635546595ef38f154c238f7c9d

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

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

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

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

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

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

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

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

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

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

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

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

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

Seems un-necessary with latest code base.

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

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

This missed out in commit f79b6ea.

Jira: None.
Test: Build passes.

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

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

Jira: None.
Test: No regressions in benchmarks.

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

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

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

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

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

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

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

Regression introduced by the cursor plane 3d fallback fix

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

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

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

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

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

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

This reverts commit 3323f07aa3d70c5bd2910a3fbcbd59e8a17127ce.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Jira: None
Test: Build Passed with Display dump enable

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

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

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

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

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

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

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

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

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

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

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

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd color correction tests to check gamma color remap
Yugang, Fan [Tue, 28 Mar 2017 16:52:23 +0000 (00:52 +0800)]
Add color correction tests to check gamma color remap

Reused igt test kms_pipe_color/test_pipe_gamma source and check if
HWC gamma value 0 can remap gradient colors to solid. Build and run
colorcorrection_autotest binary, check if the test can print "PASSED".

JIRA: IAHWC-55
Test: build the colorcorrection_autotest successfully and run it, the
  test will compare crc value of each display pipe which show solid
  colors and each display pipe which show gradient colors with
  gamma value 0 remapping (after remapping, the gradient will
  become to solid), and print "PASSED" if test result is
  successful).

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoAdd color correction relevant APIs.
Yugang, Fan [Tue, 28 Mar 2017 16:51:32 +0000 (00:51 +0800)]
Add color correction relevant APIs.

Added three APIs for gamma, contrast and brightness to hwc display for
color correction. The gamma API accepts float value for RGB colors,
contrast and brightness APIs accept 0 ~ 255 unsigned int value, and
bigger value with stronger contrast/brightness.
Added one APIs for DRM boardcast rgb range setting, e.g. change default
"Automatic" to "Full" so that color correction gamma API can remap
gradient colors to solid color.
Added display pipe API for color correction test using which need get
crc value for each connected pipe.

Jira: IAHWC-55
Test: call color correction APIs when show colors in display in HWC
  display class to check if the display hardware change the effect
  on orignial colors. and some video card need set boardcast rgb to
  "Full" to remap colors to 0~255 before calling color correction.
  And call display API to check if the pipe number is correct.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoTests: Initialize all variables correctly.
Johnson Lin [Mon, 27 Mar 2017 06:03:46 +0000 (14:03 +0800)]
Tests: Initialize all variables correctly.

JIRA: IAHWC-58
Tests: Build passes and no regressions on Linux.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoAllow the minigbm project to be relocated in the tree
Bruce Beare [Sun, 26 Mar 2017 23:55:46 +0000 (16:55 -0700)]
Allow the minigbm project to be relocated in the tree

Jira: None.
Test: Build passes on Android.

Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
7 years agoMake static analyzers happy.
Kalyan Kondapally [Sun, 26 Mar 2017 23:21:09 +0000 (16:21 -0700)]
Make static analyzers happy.

Add checks and throw error messages as applicable.
We are still left with 7 issues mostly in tests which will be
handled in followup patches.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support to handle both Double Buffered & Triple buffered cases.
Kalyan Kondapally [Sun, 26 Mar 2017 21:29:40 +0000 (14:29 -0700)]
Add support to handle both Double Buffered & Triple buffered cases.

Different platforms can choose either to use double buffering or
triple buffering. HWC can signal buffers earlier in triple buffering
case while need to signal the fences bit later in double buffering
case. This makes a significant difference to the performance, lets
make this a build option instead of assuming either of cases being
used by the platform.

Jira: IAHWC-46
Test: No visible tearing with apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support for retire_fence.
Kalyan Kondapally [Sun, 26 Mar 2017 11:26:03 +0000 (04:26 -0700)]
Add support for retire_fence.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd OverlayBufferManager.
Kalyan Kondapally [Sun, 26 Mar 2017 04:41:15 +0000 (21:41 -0700)]
Add OverlayBufferManager.

We need to track life time of OverlayBuffer in various cases:
1) Ensure its available until the buffer is scanned out and
   is being displayed on screen.
2) Ensure its not destroyed if it's going to be re-used.

We dont have a central tracking place for all this which is
making it hard to ensure the buffers are alive. This patch
adds OverlayBufferManager which is responsible for creating
the buffers and deleting them when it's not in use.

Jira: IAHWC-46
Test: No visible tearing with apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUnify Hot plug logic on Linux and Android.
Kalyan Kondapally [Sun, 26 Mar 2017 06:23:18 +0000 (23:23 -0700)]
Unify Hot plug logic on Linux and Android.

We currently have two different patch which is un-necessayr, lets
unify it.

Jira: AIA-170
Test: Hot plug events are working on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoReplace all printf with ETRACE under common/
Kalyan Kondapally [Sat, 25 Mar 2017 23:10:07 +0000 (16:10 -0700)]
Replace all printf with ETRACE under common/

This should ensure we get the logs printed on Android too.

Jira: IAHWC-40
Test: Build passes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agovk: Make each VKSurface track its own fb
Kevin Strasser [Fri, 24 Mar 2017 13:36:02 +0000 (06:36 -0700)]
vk: Make each VKSurface track its own fb

Only 1 framebuffer is being created as it's being tracked at global scope.
Add a member field to VKSurface so each instance has its own fb, and then
assign it to the global target during MakeCurrent().

While we're at it, remove dst_image_ and dst_image_view_ from global scope,
as they are only ever used inside vksurface.

Jira: IAHWC-40
Test: Try demo apps and check that there is no flickering

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoChromeOS: fix include path for drm_fourcc.h
Wayne Boyer [Thu, 16 Mar 2017 00:35:34 +0000 (17:35 -0700)]
ChromeOS: fix include path for drm_fourcc.h

In common/display/displayplanemanager.cpp and
tests/common/videolayerrenderer.cpp the drm_fourcc.h header file
is #included.  In the ChromeOS build environment, that file has
a different path.  Therefore, change the path to fix the build.

This change is similar to the one in
217b2bc7ec4e6000e81b7b9ea15d9bb3e17aab8c

JIRA: None
Test: Build succeedes on Linux & ChromeOS

Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
7 years agovk: Define missing Renderer overrides
Kevin Strasser [Fri, 24 Mar 2017 11:11:17 +0000 (04:11 -0700)]
vk: Define missing Renderer overrides

Since commit 78a230016b RestoreState() and MakeCurrent() are required to be
redefined in classes inheriting from Renderer. There doesn't appear to be
anything needed from Vulkan for these calls, so for now add noop overrides
to make the build green again.

Jira: IAHWC-40
Test: Vulkan backend compiles

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoFormat check in the getclienttargetsupport API
Poornima [Thu, 23 Mar 2017 05:07:59 +0000 (10:37 +0530)]
Format check in the getclienttargetsupport API

Querying whether the client target format can be supported by
device.

Jira: https://01.org/jira/browse/IAHWC-12
Test: No regression observed on Android.

Signed-off-by: Poornima <poornima.y.n@intel.com>
7 years agoRemove fd from our tracking list when Thread is killed.
Kalyan Kondapally [Fri, 24 Mar 2017 07:49:01 +0000 (00:49 -0700)]
Remove fd from our tracking list when Thread is killed.

We didnt remove the event fd when Thread was killed, causing
these warnings.

Jira: None.
Test: No error messages like "fd is already in the list" seen
      when running apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRename pageflipeventhandler to vblankeventhandler.
Kalyan Kondapally [Fri, 24 Mar 2017 06:58:24 +0000 (23:58 -0700)]
Rename pageflipeventhandler to vblankeventhandler.

Lets name this appropriately as that's what it does.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support to use either of GBM or Mini GBM as needed
Shobhit Kumar [Fri, 10 Mar 2017 14:34:15 +0000 (20:04 +0530)]
Add support to use either of GBM or Mini GBM as needed

This only supports single planar formats yet for GBM and only enabled
gllayerrenderer over GBM. If we enable GBM support VideoLayer Renderer
and ImageLayer renderer are not available right now.

use --enable-gbm while running autogen.sh or configure.

We need to also build mesa with GBM enabled

Jira: IAHWC-53
Test: Test KMS Cube test application works without any crash.

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
7 years agoWait on kms fence in a separate thread.
Kalyan Kondapally [Thu, 23 Mar 2017 02:37:51 +0000 (19:37 -0700)]
Wait on kms fence in a separate thread.

This ensures we are able to release buffers on time
and in DisplayQueue, we can still process next frame while
we are waiting the current frame to be on screen. We dont
have DisplayQueue as a separate thread anymore which will
simplify things for tracking surface damage, release fence
etc in followup patches.

Jira: IAHWC-46
Test: No visible tearing with apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRelease fences early for layers using 3D composition.
Kalyan Kondapally [Wed, 22 Mar 2017 05:34:03 +0000 (22:34 -0700)]
Release fences early for layers using 3D composition.

Currently, we hold on to fences of layer which we dont scanout
but composite to another buffer for over a frame. This is
un-necessary as we will not be reading from these buffers
once we sample from them. Lets release these fences early.

Jira: IAHWC-36
Test: No tearing seen with multilayer demo on Linux or on
      Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse poll instead of sync_wait.
Kalyan Kondapally [Tue, 21 Mar 2017 11:42:03 +0000 (04:42 -0700)]
Use poll instead of sync_wait.

This way we can get rid of sync_wait which is not being used
anywhere else.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix tearing.
Kalyan Kondapally [Tue, 21 Mar 2017 10:04:24 +0000 (03:04 -0700)]
Fix tearing.

Currently, we do a non blocking commit and signal the fences of
all buffers associated with previous frame. However, non blocking
commit doesnt guarantee that the current frame buffers are already
on screen. Now, we wait for the KMS fence of current frame to be
signalled before signalling the buffers of previous frame.

Jira: IAHWC-46
Test: No visible tearing with apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTrack sync objects for each overlay layer.
Kalyan Kondapally [Tue, 21 Mar 2017 09:36:56 +0000 (02:36 -0700)]
Track sync objects for each overlay layer.

We might want to signal some buffers as free while continue
to use some based on surface damage etc. For this we need to
ensure we are able to signal each buffer independent of each
other. For now, we create a sync object(sw_sync) per layer.

Jira: IAHWC-36
Test: No regressions with Linux apps and on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd nv12 support.
johnson.lin [Thu, 23 Mar 2017 06:29:37 +0000 (14:29 +0800)]
Add nv12 support.

NV12 is not supported as SCANOUT in older platforms,
so try to use RENDERING only; Some logic should be
changed in overlaybuffer ImportImage, as NV12 is
2 planes format

JIRA: IAHWC-52
Test: testlayers -j jsonconfigs/video1layer_nv12.json

7 years agovk: Check queue family before vkCreateDevice
Kevin Strasser [Wed, 22 Mar 2017 12:19:18 +0000 (05:19 -0700)]
vk: Check queue family before vkCreateDevice

VK_LAYER_LUNARG_core_validation complains if we don't check the device queue
family before device creation. Check that there are queue family properties
and that index 0 is a graphics queue. While we're at it, lets also remove
the assumption that there is a physical device available.

JIRA: IAHWC-40
Test: Test Apps render with Vulkan support enabled.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agovk: Free descriptor sets after use
Kevin Strasser [Wed, 22 Mar 2017 11:31:53 +0000 (04:31 -0700)]
vk: Free descriptor sets after use

Descriptor sets are being allocated on each Draw call, so after 256 frames
the descriptor pool runs out of room. Explicity free the descriptor sets
after we are finished using them. In the future we may want to allow for
resizing the descriptor pool if we ever need more than 256 at once.

JIRA: IAHWC-40
Test: Test Apps render with Vulkan support enabled.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoAlways handle hot plug callback.
Johnson Lin [Tue, 21 Mar 2017 02:13:16 +0000 (10:13 +0800)]
Always handle hot plug callback.

Even connected display is empty, callback should be used to
inform application Otherwise application will not know there
is no connected display, and will continue to commit frames,
which cause errors.

JIRA:IAHWC-50
Tests: Application doesnt try to commit anything in case no
       display is connected.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoOnly need to assign one encoder for the connector.
Johnson Lin [Tue, 21 Mar 2017 02:11:16 +0000 (10:11 +0800)]
Only need to assign one encoder for the connector.

Otherwise it will cause multiple encoder and display
used for one connector, which is not necessary

JIRA:IAHWC-49
Tests:None

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoHotplug event thread should not wait.
Johnson Lin [Tue, 21 Mar 2017 02:00:10 +0000 (10:00 +0800)]
Hotplug event thread should not wait.

The HWCThread is using HandleWait to wait for signals
before processing routine. For Hotplug event thread,
it is not necessary because it should be acting as an
loop and it waits for uevents caused by hotplug.
Override the HanleWait function to keep the thread
running.

JIRA:IAHWC-48
Tests:None

Signed-off-by: Johnson Lin <johnson.lin@intel.com
7 years agoConfirm Validate display call before Accepting Display Changes.
Poornima [Mon, 20 Mar 2017 09:39:23 +0000 (02:39 -0700)]
Confirm Validate display call before Accepting Display Changes.

Added a check to confirm ValidateDisplay is called
before AcceptDisplayChanges.

Jira: https://01.org/jira/browse/IAHWC-28
Test: No regression observed on Android.

Signed-off-by: Poornima <poornima.y.n@intel.com>
7 years agovk: Initial commit of the Vulkan backend
Kevin Strasser [Sat, 11 Mar 2017 03:58:54 +0000 (19:58 -0800)]
vk: Initial commit of the Vulkan backend

Add an optional Vulkan backend to the compositor. For now this should be
considered very experimental as it doesn't yet work with the tests and
doesn't include support for explicit sync. Additionally, it is using an
unregistered extension function vkCreateDmaBufImageINTEL, that will need to
be replaced once a proper extension has been added to the spec.

Building the new backend is as simple as passing '--enable-vulkan' during
configuration.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoGet all needed data from cros_gralloc_handle.
Kalyan Kondapally [Sun, 19 Mar 2017 08:27:15 +0000 (01:27 -0700)]
Get all needed data from cros_gralloc_handle.

cros_gralloc_handle has all needed data we need like width,
height, offsets etc. We dont need a special call to query
this information.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix HDMI display hotplug issue
Mingwei Wang [Wed, 15 Mar 2017 02:35:30 +0000 (10:35 +0800)]
Fix HDMI display hotplug issue

drm_event and hotplug_event becomes true after first hotplug event.
Then it will not handle hotplug event anymore if not set these 2
variables to false.

Jira: None.
Test: Pass test on Android Things.

Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
7 years agoTests: Store fences for each display separately.
Johnson Lin [Tue, 14 Mar 2017 01:23:37 +0000 (09:23 +0800)]
Tests: Store fences for each display separately.

HWC is overriding fence if mutiple displays is used.
so Application need to retore the fences for displays
seperately.

Jira: none
Tests: none
Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoAdd documentation to FDHandler.
Rafael Antognolli [Tue, 14 Mar 2017 15:30:21 +0000 (08:30 -0700)]
Add documentation to FDHandler.

Jira: None.
Test: None.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoAdd documentation to HWCEvent.
Rafael Antognolli [Tue, 14 Mar 2017 15:22:49 +0000 (08:22 -0700)]
Add documentation to HWCEvent.

Jira: None.
Test: None.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoSeparate code for finishing commit and handling requests.
Rafael Antognolli [Tue, 14 Mar 2017 07:32:11 +0000 (00:32 -0700)]
Separate code for finishing commit and handling requests.

This makes the main DisplayQueue::HandleRoutine function smaller and
cleaner, so it's easier to understand its logic.

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

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoRefactor DisplayQueue to watch for drmAtomicCommit out fence.
Rafael Antognolli [Mon, 13 Mar 2017 21:52:00 +0000 (14:52 -0700)]
Refactor DisplayQueue to watch for drmAtomicCommit out fence.

By adding the out fence to the FDHandler watchlist, we now can check
when the commit has finished. This means we don't need to wait before
submitting a commit, since the out fence already tells us that.

Jira: None.
Test: No regressions with Linux apps and Android.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoMake HWCThread use FDHandler to watch for events.
Rafael Antognolli [Tue, 14 Mar 2017 07:41:14 +0000 (00:41 -0700)]
Make HWCThread use FDHandler to watch for events.

The HWCEvent used in HWCThread is supported by a file descriptor. So we
can add a FD handler to watch for events on it, and any other file
descriptors used. This allows us to have a single point of waiting for
multiple file descriptors.

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

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoAdd FDHandler to watch for fds that are ready.
Rafael Antognolli [Fri, 10 Mar 2017 20:37:59 +0000 (12:37 -0800)]
Add FDHandler to watch for fds that are ready.

Jira: None.
Test: No regressions with Linux apps and Android.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoMake PageFlipEventHandler work with eventfd.
Kalyan Kondapally [Sat, 11 Mar 2017 22:34:50 +0000 (14:34 -0800)]
Make PageFlipEventHandler work with eventfd.

Also expanded tests to register for vsync call back.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd HWCEvent to handle signalling of HWCThread.
Rafael Antognolli [Wed, 8 Mar 2017 19:13:35 +0000 (11:13 -0800)]
Add HWCEvent to handle signalling of HWCThread.

This class uses linux eventfd() to handle events and signal when the
HWCThread should wake up.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoFix build by missing header.
Rafael Antognolli [Wed, 8 Mar 2017 18:51:47 +0000 (10:51 -0800)]
Fix build by missing header.

cmath is required for some math operations.

Jira: None.
Test: Build passes on my Linux environment.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoAdopt to new changes from Minigbm.
Kalyan Kondapally [Sat, 11 Mar 2017 09:17:17 +0000 (01:17 -0800)]
Adopt to new changes from Minigbm.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd ebuild file for chromeos.
Johnson Lin [Fri, 10 Mar 2017 03:11:28 +0000 (11:11 +0800)]
Add ebuild file for chromeos.

Jira: None
Tests: None

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoFix rotation issue
Mingwei Wang [Fri, 10 Mar 2017 02:33:32 +0000 (10:33 +0800)]
Fix rotation issue

This would avoid uninitialized value of transform_
which probably caused screen rotation issue.

Jira: None.
Test: Pass test on Android Things.

Signed-off-by: Randy Xu <randy.xu@intel.com>
Signed-off-by: Mingwei Wang <mingwei.wang@intel.com>
7 years agoInclude file drm/drm_fourcc.h should be drm_fourcc.h
Johnson Lin [Fri, 10 Mar 2017 02:07:13 +0000 (10:07 +0800)]
Include file drm/drm_fourcc.h should be drm_fourcc.h

In ChromeOS there is no drm/drm_fourcc.h but
libdrm/drm_fourcc.h. Make it simple to use drm_fourcc.h
as in other source files

JIRA:None
Test:Build passes on Linux & ChromeOS.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoTest: rename c files to cpp.
Johnson Lin [Fri, 10 Mar 2017 02:02:59 +0000 (10:02 +0800)]
Test: rename c files to cpp.

This avoid compile error, -std=c11 is not supported for C files.
Make it simple to move C type to cpp JIRA:None Test:None

Jira: None.
Test: Builds on Linux.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoRemove unused variables.
sivag [Wed, 8 Mar 2017 18:25:12 +0000 (23:55 +0530)]
Remove unused variables.

1. Enable GL_GLEXT_PROTOTYPES when it is not defined.
2. Remove unused variabled from code.

Jira: None
Test: Build passes on Linux.

Signed-off-by: sivag <sivag46@gmail.com>
7 years agoTest: Different renders should use different GL context.
johnson.lin [Fri, 3 Mar 2017 10:36:11 +0000 (18:36 +0800)]
Test: Different renders should use different GL context.

This would avoid command context conflicts and also
enable renderers to run in different threads.

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

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoTests: Fix warnings.
Kalyan Kondapally [Wed, 8 Mar 2017 07:40:23 +0000 (23:40 -0800)]
Tests: Fix warnings.

Misc fixes. Remove unused variables, functions etc.

Jira: None.
Test: Build passes on Linux and apps work as before.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoForce 3DComposition when DISABLE_OVERLAY_USAGE is enabled.
Kalyan Kondapally [Tue, 7 Mar 2017 19:23:17 +0000 (11:23 -0800)]
Force 3DComposition when DISABLE_OVERLAY_USAGE is enabled.

In this case we might not have all the support needed for Atomic
Test commits. Lets keep it simple and fallback to 3D composition
in this case.

Jira: None.
Test: No regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAndroid: Use same sw_sync ABI as supported by AOSP version.
Kalyan Kondapally [Mon, 6 Mar 2017 08:32:31 +0000 (00:32 -0800)]
Android: Use same sw_sync ABI as supported by AOSP version.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTests: Make power mode toggling continuous.
Kalyan Kondapally [Sun, 5 Mar 2017 11:12:21 +0000 (03:12 -0800)]
Tests: Make power mode toggling continuous.

When --p mode is passed to tests, let continously test
changing the mode and not just once to ensure the mode change
actually workes repeatedly.

Jira: None.
Test: Powermode related tests work as expected.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSimplify connect/disconnect logic in DisplayQueue.
Kalyan Kondapally [Sat, 4 Mar 2017 09:23:06 +0000 (01:23 -0800)]
Simplify connect/disconnect logic in DisplayQueue.

We now have two possibilities, either the physical display is
disconnected or is turned off by calling SetPowerMode. Instead
of trying to deal with all possible combinations within the
display queue, let user of DisplayQueue set appropriate
state by calling SetPowerMode.

Jira: None.
Test: Tested with all the powermode and things work as expected.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove unused code.
Kalyan Kondapally [Sun, 5 Mar 2017 23:10:34 +0000 (15:10 -0800)]
Remove unused code.

Exit() API is DisplayQueue is not used by anyone, lets remove it.

Jira: None.
Test: No regression with Multi monitor related tests.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTry closing fd only when it's > 0.
Kalyan Kondapally [Sun, 5 Mar 2017 01:11:54 +0000 (17:11 -0800)]
Try closing fd only when it's > 0.

Jira: None.
Test: No regressions with test apps.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRespect PowerMode state in PageFlipEventHandler.
Kalyan Kondapally [Sat, 4 Mar 2017 09:08:52 +0000 (01:08 -0800)]
Respect PowerMode state in PageFlipEventHandler.

Depending on the state we either should exit PageFlipEventHandler
or start observing for vblank events. Lets take the state into
account and act accordingly.

Jira: None.
Test: No regressions on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTrack if Display is powered on using power_mode_ state.
Kalyan Kondapally [Sat, 4 Mar 2017 09:02:51 +0000 (01:02 -0800)]
Track if Display is powered on using power_mode_ state.

Currently, we have two variables to track if the display is on
or not i.e. power_mode_ and is_powered_off_. Instead of having two
variable track the same state, lets just use power_mode_.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd new gl test to check texture and dma_buf mmap.
Fan Yugang [Fri, 3 Mar 2017 09:44:41 +0000 (01:44 -0800)]
Add new gl test to check texture and dma_buf mmap.

Reuse https://github.com/ds-hwang/gbm_es2_demo.git
dma_buf_mmap_demo as new gl cube test:
* Same to gl cube test except for updating cube surface
  using dma_buf mmap
* It's very nice demo to show how Chromium zero-copy
  texture upload works. Chromium doesn't use glTexImage2D
  to update texture thank to new dma_buf mmap API.
  For more Chromium detail, check the chrome issue
  crbug.com/475633i, https://01.org/blogs/2016/native-one
  -copy-texture-uploads-for-chrome-OS
* After Linux kernel v4.6, you can use following code.
  (currently only Intel Architecture supports it)

Jira: None
Test: Build tests and run with type 3 to check if the cube
      and the texture show normally.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agogl: remove extra program->Init() call
Kevin Strasser [Thu, 2 Mar 2017 19:19:21 +0000 (11:19 -0800)]
gl: remove extra program->Init() call

No sense in calling Init twice as it should always give the same result.
Drop the unused call.

Jira: None.
Tests: No regression on Linux.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
7 years agoAdded power mode tests as part of the standalone test
Pallavi G [Tue, 28 Feb 2017 08:05:06 +0000 (13:35 +0530)]
Added power mode tests as part of the standalone test

Added the simple tests to test the power modes like doze, doze suspend,
off and on. The test will call the setpowermode with the requested
mode after the first frame presented.

After the power mode changed, sleep for 1 sec and then turn the display on
again.

usage: testlayer -j ./jsonconfigs/kmscubelayer1.json -p <on/off/doze/dozesuspend>

Jira: IAHWC-21
Tests: Tested with all the powermode and things work as expected
Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoAdded the doze power mode support
Pallavi G [Mon, 20 Feb 2017 09:40:18 +0000 (15:10 +0530)]
Added the doze power mode support

Added the suport for the doze and doze suspend power modes.
For more details about doze and doze suspend refer the below link
https://developer.android.com/training/monitoring-device-state/doze-standby.html

Jira: IAHWC-21
Test: Not able to test the exact doze path device not entering into the idle mode
Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoWait on KMS Fence before even calling commit.
Kalyan Kondapally [Tue, 28 Feb 2017 08:47:05 +0000 (00:47 -0800)]
Wait on KMS Fence before even calling commit.

Also, we signal sw_sync timeline after inserting the sync fence
for 3D Engine. This fixes flickers being seen in multiple layer
demo.

Jira: IAHWC-46.
Test: No flickers with multiple layer demo.

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