With the legacy Backend class renamed to CompositionPlanner, rename the
PipelineCreator interface to Backend. This interface maps most closely
to the concept of the "Backend".
Add some documentation to various Backend related classes.
Change-Id: I5d6a7afcebb9d0015c3d7629bf8c10324c8f07df
Rather than global variables with static scope, make them private static
members of their respective classes.
Change-Id: I20f0ad1d63fe14001266058983b0d013058667dc
Allow classes to inherit from GenericPipelineCreator and use it for
creating the DrmDisplayPipeline, but override which CompositionPlanner
is used.
Extract the GetFlattenedComposition function into a static function that
can be called from any backend.
Change-Id: Id75705b969eb6d23fbc6147c496ac3f3e9956abf
Rename the generic CompositionPlanner implementation to
GenericCompositionPlanner, and abstract the CompositionPlanner
interface.
Change-Id: I39d6fd44956d77669271999dd83fc78eebec742a
With the Backend concept expanding to also include the initial display
configuration and creation of DrmDisplayPipeline, rename the Backend
class to more precisely reflect its purpose.
Change-Id: I8a9a0d49242771e5df6e80cd50f0b2b0670c2de2
Define a PipelineCreator interface which allows Backends to use
Backend-specific heuristics in creating the DrmDisplayPipeline.
Change-Id: I1f929213ce403267b539635ec9d5853cf1a7f18a
Additionally, move the creation of the Backend into BackendManager so
that it the Backend is created along with the DrmDisplayPipeline
Change-Id: I24dc19cadb324429f229fe7751b60b70ab512265
Create a Backend for the given DrmDisplayPipeline using the same logic
in CreateBackendForDisplay.
A subsequent change will use this function and deprecate
CreateBackendForDisplay.
Change-Id: I72365f5c689f6643e2f6da11f76dde1ac68f3e2d
This change moves all modifications to the total_stats_
property out of the Backend. HwcDisplay becomes responsible
for updating its own stats based on the results of validating
and presenting a composition.
Change-Id: I54ff8c2c8f6ad983ef583e60e2e77cf8b7866e9b
This change adds a new enum FlattenReason which
describes possible reasons that a given composition
would be flattened. The flatten reason is now
returned with the ValidationComposition.
Change-Id: Ia7ba2ffbdc3512fea9cb19ab6be63a99eaa3f367
This change adds caching to save the most recently
validated composition. The cached value is used where
appropriate to avoid recalculating the DrmKmsPlan or
the CompositionTypeMap from ValidateDisplay again in
PresentDisplay. The cached ValidatedComposition
replaces the previously cached DrmKmsPlan, preserving
the lifecycle management requirements.
Change-Id: I59704e26ae1a6950e750d246314b2db6af2f11a0
When all layers are designated for client composition, do not attempt to
add additional layer to client composition.
Change-Id: I4579c7d5f96cd148ae805e91cb0837284956bff9
Backend can get a const reference to the FlatteningController for
checking if the scene should be flattened or not. Updating of the
FlatteningController is moved to HwcDisplay just before deferring to the
Backend during the Validate.
Change-Id: I9c7cc309bb16ea7b60187476db67fc9df1485275
FlatteningController is owned by HwcDisplay, so use a unique_ptr to
better control and indicate the ownership.
Remove the CreateInstance factory method and use std::make_unique
instead.
Change-Id: I0155c602dcf5a31d27fd2677f9f96ff9696a4022
Under the previous behavior, NewFrame both updated the internal state
tracking to indicate that the scene is not idle, as well as returning a
bool to indicate whether the scene should be flattened or not.
ShouldFlatten was not being used, and would return `true` during the
interval between the refresh callback being triggered and the next
NewFrame, which would be in response to the refresh callback. Subsequent
calls to ShouldFlatten would return `false` even though the scene
remains idle.
This commit updates NewFrame to only update the internal state. Callers
should call ShouldFlatten to check whether the controller has detected
that the scene should be flattened.
After the callback is triggered, ShouldFlatten returns true. It will
continue to return true after the first NewFrame, which would be in
response to the refresh callback. Subsequent NewFrame calls will reset
the idle detection.
Change-Id: I8b11a55bb6b101bb2ce473a844f5b9795a027956
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>