1
0
Fork 0
Commit graph

1082 commits

Author SHA1 Message Date
Deborah Brouwer
2eada4fbe3 CI: Update ci-templates
Update the ci-templates commit sha so that additional fdo_log format
functions can be used when building CI containers.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-10-03 15:49:50 -07:00
Andrew Wolfers
a51a43422d drm_hwcomposer: Use cached validated composition
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
2025-10-03 18:56:19 +00:00
Andrew Wolfers
99f677a2ea drm_hwcomposer: Manage current_plan_ lifecycle
This change refactors the lifecycle management of
HwcDisplay::current_plan_. The purpose of the current_plan_
is to keep plane bindings in memory between calling
ValidateDisplay() and PresentDisplay(). This ensures that
bound planes will not be stolen by other CRTCs in the
interim, which could cause a validated composition to
become invalid before it can be presented.

The current_plan_ is intended to fulfill the contract
prescribed by the documentation of
Backend::ValidatedComposition::composition_plan, which
requires the plan to not be destructed until the
composition is committed.

Prior to this change, the lifetime of current_plan_ was
extraneous. Rather than being released after
PresentDisplay(), it was being unnecessarily held until
the next ValidateDisplay(). This would have the
unintended effect of holding the plane bindings after
the composition has been committed, which would prevent
other CRTCs from using the shared planes during that time.

This change updates the management of current_plan_,
still satisfying the Backend's contract, but releasing it
once it is appropriate to do so.

Change-Id: I956d3983b43302040f6ff18b5e907e2ed143c2dd
2025-10-03 13:47:00 +00:00
Andrew Wolfers
8940921be7 drm_hwcomposer: Add GetUsablePlanes tests to DrmDisplayPipelineTest
Change-Id: I02391c51ba392795bc39b3d918b5b86e5f4079bd
2025-10-02 15:06:23 +00:00
Andrew Wolfers
a95aa3b1c7 drm_hwcomposer: Add CreatePipeline tests to DrmDisplayPipelineTest
Change-Id: If105c7773e7f4adaa9c0ab7e6f410d9cc09f476e
2025-10-02 15:06:21 +00:00
Andrew Wolfers
086a6f1fc4 drm_hwcomposer: Add drm object fakes for DrmDisplayPipelineTest
Change-Id: I1ffbf45a787bac8ce414ef03701bc544835da3a7
2025-10-02 15:06:19 +00:00
Andrew Wolfers
ec00b3dc25 drm_hwcomposer: Add PipelineBindable unit tests
Change-Id: Iada6f16cb3b72f38cbaad1b71b38c8ef201c4722
2025-10-02 15:06:16 +00:00
Andrew Wolfers
84892ec611 drm_hwcomposer: Cleanup includes for test target
Change-Id: I1332873df0109347a91e729955ba5f84cf8c7fec
2025-10-02 15:06:12 +00:00
Andrew Wolfers
ff954db228 drm_hwcomposer: Add buildflag guards around libsync deps
This change adds the buildflag HAS_LIBSYNC for managing
availability of libsync. This is necessary for the
unittests target for which libsync doesn't provide the
necessary variant.

DrmAtomicStateManager.cpp is the only file which depends
on libsync. Guards have been added using the HAS_LIBSYNC
flag, such that any method which would depend on libsync
is now stubbed when it is unavailable.

Change-Id: I101083074a9fad98e1c40c27b55f2eddf1c53581
2025-10-02 15:06:06 +00:00
Su Hong Koo
87ffe73cd7 drm_hwcomposer: Update VSyncWorker::last_timestamp_ on every present 2025-10-01 06:24:44 -06:00
Sasha McIntosh
2818649164 drm_hwcomposer: Do not set color_matrix_ for 3x4 transform
When the request CTM is a 3x4 transform, we designate all layers for
client composition and do not set the plane CTM. In the DRM_OR_IGNORE
case, we do not force client composition and end up using the incomplete
transform.

This change ensures that we only set the CTM when the matrix is useable.

Change-Id: Ic7928616208b61fcdef72cc214d652cdf8a47d00
2025-10-01 04:27:51 -06:00
Drew Davenport
151c10dc9a CI: Remove drm_hwcomposer: prefix requirement
The prefix doesn't provide a lot of value, and unnecessarily lengthens
the commit message subject lines.

Change-Id: I5e234510b2ad9822e95135e56a8a19b4b9329357
2025-09-29 09:26:01 -06:00
Sasha McIntosh
ace08f065a drm_hwcomposer: Fix device composition bug
When all layers are designated for client composition, do not attempt to
add additional layer to client composition.

Change-Id: I4579c7d5f96cd148ae805e91cb0837284956bff9
2025-09-29 02:12:29 -06:00
Sasha McIntosh
525d1aebcb drm_hwcomposer: Disable HDR for internal displays
Supported on external displays only. Update to match implementation in
QueueConfig.

Change-Id: I647935f914f33f488b28b909d847d85039986f9b
2025-09-29 02:12:29 -06:00
Su Hong Koo
7e7e0609ee drm_hwcomposer: Add tracing around validate/present paths
Add perferto tracing around validate and present paths. Specifically
around code that blocks on the main thread (e.g. commit, fence waits).
These should increase the visibility of what is blocking the
presentation hot path in perfetto traces.

Change-Id: I6db60648c5e1d5f1a666ebc52f5ae5ad57e0e82a
2025-09-24 12:11:22 -04:00
Drew Davenport
f61371b260 drm_hwcomposer: Don't reset callbacks in FlatteningController
Make cbks_ const as set in the constructor. Add a new kExitThread state
to indicate that the thread should exit.

This reduces the amount of state that needs to be synchronized across
threads and the amount of member variables that control state flow.

Change-Id: Ic99dd7ab153939bfa2d971985799413b212a999e
2025-09-19 17:36:33 -06:00
Drew Davenport
9876f33138 drm_hwcomposer: Make FlatteningController::StopThread private
There is no need for this to be public since it is called from the
destructor, and any public usage of it was immediately before
destructing the FlatteningController

Change-Id: Ice233feaa9b934e7385ac83769250fea33f9140c
2025-09-19 17:36:33 -06:00
Drew Davenport
d2ccec310e drm_hwcomposer: No-op FlatteningController cleanup
- Move member function implementations to the .cpp file.
- Rename Disable -> DisableFlattening
- Update comments for functions

Change-Id: I71eec96597a0d41f652b897c1862a34138b5be85
2025-09-19 17:36:33 -06:00
Drew Davenport
08fea937a1 drm_hwcomposer: Update flatcon in HwcDisplay
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
2025-09-19 17:36:27 -06:00
Drew Davenport
6075ab4596 drm_hwcomposer: Use unique_ptr for FlatteningController
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
2025-09-19 16:58:58 -06:00
Drew Davenport
23e38a1033 drm_hwcomposer: Refactor state tracking in FlatteningController
Use an enum to track the different possible states of the
FlatteningController rather than a collection of bools.

Change-Id: I6136fd8f57a4033a10798f932a952951a01707b7
2025-09-19 16:58:46 -06:00
Drew Davenport
ccd7ca17c5 drm_hwcomposer: Add thread annotations to FlatteningController
Annotate the state that is access across multiple threads. Add locks in
appropriate scopes as necessary.

Change-Id: I05ca1054b4836b72c6efb3fd2bf241d4958e3252
2025-09-19 16:57:31 -06:00
Drew Davenport
c50f6851d6 drm_hwcomposer: Add tests for FlatteningController
Add gtest unittests to validate expected behaviour of
FlatteningController.

Change-Id: Ia40d232c7a72912df9480bd82adfe3315baaa493
2025-09-19 16:57:30 -06:00
Drew Davenport
2432cb0dfa drm_hwcomposer: Update FlatteningController behavior
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
2025-09-19 16:56:55 -06:00
Drew Davenport
ce65d6c6e3 drm_hwcomposer: Make FlatteningController timeout configurable
Pass a timeout to the FlatteningController constructor. Move the
original default timeout from FlatteningController to HwcDisplay.cpp

Change-Id: I6e3f8950badc38a5ccad8ae68e1b11317c850d61
2025-09-19 16:54:55 -06:00
Drew Davenport
38045be8af drm_hwcomposer: Add FlatteningController constructor args
Add a constructor that takes the callbacks and initialize the callbacks
in the constructor.

Change-Id: Id7a64fc23819e913a75753035f18fca2c81ce034
2025-09-19 16:54:54 -06:00
Drew Davenport
ac727c57ae drm_hwcomposer: Fix used_plane state tracking
Ensure that the next frame's list of used_planes is correct. The list of
used planes for the new frame is initialized to the previous frame's
list of planes when creating the AtomicRequest. If there is a
composition as a part of this request, the list should be cleared before
creating the new composition, since the list will be re-populated.

Neglecting to clear this left planes on the list when they shouldn't
have been, or the same plane multiple times. This led to some spurious
commit and validation failures on single display configurations, but on
multiple display configurations also resulted in highly visible stuttering.

Change-Id: Ie3fa1fc120fde13ee80f9a144c459526be2822cb
2025-09-19 10:20:08 -06:00
Manasi Navare
d341024047 drm_hwcomposer: Clear connectors and CRTCs on Init
When DRM HWC starts, it resets all the connectors
and CRTCs to avoid the mimatch between drm hwc tracked
state and actual HW state programmed by the firmware
for the splash screen.

This fixes the MST connected boot issue.

Change-Id: I0773541b6bb227a2880d8442cc46411dc4c0127a
Signed-off-by: Manasi Navare <navaremanasi@google.com>
2025-09-18 15:00:19 -06:00
Su Hong Koo
a0f6ed9cc7 drm_hwcomposer: Wait for next present fence earlier in present
Currently, drm_hwcomposer has two main ways to lock up in the
composition hot path:

1. HwcDisplay::WaitForPresenttime(), where it looks at the expected
present time of the frame and sleeps until it is close to it (0.75
vsync period away from the target vsync).

2. DrmAtomicStateManager::WaitLastFrame(), where it waits on the
present fence of the last commit so that we don't call commit when
another present is pending

These are called in-order, which in certain multi-display configuration
with heterogenous refresh rates can lead to the slower display locking
up due to sleep in WaitForPresenttime().

This CL makes DrmAtomicStateManager::WaitLastFrame() public, and moves
its invocation to right before the call to
HwcDisplay::WaitForPresenttime(). This should minimize the impact of
WaitForPresenttime(), and allow drm_hwcomposer to hit more present
targets that it can hit.

Test: atest GraphicsComposerAidlCommandTest
Test: Manual testing w/ perfetto

Change-Id: Ic9c07ff0b6d00dfafce5dd109d8195886dd3094e
Signed-off-by: Su Hong Koo <sukoo@google.com>
2025-09-18 13:24:44 -06:00
Deborah Brouwer
a4777dbf87 drm_hwcomposer: CI: Add vts job for multi-displays
Currently VtsHalGraphicsComposer3_TargetTest is run only with a single
display. Use the configurable vkms driver to run vts with multiple
displays.

This job should help to catch errors that arise only when there are
multiple displays. It also allows the test
ConnectedDisplaysTest.IndependentConfigChange to run whereas it is
otherwise skipped for single display configurations.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
8f82d3d682 drm_hwcomposer: CI: Add job to run with writeback
Currently VtsHalGraphicsComposer3_TargetTest is run without a writeback
connector enabled. Use the configurable vkms driver to create a writeback
connector and run VtsHalGraphicsComposer3_TargetTest.

This job should help to catch errors that arise only for writeback
connectors.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
3972d6d3cd drm_hwcomposer: Return kUnsupported for ReadbackBuffer
For writeback connectors, no ReadbackBufferFence is returned. Instead
of returning kBadParameter, return kUnsupported so that the
GraphicsCompositionTest.GetReadbackBufferFenceInactive test will pass.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
acb3e3d8f7 drm_hwcomposer: CI: Add job to run headless
Currently VtsHalGraphicsComposer3_TargetTest is run with a crosvm
display with a connected display. Use the configurable vkms driver to
run VtsHalGraphicsComposer3_TargetTest with a disconnected display.

This job should help to catch errors that arise only in headless mode.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
c567d34443 drm_hwcomposer: Return kUnsupported for setLayerLuts
Even though drmhwc does not support per-layer LUTs, the vts test
GraphicsComposerAidlCommandV4Test.SetUnsupportedLayerLuts issues the
setLayerLuts command when the display is in headless mode with
vkms/cuttlefish. Since drmhwc ignores the command, the test fails.

Instead of ignoring the command, return a kUnsupported error which
allows the test to pass.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
670385a79f drm_hwcomposer: CI: Add vkms helper functions
Add reusable functions to help load, configure, and print vkms to make
it easier to add and maintain jobs that use vkms to run CI jobs.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
5cf71b3a00 drm_hwcomposer: CI: Add reusable function for vts
Currently VtsHalGraphicsComposer3_TargetTest is run only once in a
single script. In anticipation of running vts with different display
configurations, add a reusable function to run vts, and use a different
script to actually run vts.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-17 16:41:25 -07:00
Deborah Brouwer
996acd8793 drm_hwcomposer: CI: Update vts tests to skip
The current list of tests to skip from VtsHalGraphicsComposer3_TargetTest
is from Android15, but the CI is running Android16, so update the list
of tests that are expected to skip from Android16.

This make the CI more accurate, because if a change causes a new test to
skip unexpectedly, the CI job will fail.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-15 16:21:22 -07:00
Deborah Brouwer
e43697d99c drm_hwcomposer: CI: launch_cvd: run modem_simulator
The modem simulator is currently disabled because, in an earlier version
of cuttlefish, it was preventing drmhwc from launching. However, the
missing service causes a lot of noise in logcat as the ServiceManager
continuously looks for the IRadioModem service.

Since the cuttlefish modem simulator is now working with drmhwc on
Android16, enable the modem simulator and reduce the logcat and Activity
Manager noise.

Also, while here, remove the executable bit from launch-cvd.sh since it
is only sourced, not run directly.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-15 16:11:27 -07:00
Drew Davenport
5a1d68b1f8 drm_hwcomposer: Preserve DrmAtomicStateManager state
The next frame's state needs to be initialized with the current frame's
state to ensure that it doesn't get reset incorrectly.

Change-Id: I00caab6ad4116dceba67cbd945b83c4d45277a39
2025-09-12 10:15:36 -06:00
Deborah Brouwer
ba799096db drm_hwcomposer: CI: Add hotplugs test with vkms
Add a new test job to use the configurable vKMS driver to test hotplugs
from `aosp/platform_testing/tests/display/hcct/tests/hotplugs.cpp`

Skip the test `DetectSingleDisconnectHotplugs` which currently fails
because it expects drm-hwcomposer to send a disconnect event for the
primary display. When this test is updated on a public branch of
platform_testing, it will be added back to the CI job.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-12 08:55:59 -07:00
Deborah Brouwer
2e853865c2 drm_hwcomposer: CI: Refactor containers
The `ubuntu/x86_64_android` container is the base for running cts/vts
tests, but it is getting very large (~4GB) and takes a long time to build.
To make the base container smaller (~2.6GB), and to make it quicker to
rebuild specific components, carve out two new containers from the base
container:
  1) `ubuntu/x86_64_android_tools` for any tools that can be downloaded;
  2) `ubuntu/x86_64_android_binaries` for any binaries (excluding
      cuttlefish) that need to be built within the aosp repo.

Also, remove the jobs that start with the prefix `use-*`. These jobs pull
containers (e.g. debian/x86_64_cuttlefish) to make files inside the
container (e.g. cuttlefish.tar.xz) available to other jobs in the pipeline
as artifacts. But these `use-*` jobs can take a long time to run
(anywhere from 3 to 20 minutes to use the cuttlefish container). Instead,
use skopeo with umoci to fetch the containers and access their files,
which is much quicker.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-12 08:55:59 -07:00
Deborah Brouwer
c02ebae650 drm_hwcomposer: CI: Shrink cuttlefish container
Instead of just removing unnecessary packages from the cuttlefish
container, purge them and their dependencies. This reduces the container
size by about 280M and should make it quicker to pull and inspect the
container.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-12 08:55:59 -07:00
Deborah Brouwer
abd366858b drm_hwcomposer: CI: Build vkms hotplug binaries
Since the android container already initializes and syncs the aosp repo,
also build the vkms hotplug binaries so that they can be used later in the
CI pipeline.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-09-12 08:55:59 -07:00
Andrew Wolfers
ee0b06e40c drm_hwcomposer: Preserve cursor scaling during commit
This change modifies cursor behavior during atomic commit
so that the scaling factor is preserved. Previously, the
src rect was being overwritten to match the dimensions of
the dst rect, because it was assumed that scaling is not
permitted with the cursor plane. The new behavior will
preserve any existing scaling factor while resizing the
src rect. For hardware that cannot use scaling on the
cursor plane, this behavior should now be caught during
test commit, and trigger the appropriate fallback. For
hardware that can use scaling on the cursor plane, the
behavior is fixed such that the cursor will now appear
with the correct sizing.

Change-Id: I1d3e01441bdc5d7076b15d66b1a7a1a498ea64a9
2025-09-11 13:17:00 +00:00
Andrew Wolfers
0583f19628 drm_hwcomposer: Change cursor composition testing
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
2025-09-11 13:16:49 +00:00
Andrew Wolfers
7e3f849bca drm_hwcomposer: Fix ValidateDisplay logic
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
2025-09-11 13:16:37 +00:00
Andrew Wolfers
3ceb722bc9 drm_hwcomposer: Move pixops calculation
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
2025-09-10 19:41:32 +00:00
Andrew Wolfers
2261f81762 drm_hwcomposer: Add Rect utility type
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
2025-09-10 13:41:51 +00:00
Andrew Wolfers
9255d0d10b drm_hwcomposer: Migrate to android::drm_hwcomposer namespace
Change-Id: I2859aa8f55532d88231389724956fc77b0625339
2025-09-08 18:53:00 +00:00
Andrew Wolfers
d4ab368f7f drm_hwcomposer: Add missing namespaces
Change-Id: I2ac3580664018cf63dc14e9f8025c2e60f843e3c
2025-09-08 18:52:59 +00:00