OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
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>
7 years agoEnable fstack-protector-strong option.
Kalyan Kondapally [Thu, 16 Feb 2017 00:25:34 +0000 (16:25 -0800)]
Enable fstack-protector-strong option.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure Viewport is same as DisplayFrameRect.
Kalyan Kondapally [Wed, 15 Feb 2017 22:40:23 +0000 (14:40 -0800)]
Ensure Viewport is same as DisplayFrameRect.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUpdate json files for small size video test files.
Yugang, Fan [Wed, 15 Feb 2017 09:24:31 +0000 (17:24 +0800)]
Update json files for small size video test files.

Update test json files for the 640x360 video file instead of 1080p.
The video files will be submitted later. For yuyv422 file, still
need add a common stride reading function to read the video raw
data to gbm bo.

Jira: None.
Test: Using "testlayers -j jsonconfigs/video1layer_bgra.json" in tests
      folder to check the video rendering.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoCleanup: Remove unused variables in Compositor.
Kalyan Kondapally [Wed, 15 Feb 2017 07:06:45 +0000 (23:06 -0800)]
Cleanup: Remove unused variables in Compositor.

We dont any more need to track width, height, NativeBufferHandler
in compositor. Remove them.

Jira: None.
Test: Build passes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure final combination is tested before doing actual commit.
Kalyan Kondapally [Wed, 15 Feb 2017 05:09:58 +0000 (21:09 -0800)]
Ensure final combination is tested before doing actual commit.

While validating layer combinations, we always continue using the
first layer tested with the given plane. We might add other layers
needing GPU composition for the plane which might change the overall
Display Rect. Now, we ensure that once initial validation is done
the overall combination will infact work otherwise just fall
back to GPU for all layers.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMove NativeSurface initialization to PlaneManager.
Kalyan Kondapally [Wed, 15 Feb 2017 04:31:05 +0000 (20:31 -0800)]
Move NativeSurface initialization to PlaneManager.

This would help assiging the offscreen target when 3D fallback is
needed and use that during test commit to ensure the "real" commit
will pass.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure GL resources are initlialized before MakeCurrent.
Kalyan Kondapally [Wed, 15 Feb 2017 04:08:02 +0000 (20:08 -0800)]
Ensure GL resources are initlialized before MakeCurrent.

This is currently done when NativeSurface is initialized which is
fine but eventually we want to move Native Surface initialization
PlaneManager which doesnt know anything about compositor. Instead
of doing this during initialization lets postpone till MakeCurrent
call.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd multiple layers test json example.
Fan, Yugang [Tue, 14 Feb 2017 13:17:35 +0000 (21:17 +0800)]
Add multiple layers test json example.

The example json includes 5 layers: 3 kms cube test layers, and 2 video
layers which is using the argb video file. The layers also are placed with
overlay, and runing separately. This is just a example, and users can add
their multiple layers tests according their requirements with the json
format.

Jira: None.
Test: Use the command "ffmpeg -i ./1080p_29.97fps.mp4 -ss 30 -frames
      100 -f rawvideo -pix_fmt argb test.xrgb" to generate video raw
      file as test resources, and using current multiplelayers.json to
      test if the "testlayers" app can show and run all layers normally.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoPass NativeBufferHandler in DisplayPlaneManager Initialization.
Kalyan Kondapally [Tue, 14 Feb 2017 11:22:35 +0000 (03:22 -0800)]
Pass NativeBufferHandler in DisplayPlaneManager Initialization.

We now pass this in every BeginFrameUpdate, instead pass it once
in Initialization and have a pointer to it in DisplayPlaneManager.
We also pass widht, height here which will be used in follow up
patches to allocate surfaces.

Jira: None.
Test: No graphics regressions on Linux and Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd API to set and retrieve offscreen target for a given DisplayPlane.
Kalyan Kondapally [Tue, 14 Feb 2017 11:07:39 +0000 (03:07 -0800)]
Add API to set and retrieve offscreen target for a given DisplayPlane.

This is in preparation to move NativeSurface to DisplayPlaneManager,
so we can do a test commit exactly the same as in real commit.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd OverlayLayer to NativeSurface.
Kalyan Kondapally [Tue, 14 Feb 2017 08:14:13 +0000 (00:14 -0800)]
Add OverlayLayer to NativeSurface.

Everytime we need to use NativeSurface as RenderTarget, we create
an OverlayLayer for it. Instead the surface can just initialize
one and layer can be queried from it.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix for continous commit failures
Avinash Reddy Palleti [Tue, 14 Feb 2017 04:59:21 +0000 (20:59 -0800)]
Fix for continous commit failures

Test commit and actual commit were differing in plane resolution,
due to which test commit was successful and actual commit was failing.
It was because proper width and height were not being passed while
giving for 3D composition.
Fixed by passing proper parameters to 3D composition.

Jira: AIA-153
Test: Shareit application is running without lag.

Signed-off-by: avinash-palleti <avinash.reddy.palleti@intel.com>
7 years agoFix compiler warnings.
Kalyan Kondapally [Sun, 12 Feb 2017 11:48:39 +0000 (03:48 -0800)]
Fix compiler warnings.

Things like:
drmhwctwo.cpp:458:65:
warning: unused parameter 'damage' [-Wunused-parameter]
   hwc_region_t damage) {

Jira: None.
Test: Build passes.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support for importing YVU, NV12 etc formats.
Kalyan Kondapally [Sun, 12 Feb 2017 11:30:14 +0000 (03:30 -0800)]
Add support for importing YVU, NV12 etc formats.

We hardcoded YUV support to be only for DRM_FORMAT_YUV420 format.
Relax this and allow other formats like DRM_FORMAT_YVU420,
DRM_FORMAT_UYVY and DRM_FORMAT_NV12.

Jira: AIA-133.
Test: Check that video works now.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoPassing proper width height to create Virtual display.
arpallet [Tue, 7 Feb 2017 12:26:07 +0000 (17:56 +0530)]
Passing proper width height to create Virtual display.

Getting proper width and height from CreateVirtualDisplay call and passing
them to InitVirtualDisplay function. This will fix the issue of creating
invalid back buffer.

Jira: https://01.org/jira/browse/AIA-99
Test: No Graphics regressions.

Signed-off-by: arpallet <avinash.reddy.palleti@intel.com>
7 years agoFix shaking issue when playing video raw file
Fan Yugang [Tue, 7 Feb 2017 09:32:25 +0000 (01:32 -0800)]
Fix shaking issue when playing video raw file

Fixed the issue which always read the first frame of the video file
for one of two frames, and also fixed the issue of reading video for
second frame. Now, video test will loop to play the video file until
"Ctrl+c".

Jira: None.
Test: Use the command "ffmpeg -i ./1080p_29.97fps.mp4 -ss 30 -frames
 100 -f rawvideo -pix_fmt argb test.xrgb" to generate video raw
file as test resources, and using current videoyuyv1layer.json to
test if the "testlayers" app can run video test normally.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoInstall hwcomposer in vendor/lib
Kalyan Kondapally [Sun, 5 Feb 2017 00:24:54 +0000 (16:24 -0800)]
Install hwcomposer in vendor/lib

Jira: AIA-125
Test: Builds and boots to home screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support for Minigbm.
Kalyan Kondapally [Sat, 4 Feb 2017 20:34:10 +0000 (12:34 -0800)]
Add support for Minigbm.

Jira: AIA-133
Test: No regressions on Android and Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoSupport json-c static compilation in project build
Yugang, Fan [Fri, 3 Feb 2017 15:27:56 +0000 (23:27 +0800)]
Support json-c static compilation in project build

Updated project configure to support json-c static compilation so
that the project could be compiled without building json-c
additionally.

Jira: None.
Test: configure and build this project without additional json-c
      installed.

Signed-off-by: Fan Yugang <yugang.fan@intel.com>
7 years agoFix crash with Virtual display.
arpallet [Fri, 3 Feb 2017 03:57:19 +0000 (19:57 -0800)]
Fix crash with Virtual display.

Ensure we have a valid Native handle before trying to use it.
With Virtual Display, we are compositing all layers together
and may not have a buffer set to each layer.

Signed-off-by: arpallet <avinash.reddy.palleti@intel.com>
7 years agoPresentDisplay should return true if modeset is succesful.
Carlos Santa [Fri, 3 Feb 2017 02:48:43 +0000 (18:48 -0800)]
PresentDisplay should return true if modeset is succesful.

If we are doing modeset or commit failed we return false in
PresentDisplay, which means we failed to update layers. While
this is correct when commit failed, this is not true when commit
passed and we are handling modeset. Right thing is to just return
the value of succesful_commit here.

Bug ID: https://01.org/jira/browse/AIA-131
Test: hwc-drm-two: Failed to set layers in the composition is not shown
      in logcat during boot up.

Signed-off-by: Carlos Santa <carlos.santa@intel.com>
7 years agoTests: Fix crash with External Monitor.
Kalyan Kondapally [Wed, 1 Feb 2017 16:46:34 +0000 (08:46 -0800)]
Tests: Fix crash with External Monitor.

HWComposer keeps track of connected displays in a worker thread,
while tests query for connected displays from main thread before
rendering things. To avoid race conditions we need to ensure that
we take alock before rendering to connected displays and querying
for the list of connected displays.

Jira: AIA-130
Test: Primary display doesnot crash when external monitor is
      disconnected.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix modesetting.
Pallavi G [Wed, 1 Feb 2017 07:48:57 +0000 (23:48 -0800)]
Fix modesetting.

We are currently passing crtc property id while we should
really pass mode property id. Also, we dont set the crtc
active once we make the connection. This patch fixes them.

Jira: AIA-106, AIA-104
Test: Modeset doesnt fail anymore. External monitor works
      on Linux.

Signed-off-by: Pallavi G <pallavi.g@intel.com>
7 years agoFix crash with virtual display.
Kalyan Kondapally [Tue, 31 Jan 2017 18:02:37 +0000 (10:02 -0800)]
Fix crash with virtual display.

We where accessing wrong handle here causing seg faults.

Jira: AIA-99
Test: System doesnt crash when Secondary display option is enabled
      from developer options.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAlgorithm to detect disjoint regions for gpu composition.
arpallet [Sun, 29 Jan 2017 06:55:11 +0000 (22:55 -0800)]
Algorithm to detect disjoint regions for gpu composition.

This algorithm traverse through x co-ordinates and at each
intersection of x co-ordinates, it will traverse through y
axis for intersections. At each y co-ordinate intersection
it will give out new layer with input layer ids active at
that point.

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

Signed-off-by: arpallet <avinash.reddy.palleti@intel.com>
7 years agoWe should have only one primary and cursor per display.
Kalyan Kondapally [Mon, 30 Jan 2017 02:36:09 +0000 (18:36 -0800)]
We should have only one primary and cursor per display.

We expected one primary and maximum of one cursor plane to be
dedicated per display. There is no need to maintain a list of
these planes like now.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoHandle DPMS mode setting immediately.
Kalyan Kondapally [Sun, 29 Jan 2017 22:02:41 +0000 (14:02 -0800)]
Handle DPMS mode setting immediately.

We handle any pending modeset, dpms related operations together
while presenting layers. While this is fine for modeset, we may not
have another present call when application requested us to set the
mode to DPMS_OFF. Handle these calls immediately.

Jira: None.
Test: No regressions on Android or Linux test apps.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDo proper clean up of modeset blobs.
Kalyan Kondapally [Sun, 29 Jan 2017 21:45:47 +0000 (13:45 -0800)]
Do proper clean up of modeset blobs.

We dont release the old modeset blobs until SetActiveConfig is
called. This may not be true if app expects us to handle this
ourselves (using preferred config). Lets ensure when ever we do
modeset, we clear the old blob and create a new one.

Jira: None.
Test: Check we dont leak memory related to modeset blobs with test
      apps on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure we have internal display first in list of connected displays.
Kalyan Kondapally [Sun, 29 Jan 2017 11:54:36 +0000 (03:54 -0800)]
Ensure we have internal display first in list of connected displays.

We connect possible displays, than iterate through all of them to
populate connected displays. This was fine when pipe 0 was always
connected to internal/primary display. However on devices which
use pipe 1 as primary we ended up still using pipe 0. Now,
we populated connected displays list as we make the connection.

Jira: AIA-120
Test: Boots to Android Screenshot on BDW device. No regressions on
      Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCheck for supported formats before creating fbs for native
Kalyan Kondapally [Sun, 29 Jan 2017 03:00:09 +0000 (19:00 -0800)]
Check for supported formats before creating fbs for native
 surface.

We always create RGBA buffers for these surfaces but we might not
be able to support this format during scanout. Now, instead of
making an assumption, we check if this format is supported and
if not fall back to RGBX.

Jira: AIA-120
Test: No graphics regressions on Android and Linux. Home screen
      is visible on HSW device.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix surfaceflinger crash when not connected to an display.
Kalyan Kondapally [Sat, 28 Jan 2017 09:28:17 +0000 (01:28 -0800)]
Fix surfaceflinger crash when not connected to an display.

Surfaceflinger expects atleast one active config and GetActiveConfig
to succeed. We should be returning true in GetActiveConfig call
after setting the config but we returned false causing crashes
in Surfaceflinger side.

Jira: None.
Test: No crashes seen when no display is connected.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoAdd support for extending tests and configuring them in json file.
Johnson Lin [Thu, 26 Jan 2017 08:46:52 +0000 (16:46 +0800)]
Add support for extending tests and configuring them in json file.

We are able to configure the no of layers, type of layers etc from
json file. Video test doesnt work yet.

Main idea:
1: different layers can have different renderers
2: read configuration from json file for the parameters

thrid_pary Json_c is actually a submodule;
Use these commands:
cd tests/third_pary/json_c
./autogen.sh --prefix=$WLD
make
cd ../../../
./autogen.sh --prefix=$WLD
make

run the commands:
cd tests
./testlayers -j ./jsonconfigs/kmscube1layer.json

Jira: None.
Test: Build passes on linux and able to run kmscube demo.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoDont pass EGL_SYNC_FLUSH_COMMANDS_BIT_KHR.
Kalyan Kondapally [Thu, 26 Jan 2017 02:47:38 +0000 (18:47 -0800)]
Dont pass EGL_SYNC_FLUSH_COMMANDS_BIT_KHR.

Mesa generates invalid argument error with this and seems to
work fine without it.

Jira: None
Test: No more errors from Mesa related to EGL Fence in logcat.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCorrect the RefreshRate Query in HWC
Randy Xu [Wed, 25 Jan 2017 00:33:59 +0000 (08:33 +0800)]
Correct the RefreshRate Query in HWC

The expected value of kRefreshRate is nanosecond in a vsync cycle, while the code return fps by mistake.
It causes wrong fps count in Android framework, and the "dumpsys display" shows the fps is 1.66666667e7.
The Choreographer shows below error continuously
"The application may be doing too much work on its main thread."

Jira: None.
Test: Build and boots to home screen.

Signed-off-by: Randy Xu <randy.xu@intel.com>
7 years agoSquash BoardConfig flags.
Kalyan Kondapally [Tue, 24 Jan 2017 10:00:23 +0000 (02:00 -0800)]
Squash BoardConfig flags.

Lets just use BOARD_DISABLE_EXPLICIT_SYNC to disable explicit sync
and Overlay support.

Jira: None.
Test: Build passes.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMake Choregrapher happy.
Kalyan Kondapally [Tue, 24 Jan 2017 02:59:58 +0000 (18:59 -0800)]
Make Choregrapher happy.

We currently send Vblank callbacks only when we have a valid commit.
However, Choregrapher seems to expect for every vblank. We now
keep track of vblank events using drmWaitVBlank and send the
callbacks.

Jira: AIA-115.
Test: No complaints from Choregrapher about skipped frames and no
      regressions with test demos on Linux.

7 years agoManage sync time line within planemanager.
Kalyan Kondapally [Mon, 23 Jan 2017 23:28:46 +0000 (15:28 -0800)]
Manage sync time line within planemanager.

We now rely on PageFlipEevent to do this but we keep track of
buffers in use in PlaneManager anyway, lets do the same for sync
timeline. This way we dont need to depend on PageFlipEvent and
can just track vblank events in a separate thread in follow up
patch.

Jira: None.
Test: Builds and boots to home screen. No graphics regression.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agodrm_hwcomposer: in case of EBUSY, spin until commit succeeded
Tapani Pälli [Mon, 23 Jan 2017 22:03:21 +0000 (14:03 -0800)]
drm_hwcomposer: in case of EBUSY, spin until commit succeeded

Use this path when explicit fence is not supported.

Bug: #11
Test: AnTuTu Marooned demo works correctly
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoOnly build if BOARD_USES_IA_HWCOMPOSER is set
Marta Lofstedt [Thu, 19 Jan 2017 14:28:29 +0000 (16:28 +0200)]
Only build if BOARD_USES_IA_HWCOMPOSER is set

Jira: None
Test: Build and boot to homescreen

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
7 years agoMaintain compatibility with existing GRALLOC_MODULE_PERFORM_DRM_IMPORT.
Kalyan Kondapally [Mon, 23 Jan 2017 14:56:46 +0000 (06:56 -0800)]
Maintain compatibility with existing GRALLOC_MODULE_PERFORM_DRM_IMPORT.

This way we can use drm_gralloc with no additional changes needed
specifically for us.

Jira: None.
Test: Builds and boots to home screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoUse GraphicBuffer APIS to allocate buffers.
Kalyan Kondapally [Mon, 23 Jan 2017 13:30:56 +0000 (05:30 -0800)]
Use GraphicBuffer APIS to allocate buffers.

This way we dont need any new APIS in Gralloc implementation which
are not required by anyone else.

Jira: None:
Test: Builds and boots to home screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoCleanup: Remove redundant logging.
Kalyan Kondapally [Sun, 22 Jan 2017 21:15:46 +0000 (13:15 -0800)]
Cleanup: Remove redundant logging.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix double deletion issue.
Kalyan Kondapally [Sun, 22 Jan 2017 20:49:17 +0000 (12:49 -0800)]
Fix double deletion issue.

We release native buffer in Surface and OverlayBuffer. We
need to do this only in NativeSurface as buffer is owned
by it.

Jira: None.
Test: Check Asan builds dont complain when test app is closed
      on Linux.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoEnsure we dont close gpu fd till all resources are released.
Kalyan Kondapally [Sun, 22 Jan 2017 20:49:17 +0000 (12:49 -0800)]
Ensure we dont close gpu fd till all resources are released.

We need to ensure we dont close the gpu fd till all resources
are released.

Jira: None.
Test: Run demos on linux and ensure we dont see any errors
      like "Failed to remove fb"

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoDont set wrap mode to GL_REPEAT.
Kalyan Kondapally [Sun, 22 Jan 2017 10:12:22 +0000 (02:12 -0800)]
Dont set wrap mode to GL_REPEAT.

From https://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt

"The default s and t wrap modes are CLAMP_TO_EDGE
        and it is an INVALID_ENUM error to set the wrap mode to any other
        value. "

Jira: None.
Test: Enable MESA_DEBUG=1 and check that Mesa doesnt throw INVALID_ENUM
      errors.

7 years agoRestore EGLContext state correctly during GLRenderer initialization.
Kalyan Kondapally [Sun, 22 Jan 2017 10:02:54 +0000 (02:02 -0800)]
Restore EGLContext state correctly during GLRenderer initialization.

We make our context current in GLRenderer initialization but never
restore it. This patch fixes it.

Jira: None.
Test: Test apps on Linux render correctly even when Overlay
      support is disabled.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoFix build warning.
Ragha Khandenahally [Sun, 22 Jan 2017 05:24:23 +0000 (21:24 -0800)]
Fix build warning.

Jira: None:
Test: No Graphics Regression.

Signed-off-by: Ragha Khandenahally <Ragha.Khandenahally@intel.com>
7 years agoAlways fall back to GPU when Overlay usage is disabled.
Ragha Khandenahally [Sun, 22 Jan 2017 05:21:47 +0000 (21:21 -0800)]
Always fall back to GPU when Overlay usage is disabled.

If DISABLE_OVERLAY_USAGE is defined, there is no need to do
atomic test commits as intention is that we will only recieve
final buffer which needs to be displayed.

Jira: None:
Test: No Graphics Regression.

Signed-off-by: Ragha Khandenahally <Ragha.Khandenahally@intel.com>
7 years agoEnsure format and usage are in right types.
Ragha Khandenahally [Sun, 22 Jan 2017 04:52:36 +0000 (20:52 -0800)]
Ensure format and usage are in right types.

In GRALLOC_MODULE_PERFORM_CREATE_BUFFER, expectation is
that usage and format are of type int. Lets make this explicit.

Jira: None.
Test: Boots to Animation screen on Android Things.

Signed-off-by: Ragha Khandenahally <Ragha.Khandenahally@intel.com>
7 years agoAdd Board Config option to disable Native Color Mode support.
Ragha Khandenahally [Sun, 22 Jan 2017 02:04:45 +0000 (18:04 -0800)]
Add Board Config option to disable Native Color Mode support.

Android Things frameworks still doesnt have support for this.
This patch adds support to disable this in HWC via Build Config
option.

Jira: None.
Test: Build passes.

Signed-off-by: Ragha Khandenahally <Ragha.Khandenahally@intel.com>
7 years agoNo need to maintain a cache of OverlayBuffers.
Kalyan Kondapally [Sat, 21 Jan 2017 08:18:09 +0000 (00:18 -0800)]
No need to maintain a cache of OverlayBuffers.

We cache imported buffers which is unneeded as Gralloc does it
already. Instead, what we try to ensure is have a reference to
the buffer till it is scanned out.

Jira: None.
Test: Doesnt regress Android, Test cases work on Linux.

7 years agoLinux: Make kmscube wait on the right fence.
Rafael Antognolli [Wed, 18 Jan 2017 18:23:32 +0000 (10:23 -0800)]
Linux: Make kmscube wait on the right fence.

Inside the main loop, when going to wait on the fence that informs that
the drm commit is finished, we need to wait on the fence from the
previous frame. The current frame is yet to be committed, so it has no
valid fence.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoTests: Inital plumbing for connection change notifications.
johnson.lin [Wed, 18 Jan 2017 07:57:37 +0000 (15:57 +0800)]
Tests: Inital plumbing for connection change notifications.

In order to test multi monitor support, we need a way for test apps
to know when a display has been connected or disconnected. This
patch adds initial support for it but the hot plug events dont
yet work.

Jira:None.
Test:Kmscube works on external monitor.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoEnsure we are using the right connected display.
johnson.lin [Wed, 18 Jan 2017 07:54:32 +0000 (15:54 +0800)]
Ensure we are using the right connected display.

We assume that the first crtc is connected while it might
not be true depending on what you are using (i.e. HDMI, DP etc).
This patch fixes it.

Jira: None.
Test: KmsCube runs on external monitor connected via DP.

Signed-off-by: johnson.lin <johnson.lin@intel.com>
7 years agoLinux: Fix kms cube test case.
Kalyan Kondapally [Wed, 18 Jan 2017 00:08:40 +0000 (16:08 -0800)]
Linux: Fix kms cube test case.

When creating fbs to scanout buffers ensure they have the right
permissions. The buffer needs to be imported with card0 fd rather
than render node.

Jira: None.
Test: Builds on linux and kms cube demo works correctly.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoMake DisplayManager private in cpp file.
Kalyan Kondapally [Mon, 16 Jan 2017 10:09:13 +0000 (02:09 -0800)]
Make DisplayManager private in cpp file.

We dont need this in header file and avoids exposing other unneeded
headers like spinlock etc.

Jira: None.
Test: Builds and boots to home screen.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
7 years agoInitial import.
Kalyan Kondapally [Wed, 21 Dec 2016 21:06:52 +0000 (13:06 -0800)]
Initial import.

Includes Several commits:

commit aee43ab680941f5c7322cd62abb91b1ddf398852
Author: Kalyan Kondapally <kalyan.kondapally@intel.com>
Date:   Sat Jan 14 23:35:35 2017 -0800

    Fix issues related to Tests.

    This fixes the linking issues we had with some of the GL
    and EGL API. Test apps build and link but Atomic commit fails
    during run time.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
commit 8ff76e215cfdb08a92382a11ea15ac3188ddf6fa
Author: Kalyan Kondapally <kalyan.kondapally@intel.com>
Date:   Sat Jan 14 16:47:26 2017 -0800

    Use sync wait instead of waiting in a loop to submit commit.

    Inspired by: https://github.com/rantogno/kmscube/commit/fc52268da79ed406da02c88f849f1ef70dab789f

    Jira: None.
    Test: Builds and boots to home screen. No Graphics regrssion.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
commit 3aa1ae042b9ccd7c4f768db0498a056b92903f71
Author: Johnson Lin <johnson.lin@intel.com>
Date:   Thu Jan 12 10:58:08 2017 +0800

    Add kmscube as test program

    Test program doesn't link yet. Imported from
    https://github.com/rantogno/kmscube

    Jira: None.
    Test: None.

commit 0f7cfbc9bc8fcec3e296433ac9d09e549cc4967c
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Tue Jan 10 06:58:27 2017 -0800

    hwcomposer: in case of EBUSY, spin until commit succeeded

    Bug: #11
    Test: AnTuTu Marooned demo works correctly
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Initial Linux support added by Johnson Lin <johnson.lin@intel.com>