aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRoman Stratiienko <roman.o.stratiienko@globallogic.com>2022-05-03 18:24:49 +0300
committerRoman Stratiienko <roman.o.stratiienko@globallogic.com>2022-05-10 11:17:32 +0300
commitdd21494e0099851d6632ffaa3719da411311695d (patch)
treec7cd6882fe5e0fb0bfa1d9db0d05dc7645bb54e4 /utils
parent5f21dbc6f381d54b483a904799d850f6f9571a8e (diff)
downloaddrm_hwcomposer-dd21494e0099851d6632ffaa3719da411311695d.tar.gz
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>
Diffstat (limited to 'utils')
-rw-r--r--utils/UniqueFd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/UniqueFd.h b/utils/UniqueFd.h
index 1a390ba..d747a7f 100644
--- a/utils/UniqueFd.h
+++ b/utils/UniqueFd.h
@@ -17,6 +17,7 @@
#ifndef UNIQUEFD_H_
#define UNIQUEFD_H_
+#include <fcntl.h>
#include <unistd.h>
#include <memory>
@@ -73,6 +74,11 @@ class UniqueFd {
return fd_;
}
+ static auto Dup(int fd) {
+ // NOLINTNEXTLINE(android-cloexec-dup): fcntl has issue (see issue #63)
+ return UniqueFd(dup(fd));
+ }
+
explicit operator bool() const {
return fd_ != kEmptyFd;
}