Bug 1488573 - Part 1: Add crash log for VR controllers have unmatched button/axis count. r=kip

MozReview-Commit-ID: 8F3cDiZJ7ef

Differential Revision: https://phabricator.services.mozilla.com/D6817

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daosheng Mu 2018-09-25 21:58:35 +00:00
Родитель a1355f493d
Коммит ab575da60d
2 изменённых файлов: 61 добавлений и 3 удалений

Просмотреть файл

@ -1321,13 +1321,13 @@ VRControllerOculus::VRControllerOculus(dom::GamepadHand aHand, uint32_t aDisplay
VRControllerState& state = mControllerInfo.mControllerState;
char* touchID = "";
char* touchID = (char*)"";
switch (aHand) {
case dom::GamepadHand::Left:
touchID = "Oculus Touch (Left)";
touchID = (char*)"Oculus Touch (Left)";
break;
case dom::GamepadHand::Right:
touchID = "Oculus Touch (Right)";
touchID = (char*)"Oculus Touch (Right)";
break;
default:
MOZ_ASSERT(false);
@ -1808,6 +1808,13 @@ VRSystemManagerOculus::HandleButtonPress(uint32_t aControllerIdx,
// diff & (aButtonPressed, aButtonTouched) would be true while a new button pressed or
// touched event, otherwise it is an old event and needs to notify
// the button has been released.
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("Oculus handleButton(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, aButtonMask & aButtonPressed,
aButtonMask & aButtonTouched,
(aButtonMask & aButtonPressed) ? 1.0L : 0.0L);
@ -1834,6 +1841,13 @@ VRSystemManagerOculus::HandleIndexTriggerPress(uint32_t aControllerIdx,
// Avoid sending duplicated events in IPC channels.
if (oldValue != aValue ||
touchedDiff & aTouchMask) {
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("Oculus handleIndexTrigger(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, aValue > threshold,
aButtonTouched & aTouchMask, aValue);
controller->SetIndexTrigger(aValue);
@ -1855,6 +1869,13 @@ VRSystemManagerOculus::HandleHandTriggerPress(uint32_t aControllerIdx,
// Avoid sending duplicated events in IPC channels.
if (oldValue != aValue) {
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("Oculus handleHandTrigger(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, aValue > threshold,
aValue > threshold, aValue);
controller->SetHandTrigger(aValue);
@ -1870,6 +1891,13 @@ VRSystemManagerOculus::HandleTouchEvent(uint32_t aControllerIdx, uint32_t aButto
const uint64_t touchedDiff = (controller->GetButtonTouched() ^ aButtonTouched);
if (touchedDiff & aTouchMask) {
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("Oculus HandleTouchEvent(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, false, aTouchMask & aButtonTouched, 0.0f);
}
}
@ -1887,6 +1915,13 @@ VRSystemManagerOculus::HandleAxisMove(uint32_t aControllerIdx, uint32_t aAxis,
}
if (controller->GetAxisMove(aAxis) != value) {
if (MOZ_UNLIKELY(aAxis >= controller->GetControllerInfo().GetNumAxes())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("Oculus HandleAxisMove(aAxis = %d, length = %d, controller: %s.)",
aAxis,
controller->GetControllerInfo().GetNumAxes(),
controller->GetControllerInfo().GetControllerName());
}
NewAxisMove(aControllerIdx, aAxis, value);
controller->SetAxisMove(aAxis, value);
}
@ -1994,6 +2029,8 @@ VRSystemManagerOculus::ScanForControllers()
case ovrControllerType::ovrControllerType_RTouch:
hand = GamepadHand::Right;
break;
default:
continue;
}
RefPtr<VRControllerOculus> oculusController = new VRControllerOculus(hand,
mDisplay->GetDisplayInfo().GetDisplayID());

Просмотреть файл

@ -962,6 +962,13 @@ VRSystemManagerOpenVR::HandleButtonPress(uint32_t aControllerIdx,
// diff & (aButtonPressed, aButtonTouched) would be true while a new button pressed or
// touched event, otherwise it is an old event and needs to notify
// the button has been released.
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("OpenVR handleButton(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, aButtonMask & aButtonPressed,
aButtonMask & aButtonTouched,
(aButtonMask & aButtonPressed) ? 1.0L : 0.0L);
@ -985,6 +992,13 @@ VRSystemManagerOpenVR::HandleTriggerPress(uint32_t aControllerIdx,
// Avoid sending duplicated events in IPC channels.
if (oldValue != aValue) {
if (MOZ_UNLIKELY(aButton >= controller->GetControllerInfo().GetNumButtons())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("OpenVR handleTrigger(aButton = %d, length = %d, controller: %s.)",
aButton,
controller->GetControllerInfo().GetNumButtons(),
controller->GetControllerInfo().GetControllerName());
}
NewButtonEvent(aControllerIdx, aButton, aValue > threshold,
aValue > threshold, aValue);
controller->SetTrigger(aTrigger, aValue);
@ -999,6 +1013,13 @@ VRSystemManagerOpenVR::HandleAxisMove(uint32_t aControllerIdx, uint32_t aAxis,
MOZ_ASSERT(controller);
if (controller->GetAxisMove(aAxis) != aValue) {
if (MOZ_UNLIKELY(aAxis >= controller->GetControllerInfo().GetNumAxes())) {
// FIXME: Removing crash log for Bug 1488573 to investigate unmatched count.
MOZ_CRASH_UNSAFE_PRINTF("OpenVR handleAxis(aAxis = %d, length = %d, controller: %s.)",
aAxis,
controller->GetControllerInfo().GetNumAxes(),
controller->GetControllerInfo().GetControllerName());
}
NewAxisMove(aControllerIdx, aAxis, aValue);
controller->SetAxisMove(aAxis, aValue);
}