Merge changes I51a58e57,Ibdf8c2c5,I0b1e9221,Ie2a62c5a,Ic7fab603, ... am: 1d66f1aabb
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1472682
Change-Id: I92d7531c95890d94e1bc8d8a57b89136f6ad39ab
diff --git a/services/gpuservice/gpumem/GpuMem.cpp b/services/gpuservice/gpumem/GpuMem.cpp
index c78322e..3aa862f 100644
--- a/services/gpuservice/gpumem/GpuMem.cpp
+++ b/services/gpuservice/gpumem/GpuMem.cpp
@@ -43,18 +43,21 @@
// Make sure bpf programs are loaded
bpf::waitForProgsLoaded();
- int fd = bpf::bpfFdGet(kGpuMemTotalProgPath, BPF_F_RDONLY);
+ errno = 0;
+ int fd = bpf::retrieveProgram(kGpuMemTotalProgPath);
if (fd < 0) {
- ALOGE("Failed to retrieve pinned program from %s", kGpuMemTotalProgPath);
+ ALOGE("Failed to retrieve pinned program from %s [%d(%s)]", kGpuMemTotalProgPath, errno,
+ strerror(errno));
return;
}
// Attach the program to the tracepoint, and the tracepoint is automatically enabled here.
+ errno = 0;
int count = 0;
while (bpf_attach_tracepoint(fd, kGpuMemTraceGroup, kGpuMemTotalTracepoint) < 0) {
if (++count > kGpuWaitTimeout) {
- ALOGE("Failed to attach bpf program to %s/%s tracepoint", kGpuMemTraceGroup,
- kGpuMemTotalTracepoint);
+ ALOGE("Failed to attach bpf program to %s/%s tracepoint [%d(%s)]", kGpuMemTraceGroup,
+ kGpuMemTotalTracepoint, errno, strerror(errno));
return;
}
// Retry until GPU driver loaded or timeout.
@@ -62,9 +65,11 @@
}
// Use the read-only wrapper BpfMapRO to properly retrieve the read-only map.
+ errno = 0;
auto map = bpf::BpfMapRO<uint64_t, uint64_t>(kGpuMemTotalMapPath);
if (!map.isValid()) {
- ALOGE("Failed to create bpf map from %s", kGpuMemTotalMapPath);
+ ALOGE("Failed to create bpf map from %s [%d(%s)]", kGpuMemTotalMapPath, errno,
+ strerror(errno));
return;
}
setGpuMemTotalMap(map);