Loading cmds/vr/vrscreencap/Android.mk +3 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ LOCAL_SRC_FILES := \ vrscreencap.cpp LOCAL_STATIC_LIBRARIES := \ libbufferhub \ libdisplay \ libimageio \ libpdx_default_transport \ Loading @@ -14,7 +15,8 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libpng \ libsync libsync \ libui \ LOCAL_MODULE := vrscreencap Loading libs/vr/libbufferhub/buffer_hub_client.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ using android::pdx::Status; namespace { // TODO(hendrikw): These flags can not be hard coded. constexpr int kUncachedBlobUsageFlags = GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY | GRALLOC_USAGE_PRIVATE_UNCACHED; Loading Loading @@ -110,6 +111,7 @@ int BufferHubBuffer::Unlock(size_t index) { return slices_[index].Unlock(); } int BufferHubBuffer::GetBlobReadWritePointer(size_t size, void** addr) { int width = static_cast<int>(size); int height = 1; // TODO(hendrikw): These flags can not be hard coded. constexpr int usage = GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY | GRALLOC_USAGE_PRIVATE_UNCACHED; Loading libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ class NativeBufferHandle { } } NativeBufferHandle(NativeBufferHandle&& other) = default; NativeBufferHandle& operator=(NativeBufferHandle&& other) = default; // Imports the native handle into the given IonBuffer instance. int Import(IonBuffer* buffer) { Loading Loading @@ -93,6 +94,9 @@ class NativeBufferHandle { void operator=(const NativeBufferHandle&) = delete; }; using BorrowedNativeBufferHandle = NativeBufferHandle<pdx::BorrowedHandle>; using LocalNativeBufferHandle = NativeBufferHandle<pdx::LocalHandle>; template <typename FileHandleType> class FenceHandle { public: Loading libs/vr/libdisplay/display_client.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -216,7 +216,8 @@ int DisplayClient::GetDisplayMetrics(SystemDisplayMetrics* metrics) { return 0; } pdx::Status<void> DisplayClient::SetViewerParams(const ViewerParams& viewer_params) { pdx::Status<void> DisplayClient::SetViewerParams( const ViewerParams& viewer_params) { auto status = InvokeRemoteMethod<DisplayRPC::SetViewerParams>(viewer_params); if (!status) { ALOGE("DisplayClient::SetViewerParams: Failed to set viewer params: %s", Loading Loading @@ -252,16 +253,20 @@ std::unique_ptr<DisplaySurfaceClient> DisplayClient::CreateDisplaySurface( return DisplaySurfaceClient::Create(width, height, format, usage, flags); } std::unique_ptr<BufferConsumer> DisplayClient::GetPoseBuffer() { auto status = InvokeRemoteMethod<DisplayRPC::GetPoseBuffer>(); std::unique_ptr<IonBuffer> DisplayClient::GetNamedBuffer( const std::string& name) { auto status = InvokeRemoteMethod<DisplayRPC::GetNamedBuffer>(name); if (!status) { ALOGE( "DisplayClient::GetPoseBuffer: Failed to get pose buffer %s", status.GetErrorMessage().c_str()); "DisplayClient::GetNamedBuffer: Failed to get pose buffer. name=%s, " "error=%s", name.c_str(), status.GetErrorMessage().c_str()); return nullptr; } return BufferConsumer::Import(std::move(status)); auto ion_buffer = std::make_unique<IonBuffer>(); status.take().Import(ion_buffer.get()); return ion_buffer; } bool DisplayClient::IsVrAppRunning() { Loading libs/vr/libdisplay/display_manager_client_impl.cpp +11 −8 Original line number Diff line number Diff line Loading @@ -31,19 +31,22 @@ int DisplayManagerClient::GetSurfaceList( return 0; } std::unique_ptr<BufferProducer> DisplayManagerClient::SetupPoseBuffer( size_t extended_region_size, int usage) { auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupPoseBuffer>( extended_region_size, usage); std::unique_ptr<IonBuffer> DisplayManagerClient::SetupNamedBuffer( const std::string& name, size_t size, uint64_t producer_usage, uint64_t consumer_usage) { auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupNamedBuffer>( name, size, producer_usage, consumer_usage); if (!status) { ALOGE( "DisplayManagerClient::SetupPoseBuffer: Failed to create the pose " "buffer %s", status.GetErrorMessage().c_str()); "DisplayManagerClient::SetupNamedBuffer: Failed to create the named " "buffer: name=%s, error=%s", name.c_str(), status.GetErrorMessage().c_str()); return {}; } return BufferProducer::Import(std::move(status)); auto ion_buffer = std::make_unique<IonBuffer>(); status.take().Import(ion_buffer.get()); return ion_buffer; } } // namespace dvr Loading Loading
cmds/vr/vrscreencap/Android.mk +3 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ LOCAL_SRC_FILES := \ vrscreencap.cpp LOCAL_STATIC_LIBRARIES := \ libbufferhub \ libdisplay \ libimageio \ libpdx_default_transport \ Loading @@ -14,7 +15,8 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libpng \ libsync libsync \ libui \ LOCAL_MODULE := vrscreencap Loading
libs/vr/libbufferhub/buffer_hub_client.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ using android::pdx::Status; namespace { // TODO(hendrikw): These flags can not be hard coded. constexpr int kUncachedBlobUsageFlags = GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY | GRALLOC_USAGE_PRIVATE_UNCACHED; Loading Loading @@ -110,6 +111,7 @@ int BufferHubBuffer::Unlock(size_t index) { return slices_[index].Unlock(); } int BufferHubBuffer::GetBlobReadWritePointer(size_t size, void** addr) { int width = static_cast<int>(size); int height = 1; // TODO(hendrikw): These flags can not be hard coded. constexpr int usage = GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY | GRALLOC_USAGE_PRIVATE_UNCACHED; Loading
libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ class NativeBufferHandle { } } NativeBufferHandle(NativeBufferHandle&& other) = default; NativeBufferHandle& operator=(NativeBufferHandle&& other) = default; // Imports the native handle into the given IonBuffer instance. int Import(IonBuffer* buffer) { Loading Loading @@ -93,6 +94,9 @@ class NativeBufferHandle { void operator=(const NativeBufferHandle&) = delete; }; using BorrowedNativeBufferHandle = NativeBufferHandle<pdx::BorrowedHandle>; using LocalNativeBufferHandle = NativeBufferHandle<pdx::LocalHandle>; template <typename FileHandleType> class FenceHandle { public: Loading
libs/vr/libdisplay/display_client.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -216,7 +216,8 @@ int DisplayClient::GetDisplayMetrics(SystemDisplayMetrics* metrics) { return 0; } pdx::Status<void> DisplayClient::SetViewerParams(const ViewerParams& viewer_params) { pdx::Status<void> DisplayClient::SetViewerParams( const ViewerParams& viewer_params) { auto status = InvokeRemoteMethod<DisplayRPC::SetViewerParams>(viewer_params); if (!status) { ALOGE("DisplayClient::SetViewerParams: Failed to set viewer params: %s", Loading Loading @@ -252,16 +253,20 @@ std::unique_ptr<DisplaySurfaceClient> DisplayClient::CreateDisplaySurface( return DisplaySurfaceClient::Create(width, height, format, usage, flags); } std::unique_ptr<BufferConsumer> DisplayClient::GetPoseBuffer() { auto status = InvokeRemoteMethod<DisplayRPC::GetPoseBuffer>(); std::unique_ptr<IonBuffer> DisplayClient::GetNamedBuffer( const std::string& name) { auto status = InvokeRemoteMethod<DisplayRPC::GetNamedBuffer>(name); if (!status) { ALOGE( "DisplayClient::GetPoseBuffer: Failed to get pose buffer %s", status.GetErrorMessage().c_str()); "DisplayClient::GetNamedBuffer: Failed to get pose buffer. name=%s, " "error=%s", name.c_str(), status.GetErrorMessage().c_str()); return nullptr; } return BufferConsumer::Import(std::move(status)); auto ion_buffer = std::make_unique<IonBuffer>(); status.take().Import(ion_buffer.get()); return ion_buffer; } bool DisplayClient::IsVrAppRunning() { Loading
libs/vr/libdisplay/display_manager_client_impl.cpp +11 −8 Original line number Diff line number Diff line Loading @@ -31,19 +31,22 @@ int DisplayManagerClient::GetSurfaceList( return 0; } std::unique_ptr<BufferProducer> DisplayManagerClient::SetupPoseBuffer( size_t extended_region_size, int usage) { auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupPoseBuffer>( extended_region_size, usage); std::unique_ptr<IonBuffer> DisplayManagerClient::SetupNamedBuffer( const std::string& name, size_t size, uint64_t producer_usage, uint64_t consumer_usage) { auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupNamedBuffer>( name, size, producer_usage, consumer_usage); if (!status) { ALOGE( "DisplayManagerClient::SetupPoseBuffer: Failed to create the pose " "buffer %s", status.GetErrorMessage().c_str()); "DisplayManagerClient::SetupNamedBuffer: Failed to create the named " "buffer: name=%s, error=%s", name.c_str(), status.GetErrorMessage().c_str()); return {}; } return BufferProducer::Import(std::move(status)); auto ion_buffer = std::make_unique<IonBuffer>(); status.take().Import(ion_buffer.get()); return ion_buffer; } } // namespace dvr Loading