This CL strengthens the cursor plane usage check with a test
commit. A test commit is a cheap and definitive means of
determining whether the cursor plane can be used. Under the
previous scheme, if a validation test commit would fail, it
was unclear whether the failure was due to the cursor plane
or due to other factors, and sometimes the cursor would be
demoted when it was not at fault. The new flow relies on the
result of the cursor test commit, and applies updated fallback
behavior to preserve the cursor as much as possible.
Change-Id: If3b86a4cbfb5220532a58b14797d6840c3a93af6
This CL resolves some logical errors in Backend::ValidateDisplay.
Previously, it was possible for the ValidatedComposition's
composition_plan to improperly hold plane bindings when the
TestCompostion was skipped. Additionally, metric values were
not being counted properly, due to the client_start, client_size,
and use_cursor_plane variables not being updated when the
composition is flattened due to failed validation. Finally, the
client_start and client_size variables are moved out of the
validate_and_test helper, which makes their state simpler
to reason about.
Change-Id: I229d8aa38993c3e26ef61d9f6127ce17bac5336f
This change moves the pixops calculation into HwcLayer. This
simplifies the logic to determine the total pixops over the
client range performed within Backend. This change also moves
the display size calculation into HwcDisplay.
Change-Id: Id7e12657a512db3aaea98d88833c818c10efef66
This change refactors the IRect and FRect types into a single
templated type Rect<T>, which allows the implementation to be
shared across both variants. This change also adds convenience
getters for the rect widths and heights, and updates callsites
accordingly.
Change-Id: I38509631d57706266186a7b7fa21bd43c0860890
Add some const correctness to HwcDisplay. Narrow the public
interface of HwcDisplay to avoid exposing non-const members
unnecessarily.
Change-Id: I691c9e0025065085ca1e2045bb1d6614535fdbdc
DrmKmsPlan lifetime is used to manage ownership of drm planes that have
affinity for multiple crtcs. As such, the DrmKmsPlan lifetime needs to
persist from a Validate call to when the composition is Presented to
ensure that such planes aren't stolen by another display.
Rather than stashing the DrmKmsPlan as part of TestComposition, return
the DrmKmsPlan as part of the Backend's Validate. HwcDisplay::Validate
then becomes responsible for lifetime management of the resulting
DrmKmsPlan as before.
Change-Id: I14ae115b2eed5c9b27e70f0b695fbbc4f3a4faa6
This change cleans up some typing within Backend around data which
was inconsistently being handled as int, uint32_t, or size_t. This
change resolves an instance of integer underflow.
Change-Id: I4a2aa352b6cb4d1ff74929eb67c7edfc907cdb0c
Call this from the Backend when testing a composition. Future commit
will make this a const function to indicate that it doesn't change
HwcDisplay internal state.
Change-Id: I9bd6962e213acd76d13afbdc620418bd1ff95557
Backend shouldn't directly mutate HwcLayer state, so make HwcLayer
const. Make a few other related functions const correct as well.
Change-Id: Id7f8e255e9e72b756399b1a4dabc3db779d64bc9
Rename to GetCompositionTypes to reflect that the function is no longer
setting HwcLayer state (marking). Also make the input |layers| const
since it's no longer being modified.
Change-Id: I53702a6df680b9a138bb16191a3cac0b17e4b632
Rather than setting the ValidatedType on the layers directly from the
Backend, return the per-layer composition type decisions from the
Backend and let the HwcDisplay set it.
This is a step towards the goal of not setting HwcLayer state directly
from the Backend.
Change-Id: I8e2d1e7c6fb0d9071d5dca101ddb455b95535bd0
CalcPixOps determines the cost of GPU-composition over a range
of layers. This change removes cursor-specific logic that was
accounting for behavior that only applies when the cursor is
not GPU-composited. This change restores the standard logic,
so that the cost of GPU-compositing the cursor layer is corrected.
Change-Id: I310fd35e2cd4f4df6d334ae0d989f2298267323a
When the number of requested layers exceeds the available planes,
Backend::GetExtraClientRange chooses which layers to demote to
client (GPU) composition. The existing implementation prioritizes
minimizing the number of pixel operations which will be sent to
the GPU. Since the cursor layer tends to be one of the smaller
layers, it is often chosen. However, the cursor layer is generally
a poor choice for client composition because its position
frequently changes, causing the scene geometry to refresh. This
change updates the extended client range determination logic to
exclude the cursor layer from consideration.
Note: this behavior only applies to the cursor when it is being
device composited. When the cursor is being composited to the
HW cursor plane, it isn't competing for the same pool of planes,
so it was already a non-issue in that case.
Change-Id: I5cc2ac0f4ac2329c923b5c5060b78e80c32503f7
This change resolves inaccuracies in the calculations of
per-layer pixel operation counts, i.e. "pixops". The display
frame of a layer attributes special meaning to a value of
nullopt, indicating that the frame occupies the whole display.
Correctly calculating the pixops for such a layer requires
checking the dimensions of the display mode. Additionally,
a layer being committed to the hardware cursor plane ignores
its display frame, instead using the dimensions of its buffer,
and therefore the pixops calculation needs to match.
Change-Id: I68cd2c3b42b9a556828a74eda715a106b958624b
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
Add Properties::GetBackendOverride to query the sysprop, and handle the
default in BackendManager.
Change-Id: Ifc01a23d64a5406ba5c9f065b7d5967b42b1b5d5
No longer need to #include the hwcomposer2 headers in common code.
Pull the hwc2 specific files into a different filegroup. There is no
need to build these for hwc3. Additionally, no need for hwc2-specific
CPPFLAGS in common or hwc3 code.
Change-Id: Ie194e9dc4b0d8f7b900227bd5d3b73efc692d975
All errors from HwcDisplay::CreateComposition are handled the same way,
so just return a bool. There is no need for a finer grained return code.
Change-Id: I5a10cf2672d377efa715fba8f8eb50cd4c41316f
Signed-off-by: Drew Davenport <ddavenport@google.com>
Remove HWC2 CompositionType from midlayers. Define a new
HwcLayer::CompositionType enum to capture all composition types
supported by drm-hwcomposer.
HWC2 and HWC3 frontends do the necessary conversion to/from
HwcLayer::Composition type.
Since the last HWC2 usage has been removed from HwcLayer, remove the
hwc2 #include.
Change-Id: I00d579d699599f0918d114b35080933348aa513b
Signed-off-by: Drew Davenport <ddavenport@google.com>
The latter was extracted from the former, so only minor renaming is
needed.
Change-Id: Iea3228b802ddcd16f6840adbf242be3bd61fac60
Signed-off-by: Drew Davenport <ddavenport@google.com>
Backend::Validate function signature reflects the corresponding HWC2
function signature. The return value and arguments are redundant.
- Remove the return value, since Validate never fails and it wasn't used
anyways.
- Remove the out params, since the same information can be (and is)
determined by comparing the SfType and ValidatedType for each layer
Change-Id: I659f7e0b03f183c38ca0a6996c0546eb263e7b99
Signed-off-by: Drew Davenport <ddavenport@google.com>
With the cursor layer's LayerData already populated before entering the
Backend, the Backend can check whether the cursor layer is compatible
with the drm cursor plane before attempting the composition.
Change-Id: I2725f411913b5f998b9549bfc0537d0d9886a569
Signed-off-by: Drew Davenport <ddavenport@google.com>
This change resolves a check in composition testing which
evaluates whether the test succeeded. Previously it was
checking whether the test failed.
Change-Id: I2ccdd27b80167be46eb5d1baaef1b4055d5d8ba2
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This change adds stats for commits that use the cursor plane.
The failed_kms_cursor_validate_ stat is incremented whenever a
test commit fails which attempted to match a layer to the cursor
plane. This event was previously being tracked by the
broader failed_kms_validate_ stat, but this change disentangles
the two events to help with debugging.
This change also adds a stat which tracks the number of frames
which successfully commit to the cursor plane.
Change-Id: I3f23e3e1d4bfd5ac70d2ceb1d768a2ded8ee034b
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This change fixes an issue during display validation where
cursor layer failures would trigger a fallback that forces
all other layers to be client composited.
Prior to this fix, if the cursor layer could not match to
the cursor plane, DrmKmsPlan would attempt to match it to
another plane. This could result in the number of layers
exceeding the number of available planes, which causes the
composition to fail into the client-composition fallback
behavior.
This fix changes the first-level fallback behavior, so
that when the cursor layer doesn't match to the cursor
plane, the client range will be recaluclated in order to
reserve an additional plane for device composition. Then
the cursor layer is converted to device composition and
the composition is retried.
Change-Id: Id704e182b7cc1dc66270de45a986a29e4b71a5a8
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This file was missing the LOG_TAG define so logs from this file weren't
coming to logcat as expected.
Change-Id: Iba5a6b0dfee8171f6f680f31b900ec993868597a
Signed-off-by: Drew Davenport <ddavenport@google.com>
This change adds support for presenting to the cursor plane.
Logic is added to match cursor layers with cursor planes during
composition, plus additional test commit logic with backoff
behavior. Prior to this change, cursor planes were never
considered during composition. After this change, cursor
planes are available to be matched with compatible layers and
then used for presentation.
Change-Id: I3acd131cd210de46ff19af5a8960b07a82f462b2
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This change adds cursor plane binding into DrmDisplayPipeline.
The signature of DrmDisplayPipeline::GetUsablePlanes is updated
to return a pair where the second element points to the bound
cursor plane (if it exists), and the first element points to
all other planes.
Change-Id: Ic6a623b10383b7dd0a0c2e79fc2d87329ebc6214
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
This commit introduces two improvements:
1. Introduces frontend-agnostic structures for rects.
2. Support default values in them so that the backend can handle
cases where rects are not specified by the client, like
the client layer display frame, etc.
This reduces the complexity of the Internal layer, making it
feasible to use a single Frontend<->Internal layer API for
regular layers, as well as for the Client and Output layers.
Change-Id: Iab5030ad523d36ea4c5af142f6f628952467d6ab
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
DrmHwc holds implementation details that can be shared between hwc2 and
hwc3. It exposes abstract functions for implementing callbacks to hwc
clients.
Leave the HWC2 specific implementation details in the DrmHwcTwo class, such
as the client callback implementation, and implement the DrmHwc abstract
functions in terms of hwc2.
DrmHwc is based on the DrmHwcInterface extracted in
(drm_hwcomposer: Connect ComposerClient with HwcDisplay) from !238
Co-authored-by: Dennis Tsiang <dennis.tsiang@arm.com>
Co-authored-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
It's a pain to use logcat filters for drm_hwcomposer since each file has a different tag necessitating one to specify each tag for the logcat filter or use a regex.
Use one tag for all of drm_hwcomposer to simplify this.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
PL111[1] is the color LCD controller available on the Armv-A Base
Platform RevC FVP and the Versatile Express LogicTile FPGA board. The
8MB video memory of PL111 is barely enough for the two fullscreen
buffers always requested by SurfaceFlinger for client composition, and
there is no video memory left for any device composition buffers.
Therefore we add PL111 to the list of devices that uses the client-only
composition backend.
[1]: https://developer.arm.com/Processors/PL111
Change-Id: Ib64ccf5e030b623d5c920eb998c6b22ead89b4c9
Signed-off-by: Lingkai Dong <lingkai.dong@arm.com>
Using vsync means consume some CPU time every frame for
IRQ -> Kernel_Thread -> UserSpace_listener thread transitions.
Framework tries to reduce vsync usage to the minimum, by using timelines
instead.
New flattening controller thread wakes-up only once per second.
This commit also removes flattening info from dumpsys. Practice shows
that it is almost useless. Instead debugging can be done using ALOGV
dumps.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
1. Add and wire-up CRTC CTM property support.
2. Add custom Android property to select behavior for cases
where DRM can't handle color transform matrix.
The "vendor.hwc.drm.ctm" property can be set to:
- DRM_OR_GPU (default) - Use GPU if CTM is not supported by DRM.
- DRM_OR_IGNORE - Ignore CTM if DRM doesn't support it.
The last option is useful for Android 13 and later where default
color transformation matrix is not an identity matrix.
At the moment I do not have any devices with CTM support, therefore
I can test only DRM_OR_IGNORE option.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Some of existing include guards were copy-pasted without modification,
therefore have incorrect name. Switch to 'pragma once' in order to fix
it and avoid such copy-paste issues in the future.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Address new clang-tidy findings, in most cases 'misc-const-correctness'
check was addressed by adding 'const' modifier, or in some cases changed
to 'auto' (where it's better for formatting).
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
1. Move BlendMode, ColorSpace, SampleRange fields to the struct BufferInfo,
allowing extraction of the data from native_handle using Metadata@4 API.
Use it when data from HWC2 API can't be used (Currently it's a BlendMode
case for CLIENT layer)
2. Rename DrmHwcLayer to LayerData and move it to compositor/ directory.
(I was confused in the past because of similarity of names DrmHwcLayer
vs HwcLayer, so this step should meke it easier for newcomers to
understand the code)
3. Allow clonning of the LayerData to propagate it through the composition
pipeline. Thus LayerData can be used by both HwcLayer to track state
and by the compositor.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
We are not testing it for more than year, therefore it's better
to use generic logic for 'rcar-du' instead.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
The following use scenarios are now possible:
1. When no display connected, primary HwcDisplay is created in headless
mode.
2. When user connects first display, it binds to primary slot, replacing
headless HwcDisplay.
3. When user connects another display it binds to the new HwcDisplay
slot, creating new display for the framework.
4. When user disconnects first (Primary) display, drm_hwc detaches
second display and attaches it to the Primary slot. In this case
framework is notified as Primary display resolution updated
(Plugged->Plugged transition). And second display is disconnected
(Plugged->Unplugged transition).
DrmDisplayPipeline is now created on demand (after hotplug event).
HwcDisplay class is now destructed on connector unplug, which will give
us ability to destroy any resource caches (will be required for FB
caching logic).
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Implement DrmConnector instantiation through CreateInstance() static method,
which helps to reduce complexity of DrmDevice::Init() function.
Move Connector-to-CRTC binding information to the DrmDevice class.
Move drm/DrmConnector.h to Normal clang-tidy checks list by fixing
clang-tidy findings.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
... to reduce complexity of DrmHwcTwo.* files.
Bump-up tidy level of new files to NORMAL (fix function naming,
add NOLINT, etc.)
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Android-9 has -Wsign-compare enabled by default and it causes build issues.
Enable -Wsign-compare option in CI, so we won't introduce such issues anymore.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>