OSDN Git Service

android-x86/external-IA-Hardware-Composer.git
6 years agotravis-ci update: Add cppcheck run on codebase
Richard Avelar [Thu, 26 Apr 2018 19:58:02 +0000 (12:58 -0700)]
travis-ci update: Add cppcheck run on codebase

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

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

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

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

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

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

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

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

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

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

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

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

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

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

utils_alios.h had an unnecessary assignment

yallocbufferhandler.h had an unused member

gralloc1bufferhandler.h had an unused member

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

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

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

Jira: None.
Test: Build passes on Android.

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

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

Jira: None
Test: HWC build passes without errors.

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

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

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

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

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

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

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

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

Jira: None.
Test: Build passes on Android.

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

with configure option,

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

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

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

v2: rebased

v3: minor code-format adjustment

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Jira: None.
Test: Build passes on Android.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Destroy handle when releasing the buffer.

Jira: None
Test: weston-simple-egl works

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

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

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

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

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

Jira: None.
Test: Build succeeds.

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

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

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

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

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

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

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

Jira: None.
Test: Build passes on Linux.

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

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

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

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

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

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

Jira: None.
Test: Build passes on Linux.

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

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

Jira: None.
Test: Build passes on Linux.

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

We didn't use these while setting overlays.

Jira: None.
Test: Build passes on Linux.

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

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

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

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

Jira: None.
Test: Weston still launches.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Jira: None.
Test: Build passes on Linux.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoAdd test for Canvas/Background color feature
Vivek Kasireddy [Sat, 31 Mar 2018 01:50:03 +0000 (18:50 -0700)]
Add test for Canvas/Background color feature

We reduce the size of the surface and the primary plane such
that the canvas color is visible.

Jira: None
Tests: tests/jsonconfigs/kmscube1layer_canvascolor.json

Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
6 years agoAdd support for canvas color feature
Vivek Kasireddy [Sat, 31 Mar 2018 00:02:27 +0000 (17:02 -0700)]
Add support for canvas color feature

When the hardware composer sees that there is a canvas/background
color property exposed by the i915 driver, it can try to set it.

Jira: None
Test: When the primary plane is not the size of the mode, one can
observe that the color of the canvas (area under the primary plane)
reflects the color set by the userspace.

Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
6 years agoEnsure we set all attributes correctly when we clone layer.
Kalyan Kondapally [Wed, 11 Apr 2018 09:03:18 +0000 (02:03 -0700)]
Ensure we set all attributes correctly when we clone layer.

We forgot to copy alpha, blending values and also to set the
z_order of layer.

Jira: None.
Test: Tool bar is visible when displays are in clone mode.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agowsi: fix gcc flag error
Kelly Ledford [Fri, 6 Apr 2018 18:29:42 +0000 (11:29 -0700)]
wsi: fix gcc flag error

expected to define "DISABLE_HOTPLUG_NOTIFICATION" -- was instead
defining "ISABLE_HOTPLUG_NOTIFICATION"

Jira: None
Test: None

Signed-off-by: Kelly Ledford <kelly.ledford@intel.com>
6 years agoAvoid using parent compositor for cloned display.
Kalyan Kondapally [Mon, 9 Apr 2018 04:34:41 +0000 (21:34 -0700)]
Avoid using parent compositor for cloned display.

We where using compositor of parent display in case of
cloned display. This can cause issues when releasing
resources of the cloned display as you end up deleting
them with wrong context. Also, we should use FBBufferManager
to ensure buffer is not closed till all displays are done
using it.

Jira: None.
Test: Video plays fine on cloned display and fd's don't increase
      with commit failures.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoWeston: Add support to synchronize texture uploads.
Kalyan Kondapally [Sun, 8 Apr 2018 23:37:51 +0000 (16:37 -0700)]
Weston: Add support to synchronize texture uploads.

We can have different scenarios:
1) Layer buffer is being replaced while old buffer pixel
   data is still being uploaded.
2) Layer is being destroyed while data is being uploaded.

To avoid these and any more race conditions, this patch
adds support to synchronize the buffer uploads and also
a callback mechanism to let clients know when the uploads
are done.

Jira: None.
Test: Weston launches succesfully with iahwc plugin.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Linux builds.
Kalyan Kondapally [Sun, 8 Apr 2018 22:46:37 +0000 (15:46 -0700)]
Fix Linux builds.

Jira: None.
Test: Build passes on Linux with GBM and MiniGBM.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd support to set alpha for layer.
Kalyan Kondapally [Mon, 2 Apr 2018 08:04:27 +0000 (01:04 -0700)]
Add support to set alpha for layer.

We want to be able to set alpha values for layers instead
of assuming them to be opaque. This patch adds the needed
support for this.

Jira: None.
Test: Weston launches and linux test apps work as now.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoInitial support for AliOS.
Han, Xu [Tue, 3 Apr 2018 06:59:32 +0000 (23:59 -0700)]
Initial support for AliOS.

Jira: None.
Test: With additional out of tree patches, build passes on AliOS.

Signed-off-by: Han, Xu <xu.han@intel.com>
6 years agoAdd support to enable RBC dynamically.
Kalyan Kondapally [Sun, 18 Mar 2018 01:35:35 +0000 (18:35 -0700)]
Add support to enable RBC dynamically.

Jira: None.
Test: Android boots to home screen and linux tests still work.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd Render Buffer Compression support in HWComposer.
Yuanjun Huang [Sun, 18 Mar 2018 01:18:19 +0000 (18:18 -0700)]
Add Render Buffer Compression support in HWComposer.

Jira: https://jira01.devtools.intel.com/browse/AREQ-23273
Test: Build passes and validates both on Linux and Android.

Signed-off-by: Yuanjun Huang <yuanjun.huang@intel.com>
6 years agoEnsure we do test commit every time cursor layer changes.
Kalyan Kondapally [Sun, 8 Apr 2018 11:09:20 +0000 (04:09 -0700)]
Ensure we do test commit every time cursor layer changes.

The overall composition might have changed which would change
the Watermark results in kernel side. Instead of using cached
results for cursor, let's re-test the new combination. While
at it improve logging to identify these cases easily in future.

Jira: None.
Test: No commit failuers seen with multiple display cases with the
      following logs in dmesg:
      "Requested display configuration exceeds system watermark limitations"

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix compile warnings.
jenny.q.cao [Sun, 8 Apr 2018 06:40:54 +0000 (14:40 +0800)]
Fix compile warnings.

Fix compile warning : "Deprecated: don't include cutils/log.h,
                     use either android/log.h or log/log.h" [-W#warnings]
Fixe compile warning : unused parameter 'source_layers' [-Wunused-parameter]

Jira: GSE-1411
Tests: Compilation passes without these warnings on Android.

Signed-off-by: jenny.q.cao <jenny.q.cao@intel.com>
6 years agoRelease the lock upon detecting an error in DisplayHotPlugEventCallback().
Michele Lim [Wed, 4 Apr 2018 23:27:57 +0000 (16:27 -0700)]
Release the lock upon detecting an error in DisplayHotPlugEventCallback().

DisplayHotPlugEventCallback() must release the lock before aborting
if connected_displays_.empty() returns true.

Jira: None
Test: None
Signed-off-by: Michele Lim <Michele.Lim@intel.com>
6 years agoSet usage flag correctly in GBMBufferHandler.
Kalyan Kondapally [Sun, 8 Apr 2018 09:42:08 +0000 (02:42 -0700)]
Set usage flag correctly in GBMBufferHandler.

We didn't set the usage correctly in case of video layer.

Jira: None.
Test: Video uses Media path on Linux and shows Video Content.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemoved unused is_cursor_layer param in InitializeFromNativeHandle.
Kalyan Kondapally [Sun, 8 Apr 2018 09:40:23 +0000 (02:40 -0700)]
Removed unused is_cursor_layer param in InitializeFromNativeHandle.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAvoid ref twice if fb is generated
Lin Johnson [Tue, 3 Apr 2018 06:43:53 +0000 (23:43 -0700)]
Avoid ref twice if fb is generated

It will cause memory leak for monitor case
As registerGemHandles will also increase the fb_ref

Jira: None
Tests: No steep memory increase with multiple monitor.

Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoRemove unused code related to PixelBuffer.
Kalyan Kondapally [Sun, 1 Apr 2018 12:37:44 +0000 (05:37 -0700)]
Remove unused code related to PixelBuffer.

All related handling should be moved to iahwcdisplay/layer.

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

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoMove raw pixel data handling to IAHWCLayer.
Kalyan Kondapally [Sun, 1 Apr 2018 16:01:20 +0000 (09:01 -0700)]
Move raw pixel data handling to IAHWCLayer.

This gives flexibility to let weston handle in case
we cannot handle these layers. Also, in coming up patches
we can easily add shaders to handle this case separately.
Lot of un-needed code is still present which will be removed
in followup patch.

Jira: None.
Test: We are able to still see Cursor rendered correctly and
      use a separate plane for Cursor when using Weston Shell.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTravis-ci: Fix weston build
Harish Krupo [Fri, 30 Mar 2018 17:16:44 +0000 (22:46 +0530)]
Travis-ci: Fix weston build

Jira: None
Test: Travis-ci build should pass

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Fix compiler warnings and indentation
Harish Krupo [Fri, 30 Mar 2018 16:20:05 +0000 (21:50 +0530)]
Weston: Fix compiler warnings and indentation

Jira: None
Test: Weston build passes.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoWeston: Fix authentication error for egl clients
Harish Krupo [Fri, 30 Mar 2018 15:15:16 +0000 (20:45 +0530)]
Weston: Fix authentication error for egl clients

When a wayland egl client initializes, it tries to authenticate
with the server. This is done using drm{Get,Auth}magic calls.
These calls would fail if weston opens card0 because IAHWC also
opens card0 and is the actual master/control client.
Mesa ignores the authentication part when opening the render node
and sends the authenticated response to the client.

Jira: None
Tests: weston-simple-egl app should run.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
6 years agoClean up errors returned by HWCServiceAPI routines.
Michele Lim [Thu, 29 Mar 2018 23:52:19 +0000 (16:52 -0700)]
Clean up errors returned by HWCServiceAPI routines.

Currently HWCServiceAPIs return "-1" which is inconsistent
with predefined Android return status codes.

Jira: #268
Test: None
Signed-off-by: Michele Lim <Michele.Lim@intel.com>
6 years agoWeston: Build clients by default.
Kalyan Kondapally [Fri, 30 Mar 2018 02:45:26 +0000 (19:45 -0700)]
Weston: Build clients by default.

Jira: None.
Test: Build passes and able to launch weston clients.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoCustom position for float display
Gowtham Hosamane [Thu, 29 Mar 2018 04:06:10 +0000 (21:06 -0700)]
Custom position for float display

By default HWC sets the display hardware config mode as the resolution
and position it to 0,0 for top left. The additional mechanism of
setting the top left position to non-zero in case of float display enabled.
The float display resolution could be smaller than display resolution.

Jira: #302

Test: When float mode is set, config changes to set custom resolution
at custom position for the required pipe to be working as desired.
If not enabled, it should continue to work as before.

Signed-off-by: Gowtham Hosamane <gowtham.hosamane@intel.com>
6 years agoDon't register pixel buffers.
Kalyan Kondapally [Fri, 30 Mar 2018 01:11:33 +0000 (18:11 -0700)]
Don't register pixel buffers.

In this case HWC will be creating the buffer and it will not
have any prime fds associated during registration time.

Jira: None.
Test: No "Error generate handle from prime fd" seen when running
      Weston.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoImprove Weston support.
Harish Krupo [Wed, 28 Mar 2018 17:35:47 +0000 (23:05 +0530)]
Improve Weston support.

Changes in this commit:
- Add helper functions to maintain the list of created
  layers in compositor-iahwc.c
- Add support for setting raw pixel data in the linux
  frontend
- Add support for mmapping buffers.
- Map the raw pixel data and copy it to a gbm bo.
- README.org change to reflect the above change
- modify travis.yml to build without the build_script.sh

Jira: None.
Test: Able to run weston from VT.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
6 years agoMark unused surfaces for deletion immediately.
Kalyan Kondapally [Thu, 29 Mar 2018 07:59:57 +0000 (00:59 -0700)]
Mark unused surfaces for deletion immediately.

We mark surfaces not onscreen for deletion in plane state
but they might not actually be deleted till the next time
any surface is released using MarkSurfacesForRecycling.
Let's now inform planemanager that we have surfaces to be
released immediately.

Jira: None.
Test: Monitoring shmem shows that memory is re-claimed with
      task switcher.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoUse Cursorplane for Cursor.
Kalyan Kondapally [Wed, 28 Mar 2018 10:00:10 +0000 (03:00 -0700)]
Use Cursorplane for Cursor.

If we have a cursor plane let's use that for cursor than
any other overlay. This should help with any rotation, blending
needs of cursor until we have full support for universal
planes.

Jira: None.
Test: Cursor plane is active when cursor is used.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoDont force clear when whole buffer is damaged.
Kalyan Kondapally [Wed, 28 Mar 2018 08:39:02 +0000 (01:39 -0700)]
Dont force clear when whole buffer is damaged.

This was only meant to be used when dealing with buffers
smaller than DAMAGE_THRESHOLD.

Jira: None.
Test: No new regressions on Android.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRemove unused gpu_fd variable.
Kalyan Kondapally [Fri, 30 Mar 2018 00:19:31 +0000 (17:19 -0700)]
Remove unused gpu_fd variable.

Jira: None.
Test: Build passes on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoTrack GemHandles and FB separately.
Kalyan Kondapally [Thu, 29 Mar 2018 23:59:50 +0000 (16:59 -0700)]
Track GemHandles and FB separately.

We might be having cases where we don't end up creating
FB as fb creation failed or layers go through offscreen
composition pass. In this case we worked around it by
closing the gem handles in gralloc handler. Instead, we
now track gem handle registration and fb registration
separately in FrameBufferManager and use GemHandles as
key for both.

Jira: None.
Test: 1) Don't see rapid increase in memory usage when using
         task switcher in Android IA.
      2) No errors complaining about us trying to close invalid
         handles in multi monitor case.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoEnsure we release handle even if hwc owns the buffer.
Lin Johnson [Thu, 29 Mar 2018 06:13:27 +0000 (14:13 +0800)]
Ensure we release handle even if hwc owns the buffer.

Jira: None.
Tests: App switch doesn't show exponential memory growth on AndroidIA.
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoFix memory leak.
Kalyan Kondapally [Thu, 29 Mar 2018 08:55:33 +0000 (01:55 -0700)]
Fix memory leak.

We didn't close gem handles if we didn't create the fb for
a particular drm buffer on Android. We should close this
nevertheless.

Jira: None.
Test: Memory doesnt grow exponentialy when switching apps using
      launcher on Android IA.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAndroid: use native_handle_clone to simplify code
Lin Johnson [Wed, 28 Mar 2018 03:16:59 +0000 (11:16 +0800)]
Android: use native_handle_clone to simplify code

Jira: None
Tests: Build pass on Android
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoGive out error message when meet errors
Lin Johnson [Fri, 23 Mar 2018 03:30:26 +0000 (11:30 +0800)]
Give out error message when meet errors

It will help for debug HWC.
Aslo fix android build warning cutils/log.h is deprecated

Jira:None
Tests:Build pass on Android
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoEnsure we re-map layer+plane in case layers are removed.
Kalyan Kondapally [Wed, 28 Mar 2018 07:53:52 +0000 (00:53 -0700)]
Ensure we re-map layer+plane in case layers are removed.

Currently, we did this when all layers associated with a
plane where removed. Instead we now check if we have free
planes to accomadate remaining layers when a layer is
removed or added and do incremental validation of
layers and planes.

Jira: None.
Test: Layers are scanned out directly when panning home screen
      after going to a idle state.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix warnings generated in common core hwc
Richard Avelar [Fri, 23 Mar 2018 21:42:08 +0000 (14:42 -0700)]
Fix warnings generated in common core hwc

Adjust casting for coversion warnings and adjust ifdef gaurd which
causes a param unused warning for source_layers.

Jira: None.
Test: Build passes without warnings
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agoChange meta-data process to algin with SOS & fix Nestedisplay hotplug miss
xue.yifei [Wed, 21 Mar 2018 08:27:01 +0000 (16:27 +0800)]
Change meta-data process to algin with SOS & fix Nestedisplay hotplug miss

Change-Id: I2a329ba493d8666214483872e820fcbb5d4248f3
Jira: None
Test: Tested on android
Signed-off-by: xue.yifei <yifei.xue@intel.com>
6 years agoRefine VA module.
Wang,Fei [Tue, 27 Mar 2018 08:07:10 +0000 (16:07 +0800)]
Refine VA module.

1. Ensure HSBC/Sharp/Deinterlace/Scaling mode can be set to libva
correctly.
2. Integrate Hue/Satation/Brightness/Contrast into one filter.
3. Do memset before quary from libva.
4. Set default csc scaling mode as High Quality mode.

Jira: None.
Test: Set/Restore color works as expected.

Signed-off-by: Wang,Fei <fei.w.wang@intel.com>
6 years agoUse global cache for KMS resources
Lin Johnson [Tue, 27 Mar 2018 02:35:57 +0000 (19:35 -0700)]
Use global cache for KMS resources

KMS resources include framebuffers and gem handles
should be process widely shared. Do not close gem handle
when other drmbuffer are still refernce it

Jira: None
Tests: Extend mode, video playback
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoFix Damage rect regression
Lin Johnson [Tue, 27 Mar 2018 02:40:16 +0000 (10:40 +0800)]
Fix Damage rect regression

The regression introduced in fb2fdd91d3cb99adcb1737131b3f55b69a0bf6ca.
Some buttons are not getting rendered correctly.

Jira: None
Tests: Buttons correctly rendered
Signed-off-by: Lin Johnson <johnson.lin@intel.com>
6 years agoFixed one display hang when plug 3 displays in clone mode.
Wan Shuang [Fri, 23 Mar 2018 02:23:02 +0000 (10:23 +0800)]
Fixed one display hang when plug 3 displays in clone mode.

JIRA: #1242
Test: Boot into Android home screen.

6 years agoBe more aggresive with plane allocation when layers are removed.
Kalyan Kondapally [Mon, 26 Mar 2018 06:38:41 +0000 (23:38 -0700)]
Be more aggresive with plane allocation when layers are removed.

In case additional layers are removed, we still continue to use
the old plane+layer combination even if no new layers are
added. Let's check if layers can be scanned out in this case
and try to avoid offscreen composition.

Jira: None.
Test: We see overlays all layers scanned out with gfx benchmark.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRevert "videoeffect: Query vpp caps before use it"
Kalyan Kondapally [Sat, 24 Mar 2018 11:29:55 +0000 (04:29 -0700)]
Revert "videoeffect: Query vpp caps before use it"

H264 Benchmarks miss 60 fps.

This reverts commit 89909d407c1efd4fec07156719739e9e83f3fba4.

6 years agoOptimize Cursor rendering using GPU.
Kalyan Kondapally [Mon, 26 Mar 2018 04:21:19 +0000 (21:21 -0700)]
Optimize Cursor rendering using GPU.

When layers are moving, we need to clear old and new damage rect
of that layer to ensure we don't show any old content. Now, we
detect this situation in NativeSurface and take cummulative
surface damage into account.

Jira: None.
Test: No garbage rendered when CURSOR_WA is enabled, display is rotated
      90 and cursor is moved around.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHandle Surface Damage correctly in case of Transforms.
Kalyan Kondapally [Sun, 25 Mar 2018 06:49:21 +0000 (23:49 -0700)]
Handle Surface Damage correctly in case of Transforms.

We didn't flip the SurfaceDamage co-ordinates in this case
like RenderState does with Display Frame and Source Rects.
Let's handle 90 and 270 case for SurfaceDamage.

Jira: #278.
Test: Rendering works fine when displays are rotated 90/270.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoRe-work Clone mode.
Kalyan Kondapally [Sat, 24 Mar 2018 10:46:57 +0000 (03:46 -0700)]
Re-work Clone mode.

We reset all fences after source display is handled. When
handling Clone display we cannot rely on original layer
fences for any synchronization. Instead of using original
layers, let's use the composition results of Source display.

Jira: #295.
Test: Clone display still works without any regressions.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoAdd Cursor plane checks.
Kalyan Kondapally [Fri, 23 Mar 2018 03:21:26 +0000 (20:21 -0700)]
Add Cursor plane checks.

We might be having only one plane allocated to us and this
might not be a universal plane. Ensure cursor plane is valid
before trying to use it.

Jira: None.
Test: No crash seen with single plane per pipe usage.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix conversion warning when building hwc
Richard Avelar [Wed, 21 Mar 2018 20:58:11 +0000 (13:58 -0700)]
Fix conversion warning when building hwc

Adjust casting to remove warning that occurs when building make
androidia with hwc.

Jira: None.
Test: Build passes without the warning.
Signed-off-by: Richard Avelar richard.avelar@intel.com
6 years agoConfigure custom resolution
Gowtham Hosamane [Mon, 5 Mar 2018 03:55:03 +0000 (19:55 -0800)]
Configure custom resolution

By default HWC sets the display hardware config mode as the resolution.
The additional mechanism of setting resolution via config file.
This resolution could be smaller from display resolution.

Jira: #275
Test: When float mode is set, config changes to set custom resolution
for the required pipe to be working as desired. If not enabled, it
should continue to work as before.

6 years agoFix Rendering issues when playing Video with Mosaic display.
Kalyan Kondapally [Wed, 21 Mar 2018 13:56:25 +0000 (06:56 -0700)]
Fix Rendering issues when playing Video with Mosaic display.

We didn't translate the surface damage to be within the bounds
of the display frame. This meant we would discard the whole
surface damage as outside display frame in certain cases ending
up not rendering the content at all.

Jira: None.
Test: Video plays fine with Mosaic support set to true.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoFix Crashes when running on Virtual environments.
Kalyan Kondapally [Wed, 21 Mar 2018 11:16:21 +0000 (04:16 -0700)]
Fix Crashes when running on Virtual environments.

We might be just have a single plane or no plane
given to us in this case. Let's have appropriate checks
taking this into account and not assume to have atleast
1 plane.

Jira: None.
Test: Boots to Android Home screen.
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoReset Cache in case composition failed.
Kalyan Kondapally [Wed, 21 Mar 2018 03:20:00 +0000 (20:20 -0700)]
Reset Cache in case composition failed.

We are not sure about our state in this case. Let's
start over.

Jira: #286
Test: No crash happens when Media composition fails.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
6 years agoHandle Buffer format changes in case of using Media backend.
Kalyan Kondapally [Wed, 21 Mar 2018 02:18:21 +0000 (19:18 -0700)]
Handle Buffer format changes in case of using Media backend.

In some cases last video frame might have xr24 format. In this
case we should choose 3D Compositor and not really the Media
backend to handle offscreen composition. Now we do these checks
and ensure we choose the right backend.

Jira: fixes #269
Test: Video playback doesn't fail when at the very end of the stream.

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