From 3d127cf42f5578d58737043fb6dc656ee21d4e91 Mon Sep 17 00:00:00 2001 From: Okan Arikan Date: Tue, 6 Jun 2017 09:52:33 -0700 Subject: [PATCH] Floor height API changes. The platform does not populate this field yet. This CL is for making the necessary API change in frameworks/native before we cut the DR branch. Bug: 38212129 Test: No functional change. Must compile. Change-Id: Iaa21bbc0cec866bf5325d760e13989e49bce502a --- libs/vr/libdvr/include/dvr/dvr_pose.h | 25 +++++++++++++++++++------ libs/vr/libdvr/include/dvr/dvr_shared_buffers.h | 6 +++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/libs/vr/libdvr/include/dvr/dvr_pose.h b/libs/vr/libdvr/include/dvr/dvr_pose.h index a7e83c97bf..4256cf906e 100644 --- a/libs/vr/libdvr/include/dvr/dvr_pose.h +++ b/libs/vr/libdvr/include/dvr/dvr_pose.h @@ -36,16 +36,23 @@ typedef struct __attribute__((packed, aligned(16))) DvrPoseAsync { int64_t timestamp_ns; // Bitmask of DVR_POSE_FLAG_* constants that apply to this pose. // - // If DVR_POSE_FLAG_VALID is not set, the pose is indeterminate. + // If DVR_POSE_FLAG_INVALID is set, the pose is indeterminate. uint64_t flags; // Reserved padding to 128 bytes. uint8_t pad[16]; } DvrPoseAsync; enum { - DVR_POSE_FLAG_VALID = (1UL << 0), // This pose is valid. - DVR_POSE_FLAG_HEAD = (1UL << 1), // This pose is the head. - DVR_POSE_FLAG_CONTROLLER = (1UL << 2), // This pose is a controller. + DVR_POSE_FLAG_INVALID = (1UL << 0), // This pose is invalid. + DVR_POSE_FLAG_INITIALIZING = (1UL << 1), // The pose delivered during + // initialization and it may not be + // correct. + DVR_POSE_FLAG_3DOF = + (1UL << 2), // This pose is derived from 3Dof sensors. If + // this is not set, pose is derived using + // 3Dof and 6Dof sensors. + DVR_POSE_FLAG_FLOOR_HEIGHT_INVALID = + (1UL << 3), // If set the floor height is invalid. }; // Represents a sensor pose sample. @@ -70,8 +77,14 @@ typedef struct __attribute__((packed, aligned(16))) DvrPose { // Timestamp for the measurement in nanoseconds. int64_t timestamp_ns; - // Padding to 96 bytes so the size is a multiple of 16. - uint8_t padding[8]; + // The combination of flags above. + uint64_t flags; + + // The current floor height. May be updated at a lower cadence than pose. + float floor_height; + + // Padding to 112 bytes so the size is a multiple of 16. + uint8_t padding[12]; } DvrPose; __END_DECLS diff --git a/libs/vr/libdvr/include/dvr/dvr_shared_buffers.h b/libs/vr/libdvr/include/dvr/dvr_shared_buffers.h index 096f800426..63c73855f4 100644 --- a/libs/vr/libdvr/include/dvr/dvr_shared_buffers.h +++ b/libs/vr/libdvr/include/dvr/dvr_shared_buffers.h @@ -11,7 +11,7 @@ namespace android { namespace dvr { // Increment when the layout for the buffers change. -enum : uint32_t { kSharedBufferLayoutVersion = 1 }; +enum : uint32_t { kSharedBufferLayoutVersion = 2 }; // Note: These buffers will be mapped from various system processes as well // as VrCore and the application processes in a r/w manner. @@ -24,7 +24,7 @@ enum : uint32_t { kSharedBufferLayoutVersion = 1 }; // Sanity check for basic type sizes. static_assert(sizeof(DvrPoseAsync) == 128, "Unexpected size for DvrPoseAsync"); -static_assert(sizeof(DvrPose) == 96, "Unexpected size for DvrPose"); +static_assert(sizeof(DvrPose) == 112, "Unexpected size for DvrPose"); static_assert(sizeof(DvrVsync) == 32, "Unexpected size for DvrVsync"); static_assert(sizeof(DvrConfig) == 16, "Unexpected size for DvrConfig"); @@ -85,7 +85,7 @@ struct __attribute__((packed, aligned(16))) DvrVsyncPoseBuffer { uint8_t padding[12]; }; -static_assert(sizeof(DvrVsyncPoseBuffer) == 1136, +static_assert(sizeof(DvrVsyncPoseBuffer) == 1152, "Unexpected size for DvrVsyncPoseBuffer"); // The keys for the dvr global buffers. -- 2.11.0