Add and use DisplayHotplugConnectModeDetectedAtomReporter, which logs
all valid modes of a hotplugged display.
Change-Id: Ie93487ad8e4936195e3d949ce46034c5ec4fda83
Add DisplayRefreshRatesChangedAtomReporter, which reports the changed
refresh rates of all the active displays managed by drm_hwcomposer.
Change-Id: I03a81c667c44160dc319a899a3bd9a8bc527a382
With the legacy Backend class renamed to CompositionPlanner, rename the
PipelineCreator interface to Backend. This interface maps most closely
to the concept of the "Backend".
Add some documentation to various Backend related classes.
Change-Id: I5d6a7afcebb9d0015c3d7629bf8c10324c8f07df
Allow classes to inherit from GenericPipelineCreator and use it for
creating the DrmDisplayPipeline, but override which CompositionPlanner
is used.
Extract the GetFlattenedComposition function into a static function that
can be called from any backend.
Change-Id: Id75705b969eb6d23fbc6147c496ac3f3e9956abf
Rename the generic CompositionPlanner implementation to
GenericCompositionPlanner, and abstract the CompositionPlanner
interface.
Change-Id: I39d6fd44956d77669271999dd83fc78eebec742a
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
The version is being updated downstream so ndk_shared points to v5 which
is not yet upstreamed and breaks the build. Pinning to v4 instead.
Change-Id: I68b26aad6a55bbf58d8c3786c6de1661a04d7484
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
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 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>
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
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>
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>
Fixes a link error in hwcomposer.filegroups_build_test
Change-Id: Ie6cf781a71f5d01c17a7559dfe3cb8307685020c
Signed-off-by: Drew Davenport <ddavenport@google.com>
Now that we have our own buffer importer and slots tracker,
ComposerResourcer is no longer needed.
Change-Id: I9b1e15800695b4c5f1a3f2c942ba669526e8a94c
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Retrieve color and HDR information from the EDID.
Change-Id: I1aac27644d5c4fd5d5f295ca32b69ed69e94e0c6
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
Implement a function to set HDR metadata on the connector. Support HDR10
and HLG, which are common HDR types.
Change-Id: Id3dbe8eea2ee6b8ba700af23845a43e2070dd14e
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
Use libdisplay-info to parse display EDID. Wrap the parsing logic in a
class to extract specific EDID information.
Change-Id: I20376eb96ebcd0073155cedf1e8f055bbf8dfb49
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
All devices in aosp have been migrated to hwc3. Remove the hwc2 build
targets as a first step towards removing hwc2 from this project.
Change-Id: I116e4d13342368e9375b4d96d9598ba058f936a0
Signed-off-by: Drew Davenport <ddavenport@google.com>
Some vendors do not use gralloc4 and can't use the BufferInfoGetter
implemented on top of the IMapper 4 API. These vendors use a
LegacyBufferInfoGetter implementation, and need to define a new build
target for it.
Move the majority of the configuration for the hwc3 service to a
cc_defaults target, so that this can be referenced downstream and reduce
duplication.
Change-Id: I2561ecbb2d3c520f8cd8bdbf171a28d5f7fb1a51
Signed-off-by: Drew Davenport <ddavenport@google.com>
Check the "Present Not Reliable" property to determine if the capability
PRESENT_FENCE_IS_NOT_RELIABLE should be enabled or not.
The virtio gpu module sends frames to the host as fast as possible and
does not emulate "real display timing". Devices using the virtio gpu
module (for example, the virtual Android device Cuttlefish) should set
the following property to "true" to enable the capability:
ro.vendor.hwc.drm.present_not_reliable.enabled
For example, in an Android BoardConfig.mk:
PRODUCT_VENDOR_PROPERTIES += \
vendor.hwc.drm.present_not_reliable.enabled=true
Signed-off-by: Tim Van Patten <timvp@google.com>
The CI is configured to build using std=c++17, so update the default
build flags to the same.
This avoids the case where a contributor's change builds properly
locally, but fails in CI due to the usage of c++20 features.
Change-Id: I41d3115a314305e3863cd65623b244e9ab82dc3c
Signed-off-by: Drew Davenport <ddavenport@google.com>
Why:
The aospless file from Android-15 contains compiler flags that
clang-15 does not understand.
Additionally, new tidy findings were suppressed.
It would be nice to fix them in the future instead.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
... so that Cuttlefish can runtime select between drm_hwcomposer
and ranchu.
Drops the libbinder to avoid error:
APEX can't use libbinder (must use libbinder_ndk)
and fixes a couple includes.
Bug: b/348466630
Test: cvd start
Test: cvd start --hwcomposer=drm_hwcomposer
Change-Id: I50681677d89c56fb6761b740a465bf92890157ea
Add stubs for new APIs. Bump the version number in the manifest
fragment.
Update Docker configuration to use new aospless tarball that contains
the required build dependencies for hwc3 v3.
Change-Id: I521f649c2f820f54bc3c6adcda8e17d5ab3112e1
Signed-off-by: Drew Davenport <ddavenport@google.com>
Implements the HWC3 frontend by calling the HWC2 interfaces already
exposed through DrmHwc, HwcDisplay, HwcLayer, and so on.
Convert between hwc2 types and hwc3 types in ComposerClient.
The following changes from !238 were used as a basis for this change,
and squashed together:
(drm_hwcomposer: Connect ComposerClient with HwcDisplay)
(drm_hwcomposer: Implement HWC3 frontend by calling down to HWC2)
The projects [1, 2] were used as a reference for the implementation.
[1]: https://android.googlesource.com/platform/hardware/google/graphics/common/+/refs/heads/main/hwc3/
[2]: https://android.googlesource.com/device/generic/goldfish-opengl/+/refs/heads/master/system/hwc3/
Co-authored-by: Normunds Rieksts <normunds.rieksts@arm.com>
Co-authored-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I98c10175d5c5f01aec1e192863238e16aa1537ec
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
Signed-off-by: Drew Davenport <ddavenport@google.com>
Inherit from DrmHwc base class and implement the client
callback functions in terms of IComposerCallback.
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
Signed-off-by: Drew Davenport <ddavenport@google.com>
Add a android.hardware.composer.hwc3-service.drm binary target that
builds relevant hwc3 sources and common sources.
Uses BufferInfoLibdrm. The structure of this service may need to be
looked at again to support other BufferInfo implementations.
Also update the executable name in hwc3-drm.rc to match the target name.
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
Signed-off-by: Drew Davenport <ddavenport@google.com>
Adds a stub implementation of the HWC3 interface and service.
This is a barebones implementation of HWC3 interface that should contain
all the necessary code to build a HWC3 module but provides no
functionality.
The project [1] was used as a reference.
[1]: https://android.googlesource.com/platform/hardware/google/graphics/common/+/refs/tags/android-13.0.0_r18/hwc3/
Change-Id: I99754bb72f12183a94b24b7182cb7857173b31d2
Co-authored-by: Roman Stratiienko <r.stratiienko@gmail.com>
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Drew Davenport <ddavenport@google.com>
DrmHwc holds implementation details that can be shared between hwc2 and
hwc3. It exposes abstract functions for implementing callbacks to hwc
clients.
Leave the HWC2 specific implementation details in the DrmHwcTwo class, such
as the client callback implementation, and implement the DrmHwc abstract
functions in terms of hwc2.
DrmHwc is based on the DrmHwcInterface extracted in
(drm_hwcomposer: Connect ComposerClient with HwcDisplay) from !238
Co-authored-by: Dennis Tsiang <dennis.tsiang@arm.com>
Co-authored-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Drew Davenport <ddavenport@chromium.org>
Issues can arise when shared libraries with c++17 and c++20
loaded into the same process refer to the same global symbol
(usually std::string).
So avoid overriding the default cpp_std.
Bug: http://b/344590580
Signed-off-by: Elliott Hughes <enh@google.com>
[jstultz: Tweaked & expanded commit message]
Signed-off-by: John Stultz <jstultz@google.com>
Change-Id: I6bde2ab4d208c990103e6d303ec96a4969fa06ef
Error:
ld.lld: error: undefined symbol: android::MakeUniqueFd(int)
Fixes: 76892784ac ("drm_hwcomposer: Introduce SharedFd, use standard c++ RAII for UniqueFd")
Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/77
Change-Id: I6d37ff15b002cc49159a239393e18a8ca5b3cb27
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Using vsync means consume some CPU time every frame for
IRQ -> Kernel_Thread -> UserSpace_listener thread transitions.
Framework tries to reduce vsync usage to the minimum, by using timelines
instead.
New flattening controller thread wakes-up only once per second.
This commit also removes flattening info from dumpsys. Practice shows
that it is almost useless. Instead debugging can be done using ALOGV
dumps.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
We use too much dup() system calls for present fence propagating.
Also when propagating acquire fence we use additional logic for
skipping such propagation for the validate/test cycle.
Both issues can be solved by introducing SharedFd, which will track
reference count of fd object.
After that the UniqueFd is used very rarely and can be simplified by
wrapping it into std::unique_ptr without caring too much of adding
an extra malloc/free operation.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
utils/worker is no longer used and can be removed.
Change-Id: I5fc9bd2b3b8b0375622ee2446044d3b893756b30
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
__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>
1. Move BlendMode, ColorSpace, SampleRange fields to the struct BufferInfo,
allowing extraction of the data from native_handle using Metadata@4 API.
Use it when data from HWC2 API can't be used (Currently it's a BlendMode
case for CLIENT layer)
2. Rename DrmHwcLayer to LayerData and move it to compositor/ directory.
(I was confused in the past because of similarity of names DrmHwcLayer
vs HwcLayer, so this step should meke it easier for newcomers to
understand the code)
3. Allow clonning of the LayerData to propagate it through the composition
pipeline. Thus LayerData can be used by both HwcLayer to track state
and by the compositor.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Fixes the following building error:
external/drm_hwcomposer/DrmHwcTwo.cpp:985:14: error: decomposition declarations are a C++17 extension [-Werror,-Wc++17-extensions]
for (auto &[handle, layer] : layers_) {
^~~~~~~~~~~~~~~
1 error generated.
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I236f16969e4500ff2efb79c06500bc4d3a3d810c