Refresh rate control on IDXGISwapChain1
I play video on my application on xbox with 120Hz, but it seems to be played with 60Hz. Interval between time samples is ~16ms instead of 8ms. I checked few different videos with different fps and the result is the same (I thought that the problem is vsync but not bcs if I set 60Hz and 30fps time sample is ~16ms anyways -> so each frame is played twice like expected).
(interval between time samples == ~time of m_swap_chain1->Present1)
RECT rect = {static_cast<LONG>(x), static_cast<LONG>(m_height - y - height),
static_cast<LONG>(x + width), static_cast<LONG>(m_height - y)};
DXGI_PRESENT_PARAMETERS params = {1, &rect, nullptr, nullptr};
result = m_swap_chain->Present1(swap_interval, 0, ¶ms);
So the question is how can I force to use swap chain with 120Hz? In DXGI_SWAP_CHAIN_DESC we have DXGI_MODE_DESC where it is possible to set refresh rate.. but for DXGI_SWAP_CHAIN_DESC1 I don't have option like that.
I also found IDXGISwapChainMedia but it is dxgi1_3.h.. I am using dxgi1_2.h.
and the second question:
how can I check which refresh rate is currently played. Does any method like that exist?
I tried in this way:
IDXGIOutput* dxgiOutput;
auto hr = dxgiAdapter->EnumOutputs(output, &dxgiOutput);
if (FAILED(hr))
{
std::cout << "Failed to enumerate output. HRESULT: " << hr << " " << output;
return;
}
IDXGIOutput1* dxgiOutput1 = my_dynamic_cast<IDXGIOutput1>(dxgiOutput);
// Step 4: Fallback to enumerate available modes
UINT modeCount = 0;
UINT flags = DXGI_ENUM_MODES_INTERLACED;
hr = dxgiOutput1->GetDisplayModeList1(format, flags, &modeCount, nullptr);
if (FAILED(hr))
{
std::cout << "Failed to get display mode list1. HRESULT: " << hr << " " << output;
return;
}
std::vector<DXGI_MODE_DESC1> modes(modeCount);
hr = dxgiOutput1->GetDisplayModeList1(format, flags, &modeCount, modes.data());
if (FAILED(hr))
{
std::cout << "Failed to retrieve display modes1. HRESULT: " << hr;
return;
}
std::cout << "Available display modes:";
for (const auto &mode : modes)
{
std::cout << "Resolution: " << mode.Width << "x" << mode.Height
<< ", Refresh rate: "
<< mode.RefreshRate.Numerator / mode.RefreshRate.Denominator << " Hz";
}
but it failed here:
Failed to get display mode list1. HRESULT: -2005270494
and it probably receive all modes instead of currently used.