| 827 | } |
| 828 | |
| 829 | void PMTraceConsumer::HandleDXGKEvent(EVENT_RECORD* pEventRecord) |
| 830 | { |
| 831 | auto const& hdr = pEventRecord->EventHeader; |
| 832 | |
| 833 | if (hdr.EventDescriptor.Id == Microsoft_Windows_DxgKrnl::PresentHistory_Start::Id || |
| 834 | (hdr.EventDescriptor.Id == Microsoft_Windows_DxgKrnl::PresentHistoryDetailed_Start::Id && mTrackDisplay)) { |
| 835 | EventDataDesc desc[] = { |
| 836 | { L"Token" }, |
| 837 | { L"Model" }, |
| 838 | { L"TokenData" }, |
| 839 | }; |
| 840 | mMetadata.GetEventData(pEventRecord, desc, _countof(desc)); |
| 841 | auto Token = desc[0].GetData<uint64_t>(); |
| 842 | auto Model = desc[1].GetData<Microsoft_Windows_DxgKrnl::PresentModel>(); |
| 843 | auto TokenData = desc[2].GetData<uint64_t>(); |
| 844 | |
| 845 | if (Model != Microsoft_Windows_DxgKrnl::PresentModel::D3DKMT_PM_REDIRECTED_GDI) { |
| 846 | HandleDxgkPresentHistory(hdr, Token, TokenData, Model); |
| 847 | } |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | if (mTrackDisplay) { |
| 852 | switch (hdr.EventDescriptor.Id) { |
| 853 | case Microsoft_Windows_DxgKrnl::Flip_Info::Id: |
| 854 | { |
| 855 | EventDataDesc desc[] = { |
| 856 | { L"FlipInterval" }, |
| 857 | { L"MMIOFlip" }, |
| 858 | }; |
| 859 | mMetadata.GetEventData(pEventRecord, desc, _countof(desc)); |
| 860 | auto FlipInterval = desc[0].GetData<uint32_t>(); |
| 861 | auto MMIOFlip = desc[1].GetData<BOOL>() != 0; |
| 862 | |
| 863 | auto p = HandleDxgkFlip(hdr); |
| 864 | if (p != nullptr) { |
| 865 | p->SyncInterval = FlipInterval; |
| 866 | |
| 867 | if (MMIOFlip) { |
| 868 | p->WaitForFlipEvent = true; |
| 869 | } else if (FlipInterval == 0) { |
| 870 | p->SupportsTearing = true; |
| 871 | } |
| 872 | } |
| 873 | return; |
| 874 | } |
| 875 | case Microsoft_Windows_DxgKrnl::IndependentFlip_Info::Id: |
| 876 | { |
| 877 | EventDataDesc desc[] = { |
| 878 | { L"SubmitSequence" }, |
| 879 | { L"FlipInterval" }, |
| 880 | }; |
| 881 | mMetadata.GetEventData(pEventRecord, desc, _countof(desc)); |
| 882 | auto SubmitSequence = desc[0].GetData<uint32_t>(); |
| 883 | auto FlipInterval = desc[1].GetData<uint32_t>(); |
| 884 | |
| 885 | auto pEvent = FindPresentBySubmitSequence(SubmitSequence); |
| 886 | if (pEvent != nullptr) { |
no test coverage detected