1
0
Fork 0
Commit graph

1140 commits

Author SHA1 Message Date
Andrew Wolfers
f693821f25 drm_hwcomposer: Remove cursor condition from CalcPixOps
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
2025-07-31 13:00:16 +00:00
Deborah Brouwer
5223ac611e drm_hwcomposer: Skip seamless test when headless
Currently the seamless modeset test will segfault when attempting to
access the connector for a display running in headless mode.

Skip the seamless test if the display is running in headless mode.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-07-30 14:55:45 -07:00
Gil Dekel
3b2050b7f2 drm_hwcomposer: Re-enable MRR on AL devices
Configuration groups for the Multiple Refresh Rate (MRR) feature support
is currently disabled in DRM HWComposer. This is because it is
insufficient to group modes solely based on their active region size.

The primary reasons for this insufficiency are:
1. drm-hwc clients may assume they can seamlessly switch between
   configurations within the same group to support variable refresh
   rates.
2. Not all System-on-a-Chip (SoC) architectures support seamless mode
   transitions.
3. For SoCs that do support seamless switching, transitions often depend
   on other hardware-specific properties like matching blanking periods.
4. A fallback to a non-seamless (blocking) modeset is unacceptable for
   internal displays if a seamless transition fails, as this causes
   flickering. The current framework does not handle such failures
   gracefully.

To Resolve these challenges and re-enable seamless Multiple Refresh-Rate
transitions on internal panels, we add logic to validate all configs
against the preferred initial active config. This validation preforms a
seamless modeset test on each available config against the config that
was set during the display initialization. Configs that fail the
screening are assigned new group IDs.

Caveats:
1. Currently, this is only implemented for internal panels. External
   display seamless transition between variable refresh rates is not
   support. However this work can be extended to support seamless
   transitions on external displays as well.
2. Grouping is only preformed for the preffered/active config at the
   time of display init, and is valid only for the duration of the
   current full modeset commit. No other groups are not created (since
   they cannot be validated), and any new full commits will not honor
   the guarantee provided by the check. This work can be extended to
   refresh and validate all configs within the same group ID of any
   incoming full modeset commit.

Change-Id: Ie2661e74bd3ff704b40c8c7ef50c56e604e5e8df
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-07-29 16:14:12 -04:00
Gil Dekel
a4016556d0 drm_hwcomposer: GetDisplayConfigs prunes disabled configs
At some point, probably when migrating to hwc3 and creating/refactoring
HwcDisplay, we stopped pruning disabled configs before returning them
via GetDisplayConfigs().

Ensure disabled configs are pruned if disabled.

Change-Id: Iae3600d5e9b84cb3bb724949da82d42d5b801acd
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-07-29 16:14:12 -04:00
Gil Dekel
fb39c8c899 drm_hwcomposer: Prefer seamless configs, fallback to blocking
The `future_config` feature is not currently used, and incoming changes
will most likely dub it obsolete. Removing it and making QueueConfig
always seamless makes more sense.

In addition, try to always queue a seamless config first, adding it to
the next pageflip commit to reduce jank. If seamless is not allowed (no
active mode or the new config is not within the same group_id, fallback
to a full blocking modeset commit.

Change-Id: I64dec41a93ba4f29bee501f7227b6f6961c9eb44
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-07-29 16:14:05 -04:00
Gil Dekel
109a3d3553 drm_hwcomposer: Return bool for CommitFrame and ExecuteAtomicCommit
Error codes are never checked and working with errors as booleans
results in somewhat counter-intuitive logic.

Change CommitFrame() and ExecuteAtomicCommit() to return bools instead.

Change-Id: I5e8041fd4ddc99ef06184081a7f6def028bbe356
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-07-29 14:47:47 -04:00
Sasha McIntosh
3ebd9367db drm_hwcomposer: Cleanup ANDROID_API references
Target version is now 35 and set in .gitlab-ci.yml. Remove API check for
version 35 and lower.

Change-Id: I083e5e347749e79f628c839d61fe997ed0c9bef2
2025-07-25 13:41:23 -04:00
Sasha McIntosh
8a7f263bb0 drm_hwcomposer: Replace uint32t with OutputType
Add OutputType enum to DisplayInfo and use throughout.

Change-Id: If90deb5b19e7f61b7d74b9016221f35d09986678
2025-07-23 18:55:52 -04:00
Sasha McIntosh
f67a9eaae5 drm_hwcomposer: Do not clear ctm after commit.
Keep reference to ctm so that we can switch between identity CTM and
requested CTM. When the client composites all layers, all color
transforms are also applied by the client. In these cases we apply an
identity CTM. When we swap to device composition, we need to re-apply
the CTM.

Additional code cleanup.

Change-Id: I8862b37ad6f5f785aba78f9172b321ad159c2e89
2025-07-23 18:06:12 -04:00
Drew Davenport
677e72987b drm_hwcomposer: Remove sleep in unplug handling
SurfaceFlinger should now be handling this race condition more robustly
and it is find to return BAD_DISPLAY in this case. Additionally, there
is no other thread which might be holding a resource resulting in a
deadlock or race during teardown.

Change-Id: I45740febccf2efae2fa470fdbdbe050daadb053b
2025-07-16 17:49:31 -06:00
Drew Davenport
5cdddc176e drm_hwcomposer: Join UEventListener thread on exit
Ensure that the UEventListener has cleanly stopped and joined in the
destructor.

Change-Id: I8e5068b67fcdc235870a8fdbbeb09d1dd8f25520
2025-07-16 17:49:31 -06:00
Drew Davenport
199e090920 drm_hwcomposer: Join FlatteningController in destructor
Ensure that the thread has stopped and has stopped executing before
destructing the FlatteningController.

Change-Id: I32c631cbbfffc99dbd6c6b65bf1e86b670eca171
2025-07-16 17:49:31 -06:00
Lucas Berthou
446c229f98 drm_hwcomposer: refactor drmAtomicStateManager
This is a prerequisit to allow for multi-display commit at once.
It also removes the cognitive complexity of CommitFrame through addition
of helpers for all drm properties to be set.

Change-Id: Ifad7e574c9ea6ced09c677923868ce29656f33f3
Signed-off-by: Lucas Berthou <berlu@google.com>
2025-07-15 21:50:01 +00:00
Andrew Wolfers
2a0a4114a2 drm_hwcomposer: Prevent cursor layer from being client composited
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
2025-07-14 13:21:30 +00:00
Deborah Brouwer
7aa4c98eb8 drm_hwcomposer: Return error for unsupported DPI
A virtual display provided by vkms does not report a physical width and so
does not support DPI. Currently a missing dpi will returning -1, but this
causes the VTS test GetDisplayConfigsIsSubsetOfGetDisplayConfigurations to
fail. Instead, return a kUnsupported error which the test recognizes.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-07-11 12:37:36 -07:00
Andrew Wolfers
d1be5f8c8b drm_hwcomposer: Fix pixops calculations
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>
2025-07-09 16:55:40 +00:00
Manasi Navare
277f1dfd9a drm_hwcomposer: Return an error corresponding to EX_CONFIG_FAILED for config failure
This commit adds a new ConfigError::kConfigFailed corresponding to the new
exception EX_CONFIG_FAILED.
SetConfig() should return this error if the requested config fails to be
committed.

Bug: b/391891910
Test: m drm_hwcomposer

Change-Id: Ie2ca26ff870324dc9016d32ffeb4382608f4d140
Signed-off-by: Manasi Navare <navaremanasi@google.com>
(cherry picked from commit 23bcfb7bc598f187380179b20695b648be3ff015)
2025-07-02 01:35:08 +00:00
Deborah Brouwer
42ab0b9f1d drm_hwcomposer: CI: Remove custom formatting functions
Now that all of the custom formatting functions are replaced with helper
functions from ci-templates, the custom formatting functions can be
removed.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:38:05 -07:00
Deborah Brouwer
ffad3e6b1b drm_hwcomposer: CI: Update cuttlefish container tag
Rebuild the cuttlefish container to add formatting functions.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:38:05 -07:00
Deborah Brouwer
bbe4ae7b5b drm_hwcomposer: CI: Use new formatting for cuttlefish
Replace the custom formatting functions from setup-test-env.sh with the
new formatting functions available from ci-templates.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:38:05 -07:00
Deborah Brouwer
1640040629 drm_hwcomposer: CI: Update android container tag
Rebuild the android container to add formatting functions.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:38:05 -07:00
Deborah Brouwer
9e5c37ae08 drm_hwcomposer: CI: Use new formatting for android
Replace the custom formatting functions from setup-test-env.sh with the
new formatting functions available from ci-templates.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:38:05 -07:00
Deborah Brouwer
72ec38a6cb drm_hwcomposer: CI: Simplify VTS failure check
In preparation for introducing $FDO_CI_BASH_HELPERS, which adds an ERR
trap that is triggered even in subshells, simplify the VTS failure check
to avoid triggering the trap when no failures are found.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-27 15:00:16 -07:00
Deborah Brouwer
0cb8a07844 drm_hwcomposer: CI: Update aospless container tag
Rebuild the aospless container to add formatting functions.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-26 17:58:01 -07:00
Deborah Brouwer
2283650026 drm_hwcomposer: CI: Use new formatting for aospless
Replace the custom formatting functions from setup-test-env.sh with the
new formatting functions available from ci-templates.

Gitlab logs will still be formatted with collapsible sections, but now
drm-hwcomposer does not need to maintain its own custom versions of
these functions.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-25 14:08:08 -07:00
Deborah Brouwer
5a1a5f7730 drm_hwcomposer: CI: Update ci-templates
Update the ci-templates commit sha so that the new fdo_log format
functions can be used when building CI containers.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-25 14:08:08 -07:00
Drew Davenport
de45e91269 drm_hwcomposer: Check for IStats service as needed
IStats service is started by system_server which is not running during
VTS tests. In this case, the IStats service is declared, but not
started, which may result in a hang when calling AServiceManager_waitForService.

Acquire the IStats client lazily when reporting atoms, and log an error
upon failure to do so. If IStats is declared, we should expect that the
service will be available under normal operation.

Another benefit of this approach is that acquiring the IStats service is
no longer blocking service initialization.

Change-Id: Ib7a38930b1a3cbcaa629e576f601d7a05980e257
2025-06-25 08:06:33 -06:00
Drew Davenport
7e66322389 Revert "drm_hwcomposer: Initialize stats asynchronously"
This reverts commit e5f755f842.

IStats initialization will be revisited in a follow-up commit. Threaded
initialization will no longer be necessary.
2025-06-25 08:06:32 -06:00
Andrew Wolfers
7f7fb03cc1 drm_hwcomposer: Update DrmKmsPlan to position cursor plane with highest z-pos
Cursor composition was previously developed under the mistaken assumption
that the z-pos property of the cursor plane was immutable. The DrmKmsPlan
would always place the cursor plane at the lowest z-position, but the
immutability made that aspect moot.

This change updates plan creation to instead place the cursor plane at the
highest z-position, which fixes cursor positioning on hardware where the
cursor plane z-pos is mutable.

Change-Id: Idfd390e0eb3de8ff6125722cda9f5ce73e983a02
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
2025-06-25 13:14:34 +00:00
Deborah Brouwer
397dc100e5 drm_hwcomposer: CI: Build and swap apex package
Currently the CI pipeline is pushing the drm-hwcomposer binaries into
the vendor partition. Instead put the drm-hwcomposer binary into a new
apex package and run it in cuttlefish.

This approach aligns better with developer workflow.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
c36dcfa1df drm_hwcomposer: CI: Update cuttlefish container tag
Rebuild the cuttlefish container.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
58ad5d7232 drm_hwcomposer: CI: Build drm-hwcomposer apex
Currently cuttlefish is building the ranchu apex package. Instead
configure it to build the drm-hwcomposer apex package. This will make
it possible to hot-swap the apex package later in the CI pipeline.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
1be7f545a4 drm_hwcomposer: CI: Fetch repos by release tag
Currently custom repos are fetched by commit sha. Instead fetch them by
release tag or branch name to be clear that the commit is not arbitrary.

Also update the mesa repository to the lastest release.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
13d96bf492 drm_hwcomposer: CI: Fix file copying in cuttlefish
When building the cuttlefish tarball, the entire cvd-host_package is
copied instead of the individual files. This adds an extra step later
when the tarball is unpacked because the files have to be copied to
the correct location.

Fix the minor file copying issue to make the code cleaner.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
28317655ba drm_hwcomposer: CI: Update android container tag
Rebuild the android container.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
c5b3e1a597 drm_hwcomposer: CI: Add apex tools to android container
Add apexer and android.jar to the android container to support building
new apex packages in the cts/vts jobs.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
ac63f967e8 drm_hwcomposer: CI: Update cuttlefish packages
Since the android container is being rebuilt, update the cuttlefish
packages that it uses from v1.0.1 -> v.1.5.0.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
842681a9b6 drm_hwcomposer: CI: Use 22.04 LTS for android container
Currently the android container is using 24.10 just to be consistent
with the aospless container, but since 24.10 is reaching end of life,
rebuild the android container with Ubuntu 22.04 for long-term support.

Ubuntu 22.04 is a better base than 24.04 because the cuttlefish support
packages expect older package versions.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
542eed1478 drm_hwcomposer: CI: Update aospless container tag
Rebuild the aospless container.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
f046c16c11 drm_hwcomposer: CI: Move aospless flags to meson.build
Currently __ANDROID_API__ is defined by adding it directly to the
aospless cross-configuration file. But aospless is designed to use the
meson.build files in drm-hwcomposer, so put the flag in there instead.
This aligns better with the proper use of aospless.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Deborah Brouwer
56b63f4dfa drm_hwcomposer: CI: Use 24.04 LTS for aospless container
The aospless container uses the Ubuntu interim release 24.10 as its base
because, originally, clang 19 packages were not available in the Ubuntu
long-term support release 24.04. But these packages were backported to
24.04 in February 2025 as part of the 24.04.2 update.

Change the aospless container base to 24.04 since it now provides all
necessary packages and will ensure long-term support.
2025-06-23 09:10:55 -07:00
Deborah Brouwer
4c6de08534 drm_hwcomposer: CI: Make ANDROID_SDK_VERSION global
The ANDROID_SDK_VERSION variable is defined separately in the jobs that
build the android and aospless containers. Instead, defined it globally
and make it available to all CI jobs. This will avoid errors and make it
easier to update in the future.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-06-23 09:10:55 -07:00
Andrew Wolfers
f35210964c drm_hwcomposer: Remove cursor buffor validity check
This change removes a check in DrmPlane::IsValidForLayer which would
verify that the buffer size matches known accepted values from the
DRM_CAP_CURSOR or SIZE_HINTS properties. Those properties are required
to return valid buffer sizes for committing to the cursor plane, but
they are not meant to be exhaustive. As a result, this check was
returning false negatives, and forcing the cursor into client
composition unnecessarily. The intended usage is that these props
should be checked during buffer allocation, not during composition.
Instead, test commits are sufficient for detecting whether a buffer
is valid for the cursor plane, and triggering fallback logic as needed.

Change-Id: Iae14436a6f50e45a113a4d18de67e73810b2a83e
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
2025-06-20 15:43:33 +00:00
Drew Davenport
e5f755f842 drm_hwcomposer: Initialize stats asynchronously
Since stats reporter may need to wait for the IStats service to start
up, initialize the stats reporter and poller on a helper thread to avoid
blocking ComposerClient::Init, which is run early in boot.

Change-Id: I48949809d33f9aff0fab97822da34d76b7ce8dd9
2025-06-19 15:06:48 -06:00
Drew Davenport
13fcd098a2 drm_hwcomposer: Move properties stuff to cpp
Move the implementations for properties related functions on non-Android
platforms into properties.cpp

Change-Id: I91fce6a618445ea3021ef1013228285c99d819bd
2025-06-12 01:51:29 +00:00
Drew Davenport
f4cebdbec7 drm_hwcomposer: Move device path to Properties
Add Properties::GetDevicePath to query the value of the
vendor.hwc.drm.device sysprop.

Change-Id: I8c2f9e6f06f3d7f11f03051e21b885413da81c47
2025-06-12 01:51:29 +00:00
Drew Davenport
cb4e848c3b drm_hwcomposer: Move GetBackendOverride to Properties
Add Properties::GetBackendOverride to query the sysprop, and handle the
default in BackendManager.

Change-Id: Ifc01a23d64a5406ba5c9f065b7d5967b42b1b5d5
2025-06-12 01:51:29 +00:00
Drew Davenport
0f9eae2291 drm_hwcomposer: Move GetCtm to Properties
Move the handling of the sysprop for how to handle CTM to the Properties
class.

Change-Id: I049c8a726fc68576e884b2a7a618a23521d5ed2b
2025-06-12 01:51:29 +00:00
Drew Davenport
51d588a99e drm_hwcomposer: Move Properties to android namespace
The rest of the project is in the android namespace, so move this into
it as well.

Change-Id: Iecd47d014d18751d678b91602df9d5ac09e4881d
2025-06-12 01:51:28 +00:00
Drew Davenport
e91805b9ae drm_hwcomposer: Cleanly exit DrmAtomicStateManager helper thread
Now that the helper thread doesn't acquire the global lock, we can wait
for the helper thread to exit without risk of deadlock.

Change-Id: Ibaf8a1a64fb1aa64f8b75fd9a8ae1eff81dae0df
2025-06-12 01:39:23 +00:00