1
0
Fork 0
Commit graph

50 commits

Author SHA1 Message Date
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
Drew Davenport
129d12f38a drm_hwcomposer: Report composition stats as vendor atoms
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>
2025-06-10 06:59:51 +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
Sasha McIntosh
094b09d976 drm_hwcomposer: Use latest available composer3 API
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>
2025-05-20 13:36:11 -04:00
Drew Davenport
98360f9e0c drm_hwcomposer: Add CompositionStats
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>
2025-04-29 14:12:59 -06:00
Drew Davenport
35a395720a drm_hwcomposer: Use clang thread-safety analysis in VSyncWorker
See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html for details.
Define thread annotation macros according to the example provided in the
documentation, and use these to annotate VSyncWorker members that can be
accessed from multiple threads.

Thread safety analysis does not yet work with std::unique_lock, so
disable the warnings when it is used.

Change-Id: I8b3b503fbaf0923588fbe3d0180f6fe6ec228350
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-02-21 10:51:42 -07:00
Roman Stratiienko
88bd6a2745 drm_hwcomposer: Enable readability-math-missing-parentheses tidy check
... and fix all related warnings.

Change-Id: Ic122235524e567f2be5040ae7742fefb531a9766
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-25 00:22:25 +02:00
Roman Stratiienko
9270b88760 drm_hwcomposer: Enable readability-avoid-unconditional-preprocessor-if
Enabling this check doesn't require changes in the code.

Change-Id: I190f8af9cca51bac9fc624501eac8a2bcb3e0637
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-25 00:22:22 +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
5742bcb285 drm_hwcomposer: Enable performance-avoid-endl clang-tidy check
And fix every related warning.

Change-Id: I6afacef19ac04269245ef687762698be057d420b
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:44:00 +02:00
Roman Stratiienko
179cc6da9b drm_hwcomposer: Enable readability-static-accessed-through-instance
... and fix the following warning:

hwc3/ComposerClient.cpp:1326:19: error: static member accessed through
   instance [readability-static-accessed-through-instance]

Change-Id: Ia52431259d45d9400f4e7dc6626e20a203612500
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:44:00 +02:00
Roman Stratiienko
7079334c2a drm_hwcomposer: Enable misc-use-internal-linkage clang-tidy check
... and fix the following warning:

hwc3/ComposerResources.cpp:30:56: error: function 'ToHwc2Display' can be
  made static or moved into an anonymous namespace to enforce internal
  linkage [misc-use-internal-linkage,-warnings-as-errors]

Change-Id: I97dcfcf6db3ad3bcf9379f0f896a66b377a730c8
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:33:35 +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
0369cf731f drm_hwcomposer: Enable performance-inefficient-vector-operation tidy check
... and fix the following warning:

hwc3/ComposerClient.cpp:1492:5: error: 'push_back' is called inside a loop;
   consider pre-allocating the container capacity before the loop
   [performance-inefficient-vector-operation,-warnings-as-errors]

Change-Id: Ie3e8d2a56e12d09a3c40791bebb198f5f9e631ec
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:33:35 +02:00
Roman Stratiienko
8b31578a2d drm_hwcomposer: CI: Keep nostdlibinc cflag option
Otherwise, the build will be broken due to the recent BIONIC [change][1].

[1]: https://android.googlesource.com/platform//bionic/+/47eb52732097ff9d4311f923ba48f4eabffe04b7%5E%21/#F0
Change-Id: I3d22cdfaa47ac037adb05442ef1b4f27da4505d5
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-15 14:31:00 +02:00
Roman Stratiienko
6e5c82eae6 drm_hwcomposer: CI: Properly upgrade drm_hwc aospless file
In the previous version, build flags pointed to Android API v33, while
headers were from Android API v35. This caused issues when using
"if __ANDROID_API__ >= 35" preprocessor macros.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2024-10-17 02:13:20 +03:00
Roman Stratiienko
57ba08add7 drm_hwcomposer: CI: Upgrade Ubuntu and clang version
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>
2024-10-17 02:13:14 +03:00
Roman Stratiienko
0fea188c2c Revert "drm_hwcomposer: CI: use local container image for building"
This reverts commit ca89ea5a92.
2024-10-17 02:13:05 +03:00
Drew Davenport
8ac53efade drm_hwcomposer: CI: Remove misc-const-correctness
Remove misc-const-correctness from clang-tidy. This check detects local
variables which could be declared as const. See
https://clang.llvm.org/extra/clang-tidy/checks/misc/const-correctness.html

Change-Id: Ibbce8d8c6fa4cb1631776b5dde5c33ca73b6510d
Signed-off-by: Drew Davenport <ddavenport@google.com>
2024-09-07 01:32:23 +00:00
Drew Davenport
6abf8193b0 drm_hwcomposer: CI: Remove google-readability-todo
TODOs in the project are of the form TODO(nobody). It seems pointless to
enforce Google TODO format if the TODOs are not actually assigned to a
person or issue

Change-Id: Ie6c7299ea463aaac98442843cb02485a3bcc49cd
Signed-off-by: Drew Davenport <ddavenport@google.com>
2024-08-30 22:15:14 +00:00
Mattijs Korpershoek
ca89ea5a92 drm_hwcomposer: CI: use local container image for building
The freedesktop instance provides a docker container registry with
ubuntu 23.04 based images ready to be used for building drm_hwcomposer.

Migrate to using that container image in order to:
- Avoid apt-get installing all dependencies for each job
- Remove duplication between the Dockerfile and the .gitlab-ci.yml

Since the container image provides aospless, we no longer need to download it
for each pipeline stage.
Also, this updates the folder structure:

Before:
/builds/drm-hwcomposer/drm-hwcomposer/
/builds/drm-hwcomposer/aospless

After:
/builds/drm-hwcomposer/drm-hwcomposer/
/home/user/aospless

For "tidy", this new structure requires to override the BASE_DIR variable.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-07-12 16:36:49 +00:00
Roman Stratiienko
2a93e4c882 drm_hwcomposer: CI: Use aospext to provide headers for clang-tidy
Since we're now using aospless archive for meson.build, we can use
headers from there and remove .ci/android_headers/ directory completely.

Adding aospless cflags also raised some new tidy checks fails,
which were fixed by this commit.

Since clang-tidy now relies on aospless files, running CI on the host
can't be supported and removed. Running CI within the docker container
is the only option left.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2023-11-21 18:50:58 +02:00
Roman Stratiienko
76892784ac drm_hwcomposer: Introduce SharedFd, use standard c++ RAII for UniqueFd
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>
2023-01-16 20:13:58 +02:00
Roman Stratiienko
14bc764de0 drm_hwcomposer: Remove utils/worker from the project
utils/worker is no longer used and can be removed.

Change-Id: I5fc9bd2b3b8b0375622ee2446044d3b893756b30
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-28 19:18:34 +02:00
Roman Stratiienko
d2cc73874c drm_hwcomposer: Rework VSyncWorker to work without utils/worker
utils/worker just complicates the logic without providing any benefit.

Change-Id: I7b3c91aee9c0507d9ca35792d24ba6c8c3870033
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-28 19:18:29 +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
Roman Stratiienko
df3120f9f3 drm_hwcomposer: Rework DrmMode class
Simplify code and raise-up clang-tidy level of DrmMode class
to 'normal'.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-11 21:19:43 +02:00
Roman Stratiienko
abd8e534d9 drm_hwcomposer: Rework DrmProperty class
Simplify code and raise-up clang-tidy level of DrmProperty class
to 'normal'.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-11 21:19:43 +02:00
Roman Stratiienko
a7913de518 drm_hwcomposer: CI: Bump-up clang toolchain to v15
Address new clang-tidy findings, in most cases 'misc-const-correctness'
check was addressed by adding 'const' modifier, or in some cases changed
to 'auto' (where it's better for formatting).

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-10-20 14:14:33 +03:00
Roman Stratiienko
cf80b9b158 drm_hwcomposer: CI: Bump clang toolchain version to v14
Additionally:
1. Fix new clang-tidy findings
2. Disable readability-identifier-length check for all tidy levels

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-09 18:19:45 +03:00
Roman Stratiienko
bd9731713b drm_hwcomposer: Add test utility to listen for uevents
Dumping uevents is useful for debugging purposes.

1. Extract logic related to uevent socket into utils/UEvent.h class.
2. Use it by both UEventListener.cpp and tests/uevent_print.cpp.

Bump clang-tidy level of UEventListener.cpp to normal.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-02-18 17:16:00 +02:00
Roman Stratiienko
4e994055a3 drm_hwcomposer: Rename DrmDisplayCompositor->DrmAtomicStateManager
Primary responsibilities of this class are:

1. Send composition/mode/active state over DRM atomic commit IOCTL
   to the kernel
2. Track commit state and keep planes owned by the Pipeline while they
   are either displayed or staged for displaying.
3. Keep framebuffers alive while they are in use or staged.

Not much related to composition itself, therefore rename it to
DrmAtomicStateManager and move it to drm folder.

Bump clang-tidy level of DrmAtomicStateManager.c to normal by fixing
minor clang-tidy findings.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-02-09 17:40:35 +02:00
Roman Stratiienko
9362cef4c3 drm_hwcomposer: Rework KMS composition planner + plane sharing support
Rewrite Layer-to-Plane planner. Get rid of ~200 redundant lines of code
+ added plane sharing functionality.

Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/11
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-02-04 11:19:40 +02:00
Roman Stratiienko
7d89911c32 drm_hwcomposer: Tidy-up DrmDevice class
1. Move drm/DrmConnector.h to Normal clang-tidy checks list by fixing
   clang-tidy findings.

2. Remove DrmDevice self-reference.

3. Replace shared_ptr reference to DrmDevice in DrmFbImporter with a
   pointer, making ResourceManager only owner of DrmDevice and its
   chilren.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-31 21:48:40 +02:00
Roman Stratiienko
650299a235 drm_hwcomposer: Tidy-up DrmConnector class
Implement DrmConnector instantiation through CreateInstance() static method,
which helps to reduce complexity of DrmDevice::Init() function.

Move Connector-to-CRTC binding information to the DrmDevice class.

Move drm/DrmConnector.h to Normal clang-tidy checks list by fixing
clang-tidy findings.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-31 21:48:40 +02:00
Roman Stratiienko
027987b1fe drm_hwcomposer: Tidy-up DrmEncoder class
Implement DrmEncoder instantiation through CreateInstance() static method,
which helps to reduce complexity of DrmDevice::Init() function.

Move Encoder-to-CRTC binding information to the DrmDevice class.

Move drm/DrmEncoder.h to Normal clang-tidy checks list by fixing
clang-tidy findings.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-31 21:31:32 +02:00
Roman Stratiienko
10be875de0 drm_hwcomposer: Tidy-up DrmCrtc class
Implement DrmCrtc instantiation through CreateInstance() static method,
which helps to reduce complexity of DrmDevice::Init() function.

Move CRTC-to-Display binding information to the DrmDevice class.

Move drm/DrmCrtc.h to Normal clang-tidy checks list by fixing
clang-tidy findings.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-31 21:31:32 +02:00
Roman Stratiienko
780f7dacf9 drm_hwcomposer: CI: Upgrade to clang-13 && clang-tidy-13
+ address new clang-tidy findings.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-20 17:21:46 +02:00
Roman Stratiienko
3e1689054d drm_hwcomposer: Move DrmHwcTwo.{cpp|h} to hwc2_device/ directory
To keep all frontend-related files in a single directory.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:27:09 +02:00
Roman Stratiienko
3627bebf7b drm_hwcomposer: Move HwcDisplay out of DrmHwcTwo class
Reduces code complexity.

Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/35
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:27:07 +02:00
Roman Stratiienko
568e5981ca drm_hwcomposer: CI: Remove -readability-use-anyofallof from COARSE list
We have single fail case of -readability-use-anyofallof.
Use NOLINTNEXTLINE comment instead.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:47:23 +02:00
Roman Stratiienko
25311dd62b drm_hwcomposer: CI: Remove duplicate tidy checks
This improves visibility and helps to distinguish which
particular checks are disabled at every level.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:47:23 +02:00
Roman Stratiienko
c46896d6e2 drm_hwcomposer: CI: Move tidy FINE checklist to Makefile
To make checklists definitions aligned and allow inheritance.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:47:23 +02:00
Roman Stratiienko
f815d38c2a drm_hwcomposer: Raise clang-tidy level of some files to NORMAL
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:47:23 +02:00
Roman Stratiienko
5741bbd6d8 drm_hwcomposer: CI: Find all source files instead of hardcoding them.
Goals:

1. Follow clang-tidy rules to maintain project clean.

2. Do not allow new code to break goal #1.

Requirements for CI:

1. In case new file appears in the project, it should be picked-up by CI
   automatically and CI should assign NORMAL clang-tidy check level.

2. CI makefile should have SKIP list to define files for which build
   by CI is impossible for some reason.

3. CI makefile should have ability to override clang-tidy check level for
   every file.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
fc014f5792 drm_hwcomposer: CI: Set clang-tidy level to NORMAL for some files
Some of files require small adjustments to move into NORMAL checks list.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
e78235c0be drm_hwcomposer: CI: Raise clang-tidy level from NONE to COARSE for *.h
To improve CI coverage.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
24a7fc43eb drm_hwcomposer: CI: Process every file with clang-tidy.
Currently part of header files isn't processed by CI.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
35112734ac drm_hwcomposer: CI: Fix Makefile dependencies
Previous dependencies relations was triggering FULL 'clang-tidy'
re-validation, even in case single source file has changed.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
cef5c77ef9 drm_hwcomposer: CI: Replace shell scripts with Makefile
This won't make much benefits for CI, but for local native builds will
significantly speed-up build cycle by allowing parallel build and by
using dependency tracking logic.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-12-22 17:31:54 +02:00