[magma] Remove devfs use Use services instead of devfs. Change-Id: I4648bcdf525a6e51cc5be6303f8be3a280fee04d Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/github.com/ARM-software/HWCPipe/+/1360271 Reviewed-by: Craig Stout <cstout@google.com>
diff --git a/vendor/arm/mali/mali_profiler_magma.cpp b/vendor/arm/mali/mali_profiler_magma.cpp index 5b85ef6..360f32f 100644 --- a/vendor/arm/mali/mali_profiler_magma.cpp +++ b/vendor/arm/mali/mali_profiler_magma.cpp
@@ -229,7 +229,7 @@ void MaliProfilerMagma::init() { MaliHWInfo hw_info; - for (auto &p : std::filesystem::directory_iterator("/dev/class/gpu")) + for (auto &p : std::filesystem::directory_iterator("/svc/fuchsia.gpu.magma.Service/")) { zx::channel server_end, client_end; zx_status_t zx_status = zx::channel::create(0, &server_end, &client_end); @@ -237,7 +237,8 @@ { throw std::runtime_error("Failed to create zx channel"); } - zx_status = fdio_service_connect(p.path().c_str(), server_end.release()); + std::string path = std::string(p.path().c_str()) + "/device"; + zx_status = fdio_service_connect(path.c_str(), server_end.release()); if (zx_status != ZX_OK) { throw std::runtime_error("Failed to connect to device"); @@ -306,12 +307,13 @@ } bool success = false; - for (auto &p : std::filesystem::directory_iterator("/dev/class/gpu-performance-counters")) + for (auto &p : std::filesystem::directory_iterator("/svc/fuchsia.gpu.magma.PerformanceCounterService/")) { zx::channel server_end, client_end; zx::channel::create(0, &server_end, &client_end); - zx_status_t zx_status = fdio_service_connect(p.path().c_str(), server_end.release()); + std::string path = std::string(p.path().c_str()) + "/access"; + zx_status_t zx_status = fdio_service_connect(path.c_str(), server_end.release()); if (zx_status != ZX_OK) { throw std::runtime_error("Failed to connect to GPU perf count access service\n");