OSDN Git Service

drm_hwcomposer: Rework autofd
authorRoman Stratiienko <r.stratiienko@gmail.com>
Sat, 20 Feb 2021 11:59:55 +0000 (13:59 +0200)
committerRoman Stratiienko <r.stratiienko@gmail.com>
Sat, 24 Jul 2021 14:59:09 +0000 (17:59 +0300)
commit0fade37afd60c3f0e387172e03759e055f831d30
tree247fb23bfac5a18ce8dc8d90efffa3166845b36d
parent5128715b42e6713b98244bd05f218b8800a39b74
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>
13 files changed:
.ci/.gitlab-ci-clang-tidy-fine.sh
DrmHwcTwo.cpp
DrmHwcTwo.h
compositor/DrmDisplayComposition.h
compositor/DrmDisplayCompositor.cpp
compositor/DrmDisplayCompositor.h
drm/DrmDevice.cpp
drm/DrmDevice.h
drm/DrmEventListener.cpp
drm/DrmEventListener.h
include/autofd.h [deleted file]
include/drmhwcomposer.h
utils/UniqueFd.h [new file with mode: 0644]