1
0
Fork 0
Commit graph

67 commits

Author SHA1 Message Date
Konsta
69629f8907 Merge remote-tracking branch 'freedesktop/main' into android-16.0 2025-11-11 23:09:59 +02:00
Andrew Wolfers
e45aaa0bb6 Cleanup includes in utils/ per IWYU style
Change-Id: I94248754ae4d6ce8c4931a5ddfc021f4d7993b5a
2025-11-11 19:14:26 +00:00
Konsta
adcc927bd4 drm_hwcomposer: Add property to disable HDR
* It has been reported that HDR is not working properly on Raspberry Pi
  with HDMI displays that support it.

Change-Id: I31f9d7bb5a3f81eeca1f98a72c26786d97edc28d
2025-11-10 15:56:28 +02:00
Konsta
e2e9c8cff7 drm_hwcomposer: Add property to force display mode
* Display resolution and refresh rate can be forced using a property.
  Other modes reported as supported by the display are ignored when forcing
  a specific mode.
* Force resolution and refresh rate for headless mode as well.

This is based on following 4 commits with further updates.

Author: Chih-Wei Huang <cwhuang@linux.org.tw>
Date:   Wed Sep 19 22:57:32 2018 +0800

    drm_hwcomposer: allow to force mode by a property

    The desired resolution could be set by property debug.drm.mode.force.
    The other modes are ignored.

Author: Konsta <konsta09@gmail.com>
Date:   Sun Dec 5 15:40:40 2021 +0200

    drm_hwcomposer: use first refresh rate reported by the display

    * Android can switch between different refresh rates which
      can lead to display changing modes in some cases.
    * Use the first refresh rate reported by the display when
      forcing the resolution unless specified otherwise.

Author: Konsta <konsta09@gmail.com>
Date:   Tue Jan 25 17:46:33 2022 +0200

    drm_hwcomposer: Default to 1920x1080 resolution for headless mode

Author: Konsta <konsta09@gmail.com>
Date:   Tue Feb 1 17:40:43 2022 +0200

    drm_hwcomposer: Allow setting resolution for headless mode
2025-11-10 15:56:19 +02:00
Andrew Wolfers
a890ccd62f Add atom reporting for flattening controller state
Change-Id: I09f60c95519d844359d5f1c70b940b47f756da21
2025-11-06 15:30:45 +00:00
Andrew Wolfers
84892ec611 drm_hwcomposer: Cleanup includes for test target
Change-Id: I1332873df0109347a91e729955ba5f84cf8c7fec
2025-10-02 15:06:12 +00:00
Andrew Wolfers
9255d0d10b drm_hwcomposer: Migrate to android::drm_hwcomposer namespace
Change-Id: I2859aa8f55532d88231389724956fc77b0625339
2025-09-08 18:53:00 +00:00
Gil Dekel
3b2050b7f2 drm_hwcomposer: Re-enable MRR on AL devices
Configuration groups for the Multiple Refresh Rate (MRR) feature support
is currently disabled in DRM HWComposer. This is because it is
insufficient to group modes solely based on their active region size.

The primary reasons for this insufficiency are:
1. drm-hwc clients may assume they can seamlessly switch between
   configurations within the same group to support variable refresh
   rates.
2. Not all System-on-a-Chip (SoC) architectures support seamless mode
   transitions.
3. For SoCs that do support seamless switching, transitions often depend
   on other hardware-specific properties like matching blanking periods.
4. A fallback to a non-seamless (blocking) modeset is unacceptable for
   internal displays if a seamless transition fails, as this causes
   flickering. The current framework does not handle such failures
   gracefully.

To Resolve these challenges and re-enable seamless Multiple Refresh-Rate
transitions on internal panels, we add logic to validate all configs
against the preferred initial active config. This validation preforms a
seamless modeset test on each available config against the config that
was set during the display initialization. Configs that fail the
screening are assigned new group IDs.

Caveats:
1. Currently, this is only implemented for internal panels. External
   display seamless transition between variable refresh rates is not
   support. However this work can be extended to support seamless
   transitions on external displays as well.
2. Grouping is only preformed for the preffered/active config at the
   time of display init, and is valid only for the duration of the
   current full modeset commit. No other groups are not created (since
   they cannot be validated), and any new full commits will not honor
   the guarantee provided by the check. This work can be extended to
   refresh and validate all configs within the same group ID of any
   incoming full modeset commit.

Change-Id: Ie2661e74bd3ff704b40c8c7ef50c56e604e5e8df
Signed-off-by: Gil Dekel <gildekel@google.com>
2025-07-29 16:14:12 -04:00
Lucas Berthou
446c229f98 drm_hwcomposer: refactor drmAtomicStateManager
This is a prerequisit to allow for multi-display commit at once.
It also removes the cognitive complexity of CommitFrame through addition
of helpers for all drm properties to be set.

Change-Id: Ifad7e574c9ea6ced09c677923868ce29656f33f3
Signed-off-by: Lucas Berthou <berlu@google.com>
2025-07-15 21:50:01 +00:00
Drew Davenport
13fcd098a2 drm_hwcomposer: Move properties stuff to cpp
Move the implementations for properties related functions on non-Android
platforms into properties.cpp

Change-Id: I91fce6a618445ea3021ef1013228285c99d819bd
2025-06-12 01:51:29 +00:00
Drew Davenport
f4cebdbec7 drm_hwcomposer: Move device path to Properties
Add Properties::GetDevicePath to query the value of the
vendor.hwc.drm.device sysprop.

Change-Id: I8c2f9e6f06f3d7f11f03051e21b885413da81c47
2025-06-12 01:51:29 +00:00
Drew Davenport
cb4e848c3b drm_hwcomposer: Move GetBackendOverride to Properties
Add Properties::GetBackendOverride to query the sysprop, and handle the
default in BackendManager.

Change-Id: Ifc01a23d64a5406ba5c9f065b7d5967b42b1b5d5
2025-06-12 01:51:29 +00:00
Drew Davenport
0f9eae2291 drm_hwcomposer: Move GetCtm to Properties
Move the handling of the sysprop for how to handle CTM to the Properties
class.

Change-Id: I049c8a726fc68576e884b2a7a618a23521d5ed2b
2025-06-12 01:51:29 +00:00
Drew Davenport
51d588a99e drm_hwcomposer: Move Properties to android namespace
The rest of the project is in the android namespace, so move this into
it as well.

Change-Id: Iecd47d014d18751d678b91602df9d5ac09e4881d
2025-06-12 01:51:28 +00:00
Drew Davenport
6be6ee958d drm_hwcomposer: Use android-base/thread_annotations.h
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
2025-06-12 01:39:23 +00: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
001432a693 drm_hwcomposer: Drop EdidWrapper::GetDpiX|Y
These were only used in the legacy GetDisplayAttribute, which is now
moved to the HWC2 frontend and implemented in the same way as the HWC3
frontend, which uses GetBoundsMm.

Change-Id: I841a8da7763a72c8a8956cd7daf1393c61f5e587
Signed-off-by: Drew Davenport <ddavenport@google.com>
2025-04-16 15:15:15 -06:00
Tamir Duberstein
dc619128b1
drm_hwcomposer: Pass length to std::string
The unary `std::string` constructor calls `strlen` on its input; in this
code there is no guarantee that `buffer` is NUL-terminated, and the
result is this (under hwasan):
```
Abort message: '==android.hardware.graphics.composer@2.1-service==4919==ERROR: HWAddressSanitizer: tag-mismatch on address 0x0077e05a36b0 at pc 0x0077ec51bc6c
READ of size 1040 at 0x0077e05a36b0 tags: 82/00 (ptr/mem) in thread T3
Invalid access starting at offset 1024
    #0 SigTrap<47U> in [hwasan_rtl]:3
    -> __hwasan_memcpy in out/lib/compiler-rt-aarch64/out/llvm-project/compiler-rt/lib/hwasan/hwasan_memintrinsics.cpp:33:3
    #1 memcpy(void*, void const* pass_object_size0, unsigned long) in out/soong/.intermediates/bionic/libc/libc/android_vendor.34_arm64_armv8-a_shared/gen/include/bits/fortify/string.h:61:12
    -> std::__1::char_traits<char>::copy(char*, char const*, unsigned long) in external/libcxx/include/__string:226:50
    -> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init(char const*, unsigned long) in external/libcxx/include/string:1799:5
    -> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string<std::nullptr_t>(char const*) in external/libcxx/include/string:822:7
    -> android::UEvent::ReadNext() in external/drm_hwcomposer/utils/UEvent.h:77:12
    #2 android::UEventListener::Routine() in external/drm_hwcomposer/drm/UEventListener.cpp:45:32
    #3 android::Worker::InternalRoutine() in external/drm_hwcomposer/utils/Worker.cpp:90:5
    #4 decltype(*std::__1::forward<android::Worker*>(fp0).*fp()) std::__1::__invoke<void (android::Worker::*)(), android::Worker*, void>(void (android::Worker::*&&)(), android::Worker*&&) in external/libcxx/include/type_traits:4294:1
    -> void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (android::Worker::*)(), android::Worker*, 2ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (android::Worker::*)(), android::Worker*>&, std::__1::__tuple_indices<2ul>) in external/libcxx/include/thread:342:5
    -> void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (android::Worker::*)(), android::Worker*>>(void*) in external/libcxx/include/thread:352:5
    #5 __pthread_start(void*) in bionic/libc/bionic/pthread_create.cpp:382:18
    #6 __start_thread in bionic/libc/bionic/clone.cpp:53:16
Cause: stack tag-mismatch
Address 0x0077e05a36b0 is located in stack of thread T3
Thread: T3 0x006e0000e000 stack: [0x0077e04aa000,0x0077e05a3c70) sz: 1023088 tls: [0x0077e05a3f80,0x0077e05a7000)
Potentially referenced stack object:
  0 bytes inside a variable "buffer" in stack frame of function "ReadNext"
  at external/drm_hwcomposer/utils/UEvent.h:60
```

Thus pass an explicit length.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
2025-04-10 11:25:29 -04:00
Linjiao Zhao
b895e8b724 drm_hwcomposer: Add build property to support Cuttlefish external displays
We add build property vendor.hwc.drm.internal_display_names to contain
displays we want to make INTERNAL, while check the property in
GetDisplayConnectionType.
If the property is set, we decide INTERNAL/EXTERNAL based on the
included displays.
Currently it's specific for CF/desktop usage.

Change-Id: I3d607b6646ac47497b9770966d4e880f5e5c0ca6
Signed-off-by: Linjiao Zhao <ruki@google.com>
2025-03-31 06:36:16 +00:00
Sasha McIntosh
7009cc1909 drm_hwcomposer: Fix HDR metadata handling
Remove const qualifiers from luminance data variables.

Set an empty HDR_OUTPUT_METADATA blob to ensure the property is
cleared when switching color modes.

Change-Id: I15d1477a98a1f4e103ef0202c157b8dfb5af8f86
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-03-12 15:00:52 -04: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
Lucas Berthou
30808a20bb drm_hwcomposer: uses edid DTD to get better estimate of dpi
Edid are not the most reliable when it comes to panel size, however it
seems like preferred DTD are slightly more reliable. This change moves
from the drm parse edid display size to the first preferred DTD to try
improve dpi accuracy.
If no preferred DTD is available we still fallback to the display size.

Change-Id: Ibcc95da9f38ba74e9b95b9d68587b38efbed8de2
signed-off-by: Lucas Berthou <berlu@google.com>
2025-02-18 17:19:38 +00:00
Roman Stratiienko
cd3902ab4a drm_hwcomposer: Do not use config groups by default
When config groups are enabled, the framework uses the Multiple Refresh
Rate feature, which causes blank screen issues on some devices, making
them unusable.

This is a temporary solution until we find a reliable way to query the
driver if a seamless mode change is supported.

Discussion can be found [here][1]

[1]: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/merge_requests/295#note_2770300
Change-Id: If17c29de9f2cd853887ece5fe050e4ceee5ddb65
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-08 03:32:41 +02:00
Sasha McIntosh
851ea4dc26 drm_hwcomposer: Implement getHdrCapabilities and getColorModes
Retrieve color and HDR information from the EDID.

Change-Id: I1aac27644d5c4fd5d5f295ca32b69ed69e94e0c6
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
2025-01-31 13:21:15 -05:00
Sasha McIntosh
f9062b6964 drm_hwcomposer: Set HDR metadata on the connector
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>
2025-01-30 23:09:52 -05:00
Sasha McIntosh
f8c14115ec drm_hwcomposer: Add wrapper for EDID parsing
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>
2025-01-30 15:55:22 -05:00
Roman Stratiienko
bf13180ffc drm_hwcomposer: treewide: Handle bool properties in the Property class
To clean things up and unify the usage of properties.

Change-Id: I0e034ed309f5f8a0d4fc9be7a4a3edcb39050e7f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2024-12-11 02:43:52 +02:00
Drew Davenport
613a9440a0 drm_hwcomposer: Add property for config groups
Android framework will change between configs in the same config group
dynamically, to support the Multiple refresh rate [1] feature. If the
display driver does not support changing modes seamlessly, there will be
visible artifacts (blank screen) when changing refresh rates.

Add a property to disable config grouping on devices that do not support
seamless mode changes. Set the default value to enable config grouping.

[1] https://source.android.com/docs/core/graphics/multiple-refresh-rate

Change-Id: Iec5927ea3af063669f6f7b7aa430e541c1c35428
Signed-off-by: Drew Davenport <ddavenport@google.com>
2024-12-04 09:54:14 -07:00
Tim Van Patten
16933c3dcf drm_hwcomposer: Check "Present Not Reliable" property
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>
2024-11-18 11:00:09 -07:00
Paz Zcharya
9c41b68d08 drm_hwcomposer: Fix build failure on Linux-native targets
Commit e11f723f ("drm_hwcomposer: Query property when checking virtual
displays availability") introduced a call to
android::base::GetBoolProperty, which is only available in Android.
This caused the test "hwcomposer.filegroups_build_test" to fail because
the code was no longer compiling for Linux-native targets.

Fix that by replacing "android::base::GetBoolProperty" with a new
function "property_get_bool," and define the function for both Android
and non-Android targets:
For Android, utilize the existing function from <cutils/properties.h>
For other targets, a new implementation is provided in
utils/properties.h.

Fixes: e11f723f ("drm_hwcomposer: Query property when checking virtual
displays availability")

Signed-off-by: Paz Zcharya <pazz@google.com>
2024-11-05 20:10:45 +00:00
Drew Davenport
b8526058c7 drm_hwcomposer: Stop UEvent thread in ResourceManager destructor
When the ResourceManager is destructed, the UEvent thread continues to
run in the background.

Change the blocking read call to poll, and create an eventfd on which to
poll as well. When ResourceManager is destructed, write to the eventfd
to wake the UEvent thread, which can then exit cleanly.

Reported-by: Normunds Rieksts <normunds.rieksts@arm.com>
Change-Id: I18d92173165f31fcd01570e65a6ffd840c8cd138
Signed-off-by: Drew Davenport <ddavenport@google.com>
2024-08-30 22:15:14 +00: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
bde95666cf drm_hwcomposer: Use pragma once instead of include guards
Some of existing include guards were copy-pasted without modification,
therefore have incorrect name. Switch to 'pragma once' in order to fix
it and avoid such copy-paste issues in the future.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-12-10 20:37:34 +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
4b2cc484f9 drm_hwcomposer: Reorganize struct DrmHwcLayer
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>
2022-05-17 11:20:44 +03:00
Roman Stratiienko
e9fbd8d626 drm_hwcomposer: Set return type to std::optional for BufferInfoGetters
This is a bit of code modernization. Further changes will require indication
that buffer_info is valid, and using std::optional is the most correct
approach to do that.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17 10:35:29 +03:00
Roman Stratiienko
1cbaaf9eeb drm_hwcomposer: Move include/drmhwcgralloc.h to bufferinfo/BufferInfo.h
... to emphasize its purpose.

- Rename struct HwcDrmBo -> struct BufferInfo
- Remove unused BufferInfo::acquire_fence, BufferInfo::hal_format and
  BufferInfo::usage fields

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17 10:35:29 +03:00
Roman Stratiienko
dd21494e00 drm_hwcomposer: Fix HwcLayer::GetReleaseFences()
GetReleaseFences() should return release fence for the prior buffer
(not for the one assigned to layer at the moment of GetReleaseFences call).

Once not provided, old front buffer can be damaged before new buffer
presented. (Such issues start to appear once we started using
non-blocking DRM/KMS commits).

Using present (out) fence is a perfect solution, since it is
signaled once old buffer replaced with the new one.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-10 11:17:32 +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
f377ff7bd6 drm_hwcomposer: Remove utils/autolock.*
AutoLock class is no longer used.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-20 17:21:46 +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
2ed4cbe40f drm_hwcomposer: Convert transform value at HWC hook call
One more step towards "frontend" isolation.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-09-29 12:47:35 +03:00
Roman Stratiienko
0a90b27c81 drm_hwcomposer: Fix property_get() linux impl.
Bad implementation was found during code surfing.
At this moment function is used only as a stub for CI.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-08-29 16:08:13 +03:00
Roman Stratiienko
5532b92a8f drm_hwcomposer: CI: Tune the readability-identifier-naming settings
Copy rules from [1], which is based on Google cpp code-style guide [2]

[1]: https://gist.github.com/airglow923/1fa3bda42f2b193920d7f46ee8345e04
[2]: https://google.github.io/styleguide/cppguide.html

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-08-29 16:08:13 +03:00
Roman Stratiienko
d26619b5d0 drm_hwcomposer: CI: Upgrade clang-* to v12
- Enabling readability-ientifier-naming tidy check does require to specify
MacroDefinitionIgnoredRegexp key, which is available only in clang-tidy-12.

- Clang-12 isn't available on ubuntu 20.10, therefore upgrade to 21.04.

- "DEBIAN_FRONTEND: noninteractive" is required to prevent ubuntu 21.04
from hanging, presumably due to waiting for the user input.

- A positive side effect of upgrading to clang-12 is new clang-tidy-12,
which exposed new issues in the code which is also fixed by this commit,
e.g:

    Failed cppcoreguidelines-narrowing-conversions check with error:
    error: narrowing conversion from 'uint32_t' (aka 'unsigned int') to 'float'

require explicit casting to pass the check, while some of such fails are caused
by incorrect variable type and fixed by changing the type to correct one.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-08-29 15:54:17 +03:00
Roman Stratiienko
0fade37afd drm_hwcomposer: Rework autofd
Motivation:

Current implementation of UniqueFd can be used in a different ways,
making analytical tracking of FD lifecycle much harder than it may be.
Keep this part clean is very important, since any wrong code may open
a hard-to-detect runtime bugs and fd leaks, which may accidentally slip
into the production.

Implementation:

1. Combine UniqueFd anf OutputFd into single class.
2. Reduce the API to be minimal and sufficient.
3. Document the API and use cases.
4. Move to utils/UniqueFd.h.
5. dup(fd) was replaced with fcntl(fd, F_DUPFD_CLOEXEC)) to
   address clang-tidy findings. Find more information at [1]

[1]: https://clang.llvm.org/extra/clang-tidy/checks/android-cloexec-dup.html

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-07-24 17:59:09 +03:00