OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
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>
7 years agoFix unintialized variables.
Kalyan Kondapally [Mon, 27 Feb 2017 19:03:43 +0000 (11:03 -0800)]
Fix unintialized variables.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoClose Acquire fences once done with them.
Kalyan Kondapally [Mon, 27 Feb 2017 03:09:34 +0000 (19:09 -0800)]
Close Acquire fences once done with them.

We take ownership of these fences. In Compositor side we release
the fence once we are done waiting on it, which resets the fd to
-1 without closing it. Instead we should just close it.

Jira: IAHWC-47
Test: Running test app on Linux using multiplelayersnovideo.json
      configuration doest crash anymore.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTests: Respect no explict fence option for glrenderer
Johnson Lin [Mon, 27 Feb 2017 01:13:48 +0000 (09:13 +0800)]
Tests: Respect no explict fence option for glrenderer

No need to generate aquire fence when explict fence
support is not used.

Jira: None.
Test: Tests dont try to create a fence when DISABLE_EXPLICIT_SYNC
      is set.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoTests: Add json file for multiple layers without video.
Johnson Lin [Mon, 27 Feb 2017 02:16:45 +0000 (18:16 -0800)]
Tests: Add json file for multiple layers without video.

Jira: None.
Test: None.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoTests: Change video bo upload logic.
Johnson Lin [Mon, 27 Feb 2017 02:15:59 +0000 (18:15 -0800)]
Tests: Change video bo upload logic.

Need to get line witdth per plane and the
actual height of the plane, and upload line
by line with strides

Jira: None.
Test: Video related tests work on Linux.

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
7 years agoMake cpplint happy.
Kalyan Kondapally [Sun, 26 Feb 2017 21:17:16 +0000 (13:17 -0800)]
Make cpplint happy.

Still we have few warnings:
1) Include the directory when naming .h file
2) Use const reference or pointer in some places.

These will be addressed as appropriate in following up
patches.

Jira: None.
Test: cpplint.py <folder>/*.cpp/*.h doesnot show errors other
      than the above mentioned ones. Build passes on Linux and
      Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMake static code analyzer happy.
Kalyan Kondapally [Sun, 26 Feb 2017 12:23:19 +0000 (04:23 -0800)]
Make static code analyzer happy.

Remove uninitialized variables.

Jira: None.
Test: No warnings with scan-build make -j4 on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAvoid intermediate composition when Overlay Support is disabled.
Kalyan Kondapally [Sun, 26 Feb 2017 10:24:58 +0000 (02:24 -0800)]
Avoid intermediate composition when Overlay Support is disabled.

When overlay support is disabled, client should take care of blending
all layers together and giving us the final output. Ideally, we
should be able to scanout the client buffer instead of rendering
to another offscreen target and scanning it out. Now, we try to
scanout the buffer if possible directly instead of rendering it
to an intermediate buffer.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCache Composition Region.
Kalyan Kondapally [Sun, 26 Feb 2017 08:15:39 +0000 (00:15 -0800)]
Cache Composition Region.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRelease GLRenderer when Display is disconnected.
Kalyan Kondapally [Sun, 26 Feb 2017 03:24:12 +0000 (19:24 -0800)]
Release GLRenderer when Display is disconnected.

We release all resources when display is disconnected but not
Renderer. This was causing EGL failures when display was connected
again.

Jira: None.
Test: Reconnecting monitor should not show errors like
      "libEGL debug: EGL user error 0x3009 (EGL_BAD_MATCH) in _eglCreateSync"

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont query for KMS fence when doing modeset.
Kalyan Kondapally [Sun, 26 Feb 2017 03:14:19 +0000 (19:14 -0800)]
Dont query for KMS fence when doing modeset.

We do a blocking Modeset and fence should be already invalid by
end of this operation.Let's not bother about fence in this case.

Jira: IAHWC-46.
Test: No regressions on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont hardcode include paths and TARGET_BOARD_PLATFORM.
Kalyan Kondapally [Sun, 26 Feb 2017 01:57:48 +0000 (17:57 -0800)]
Dont hardcode include paths and TARGET_BOARD_PLATFORM.

We dont want to hardcode the paths and TARGET_BOARD_PLATFORM as
this can be used outside Android IA.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix warnings.
Kalyan Kondapally [Sat, 25 Feb 2017 23:30:23 +0000 (15:30 -0800)]
Fix warnings.

warning: field 'gpu_fd_' will be initialized after field 'blob_id_'

Jira: None.
Test: Build doesnt show this warnings.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove sync object management to DisplayQueue.
Kalyan Kondapally [Sat, 25 Feb 2017 22:54:52 +0000 (14:54 -0800)]
Move sync object management to DisplayQueue.

We already handle planestate, layer cache here from previous frames.
Moving sync object here will ensure all frame related data is
in one place.

Jira: IAHWC-46.
Test: No regressions on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont reset needs_modeset flag till we try to handle Modeset.
Kalyan Kondapally [Sat, 25 Feb 2017 22:28:13 +0000 (14:28 -0800)]
Dont reset needs_modeset flag till we try to handle Modeset.

In HandleUpdateRequest we reset needs_modeset flag immediately
before even calling ApplyModeset. There are various checks in
between which might mean that we may never do Modeset. For
clarity reset the flag only in ApplyModeset.

Jira: IAHWC-46.
Test: No regressions on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRespect DRM_MODE_FLAG_INTERLACE and DRM_MODE_FLAG_DBLSCAN flags.
Kalyan Kondapally [Sat, 25 Feb 2017 20:30:14 +0000 (12:30 -0800)]
Respect DRM_MODE_FLAG_INTERLACE and DRM_MODE_FLAG_DBLSCAN flags.

Esnure we take this into consideration when calculating refersh
rate.

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

7 years agoTests: Dont ignore first frame.
Kalyan Kondapally [Sat, 25 Feb 2017 12:00:56 +0000 (04:00 -0800)]
Tests: Dont ignore first frame.

We start with i = 1 and render all frames till i is less than
the value passed to --frames. In case of --frames 1, we dont
commit anything. Fix the for logic.

Jira: None.
Test: Check that we do an actual commit even when --frames 1 is
      passed.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove unnecessary includes.
Kalyan Kondapally [Sat, 25 Feb 2017 06:14:29 +0000 (22:14 -0800)]
Remove unnecessary includes.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRemove save/restore of EGLContext.
Kalyan Kondapally [Fri, 24 Feb 2017 08:00:02 +0000 (00:00 -0800)]
Remove save/restore of EGLContext.

We handle Display commits in a separate thread. There is no need
to restore/save context as EGLOffscreenContext should be the
only context in that thread.

Jira: None.
Test: EGL_BAD_DISPLAY errors are not seen on linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoBuildFix.
Kalyan Kondapally [Wed, 22 Feb 2017 12:16:06 +0000 (04:16 -0800)]
BuildFix.

We didnt update DUMP_CURRENT_COMPOSITION_PLANES with latest changes
causing build failures.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDisplayQueue: Dont update state cache when needs_modeset is true.
johnson.lin [Wed, 22 Feb 2017 09:06:32 +0000 (17:06 +0800)]
DisplayQueue: Dont update state cache when needs_modeset is true.

Otherwise we will cache state which always falls back to 3D
composition and will never use overlay.

Jira: None.
Test: Overlays are used when having more than one layer
Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoEnsure Acquire fence is signalled before 3D composition.
Kalyan Kondapally [Mon, 20 Feb 2017 09:16:50 +0000 (01:16 -0800)]
Ensure Acquire fence is signalled before 3D composition.

We fallback to 3D Composition in case the layer cannot be
scanned out directly. Lets ensure the buffers are ready to
be read before compositing the layers together.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont delete buffers which are not owned by us.
johnson.lin [Mon, 20 Feb 2017 03:10:21 +0000 (19:10 -0800)]
Dont delete buffers which are not owned by us.

In case of VirtualDisplay, we get the output buffer handle
from App. App owns the life time of this buffer and should
delete the resource instead of us.

Jira: IAHWC-45
Test: Fix crashes related to double deletion on Linux.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoMove Display Commits to a separate thread.
Kalyan Kondapally [Sun, 19 Feb 2017 22:50:46 +0000 (14:50 -0800)]
Move Display Commits to a separate thread.

This should ensure that any waits we do on KMS Fences doesn't
block the main thread.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix Indentation.
Kalyan Kondapally [Sun, 19 Feb 2017 02:29:59 +0000 (18:29 -0800)]
Fix Indentation.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoNo need to call composition init function for every Connect call.
Kalyan Kondapally [Sun, 19 Feb 2017 02:56:28 +0000 (18:56 -0800)]
No need to call composition init function for every Connect call.

Compositor only creates GPUResourceHandler in init function which
should not be affected by any changes in Connect call. Move this
to init, so we dont reinitialize GPUResourceHandler unnecessarily.

Jira: None.
Test: No regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoStop manual tracking of release fences.
Kalyan Kondapally [Sun, 19 Feb 2017 02:51:51 +0000 (18:51 -0800)]
Stop manual tracking of release fences.

There is no need to do this, NativeSync will increment the
timeline whenever HW has finished with the commit or
immediately if commit has failed for any reason.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove all Display related classes under display/
Kalyan Kondapally [Sun, 19 Feb 2017 00:12:29 +0000 (16:12 -0800)]
Move all Display related classes under display/

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove OverlayBuffer under core.
Kalyan Kondapally [Sat, 18 Feb 2017 23:56:39 +0000 (15:56 -0800)]
Move OverlayBuffer under core.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoRename InternalDisplay as Display.
Kalyan Kondapally [Sat, 18 Feb 2017 23:51:13 +0000 (15:51 -0800)]
Rename InternalDisplay as Display.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse std::thread instead of PThread.
Kalyan Kondapally [Sat, 18 Feb 2017 22:53:43 +0000 (14:53 -0800)]
Use std::thread instead of PThread.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCleanup: Remove unwanted forward declarations and includes.
Kalyan Kondapally [Sat, 18 Feb 2017 22:06:11 +0000 (14:06 -0800)]
Cleanup: Remove unwanted forward declarations and includes.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoTie OverlayBuffer lifetime to OverlayLayer.
Kalyan Kondapally [Sat, 18 Feb 2017 21:49:46 +0000 (13:49 -0800)]
Tie OverlayBuffer lifetime to OverlayLayer.

We now cache layers from previous frame in InternalDisplay. Plane
Manager tires to ensure the buffer is alive till it's displayed,
we can simplify this by ensuring that the buffer assoicated to a
layer is alive till the layer cache in InternalDisplay is reset.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCache ValidateLayers result.
Kalyan Kondapally [Sat, 18 Feb 2017 08:47:24 +0000 (00:47 -0800)]
Cache ValidateLayers result.

In most cases layers between frames dont change in terms of geomerty,
only content gets updated. All the validation done to figure out
the layer<->plane combination can be cached and re-used if this
remains true between consecutive frames.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoremove compile warnings
johnson.lin [Thu, 16 Feb 2017 01:21:29 +0000 (09:21 +0800)]
remove compile warnings

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

Signed-off-by: johnson.lin <johnson.lin@intel.com>