Remove the usage of main_lock_ and ensure that mutex_ is held for no
larger a scope than is necessary.
Reorder some class members to keep protected members together.
Change-Id: Iaf29cf53e11d692fb3779b61b147abfcacf95746
The distinction between active/staged isn't important for state
tracking, so simplify management of these by using a std::queue.
Change-Id: I1871d3c2f5c6e6686baa9b6473bbbb7072077efc
Since the helper thread doesn't need to access KmsState, and we are only
using the most recently committed state, track the KmsState separately
from the KmsObjects.
The tracked KmsState doesn't need to be synchronized with the helper
thread.
Change-Id: Ic62e0753ee11d3870eb31892f18023688558ff9a
When preparing the properties for a commit, the state for the currently
active frame is used, rather than the last committed frame. This is
incorrect and could lead to a scenario such as:
- Frame N: commit enables plane 1
- Frame N+1: commit uses plane 1, 2, 3
- Frame N+2: if executed before staged_frame_state_ is moved to
active_frame_state_, the new KmsState::used_framebuffers will be
initialized to {1}
- commit uses planes 1, 2
- plane 3 is not disabled by the unused_planes code in CommitFrame
A similar problem exists for the KmsState::crtc_active_state.
To avoid this issue, always use the last committed state, regardless of
whether the previous frame has been presented or not.
Change-Id: I840b5b0ca3a3cf477882cacf6b1d5c0313ae80cf
Define DrmAtomicStateManager::KmsObjects struct to distinguish between
objects that are tracked for lifetime management and state that is
tracked for the purpose of preparing subsequent commits.
Change-Id: I5402959f17298102a904b83fbbf01577ae673e48
Shared state is protected by a combination of the local mutex_ and the
global lock. This change attempts to document and enforce that more
clearly using clang-tidy thread annotations.
Change unique_lock usage to lock_guard for cases that do not require
release of the mutex such as when using a condition variable.
Temporarily add a main_lock_ mutex which mirrors how
the global lock is being used for synchronization. Lock this at the
entry point to all public methods. This lock will be removed as a part
of subsequent refactoring and it used to more cleanly break up the
following changes in this series.
Some state is not properly protected by any lock, so temporarily disable
the warnings around access to that state until the synchronization is
resolved in subsequent changes.
Change-Id: I6f4f30c4e97f266146b0879c5255d6f2432f12a3
Ensure that the std::lock is declared early so that it can be referenced
by clang thread annotations.
Change-Id: I64e7290cc6ff6fcdebb119dc2ec7537387f4ae5c
This file already exists in android-base, so use this instead of
duplicating the macros in this project.
Since the copy in android-base provides a helper class to assist with
std::unique_lock, use that instead of disabling the warnings.
Change-Id: Ib1724045e3eea29946799fb99b3fbcfcc14a5013
Some downstream projects use hwcomposer.drm_defaults and define their
own .so with downstream logic.
Move the drm_hwcomposer_atom_reporter dependency into
hwcomposer.drm_defaults to avoid link errors when building such an .so
Change-Id: Ie3ad0d2c923fba1f2f47b4c7b5cdef3e66436c26
When a developer pushes changes to a merge request, the current workflow
rules will create two pipelines: one on the developer's fork and another
in the project namespace for the merge request.
To avoid this duplication, only run the pipeline in the project namespace
if a merge-request is open.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
When initializing the ComposerClient, create a
CompositionStatsAtomReporter and poll the DrmHwc periodically for
stats to send.
By default, the stub reporter is used
Change-Id: I864a3cc8e148b03cc6e693d141d2dcbf6d5c70d3
Signed-off-by: Drew Davenport <ddavenport@google.com>
The IStats service provides an interface for reporting metrics from
vendor processes through the IStats::reportVendorAtom interface.
The type and ordering of the data in a VendorAtom are determined by a
proto definition which is typically OEM-specific. The code to construct
the VendorAtom is generated from the proto definition.
Add a soong config variable in the DRMHWC config namespace to enable the
atom reporting. Currently there is only one such implementation.
atom_reporter: Set this to configure OEM-specific atom reporting.
With the config variable omitted, reporting will be disabled and a stub
implementation is used, ensuring no build or runtime dependency or usage
of the IStats service.
Change-Id: I832adbd42412db1ab4c9403c1da60fa075443caa
Signed-off-by: Drew Davenport <ddavenport@google.com>
Unset the damage property in DRM when receiving an empty vector from SF.
The previous behavior was to retain the damage on empty vector, but this
is not HAL compliant behavior.
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
Define a ConfigId type to be used for identifying per-display configs.
Cast this to the appropriate type in each frontend.
Change-Id: I4c242fc1f22811b52e0794378234400f38ea1ca7
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
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>
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>
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>
BadLayer could be returned in a few cases:
1. Client Layer is not usable for device composition
2. Some layer tagged for DEVICE composition is not usable for device
composition
3. Writeback layer is not usable for device composition
In the Validate phase, these errors are handled by falling back to GPU
composition. In the present phase, these are real errors.
The check was supposed to gracefully handle a case where the Client does
a validate/present cycle without having created any layers. This case is
handled by checking for empty layers and returning early, as described
in
https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/merge_requests/354
Any other as-yet-unknown cases where there are no layers to present should not
fail silently and raise an error.
Change-Id: Ie5fc2202936209a80ca8af5c3325520a1897b2e5
Signed-off-by: Drew Davenport <ddavenport@google.com>
Wrap Android16 APIs in an if block to prevent breaking Android15
integration.
s/AidlHdcpLevels/drm::HdcpLevels
Add support for external HDR displays (dropped in previous cleanup).
clang-format-diff-19 nits
Change-Id: I897e0b42e0065a61ecfe28c280094b6c375d8a72
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
When HDR10 is the desired output type for the display mode, request a minimum
bpc of 8 from the connector. This ensures the quality of the HDR content and
allows the caller to retry with SDR if there is insufficient bandwidth.
Change-Id: I897e0b42e0065a61ecfe28c280094b6c375d8a72
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
Set hdrOutputType to SYSTEM for all configs provided by drm_hwcomposer.
Change-Id: I219d70731be058b85117b63eeed769ecc31e614d
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
This is internal for now due to getLuts() AIDL interface not being public yet and will be submitted together with AIDL change.
And the getLuts() interface is to get luts of input buffer handles.
Change-Id: I8af97262cb31e78318d44370f31f5b9890113183
Signed-off-by: Sally Qi <sallyqi@google.com>
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
When SurfaceFlinger detects a secure surface, it can call this
api to inform HWC to start HDCP negotiations.
Change-Id: Ifce48821ba32c35567d608064c977ecc08fdd5b7
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
This will allow us to cherry-pick downstream changes from Android16
without breaking those using the Android15 source tree.
Add Android15 target to CXXFLAGS so that Android16 APIs are
ignored on CI.
Add ANDROID_SDK_VERSION to ci builds.
Change-Id: I4e37e5ce5b2c2b5dc5134dc8c33f284fe26d4019
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
If a contributor is a member of an upstream project, then the built-in
GitLab variable CI_PROJECT_URL points to the upstream project. This
means that a developer's fork in a merge request can't be used to build
a container.
Replace CI_PROJECT_URL and point to the developer's fork repository
instead.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
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>
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>
Earlier only the physical connectors were added on init
to the connectors_ vector and then hotplug handler
only operated on these cached connectors. But in case of MST
when new sinks are hotplugged to the downstream ports, new
dynamic connectors get added. So refresh the list of connectors
to remove the stale connectors and add new connectors
on every uevent.
This enables MST connectors hotplugged after boot.
Change-Id: I9163c6a892c3604ad8e49be94d32b30af7a6dc88
Signed-off-by: Manasi Navare <navaremanasi@google.com>
This commit properly tears down the display pieline when the
display is disconnected. This frees up the DRM CRTC and other
resources used by the connector. This ensures that the
consecutive hotplugs work correctly to reallocate the CRTCs
when new displays are connected.
This was verified by ensuring the CRTCs, mode, connectors
are freed up in modetest.
This fixes the issue of display not coming back after
screen timeout and fixes the Android VTS SetPowerMode(Off) failures
Fixes: 025ea5bfbb ("drm_hwcomposer: Teardown the pipeline and DRM
resources on disconnect")
Change-Id: Icdca56433b5cd565d1658b1a415565adc7980088
Signed-off-by: Manasi Navare <navaremanasi@google.com>
It looks like this function was removed at some point but the
declaration is still there. Remove it.
Change-Id: Ia75f6a9312aeaeca24a078714ebafdacaabdc160
Signed-off-by: Drew Davenport <ddavenport@google.com>
Change Update function to return a bool to indicate success rather than
a HWC2::Error.
Remove the hwc2 #include since it's no longer necessary
Change-Id: I7896d9e6ede68cd4052f2c942fa0b6637ecaa390
Signed-off-by: Drew Davenport <ddavenport@google.com>
aidl Transform is not used in HwcLayer, so remove it.
Change-Id: I4d9c9d455f37dbb129cd2793635b0aad225fd067
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>
Add a CompositionStatsTracker to DrmHwc which queries the displays'
stats, and keeps track of their deltas.
Extract the output formatting from HwcDisplay into DrmHwc.cpp
Change-Id: Ie3c586b18549564bcc3a05d27b0d1fba0297f0ef
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>
CompositionStats struct is a copy of HwcDisplay::Stats and is extracted
from HwcDisplay as a prestep for supporting stats reporting beyond
dumpsys.
CompositionStatsProvider interface can be implemented by a class that
will poll all displays and return a display->CompositionStats map for
the cumulative stats for each display.
CompositionStatsTracker is a helper class that tracks the state of the
last queried stats and calculates the delta between the last stats and
the currently pulled stats. A Callback function can be passed into the
Report function which will be called for each display, with the
cumulative and delta stats as arguments.
Change-Id: I4200df5b41a4dbc612160aec038c83336b68bc4b
Signed-off-by: Drew Davenport <ddavenport@google.com>
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>
Add a job to run a subset of relevant tests from CtsGraphicsTestCases on
newly built drm-hwcomposer.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Add a script to launch cuttlefish and run drm-hwcomposer in it.
This script expects that the compressed cuttlefish image and the
drm-hwcomposer binaries will be provided to it as artifacts earlier in
the CI pipeline.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Add a new job `use-debian/x86_64_cuttlefish` to extract the compressed
cuttlefish image from the cuttlefish container and make it available as
a short-lived artifact for use by subsequent jobs in the pipeline.
The cuttlefish images need to be accessed as artifacts because the
cuttlefish container itself does not include all of the android tools
and tests needed to run cts and vts jobs.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>