1
0
Fork 0
Commit graph

1140 commits

Author SHA1 Message Date
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
Drew Davenport
bd61cdab1f drm_hwcomposer: Make CleanFailedCommit private
This is only called from DrmAtomicStateManager so make it private.

Change-Id: I2ad884875514e910fc664e74fc546dbb51821f7e
2025-09-05 14:57:05 -06:00
Drew Davenport
5c7f0d6e53 drm_hwcomposer: const-correctness
Make AtomicCommitArgs const in the different helper functions to build
the AtomicRequest. Additionally, reorder the parameters to reflect the
convention that input parameters are listed first, and out parameters
are listed after.

Change-Id: I0277ec4129fbcd6312e6df9ae3f15600e9755520
2025-09-05 14:57:03 -06:00
Drew Davenport
9e59a16a2c drm_hwcomposer: Don't reset writeback fence
It's not necessary to close the fence after waiting.

Change-Id: I6cfa4dc9e2cfa9fff8a2d40a50b4badf8cb7ce1f
2025-09-05 14:55:26 -06:00
Drew Davenport
faab5a4912 drm_hwcomposer: Make some structs private
Move structs definitions that are only used inside the
DrmAtomicStateManager class to private.

Change-Id: I6f3c48cf14645dae721d0e4f9d9b1e5767f08914
2025-09-05 14:55:24 -06:00
Drew Davenport
c4c008f63a drm_hwcomposer: Use AtomicRequest struct
Add AtomicRequest struct to wrap the pending DrmModeAtomicReq and
related kms objects and state for the pending atomic commit.

After the AtomicRequest's property set has been committed, update the
internal DrmAtomicStateManager state to reflect what has been committed.

Change-Id: I49d39649eb957d69f724b53b91577a347a75527e
2025-09-05 14:54:55 -06:00
Drew Davenport
88527cddf2 drm_hwcomposer: Clear new frame state
Rather than initializing the state associated with a new frame by
copying committed_frame_state_, check committed_frame_state_ directly
when needed.

Change-Id: I62043e15e70669ce6a8ac4635101d13d8efd7f15
2025-09-05 13:42:58 -06:00
Andrew Wolfers
9e75410677 drm_hwcomposer: Fix cursor positioning
In some cases, the position of the cursor is controlled by the src rect.
For example, this is done when the cursor extends beyond the top or left
edges of the screen. This is not compatible with the hw cursor plane
however, because scaling and panning are both disallowed. As a workaround,
the position of the dst rect needs to be adjusted in the opposite
direction (in some cases taking a negative-valued position,) which
will correctly position the cursor while also assigning an acceptible
value to the src rect.

Change-Id: Ide7f75e01481bcd602a33d222d1ae6862703a1cd
2025-08-28 17:32:50 +00:00
Sasha McIntosh
9ad5a95efc drm_hwcomposer: Disable non-native color modes
drm_hwc currently does not support tone mapping. This causes a visual
color flickers when switching between CLIENT and DEVICE composition.
Temporarily disable non-native color modes until tone mapping work is
completed.

Change-Id: I114a12c474990a5a81181c52307469c7b139a2b0
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-08-27 17:31:18 -04:00
Drew Davenport
a9e13211a6 drm_hwcomposer: Start making HwcDisplay const in Backend
Add some const correctness to HwcDisplay. Narrow the public
interface of HwcDisplay to avoid exposing non-const members
unnecessarily.

Change-Id: I691c9e0025065085ca1e2045bb1d6614535fdbdc
2025-08-27 13:01:59 -06:00
Drew Davenport
67a09e278f drm_hwcomposer: Use PRId64 format
Address compiler warning on some toolchains.

Change-Id: I72a83d09e53e72909ecdcb0b15eff829a2299eed
2025-08-27 12:21:49 -06:00
Drew Davenport
df0954ca7d drm_hwcomposer: Rename CreateComposition->CommitComposition
Since CreateComposition is only being used in the present path, rename
it to CommitComposition to indicate that it's going to commit the
composition that was previously created during Validate.

Change-Id: Ia4627ff1e32b655273421510f8e1b844c6dd5e06
2025-08-26 09:27:21 -06:00
Drew Davenport
bf4210c17e drm_hwcomposer: Make TestComposition const
Making TestComposition const ensures that the Backend can't modify any
HwcDisplay state while creating and validating a composition.

Also make a bunch of other stuff const-correct since there is a const
version of GetPipe()

Change-Id: Ib7769d290148ce496b0165b64806dbd0a601b213
2025-08-26 09:27:21 -06:00
Drew Davenport
eb46a0dae5 drm_hwcomposer: Move client_layer.Populate to present
The client layer may be updated as part of Present, since the Client
doesn't know if the client layer is used or not until after Validate is
complete.

Move PopulateLayerData call out of CreateFrameUpdateCommit so that
CreateFrameUpdateCommit doesn't modify HwcDisplay state.

Change-Id: I0a78075f9476e0d27111b860b6a39fb46814b235
2025-08-26 09:27:21 -06:00
Drew Davenport
c75316c28e drm_hwcomposer: Return DrmKmsPlan from Backend
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
2025-08-26 09:27:21 -06:00
Drew Davenport
b288993101 drm_hwcomposer: Extract CreateFrameUpdateCommit
Extract the functionality to create the AtomicCommitArgs for a frame
update and call this from the TestComposition and CreateComposition
paths.

Change-Id: Ibb0695fd37e9f43eb8f97b3fd901109839d0f9ea
2025-08-26 09:27:11 -06:00
Drew Davenport
eaf305ebc2 drm_hwcomposer: Move state update to new function
Extract the parts of HwcDisplay that update HwcDisplay state post-commit
into a new function.

Change-Id: I2d5e69bb86f84b7b897ad71ea719480302f60f56
2025-08-25 16:50:24 -06:00
Drew Davenport
0fee963917 drm_hwcomposer: Use a_args.mode for state update
Rather than using next_config to determine if there was a config change
during the frame update, check the a_args.

Change-Id: Ib71dd3d542d7915e1fbfba0045c1d604382b1aab
2025-08-22 14:19:18 -06:00
Drew Davenport
7f8cf905cd drm_hwcomposer: Make CreateComposition private
This is only called internally from HwcDisplay, so make it private.

Change-Id: I8abb7ac313a450d56a2085738a2ece58350e8b8f
2025-08-22 14:15:52 -06:00
Drew Davenport
f20d3cc4da drm_hwcomposer: Move state update to the end
Change-Id: I47871438b08db3eafe53cd151d41ca904f59dd26
2025-08-22 14:15:46 -06:00
Drew Davenport
a120b869df drm_hwcomposer: Calcuate better estimate for refresh_time_ns
QueueConfig allows for a seamless refresh rate change to be queued at
some arbitrary point in the future.

Previous behavior was to report `desired_time` as the time to request
a new frame from the client to apply the refresh rate change. Since
`desired_time` could be any arbitrary point in time, this may not align
with the current refresh rate.

This change addresses a failure in
SetActiveConfigWithConstraints_Delayed exposed by the previous change to
avoid setting the active_config_id until a full commit.

Change-Id: I92888cd1a6a330455f9e7e496d6900d494605248
2025-08-22 12:11:07 -06:00
Drew Davenport
9587a01f71 drm_hwcomposer: Don't set active_mode for test commit
HwcDisplay internal tracking state should only be modified for the
commit, not for the test commit

Change-Id: Idd63e300e724ff1b6986362d2b47e7b024346e05
2025-08-21 10:55:16 -06:00
Andrew Wolfers
8674bc34a4 drm_hwcomposer: Enforce type consistency in Backend
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
2025-08-20 11:58:44 -06:00
Deborah Brouwer
a59c50f641 drm_hwcomposer: CI: Update CTS test names
In Android 16, some CtsGraphicsTestCases test names have changed which
causes the module to fail. Update the test names.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
d1b819b89d drm_hwcomposer: CI: Add CTS skips file
Android 16 added a new test, GetSupportedRefreshRatesIsDivisorRate,
which will fail when CI is updated to Android 16.

Add the ability to skip a CTS test and skip this test for now.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
1771c8fd66 drm_hwcomposer: CI: Update container tags
Force all containers to rebuild to implement the Android 16 changes.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
bf2035bc2f drm_hwcomposer: CI: Update launch-cvd for Android 16
Update the commands for launching cuttlefish, since they changed slightly
between Android 15 and Android 16.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
4c03575eb0 drm_hwcomposer: CI: Android: Use Android 16
Update the android container to include all of the packages, tools, and
tests that are up-to-date with Android 16.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
abdb5fa5b8 drm_hwcomposer: CI: aospless: Use Android 16
Update the aospless container to work with the Android 16 repositories.
This ensures that aospless can still be used to build drm-hwcomposer
binaries for Android 16.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:22:58 -07:00
Deborah Brouwer
5d47be1918 drm_hwcomposer: CI: cuttlefish: Use Android 16
Build the cuttlefish device for Android 16. This keeps CI coverage
as complete and up-to-date as possible.

Since Android 16 deprecates builds with make, temporarily stop using mesa
libraries with the intention of adding a Soong build of mesa in the
future.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 15:19:03 -07:00
Deborah Brouwer
ea5689b295 drm_hwcomposer: CI: Update to Android 16
In preparation for rebuilding all CI containers to use Android 16,
update CI/build variables to use Android 16 and Android SDK 36.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 14:52:08 -07:00
Deborah Brouwer
3312d98b61 drm_hwcomposer: CI: Save CTS failure logs
When $FDO_CI_BASH_HELPERS was added, it included an ERR trap that is
triggered when a cts failure is found in the invocation summary. This
prevents the full cts logs from being saved in the job results.

Revise the cts failure check to avoid triggering the trap on error and
allow the full cts logs to be saved.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 14:52:08 -07:00
Deborah Brouwer
91403abf73 drm_hwcomposer: Add Meson dependency on base
Since libbase is now part of hwcomposer.drm_defaults, meson builds also
need the `base` dependency to avoid linking errors.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 12:23:31 -07:00
Deborah Brouwer
f83c13fd0c drm_hwcomposer: Silence clang-tidy warnings
Currently the clang-tidy CI job is ignoring code guarded by
`__ANDROID_API__ >= 36` so some readability warnings slipped through.

In preparation for updating the ANDROID_SDK_VERSION to 36, silence these
warnings:

  * error: invalid case style for parameter 'maxProfiles'
  * error: all parameters should be named in a function

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
2025-08-19 12:23:31 -07:00
Drew Davenport
ae70ed5bf1 drm_hwcomposer: Add HwcDisplay::TestComposition
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
2025-08-19 09:16:22 -06:00
Drew Davenport
4a84e27035 drm_hwcomposer: Make HwcLayer const in Backend
Backend shouldn't directly mutate HwcLayer state, so make HwcLayer
const. Make a few other related functions const correct as well.

Change-Id: Id7f8e255e9e72b756399b1a4dabc3db779d64bc9
2025-08-19 09:16:22 -06:00
Drew Davenport
728701adba drm_hwcomposer: Rename Backend::MarkValidated
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
2025-08-19 09:16:22 -06:00
Drew Davenport
b29c974d70 drm_hwcomposer: Return composition decision from backend
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
2025-08-19 09:16:22 -06:00
Drew Davenport
a5fb437d37 drm_hwcomposer: Move CompositionType out of HwcLayer struct
Moving this paves the way for reducing dependency on HwcLayer from the
Backend class

Change-Id: I62f057a0efcb7afc3c9a04cff3bd53b5c56c5ad9
2025-08-19 09:16:22 -06:00
Drew Davenport
3a403db8d3 drm_hwcomposer: clang-format: Derive pointer alignment
Explicitly set DerivePointerAlignment: true to avoid spurious
clang-format corrections and keep the project consistent with itself.

Change-Id: I2928adebf8c56743ffe910f5026d501beda8941f
2025-08-19 09:16:22 -06:00
Drew Davenport
704a0b9398 drm_hwcomposer: Set value for hdrOutputType for fake config
GetDisplayConfigurations_hasHdrType fails for headless displays since
the hdrOutputType is not initialized for fake modes. Set fake modes to
kSystem instead of kInvalid.

Change-Id: I051dc742b4786bbb0bf8a9384a6d3cde536eebce
2025-08-15 14:42:11 -06:00
Drew Davenport
b800732193 drm_hwcomposer: Handle headless display in IsWritebackSupported
IsWriteBackSupported is called on a display as part of
getReadbackBufferAttributes. If this is called on a headless display,
then it will result in a null ptr dereference.

Check for headless display and return 'false' in this case.

Change-Id: Ia492dec338ab65457670e3b22c2e8582031aa129
2025-08-15 14:42:11 -06:00
Gil Dekel
860b363563 drm_hwcomposer: Defer display rect update to prevent state pollution
A test commit or failed modesets, particularly when with modes of a
different resolution, would cause all subsequent pafe-flip commits to
fail.

The root cause was a premature state update within
SetDisplayModeIfNeeded. The `whole_display_rect_` member was being
modified during the commit preparation phase. This polluted the state
manager's internal view of the active display size, causing subsequent
frame compositions to be built with incorrect dimensions, which were
then rejected by the kernel on certain drivers that cannot handle
scaling on the fly.

This change fixes the issue by deferring the state update until after a
commit is successfully applied:

1. `whole_display_rect_` is now only updated inside `CommitFrame` after
   a modesetting commit has been successfully applied to hardware.

2. `SetCompositionIfNeeded` is updated to use the dimensions from the
   incoming `args.display_mode`, if available, when preparing a modeset.
   Otherwise it will use the existing size in `whole_display_rect_`.
   This ensures the plane is correctly configured for either the
   requested mode, or the currently active one (for page-flips).

This prevents test-only operations from having side effects and ensures
the state manager's internal state remains consistent. It also prevents
state pollution on failed modesets.

Change-Id: Icf08b32c13879d394f883f34e6fed3d96a748a4f
Co-authored-by: Lucas Berthou <berlu@google.com>
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-08-13 13:09:01 -04:00