OSDN Git Service
John Stultz [Thu, 28 Mar 2019 22:18:53 +0000 (15:18 -0700)]
drm_hwcomposer: Remove unnecessary parentheses in the conditional
As requested by Sean, remove unnecessary parens around the
!preferred_mode_found check.
Change-Id: Ibca46c104ab54be894b860373fc42ec047afd337
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Wed, 27 Mar 2019 04:11:31 +0000 (21:11 -0700)]
drm_hwcomposer: Tweak mode selection to pick the first DRM_MODE_TYPE_PREFERRED mode
With commit
1b1e35eb ("drm_hwcomposer: Chose preferred mode with
type DRM_MODE_TYPE_PREFERRED"), we now pick a preferred mode
rather then just the first mode to use.
However, on some systems there may erroniously be multiple modes
marked as DRM_MODE_TYPE_PREFERRED. In this case, the logic added
in that commit ends up selecting the *last* preferred mode.
This seems less likely to be the desired choice, compared to
what we had before (which picked first mode provided).
So this patch alters the selection logic to only use the first
DRM_MODE_TYPE_PREFERRED mode found, rather than the last.
Change-Id: Ieb3e5d946b96099f14c1c5a287ca8113360a39d1
Signed-off-by: John Stultz <john.stultz@linaro.org>
Sean Paul [Tue, 19 Mar 2019 16:47:35 +0000 (12:47 -0400)]
Revert "drm_hwcomposer: platformgeneric: Fix build"
This reverts commit
112903781ca34a39320d99bc68bd9f971182aa27.
Per discussion in !47 [1], this is not needed.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[1]- https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/merge_requests/47
Alexandru Gheorghe [Tue, 8 Jan 2019 17:21:08 +0000 (19:21 +0200)]
drm_hwcomposer: Set zpos relative to the minimum possible value
Current implementation doesn't handle properly the cases where zpos
range starts from 1.
See https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/issues/19#note_100622
Fixes:
ea1c5e5a ("drm_hwcomposer: Add z order support")
Signed-off-by: Alexandru Gheorghe <alexc.g1.ro@gmail.com>
[seanpaul converted to std::tuple return type]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I35dc2c1cfd0e38ca3a47cf4e668eeb5f3c470ddb
Sean Paul [Wed, 13 Mar 2019 18:36:52 +0000 (14:36 -0400)]
drm_hwcomposer: Rename DrmProperty::immutable()
To be a little more precise, add an 'is_' prefix
Change-Id: Idd8fe45a4dfba1cd778b4ed6b761ec489697c31a
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Sean Paul [Wed, 6 Mar 2019 14:48:42 +0000 (09:48 -0500)]
drm_hwcomposer: Change return type of DrmProperty::value() to tuple
To keep consistent with other functions
Change-Id: I11ba07eabcee08f3db09b3a5422bc480482a62c1
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Sean Paul [Fri, 15 Mar 2019 19:18:46 +0000 (15:18 -0400)]
drm_hwcomposer: Use proper commit for author/committer check
The script uses the author/committer of HEAD instead of the commit it is
inspecting. This fails when a patch set has different authors/committers
(such as https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/merge_requests/46)
Change-Id: I0fcd724cf372fad435c7614777f13e015c204c3d
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Andrii Chepurnyi [Wed, 6 Mar 2019 13:01:59 +0000 (15:01 +0200)]
drm_hwcomposer: platformgeneric: Fix build
Propagate correct include path for gralloc_handle.h
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Andrii Chepurnyi [Tue, 19 Feb 2019 19:38:13 +0000 (21:38 +0200)]
drm_hwcomposer: Chose preferred mode with type DRM_MODE_TYPE_PREFERRED
According to the Linux Kernel: "DRM_MODE_TYPE_PREFERRED: Preferred mode,
usually the native resolution of an LCD panel. There should only be
one preferred mode per connector at any given time."
Will use it during preferred mode choice.
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Andrii Chepurnyi [Wed, 1 Aug 2018 14:42:56 +0000 (17:42 +0300)]
drm_hwcomposer: Added hotplug support of the external display
Unplug of the main display will not work because of
Activity Manager code(ActivityStackSupervisor.java:handleDisplayRemoved).
Only one display can be connected as an external
display (see SurfaceFlinger::determineDisplayType).
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Andrii Chepurnyi [Fri, 27 Jul 2018 12:14:37 +0000 (15:14 +0300)]
drm_hwcomposer: Fix VSYNC control
Use HWC2_VSYNC_ENABLE for correct state recognition.
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
John Stultz [Thu, 28 Feb 2019 05:35:03 +0000 (21:35 -0800)]
drm_hwcomposer: Initialize buffer_ pointer to NULL
In some cases, we've seen drm_hwcomposer start to try to
compose frames before anything has called SetClientTarget().
This seems to be some sort of a race, which for some reason
we only see with certain dummy HDMI dongles (which provide
fake EDID data) which allow our lab machines to run headless.
I'm still trying to understand more about why this happens
only in this case.
The net of the issue is we see CreateComposition() being called,
which adds the client_layer_ to the zmap. Then it creates the
DrmHwcLayers copying the non-initialized buffer_ value as the
sf_handle.
This then later causes a crash in ImportBuffer() when we
traverse the non-null (but invalid) hnd value.
Thus, this patch simply initilizes the buffer_ pointer to NULL
so that we error out properly in the case of the race.
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I5fde3fccde86519edb04e61cbc2842eda395ade4
John Stultz [Thu, 28 Feb 2019 07:34:53 +0000 (23:34 -0800)]
drm_hwcomposer: platformhisi: Conditionalize some of the AFBC support
Unfortunately with the AFBC support patches, I validated with
the hikey960 (which has a gralloc that supports AFBC), but not
with the original hikey board (which does not support AFBC).
Since we use the same importer for both boards, conditionalize
the AFBC logic if those values are not defined.
This patch will also need a tweak to the hikey gralloc to add
support for the handle->internal_format reference (which doesn't
currently exist on hikey's gralloc).
Change-Id: I31aea82b321ff7dd7608c6a3522cbc93bb629319
Signed-off-by: John Stultz <john.stultz@linaro.org>
Ayan Kumar Halder [Mon, 14 Jan 2019 12:47:12 +0000 (12:47 +0000)]
drm_hwcomposer: Add support for Arm Framebuffer Compression (AFBC) modifiers.
One needs to translate the Gralloc buffer flags for AFBC (eg
MALI_GRALLOC_INTFMT_AFBC_BASIC) to the corresponding linux kernel drm modifiers.
This gets passed to libdrm via drmModeAddFB2WithModifiers.
Changes from v1:-
- Moved ConvertGrallocFormatToDrmModifiers() and IsDrmFormatRgb() from 'DrmGenericImporter'
to 'HisiImporter' as suggested by Sean paul
- Check if the format is rgb and set AFBC_FORMAT_MOD_YTR only if any of the AFBC related
Gralloc flags are set.
Changes from v2:-
- Changed ConvertGrallocFormatToDrmModifiers() and IsDrmFormatRgb() from 'public' to 'private'
(suggested by Sean Paul)
Changes from v3:-
- Reordered the members of 'class HisiImporter'. Functions should go above member variables.
(suggested by Sean Paul)
Changes from v4:-
- Rebased and some style changes (as suggested by gitlab-ci-checkcommit.sh)
Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
/-- Note for reviewer
I was able to get this working for hikey960 with aosp/master for kernel 4.14. The libdrm
headers need to be updated as the AFBC modifiers are missing in the aosp/master's external/libdrm.
--/
Change-Id: I66abaa08d19ce88169cc40522b167dfe5efc7036
Sean Paul [Wed, 30 Jan 2019 14:45:21 +0000 (09:45 -0500)]
drm_hwcomposer: Fix check commit script to ignore case and extra spaces
Job 93709 [1] failed with missing committer sign-off. Ayan has their
committer string set to "Ayan kumar halder <ayan.halder@arm.com>", and
the Signed-off-by line on the commit was
"Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>". So grep did
what we asked it to do and did not find the SoB since the case was
incorrect.
This patch changes to case-insensitive search and while we're at it,
trims excess whitespace from both the commit body and the
committer/author name.
Finally, I've improved the error message so it's hopefully more clear
why things fail in the future.
[1]- https://gitlab.freedesktop.org/ayan.halder/drm-hwcomposer/-/jobs/93709
Signed-off-by: Sean Paul <seanpaul@chromium.org>
John Stultz [Wed, 9 Jan 2019 22:54:52 +0000 (14:54 -0800)]
drm_hwcomposer: Rework ValidateDisplay layer check to use if statement rather then switch
AOSP's toolchain throws errors on un-annotated switch case
fallthroughs. Rather then adding [[fallthrough]] annotations,
which would add C++17 syntax, switch to using a if statement
instead.
Change-Id: Id0b2bf6d365d50e637569f0c4353ceb4fda21c16
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Rework conditional to be more readable as suggested by seanpaul
Jorge E. Moreira [Wed, 19 Sep 2018 22:34:07 +0000 (15:34 -0700)]
drm_hwcomposer: Complete rename of DrmResources to DrmDevice
In AOSP/master, there was a structure renamed, so try to sync
AOSP/master's build fix change to freedesktop/master.
NOTE: I'm not sure how to best submit this, as the upstream
freedesktop/master may have users outside of AOSP/master. But
I'm not sure what devices on an official release are using
drm_hwc so it seems like this would be more useful then not.
Bug:
116154944
Test: builds
Change-Id: I244bd049afae6ba8310f6b6bf2d3b1ee2e891de3
Signed-off-by: John Stultz <john.stultz@linaro.org>
Alexey Firago [Tue, 27 Nov 2018 11:17:55 +0000 (14:17 +0300)]
drm_hwcomposer: platformhisi: Remove fake-importing
With CanImportBuffer() in place we don't need fake importing
anymore. Buffers should be checked before supplied to ImportBuffer()
and plane planner.
Instead of fake importing return -EINVAL for non HW_FB buffers in
ImportBuffer() and skip non HW_FB in planner. Additionally, return
error from planner if we didn't emplace any layer to force client
compositing.
Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
Alexey Firago [Wed, 21 Nov 2018 20:47:05 +0000 (23:47 +0300)]
drm_hwcomposer: Add checking if we can import a buffer
Add CanImportBuffer() function to the Importer interface.
Platform specific importer should check in this function if it can
import given buffer_handle_t. For example platformhisi will return
false for buffers without GRALLOC_USAGE_HW_FB.
This function should be used on ValidateDisplay step to avoid the
need of 'fake-importing' of buffers.
Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
Alexandru Gheorghe [Mon, 17 Sep 2018 09:48:54 +0000 (10:48 +0100)]
drm_hwcomposer: Add z order support
Currently, the planner just pops the first available drm plane and if
that can't be used for the DrmHwcLayer it just returns error.
This proposes a slighlty smarter way to do that by trying to see if
any of the DrmPlane can be used for the DrmHwcLayer in question.
More, if the drm_plane doesn't have a fix zorder then we could re-add
him to the list of unused planes, so it could be used for hosting
other less demanding DrmHwcLayers.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Tue, 9 Oct 2018 15:25:28 +0000 (16:25 +0100)]
drm_hwcomposer: Propagate PlanStage error
All existing stage planers(PlanStageGreedy, PlanStageProtected,
PlanStageHiSi) silently ignore if they couldn't allocate a drmplane
for a drmhwclayer and return success.
That doesn't go well with the assumptions from ValidateDisplay,
where if the atomic check succeeds we just assume that we could do
Device composition for a maximum of num_of_drm_planes layers. But,
since we silently dropped some drmhwclayer we never put those in the
atomic check and we won't put it in the final atomic commit, so we end
up with a wrong composition on the screen.
What this proposes is propagating the error, which will make
ValidateDisplay to fallback on client composition.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Sean Paul [Tue, 4 Sep 2018 19:32:26 +0000 (15:32 -0400)]
drm_hwcomposer: Add commit message validation to CI
Check the subject prefix starts with "drm_hwcomposer: " and we have
Signed-off-by tags for both author and committer.
Change-Id: Ib26b8e5cbeae2156014f2bbfb8703545bdc1decb
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Sean Paul [Tue, 4 Sep 2018 19:30:29 +0000 (15:30 -0400)]
drm_hwcomposer: Pull CI check into dedicated script
This will be useful for adding more functionality to it. It's not very
practical to script inside the yml.
Change-Id: I71aa6b40d282f750eb9bce65dd2cfd9e2828905b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Lowry Li [Tue, 28 Aug 2018 09:58:21 +0000 (17:58 +0800)]
drm_hwcomposer: Add support for pixel blend mode property
The upstream version of pixel blend mode property will be added
to the DRM core. So added support for pixel blend mode property
to the DrmPlane.
Created ValidatePlane() function in Planner to do the blend check,
and also moved rotation and plane alpha property check there.
Fixed the Emplace() call in platformhisi.cpp as was done with the
other planner implementations.
Change-Id: I7e6714699cf7c222a83de472060d4625e1e6945a
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Lowry Li <lowry.li@arm.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Andrii Chepurnyi [Mon, 3 Sep 2018 11:19:40 +0000 (14:19 +0300)]
Fix actual clang-format version in readme
Current .clang-format requires clang-format 5.0
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
John Stultz [Tue, 21 Aug 2018 18:21:56 +0000 (11:21 -0700)]
drm_hwcomposer: Add support for P+ environments
Originally-by: Alistair Strachan <astrachan@google.com>
With Android P, the GraphicBufferMapper ImportBuffer interface
has changed, which breaks the current drm_hwcomposer master
branch:
https://android.googlesource.com/platform/frameworks/native/+/
dbbe33b95336efa74e8bb4ebcf6cba50919aa247
Alistair has updated the AOSP/master branch of drm_hwcomposer to
make it build:
https://android.googlesource.com/platform/external/drm_hwcomposer/+/
4f73630dcdab6604a3f4b3e7d59068633d923745%5E2..
4f73630dcdab6604a3f4b3e7d59068633d923745/
But since we need to keep older users working, so I've forward
ported and conditionalized the code so both new and old users
can properly build.
Change-Id: I2089c1105a7074ff13b5ddfe2d2eb7129917794f
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2:
* Fix up LOCAL_CPPFLAGS typeo and unsued variable errors
both found thanks to Alexandru Gheorghe
v3:
* Reordered so this patch comes last
* Squish layer_count calculation patch into this one
John Stultz [Fri, 24 Aug 2018 23:27:36 +0000 (16:27 -0700)]
drm_hwcomposer: Store pixel_stride in the hwc_drm_bo
The new GraphicBufferMapper ImportBuffer takes a pixel_stride
as an argument, so we need to caluclate that and store it in
the hwc_drm_bo at import so we can use it here.
I'd still welcome better ideas to calculate pixel_stride for
generic drm importer.
Change-Id: Iea2c483f3750dd5bed38740802b560911bc54ef2
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2:
* Utilized pixel stride values already in some gralloc handle
implementations
* Fixed embarasing bit/byte math snafu (preserving bits per
pixel since YUV conversions using bytes doesn't seem sane)
- Extra review still would be appreciated here!
v3:
* Renamed to use Drm... instead of DRM...
John Stultz [Fri, 24 Aug 2018 23:08:57 +0000 (16:08 -0700)]
drm_hwcomposer: Store the HAL_PIXEL_FORMAT_* in the hwc_drm_bo
The new GraphicBufferMapper ImportBuffer takes a format
as an argument, but I believe it wants the HAL_PIXEL_FORMAT_*
and not the DRM_FORMAT value.
So stash the HAL_PIXEL_FORMAT_* into the hwc_drm_bo so we
can pass it along when needed.
Change-Id: Id5b8e0d8c624e26c2c6307f85489665c88a9e75d
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Mon, 27 Aug 2018 17:53:07 +0000 (10:53 -0700)]
drm_hwcomposer: Add HWC_DRM_BO_MAX_PLANES constant
Add HWC_DRM_BO_MAX_PLANES to avoid open coded num_gem_handles
calculations.
Change-Id: Iebdaa67518e75f5b7f4445d92b97ca72e625c04b
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Tue, 28 Aug 2018 05:24:40 +0000 (22:24 -0700)]
drm_hwcomposer: Fixup Sean's HiSi dummy planner
The dummy HiSi Planner is careful to not try to emplace layers
that aren't HW_FB. However, in some cases we might have a single
layer to draw. In that case the dummy importer will pretend it
imported the buffer, and the planner will skip over it and not
emplace it. Since there were no errors and the layers_ count is
the same as the available planes, we won't force client
composition, and will try to do device composition for the
buffer we didn't really import.
This results in the drm layer going a bit wonky.
Thus, this patch tries to fix this by erroring out if we try to
plan only a single layer, but don't emplace anything. This
results in the CreateComposition() function failing, which will
force client rendering, making it work (with only minimal logcat
noise - only in the single layer case).
Change-Id: I563dbba3c2adce5617fae61cb0440368053e5bff
Signed-off-by: John Stultz <john.stultz@linaro.org>
Sean Paul [Fri, 24 Aug 2018 20:58:35 +0000 (16:58 -0400)]
drm_hwcomposer: Fix HiSi import fail log spam
hikey can only display layers which do not have gralloc usage HW_FB
(hint: that leaves just the client target layer). As such, there's no
benefit trying to import them since it'll just fail. So if we encounter
a layer such as this, fake the import (the release will be a noop since
gem_handles will be 0).
Also, as a belt-and-suspenders move, replace the greedy planner with one
that only displays (usage != HW_FB) to be doubly sure that we don't try
to display the no-op layers
Change-Id: I7bf88cfb7bda1dd5f47b741709619494431558a2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Sean Paul [Mon, 27 Aug 2018 17:59:08 +0000 (13:59 -0400)]
drm_hwcomposer: Reformat using clang-format-5.0
Run the new clang-format style over the codebase to make things
compatible.
Change-Id: I267d5070929aaa7965d58655da841402debdcb6c
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Sean Paul [Fri, 13 Jul 2018 16:51:42 +0000 (12:51 -0400)]
drm_hwcomposer: Update clang-format to 5.0
Updating clang-format to 5.0 to get a bit more control over our
styling. Two things that will be beneficial:
- Alphabeticalize headers
- More control around line breaking, especially preferring
val = SomeFunction(arg1,
arg2);
vs:
val =
SomeFunction(arg1, arg2);
It's still not perfect, but it seems greatly improved.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Alexandru Gheorghe [Tue, 27 Mar 2018 15:10:55 +0000 (16:10 +0100)]
drm_hwcomposer: add scene flattening
Flattening of a scene is triggered if it doesn't change for a while.
As of now there is a separate thread which triggers flattening if the
scene did not change in last 60 vsyncs.
There are two options for flattening a scene:
* Serial, by using a writeback connector attached to the same crtc as
the one driving the display. This happens only if possible_clones
mask reports that the display encoder and writeback encoder could
work simultaneously.
The steps for achieving this are:
1. Build a commit that enables writeback connector, we don't need to
build a commit that contains the entire active_composition, just
set the writeback specific properties a let the kernel duplicate
the rest of the state.
2. Commit and wait for writeback_fence to fire.
3. Setup a composition with just one plane enabled.
4. Apply the composition if a new one has not been applied meanwhile.
* Concurrent, by comitting the scene to a new unused crtc (state !=
DRM_MODE_CONNECTED) and getting the result back through a writeback
connector.
The steps for achieving this are:
1. Copy layers from active composition.
2. Plan layers of copy on the unused crtc. This is realized by using a
newly created DrmDisplayCompositor object.
3. Commit copy to the unsed crtc and get the result as a drmhwclayer.
4. Setup a composition with just one plane enabled. Re-importing the
buffers might be needed since we might have been using a different
dri node.
5. Apply the composition if a new one has not been applied while doing
the flattening
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Thu, 29 Mar 2018 13:38:21 +0000 (14:38 +0100)]
drm_hwcomposer: Fix race in ApplyFrame
ApplyFrame holds the lock just when it swaps the value of
active_composition_, in a multithread context we could end up in a
situation where something is shown on the screen, but something else
is set in active_composition_. Fix it by holding the lock during
CommitFrame.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Wed, 21 Mar 2018 14:19:58 +0000 (14:19 +0000)]
drm_hwcomposer: Handle writeback connectors
When writeback connectors are available assign them to displays, in
order to be able to use them for flattening of the current displayed
scene. The pipeline for each display will look like this:
CRTC ---- encoder ------------ display connector.
|------- writeback enc ------ writeback connector.
However, the writeback connector will be later used/enabled only if
one of the following conditions are met:
- Could be a clone of the display connector, as pointed by the
possible_clones property.
- The display_connector is disconnected, so we are safe to use it for
flattening the scene that's already presented on another display.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Thu, 22 Mar 2018 11:31:29 +0000 (11:31 +0000)]
drm_hwcomposer: Parse and store possible_clones information
drmModeEncoder has a field called possible_clones. It's a bit mask
which tells if the encoder could be simultaneously connected, to the
same CRTC, with the encoders specified in the possible_clones mask.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Wed, 21 Mar 2018 12:06:20 +0000 (12:06 +0000)]
drm_hwcomposer: Add display field to Drmencoder
In the current implementation TryEncoderForDisplay just looks
at the crtc linked to the display, if that's not assigned to
a display it means the encoder could be used, otherwise iterate
to the list of possible_crtcs and find one which is not used.
This logic works fine when you have just one encoder connected to a
crtc but with two or more, like is the case when we attach a writeback
connector, we need to know if we already assigned the encoder to a
display.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Wed, 21 Mar 2018 11:40:01 +0000 (11:40 +0000)]
drm_hwcomposer: Add writeback connector support
Writeback connector is a special case of connector, which can be
linked to a CRTC in order to get the result of the composition back to
a memory buffer. This had not been merged to the mainline kernel yet,
latest version of the kernel patches could be found here [1].
[1] https://lists.freedesktop.org/archives/dri-devel/2018-February/167703.html
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Sean Paul <seanpaul at chromium.org>
Alexandru Gheorghe [Fri, 11 May 2018 10:40:53 +0000 (11:40 +0100)]
drm_hwcomposer: Purge drm_ from drmdisplaycompositor
Having DrmDevice as a member in DrmDisplayCompositor is redundant,
since that could be always retrieved by calling:
resource_manager_->GetDrmDevice(display_)
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Tue, 1 May 2018 16:25:48 +0000 (17:25 +0100)]
drm_hwcomposer: Pass resource manager to drmdisplaycompositor
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Tue, 27 Mar 2018 14:52:02 +0000 (15:52 +0100)]
drm_hwcomposer: Add resource manager support
Add a resource manager class that is responsible for detecting all
kms devices and allocates unique display numbers for every detected
display.
This is controlled by the value of hwc.drm.device property, if it ends
with a %, it will try to open minor devices until an error is detected.
E.g: /dev/dri/card%
Additionally, this will be used for finding an available writeback
connector that will be used for the flattening of the currently
displayed scene.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Alexandru Gheorghe [Tue, 1 May 2018 13:37:10 +0000 (14:37 +0100)]
drm_hwcomposer: Rename DrmResources to DrmDevice
DrmDevice is a better name to reflect the fact that DrmResources/
DrmDevice can handle just one dri node.
Suggested here [1] by Sean Paul.
[1] https://lists.freedesktop.org/archives/dri-devel/2018-April/173290.html
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
John Stultz [Wed, 11 Jul 2018 18:28:40 +0000 (11:28 -0700)]
drm_hwcomposer: Drop -Wno-unused-* build options and remove unused variables
This patch drops the -Wno-unused-* build options and removes
the currently unused variables that would keep things from
building.
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 6 Jul 2018 17:34:42 +0000 (10:34 -0700)]
drm_hwcomposer: Really fail on CreateComposition failures
The current logic in Validate assumes that if CreateComposition()
fails, it was due to overlay planes as sets the avail_planes to 1.
With most multi-plane compositions, this will then cause the
avil_planes to be later decremented to zero (to reserve the client
composited plane), resulting in all the layers to be set as
client composited.
However, in the case where there is only one layer, such as with
the Android BootAnimation, if CreateComposition fails, we set
avail_planes to one, and since there is only one layer, we don't
decrement it further, resulting in the layer to be validated as
a Device rendered layer, as if CreateComposition succeeded.
This adds an extra flag we don't mix up a single layer failure
as a success.
On HiKey/HiKey960, this patch fixes the issue where the
BootAnimation wouldn't display.
Change-Id: I58bf5f332667a46e8e997d1743b73dd4a768657f
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Thu, 24 May 2018 23:43:35 +0000 (16:43 -0700)]
drm_hwcomposer: Avoid filling the log with warnings when test compositions fail
We frequently test compositions that might fail due to various
reasons. On db820 we see:
W HwcComposer: command 0x4010000 generated error 8
E hwc-drm-display-compositor: Alpha is not supported on plane 29
E hwc-drm-two: Failed to apply the frame composition ret=-22
over and over
So to avoid filling the log with errors when those test
compsitions don't work out, this patch tries to quiet down those
error messages when we are doing test compositions.
Change-Id: Iab19628bd7488c7d104e2c775310989bb59e140d
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 1 Jun 2018 00:37:21 +0000 (17:37 -0700)]
drm_hwcomposer: platformhisi: Add support for importing DRM_FORMAT_YVU420 buffers
When trying to play fullscreen video, I started seeing import
errors, which were caused by us trying to call drmModeAddFB2()
with fmt DRM_FORMAT_YVU420 but only setting the a single set of
handle/pitch/offset values.
In the kernel, the framebuffer_check() function would then fail
with "no buffer object handle for plane 1" since we only passed
one plane in.
Thus this patch calculates and sets the pitch/offset values for
the separate planes in the single gem_handle buffer.
Many thanks to Stefan Schake and Rob Herring for helping me
understand some of the subtleties of image plans vs display
planes, etc.
Change-Id: I2d9bdfc66c504e6446a4f9c6287ab675201afa30
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 1 Jun 2018 00:46:50 +0000 (17:46 -0700)]
drm_hwcomposer: platformdrmgeneric: Handle closing gem_handles if we have duplicate handles
In some cases some multi-plane bo's may have multiple
gem_handles/offsets/pitches set. And its possible to have
multiple planes that use the same gem_handle with different
offsets/pitches.
Thus, when closing the gem_handles, if we're not careful
we could close the same handle multiple times. So this
patch avoids this by taking some old code from the nv
importer:
https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/blob/
aeccd89eaafec467cb9449cce5c64152a240c138/platformnv.cpp#L176
Many thanks to Stefan Schake for pointing me to that code.
Change-Id: Ifecd0f95de5ada5280a0af807005d0b0186a068c
Signed-off-by: John Stultz <john.stultz@linaro.org>
Alexandru Gheorghe [Wed, 13 Jun 2018 15:46:36 +0000 (16:46 +0100)]
drm_hwcomposer: Set client composition buffer at the bottom.
Currently, we allocate layers to device composition from bottom to
top and save the last DrmPlane from the top to be used by the client
target buffer.
However, we don't know much about client layer, so information for
layers which we decided to set as ClientComposition, will be lost.
For example, in BlendMode case if we have the following scene, with 2
DrmPlanes available.
z0: LAYER0 AR24 BlendNone.
z1: LAYER1 AR24 BlendPremulti.
z2: LAYER2 AR24 BlendPremulti.
We decide:
z0: LAYER0 DeviceComposition
z1: LAYER1 ClientComposition
z2: LAYER2 ClientComposition
LAYER1+LAYER2 will be in client target buffer, but we don't know
nothing about the blending for client_target_layer. Which Android
actually expects to be still BlendPremulti. So, we are kind of stucked
we the default value which is BlendNone.
I think there are two ways to solve this issue:
1) This commit, allocate layers as DeviceComposition
from top to bottom and save the bottom for ClientComposition.
2) A smarter logic for detecting what should be the actual properties
of client_layer_target, but I still think it makes more sense to
actually have the client_layer_target at the bottom.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Rob Herring [Thu, 17 May 2018 19:33:02 +0000 (14:33 -0500)]
drm_hwcomposer: Support assigning planes in ValidateDisplay
In order to assign planes to layers in ValidateDisplay, testing
compositing with a DRM atomic modeset test is needed as PresentDisplay
is too late. This means most of PresentDisplay needs to be run from
ValidateDisplay, so refactor PresentDisplay to a common function adding
a test only option.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 9 May 2018 20:18:36 +0000 (15:18 -0500)]
drm_hwcomposer: remove separate_rects
As part of removing GL compositing, separate_rects.cpp is no long
needed. Use hwc_rect_t and hwc_frect_t in places instead of our own
class.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 4 May 2018 21:34:19 +0000 (16:34 -0500)]
drm_hwcomposer: Remove GL compositing support
The GL based compositing adds alot of complexity and was only ever well
tested on closed stacks. It also only supports GLES3.x and still relies
on sw_sync timeline which is now a debugfs feature. Those are just the
known issues.
Removing the GL compositor means everything related to squashing layers
and pre-compositing can be removed. The planner is left as it may be
useful when adding back support for overlay planes. With this change,
only a single plane is supported until ValidateDisplay learns to do
atomic modesetting test for overlay planes.
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 3 May 2018 19:38:49 +0000 (14:38 -0500)]
Revert "drm_hwcomposer: Cleanup gl precompositor init and provide uses_GL flag"
This reverts commit
3b0c69d3477d3601b1dbcb75fdd748254e297e7e.
Rob Herring [Thu, 3 May 2018 19:38:46 +0000 (14:38 -0500)]
Revert "drm_hwcomposer: Fall back to client compositon if the gl precompostior fails"
This reverts commit
acc4dcf1787b9fc43c5748ce06e79f045e07a3ff.
John Stultz [Tue, 29 May 2018 23:50:23 +0000 (16:50 -0700)]
drm_hwcomposer: Try to fix clang-format pipeline
The clang-format pipeline generates false negatives
sometimes, with:
$ git diff -U0 --no-color master...HEAD | clang-format-diff-3.5 -p 1 -style=file > format-fixup.patch
fatal: ambiguous argument 'master...HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
as seen here:
https://gitlab.freedesktop.org/john.stultz/drm-hwcomposer/-/jobs/932
This tries to address the issue by explictly fetching
freedesktop/master and referencing FETHC_HEAD instead of master
which doesn't always exist.
Change-Id: I7a07d412eae164841427da90dfc7298697c5e783
Reviewed-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Andrii Chepurnyi [Thu, 17 May 2018 15:34:01 +0000 (18:34 +0300)]
drm_hwcomposer: Remove gralloc from generic code
Clean up direct gralloc usage from generic code.
Because of gralloc0/gralloc1 difference, it should
be only used by platform* part.
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Andrii Chepurnyi [Tue, 20 Mar 2018 17:41:18 +0000 (19:41 +0200)]
drm_hwcomposer: Use GraphicBufferMapper for copy buffer handle
Due to gralloc0/gralloc1 API incompatibility(register/unregister
vs retain/release) it is preferred to use generic
GraphicBufferMapper API for copy buffer handle. It will use
an appropriate adapter for the present version of gralloc.
For the reference: hardware/interfaces/graphics/mapper
Change-Id: Ia4740ed3b2ffd43fa3c107eb22d792eaabd4df40
Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Stefan Schake [Thu, 10 May 2018 00:03:36 +0000 (02:03 +0200)]
drm_hwcomposer: Ignore context in clang-format-diff
Signed-off-by: Stefan Schake <stschake@gmail.com>
Alexandru Gheorghe [Tue, 27 Mar 2018 13:09:17 +0000 (14:09 +0100)]
drm_hwcomposer: vsyncworker: Fix deadlock on exit path
vsyncworker::Routine assumes that when -EINTR is returned by
WaitForSignalOrExitLocked the lock as been released, which is not
true, so it hangs if a vsyncworker is never enabled and Exit is
called.
Fixed by releasing lock in vsynworker::Routine on all code paths.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Stefan Schake [Sat, 5 May 2018 00:39:33 +0000 (02:39 +0200)]
drm_hwcomposer: Add pass/fail CI step for clang format-diff
Signed-off-by: Stefan Schake <stschake@gmail.com>
Sean Paul [Fri, 4 May 2018 20:18:21 +0000 (20:18 +0000)]
drm_hwcomposer: Add README.md
Although we had CONTRIBUTING.md, gitlab didn't really highlight it. So I tried putting this info in the wiki, but that was equally hard to discover. _then_ I thought gitlab pages was the right way to go, but no.
Turns out README.md will be harvested by gitlab and shown on the project's frontpage \o/
Signed-off-by: Sean Paul <seanpaul@chromium.org>
John Stultz [Fri, 4 May 2018 20:22:45 +0000 (13:22 -0700)]
drm_hwcomposer: Make sure we check for new 16bit alpha value
In commit
025d0a65 ("Use 16 bit value for plane alpha"),
the alpha value was bumped to a 16bit value.
Unfortunately in drmdisplaycompositor.cpp we are still
comparing it against a 8bit 0xff value, which now fails
causing the display to not start.
So fix this comparing to the 16bit 0xffff value.
With this change the display starts up again.
Change-Id: Ic796b16fb57ae7cea58b5c66c456a58e3fb57ba5
Signed-off-by: John Stultz <john.stultz@linaro.org>
Chih-Hung Hsieh [Tue, 21 Nov 2017 22:53:29 +0000 (14:53 -0800)]
drm_hwcomposer: Use -Werror in external/drm_hwcomposer
* Suppress non-critical warnings.
I'm submitting this patch to try to align aosp/master
with the upstream fdo/master branch.
Bug:
66996870
Change-Id: I48e87526e408980c90e8a45e134f95da7a89a19d
Signed-off-by: John Stultz <john.stultz@linaro.org>
Bill Yi [Tue, 13 Feb 2018 22:36:31 +0000 (14:36 -0800)]
drm_hwcomposer: License NOTICE file and metadata from AOSP
This is a forward ported patch from the AOSP/master
branch which adds the Apache2 license notice and
a empty MODULE_LICENCE_APACHE2 file.
I'm submitting these to try to align aosp/master
with upstream fdo/master
BUG:
67772237
Change-Id: I65396852e1b64d2052232b38740e6ede20e81776
Signed-off-by: John Stultz <john.stultz@linaro.org>
Stefan Schake [Fri, 4 May 2018 16:03:00 +0000 (18:03 +0200)]
drm_hwcomposer: Use 16 bit value for plane alpha
The upstream version of the alpha property uses 16 bits to make it future
proof. Since HWC2 already passes in a float expand our internal
representation instead of just shifting for DRM.
Signed-off-by: Stefan Schake <stschake@gmail.com>
Stefan Schake [Fri, 4 May 2018 16:00:42 +0000 (18:00 +0200)]
drm_hwcomposer: Remove unused init from HWC1 layer
The HWC1 code isn't being compiled anymore.
Signed-off-by: Stefan Schake <stschake@gmail.com>
Alistair Strachan [Wed, 2 May 2018 23:53:20 +0000 (16:53 -0700)]
drm_hwcomposer: Remove NVIDIA importer header
Commit
0f7487f drm_hwcomposer: remove NVIDIA importer removed most of
the implementation, but not the platformnv.h header file. Remove this
header now.
Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Robert Foss <robert.foss@collabora.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Alistair Strachan [Thu, 3 May 2018 00:01:49 +0000 (17:01 -0700)]
drm_hwcomposer: Add platform backend for minigbm
This adds support for the chromiumos (not AOSP) version of minigbm. Like
hisi, the gralloc handle is not the same as the common libdrm handle
(just yet), so we do need a separate backend for now.
Tested with a pending change to the 'cuttlefish' android virtual device
in AOSP with its custom gralloc switched to minigbm.
Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sean Paul <seanpaul@google.com>
Cc: Greg Hartman <ghartman@google.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Alistair Strachan [Wed, 2 May 2018 23:56:12 +0000 (16:56 -0700)]
drm_hwcomposer: Drop obsolete drm_gralloc include path
In commit
d12274d, "drm_hwcomposer: Rework platformdrmgeneric.cpp
to use libdrm's gralloc handle", the use of drm_gralloc was removed.
Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sean Paul <seanpaul@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Stefan Schake <stschake@gmail.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Alistair Strachan [Wed, 2 May 2018 23:55:22 +0000 (16:55 -0700)]
drm_hwcomposer: Mark tests as vendor, fix build
After commit
94bb596, the tests for drm_hwcomposer no longer build,
because the build system detects that they are linking other vendor
modules (but installing themselves elsewhere).
This change also adds the libhardware include path explicitly, as the
implicit include of hardware/libhardware/include is going away.
Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sean Paul <seanpaul@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
John Stultz [Thu, 26 Apr 2018 19:05:57 +0000 (12:05 -0700)]
drm_hwcomposer: Fall back to client compositon if the gl precompostior fails
If the gl precompositor isn't being used, we cannot accept
every layer as a device composited layer.
Thus this patch adds some extra logic in the validate function
to fall back to client side compositing if the gl precompositor
did not initialize properly.
This does force everything to a single plane even if we have
a few available, but a deeper rework of the validate step
planning is needed before we can reliably make use of them.
Credit to Rob Herring, who's single plane patch was what this
was originally based on.
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Thu, 26 Apr 2018 19:05:56 +0000 (12:05 -0700)]
drm_hwcomposer: Cleanup gl precompositor init and provide uses_GL flag
The drm_hwcomposer has its own GL pre-compositor which is used
to squish layers when there are more layers then planes on the
display hardware. In many ways this duplicates the client-side
GL compositing that is done in SurfaceFlinger, but in theory can
be more highly optimized for the hardware.
Unfortunately, due to these optimizations, the drm_hwcomposer's
pre-compositor becomes somewhat hardware specific (originally
targeting nvidia hardware, I believe).
So on some hardware, the gl precompositor may not actually
initialize due to hardware missing features, or the hardware
supporting different shader APIs.
Rather then try to rework the drm_hwcomposers precompositor
to be more generic, I instead suggest that when the
precompositor fails to initialize, we simply fall back to the
already more widely compatible client compositor in
SurfaceFlinger.
Thus, this patch cleans up some of the precompositor
initialization, which didn't handle failures well.
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Thu, 26 Apr 2018 19:05:55 +0000 (12:05 -0700)]
drm_hwcomposer: Use log/log.h instead of cutils/log.h
When enabling Treble, Android builds are complaining about using
cutils/log.h so instead use log/log.h
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Sumit Semwal [Thu, 26 Apr 2018 19:05:54 +0000 (12:05 -0700)]
drm_hwcomposer: Andorid.mk : Mark libdrmhwc_utils as vendor module
To allow drm_hwcomposer to build with Treble, set
the libdrmhwc_utils library as a vendor module.
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
[jstultz: commit message tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Alexandru Gheorghe [Wed, 11 Apr 2018 15:22:14 +0000 (16:22 +0100)]
drm_hwcomposer: drmeventlistener: Set nl_pid to 0
By setting nl_pid to 0, we let the kernel to assign a port for us.
In the current implementation there is no way we could create more
than one instance for drmeventlistener.
Acked-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Alexandru Gheorghe [Wed, 11 Apr 2018 15:22:12 +0000 (16:22 +0100)]
drm_hwcomposer: vsyncworker: Fix uninitialized enabled_ field
Acked-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
John Stultz [Tue, 3 Apr 2018 03:57:21 +0000 (20:57 -0700)]
drm_hwcomposer: Rework platformdrmgeneric.cpp to use libdrm's gralloc handle
Rework the platformdrmgeneric buffer importer to use the libdrm
generic gralloc handle definition.
This is just to get the drm_hwcomposer project building in AOSP
along with the libdrm freedesktop/master branch. Similar changes
may also be needed to gbm_gralloc and other projects not used
in AOSP.
Mostly just sending this out for review feedback.
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sean Paul <seanpaul@google.com>
Cc: Stefan Schake <stschake@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Sean Paul [Thu, 22 Mar 2018 18:22:57 +0000 (18:22 +0000)]
Delete CONTRIBUTING, migrated information to the gitlab wiki
John Stultz [Tue, 13 Mar 2018 23:51:12 +0000 (16:51 -0700)]
drm_hwcomposer: Add platformhisi buffer importer for hikey and hikey960
This allows for importing buffers allocated from the
hikey and hikey960 gralloc implementations.
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Acked-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Rhys Kidd [Mon, 26 Feb 2018 06:18:54 +0000 (01:18 -0500)]
drm_hwcomposer: Enable and refactor Separate Rects test
Plumb through the existing test based on known sample data for the
Separate Rect algorithm via Android's NATIVE_TEST harness.
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Rhys Kidd [Mon, 26 Feb 2018 06:17:42 +0000 (01:17 -0500)]
drm_hwcomposer: Fix comment on worker_test
Reflect the boolean logic of the accompanying code, which is run after
Worker.InitWorker() has completed in test setup.
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Mon, 12 Feb 2018 22:03:35 +0000 (16:03 -0600)]
drm_hwcomposer: fix check for valid fence fd for in fences
The check for a valid fence fd is inverted, so we're failing to pass
IN_FENCE_FD's to the kernel when we have a valid fence.
Reported-by: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
John Stultz [Tue, 23 Jan 2018 23:16:36 +0000 (15:16 -0800)]
drm_hwcomposer: Make sure we set the active state when doing modesets
In trying to use drm_hwcomposer with HiKey/HiKey960 boards, I
found that the crtc wouldn't intitalize and the atomic commit
calls were failing.
I initially chased this down to following check in the kernel
drm_atomic_crtc_check() function failing:
if (state->event && !state->active && !crtc->state->active) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n",
crtc->base.id, crtc->name);
return -EINVAL;
}
Where because a fence was submitted state->event was set, but
the crtc state was not active. This results in the atomic commit
to fail and no mode to be set.
After hacking around this in the kernel, Sean Paul helped me
understand that it was the kernel complaining about the crtc
state being provided in the atomic commit which did not have the
active flag set.
Thus, the proper fix is to make sure when we do the modesetting
that we also set the crtc state active flag in property set.
With this change, the kernel no longer rejects the atomic commit
and the crtc initializes properly.
Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Mauro Rossi [Fri, 5 Jan 2018 23:59:59 +0000 (00:59 +0100)]
drm_hwcomposer: Update external connectors list
DVID, DVII and VGA are required by discrete and integrated GPUs.
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Rob Herring [Wed, 29 Nov 2017 16:19:57 +0000 (10:19 -0600)]
drm_hwcomposer: fix warnings on unused variables and parameters
AOSP master now builds by default with -Werror, so fix all the warnings.
All the warnings are related to unused variables and parameters.
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Robert Foss [Wed, 1 Nov 2017 17:50:04 +0000 (12:50 -0500)]
drm_hwcomposer: Add HDMI connector as a valid type
Accept DRM_MODE_CONNECTOR_HDMIA connector type.
Look for primary DrmConnector amongst external connectors
after looking for primary amongst internal ones first.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 1 Nov 2017 16:21:48 +0000 (11:21 -0500)]
drm_hwcomposer: correct handling of DRM_MODE_ROTATE_0
If the rotation property is supported for a plane, then the rotation
value must be non-zero. For the case of 0 degree rotation,
DRM_MODE_ROTATE_0 needs to be set.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 25 Oct 2017 00:06:43 +0000 (19:06 -0500)]
drm_hwcomposer: remove unnecessary external includes
Linking to libraries will add necessary include paths, so we don't need to
list them explicitly.
Still need libsync for sw_sync.h until this dependency is removed.
Tested-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Rob Herring <robh@kernel.org>
Adrian Salido [Mon, 2 Oct 2017 18:31:27 +0000 (11:31 -0700)]
drm_hwcomposer: make sure primary plane is allocated for squash
There are instances where the primary plane may have been disabled, look
through disabled planes as well to find primary plane to use for squash.
Signed-off-by: Adrian Salido <salidoa@google.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Fri, 9 Jun 2017 20:15:55 +0000 (15:15 -0500)]
drm_hwcomposer: fix return values for ValidateDisplay
According to the API documentation, if we've set num_types, then the
return value should be HWC2::Error::HasChanges.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 6 Oct 2017 22:02:03 +0000 (17:02 -0500)]
drm_hwcomposer: remove NVIDIA importer
There's no opensource implementation for the NVIDIA gralloc implementation,
so remove it as it is not testable.
As all of the gralloc perform() operations are specific to it, they can be
removed, too.
Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Fri, 6 Oct 2017 22:20:05 +0000 (17:20 -0500)]
platformdrmgeneric: get the gralloc usage directly from the handle
There's no point in using a gralloc perform() op to retrieve the usage as
it is already stored in the handle like width, height, format, etc. So just
copy it to the hwc_drm_bo_t and get it directly.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Fri, 6 Oct 2017 21:46:48 +0000 (16:46 -0500)]
drm_hwcomposer: use upstream DRM_MODE_{ROTATE, REFLECT} defines
The DRM_REFLECT_* and DRM_ROTATE_* defines were not upstream, but now
they are. Convert to using the upstream version which are defined as a
bit mask rather than a bit position.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Sean Paul [Tue, 28 Feb 2017 18:17:34 +0000 (13:17 -0500)]
drm_hwcomposer: Remove threading
Since HWC2 doesn't require the use of threads to implement correct
synchronization, remove some of these threads.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Robert Foss [Wed, 27 Sep 2017 17:28:15 +0000 (19:28 +0200)]
drm_hwcomposer: Add out-fence support
Add support for out-fences through the OUT_FENCE_PTR property.
Out-fences signal when their associated buffer may be read by a device.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Robert Foss [Thu, 20 Oct 2016 15:07:57 +0000 (11:07 -0400)]
drm_hwcomposer: Add crtc() fetcher to DrmResources
This is a fetcher for getting the vector of DrmCrtc objects
in DrmResources.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Robert Foss [Thu, 20 Oct 2016 14:14:43 +0000 (10:14 -0400)]
drm_hwcomposer: Add FENCE_OUT_PTR property to DrmCrtc
Add support for handling the FENCE_OUT_PTR property to DrmCrtc
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Robert Foss [Wed, 19 Oct 2016 14:46:22 +0000 (10:46 -0400)]
drm_hwcomposer: Submit in-fence to DRM
Add support for in-fences through the IN_FENCE_FD property. In-fences signal
when their associated buffer may be read by DRM/KMS.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Robert Foss [Fri, 30 Sep 2016 14:27:23 +0000 (10:27 -0400)]
drm_hwcomposer: Add support for IN_FENCE_FD property to DrmPlane
Add support for the IN_FENCE_FD property to DrmPlane.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Rob Herring [Fri, 15 Sep 2017 13:48:55 +0000 (08:48 -0500)]
drm_hwcomposer: move library to /vendor
As part of Treble project in Android O, all the device specific files have
to be located in a separate vendor partition. This is done by setting
LOCAL_PROPRIETARY_MODULE (the name is misleading). This change will not
break existing platforms without a vendor partition as it will just move
files to /system/vendor.
Signed-off-by: Rob Herring <robh@kernel.org>