1
0
Fork 0
Commit graph

58 commits

Author SHA1 Message Date
Andrew Wolfers
5337905df6 Cleanup includes in hwc2_device/ per IWYU style
Change-Id: If7440aa7796ea8d48cb2767ae3a57d853d535135
2025-11-11 19:14:30 +00:00
Andrew Wolfers
6c2df0cbdd Move CompositionPlanner from backend/ to compositor/
Change-Id: Iebd4a4d0e15c5171aa20fafe3686b7bc8c08a175
2025-11-06 18:32:05 +00:00
Andrew Wolfers
a890ccd62f Add atom reporting for flattening controller state
Change-Id: I09f60c95519d844359d5f1c70b940b47f756da21
2025-11-06 15:30:45 +00:00
Drew Davenport
f119d34769 Rename Backend to CompositionPlanner
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
2025-10-30 12:07:09 -06: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
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
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
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
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
Drew Davenport
23e05e0b85 drm_hwcomposer: Move common files out of hwc2_device directory
HwcDisplay etc. are shared between frontends and shouldn't live in the
hwc2_device directory.

Change-Id: I4bf3845f6cf7adde5f625a736cc1dffea27e5168
2025-05-23 09:01:32 -06:00
Drew Davenport
b9549d9bdc drm_hwcomposer: Remove hwc2_config_id
Define a ConfigId type to be used for identifying per-display configs.
Cast this to the appropriate type in each frontend.

Change-Id: I4c242fc1f22811b52e0794378234400f38ea1ca7
2025-05-23 09:01:32 -06:00
Drew Davenport
ca711e95bf drm_hwcomposer: Remove hwc2_display_t
Add DisplayHandle which is a typedef for int64_t. Use this type instead
of the HWC2 hwc2_display_t type.

Additionally, rename variable names to prefer `display_handle` over
`display_id`, since "DisplayId" is overloaded and carries a different
meaning in the Android framework.

Change-Id: I2a8ecce3b2c19fcd5e945d6c645f83d6a7d27a42
2025-05-23 09:01:26 -06:00
Sasha McIntosh
3b548894ac drm_hwcomposer: Remove SetColorTransform GetHdrCapabilities HWC2 API
Remove HWC2 errors from HwcDisplay::SetOutputType and
SetHdrOutputMetadata.

Change-Id: I67333210abcc4ab9f320cc8d4451564e59db777e
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-05-22 13:35:37 -04:00
Sasha McIntosh
9624a8ea11 drm_hwcomposer: Remove SetColorTransform HWC2 API
Instead, reuse generic API SetColorTransformMatrix. The only valid hints
are abitrary and identity. Convert color_transform_hint_ member variable
to a bool.

Change-Id: Iac05c54394bee67637caa3edd3cde4e2097f6e1f
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-05-22 13:35:37 -04:00
Sasha McIntosh
574a22f721 drm_hwcomposer: Remove SetColorMode HWC2 API
Add generic API for Set/GetColorMode and move HWC2 specific behavior to
hwc2_device.

Remove HwcDisplay::SetColorModeWithIntent, as the only supported intent
is colormetric.

Rename Colormode to ColorMode.

Fix contract between color mode and render intent. All supported color
modes should have a supported render intent (COLORMETRIC at least).

Change-Id: Ic1002b630f925e1ea75cb6ad7822b1384010143e
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-05-22 13:35:33 -04:00
Drew Davenport
1194dcca56 drm_hwcomposer: Check display type in DestroyVirtualDisplay
Ensure that the display handle to destroy refers to a virtual display
before deleting the display.

Change-Id: I7c284aabdc17cef92051c47d12e4b31ef02ebc9b
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-05-16 14:01:49 -06:00
Drew Davenport
1cca58e9e3 drm_hwcomposer: Remove HWC2 hooks for Virtual Displays
Change the Create/Destroy virtual display functions on DrmHwc to remove
HWC2 API stuff. Implement the corresponding functions in the HWC3 and
HWC2 frontends in terms of these functions.

Change-Id: I410da9347ccb2cd008cc94b746c2b5604969b57e
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-05-16 14:01:41 -06:00
Drew Davenport
7e573a50c9 drm_hwcomposer: Remove HWC2 CompositionType
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>
2025-05-05 14:52:56 -06:00
Drew Davenport
aeaddd3233 drm_hwcomposer: Remove HWC2 Dump interface
Rewrite DrmHwc::Dump to return a string, rather than directly
implementing the HWC2 interface.

Rewrite the HWC3 frontend Dump implementation to return this string.
Rewrite the HWC2 frontend Dump implementation to cache the string in the
frontend so that the dump string size/contents can be fetched
separately.

Change-Id: I9c286f047bb67a05ced4f0e9778679c32175084c
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-29 11:28:08 -06:00
Drew Davenport
9d43873b2b drm_hwcomposer: Remove legacy GetDisplayName
Remove the HWC2 GetDisplayName hook from HwcDisplay and replace it with
a function that simply returns the std::string.

Implement the HWC2 and HWC3 frontends in terms of the new
HwcDisplay::GetDisplayName.

Change-Id: I8230294bb7195b6d011ea450fafb80db8c9c5f50
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-15 12:16:43 -06:00
Drew Davenport
0113d20d46 drm_hwcomposer: Remove HWC2 LegacyGetDisplayConfigs
This was only used by the HWC2 frontend. Move the function to
hwc2_device.

Change-Id: I4b539e9a37ea09bd577eadd44c205e17230a5a6b
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-15 12:16:43 -06:00
Drew Davenport
2600a3d487 drm_hwcomposer: Remove HWC2 GetDisplayAttribute
This was only used by legacy HWC2. Move it to hwc2_device with the
implementation based on that in ComposerClient.

Change-Id: I645210ef11cd6c452549aef3c893f0edba21fd88
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-15 12:16:43 -06:00
Drew Davenport
c8ace00f91 drm_hwcomposer: Remove HWC2 SetActiveConfig
Move the function to the HWC2 frontend, and implement the function in
terms of HwcDisplay::QueueConfig

Change-Id: Ia47503ac7463041c36ed4e6ad5374b3491019c2d
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-10 13:46:04 -06:00
Andrew Wolfers
a2a1092e33 drm_hwcomposer: Plumb damage into Hwc layer data
This change adds a damage property to LayerData which is populated
from the damage provided via the layer command.

Change-Id: Ie6c069a1c2c81a8dc588a518f553ff087b0299dd
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
2025-04-08 15:31:28 +00:00
Drew Davenport
12bca98c92 drm_hwcomposer: Remove HWC2 SetPowerMode
drm-hwc only supports setting power mode on and off. Add a new function
to HwcDisplay to enable/disable the display, and implement the HWC API
in the frontends in terms of this.

Change-Id: I7a3d92140f4b98bbed9000489e06b8011546ce7e
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
44a3351102 drm_hwcomposer: Remove HWC2 SetVsyncEnabled
Add a function to enable/disable vsync callbacks to HwcDisplay and
implement the HWC APIs in the frontend by calling into this new
function.

Change-Id: Id4506c870a8488bdd8d25ad025e246a3bcc6619e
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
cfcdbbfa1f drm_hwcomposer: Remove GetDisplayConnectionType and GetDisplayType
GetDisplayType is not used for hwc3, so no frontend work is
required to remove it.

A display can be physical or virtual. A physical display can be internal
or external. Create an enum to cover these three cases (virtual,
internal, external), and add a function GetDisplayType.

Implement related functionality in the respective frontends in terms of
this new function.

Change-Id: I72b0b66d22bc91a7e6d0450469f4c140b2cb91c4
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
a5463cb4b0 drm_hwcomposer: Remove HWC2 GetDisplayVsyncPeriod
Update the implementation in the frontend to get the current config and
query its vsync period.

Change-Id: I1f357216a9c5b7b4887b966ab96e4948cef8c353
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
92e240e86b drm_hwcomposer: Remove HWC2 SetActiveConfigWithConstraints
Move the HWC2 implementation into the hwc2 frontend, and update the
implementation to call QueueConfig.

This is simpler than the hwc3 implementation, but should be fine since
QueueConfig is consistent with how HWC2 GetActiveConfig was implemented.
Specifically, by queuing up the config change to take effect along with
the next composition.

Change-Id: I448728bd93b5a35badba179b05e2c8865d62f123
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
2d71839c8a drm_hwcomposer: Remove HWC2 SetContentType
Add a new function to set the HDMI content type, and call this from the
frontend.

Change-Id: I338a00b7a142c6d2e2c3a727e8e7df7d24c1594d
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
ea508da8c0 drm_hwcomposer: Remove HWC2 GetActiveConfig
Move the HWC2 implementation into the hwc2 frontend, and update the
implementation to call HwcDisplay::GeLastRequestedConfig.

Change-Id: I88f0a030792892ce6bc852b11a5b726ef43bbd09
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
931fae3f45 drm_hwcomposer: Remove HWC2 GetDisplayIdentificationData
Expose functions on HwcDisplay to get the edid bytes and port, and
implement the HWC API in terms of those in the frontend.

Change-Id: I74131b165332eb39f2d77fcdd687d231f9ad504f
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
56efeea57b drm_hwcomposer: Remove HWC2 GetDisplayCapabilities
drm-hwc currently only supports one capability
(SKIP_CLIENT_COLOR_TRANSFORM). With recent changes to handle 4x3 CTMs,
this capability is no longer dependent on any display capabilities.

Extract the logic for checking this capability out of HwcDisplay and
into the frontend.

Remove the obsolete HWC2 GetDisplayCapabilities from HwcDisplay and
related conversion helpers.

Change-Id: I7255d52376c390d99246d8dd5eb9642b5d3e2554
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-02 17:51:09 -06:00
Drew Davenport
f638348b22 drm_hwcomposer: Support DisplayCommand.expectedPresentTime
DisplayCommand.expectedPresentTime indicates that the HWC should present
the composition as close to the desired time as possible. It may be that
the desired time is some number of vsync periods in the future.

A drm atomic commit will always present at the next vsync, and there is
no mechanism for userspace to indicate a desired present time.

Lacking a kernel uAPI to support this, an alternative is to sleep in
userspace until the next expected vsync aligns with the expected present
time.

Change-Id: Iad703eed9b0e459194f895339dd604990875f157
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-03-14 11:38:40 -06:00
Roman Stratiienko
ee6d843ef8 drm_hwcomposer: Rework CreateLayer/DestroyLayer
- Make HwcDisplay CreateLayer/DestroyLayer frontend-agnostic.
- Provide LayerId as an input for CreateLayer. It is necessary to add
  the HWC3 LayerLifecycleBatchCommand feature, where layer ID is
  generated by the client.

Change-Id: I317dcf22461fe4390ced9f0c0c780cffaa3b8f5d
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-18 22:58:58 +02:00
Roman Stratiienko
34c50ce47a drm_hwcomposer: Put ValidateDisplay and GetChangedTypes to the frontend
Another step towards full frontend/backend split.

Change-Id: Icaa65c72c7cc0a5f7b76b87f3a2662d9f6c08c1c
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-11 20:19:50 +02:00
Roman Stratiienko
72ff8c394b drm_hwcomposer: Put hwc2 PresentDisplay and GetReleaseFences to frontend
Another step towards full frontend/backend split.

Change-Id: I0b70a3c6ff6f3ee8bd65735f0a65fbb042c32fbd
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-11 20:19:50 +02:00
Roman Stratiienko
f74b7318b3 drm_hwcomposer: Move trivial frontend functions out of HwcDisplay class
Another step towards full frontend/backend split.

Change-Id: I854da4344bc9973cc5f076230c2baee0c46f2276
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-11 20:19:50 +02:00
Roman Stratiienko
7c8cc4eb3f drm_hwcomposer: Rework HWC frontends buffer management
Change summary:

- Use BufferInfo instead of native_buffer to configure the HwcLayer.
- Extend buffer properties with slot info.
- Provide fence and active slot ID separate from the buffer.
- Move swapchain tracking into HWC2. HWC3 doesn't need that.

Why:

- Support more flexible resource management control from the frontend
  side,  which is required by HWC3 API.
- Move more Android-specific data types to the frontend module.

Change-Id: Idaa4c552f600f78d6f0ad21997cfa7f3a6c6cbd8
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-07 00:20:09 +02:00
Roman Stratiienko
70ab939bc9 drm_hwcomposer: Use layer API for SetClientTarget and SetOutputBuffer
This removes SetClientTarget and SetOutputBuffer HWC2 API hooks from
HwcDisplay, replacing them with SetLayerProperties().

Change-Id: Ie4b1906199e6a1d0e7de9f7907aa9e679f28028c
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-05 22:39:35 +02:00
Roman Stratiienko
4e15bfc948 drm_hwcomposer: Support default values for Rect structures
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>
2025-02-05 22:39:35 +02:00
Roman Stratiienko
6275b4a6ea drm_hwcomposer: Enable modernize-type-traits clang-tidy check
... and suppress a warning.

Change-Id: I2361ebaae476928424837ea8c79fddb8b4fc6e33
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:44:00 +02:00
Roman Stratiienko
da2fcf6676 drm_hwcomposer: Simplify LayerTransform
Fixes clang-analyzer-optin.core.EnumCastOutOfRange clang tidy check.

Change-Id: I0a88d1ef084848c924198e8bd3831533b6578675
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:33:35 +02:00
Roman Stratiienko
41cd950c54 drm_hwcomposer: hwc2: Route all Layer hooks via SetLayerProperties
Another pass of hwc2<->internal layer separation.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 14:17:48 +02:00
Drew Davenport
f7e8833124 drm_hwcomposer: Implement getDisplayConfigurations
This deprecates calls like getDisplayConfigs and getDisplayAttribute.
Once HWC2 support has been removed from drm_hwcomposer, the legacy calls
could be implemented by calling getDisplayConfigurations.

The main different between the two is that in HWC3, the dpi is in
dots-per-inch and its unit is float. In HWC2, the dpi is in
dots-per-1000-inches and its unit is int32.

Change-Id: I9eed17d6f575bc05f1794dc0575f268fe1fc297d
Signed-off-by: Drew Davenport <ddavenport@google.com>
2024-09-13 10:59:13 -06:00
Sean Paul
468a7548bf drm_hwcomposer: Replace LOG_TAG with drmhwc
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>
2024-07-19 17:42:41 +00:00
Roman Stratiienko
9e2a2cd313 drm_hwcomposer: Make main mutex recursive
It allows to remove redundant unlock/lock pair from the code,
and should make it a little bit more race-proof.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2023-01-04 16:30:40 +02:00
Roman Stratiienko
6b40505a7e drm_hwcomposer: Use __ANDROID_API__ instead of PLATFORM_SDK_VERSION
__ANDROID_API__ definition is available by default in AOSP and NDK.

It also exported by standard system clang when the user sets
the '-target <ARCH>-linux-android<LEVEL>' compiler flag.

Reason for this change is integration of meson build script, where
otherwise the user has to provide the API level manually.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-11 21:19:43 +02:00