Bug 1897363 - Add profiler marker for NVIDIA SuperResolution info r=gfx-reviewers,nical

Info from GPU driver helps for debugging.

Differential Revision: https://phabricator.services.mozilla.com/D210762
This commit is contained in:
sotaro 2024-05-17 16:25:59 +00:00
parent 7eddd65a23
commit a944f46809

View file

@ -1191,6 +1191,44 @@ static UINT GetVendorId(ID3D11VideoDevice* const aVideoDevice) {
return adapterDesc.VendorId;
}
struct NvidiaVSRGetData_v1 {
UINT vsrGPUisVSRCapable : 1; // 01/32, 1: GPU is VSR capable
UINT vsrOtherFieldsValid : 1; // 02/32, 1: Other status fields are valid
// remaining fields are valid if vsrOtherFieldsValid is set - requires
// previous execution of VPBlt with SetStreamExtension for VSR enabled.
UINT vsrEnabled : 1; // 03/32, 1: VSR is enabled
UINT vsrIsInUseForThisVP : 1; // 04/32, 1: VSR is in use by this Video
// Processor
UINT vsrLevel : 3; // 05-07/32, 0-4 current level
UINT vsrReserved : 21; // 32-07
};
static void AddProfileMarkerForNvidiaVpSuperResolutionInfo(
ID3D11VideoContext* aVideoContext, ID3D11VideoProcessor* aVideoProcessor) {
MOZ_ASSERT(profiler_thread_is_being_profiled_for_markers());
// Undocumented NVIDIA driver constants
constexpr GUID nvGUID = {0xD43CE1B3,
0x1F4B,
0x48AC,
{0xBA, 0xEE, 0xC3, 0xC2, 0x53, 0x75, 0xE6, 0xF7}};
NvidiaVSRGetData_v1 data{};
HRESULT hr = aVideoContext->VideoProcessorGetStreamExtension(
aVideoProcessor, 0, &nvGUID, sizeof(data), &data);
if (FAILED(hr)) {
return;
}
nsPrintfCString str(
"SuperResolution VP Capable %u OtherFieldsValid %u Enabled %u InUse %u "
"Level %u",
data.vsrGPUisVSRCapable, data.vsrOtherFieldsValid, data.vsrEnabled,
data.vsrIsInUseForThisVP, data.vsrLevel);
PROFILER_MARKER_TEXT("DCSurfaceVideo", GRAPHICS, {}, str);
}
static HRESULT SetNvidiaVpSuperResolution(ID3D11VideoContext* aVideoContext,
ID3D11VideoProcessor* aVideoProcessor,
bool aEnable) {
@ -1825,6 +1863,11 @@ bool DCSurfaceVideo::CallVideoProcessorBlt() {
}
}
if (profiler_thread_is_being_profiled_for_markers() && vendorId == 0x10DE) {
AddProfileMarkerForNvidiaVpSuperResolutionInfo(videoContext,
videoProcessor);
}
if (mUseVpAutoHDR) {
PROFILER_MARKER_TEXT("DCSurfaceVideo", GRAPHICS, {}, "SetVpAutoHDR"_ns);