Skip to content

Commit

Permalink
Improve the refresh rate precision. (AMDVLK #268)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojbao committed Aug 16, 2024
1 parent 8bf20dd commit 57cb1b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions icd/api/vk_physical_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9474,7 +9474,7 @@ VkResult PhysicalDevice::GetDisplayModeProperties(
// The refresh rate returned by pal is HZ.
// Spec requires refresh rate to be "the number of times the display is refreshed each second
// multiplied by 1000", in other words, HZ * 1000
properties[i].parameters.refreshRate = pScreenMode[i]->refreshRate * 1000;
properties[i].parameters.refreshRate = (pScreenMode[i]->refreshRate.numerator * 1.0f / pScreenMode[i]->refreshRate.denominator) * 1000;
}

*pPropertyCount = loopCount;
Expand Down Expand Up @@ -9538,7 +9538,7 @@ VkResult PhysicalDevice::CreateDisplayMode(
// The modes are considered as identical if the dimension as well as the refresh rate are the same.
if ((pCreateInfo->parameters.visibleRegion.width == pScreenMode[i]->extent.width) &&
(pCreateInfo->parameters.visibleRegion.height == pScreenMode[i]->extent.height) &&
(pCreateInfo->parameters.refreshRate == pScreenMode[i]->refreshRate * 1000))
(pCreateInfo->parameters.refreshRate == (pScreenMode[i]->refreshRate.numerator * 1.0f / pScreenMode[i]->refreshRate.denominator) * 1000))
{
isValidMode = true;
break;
Expand Down Expand Up @@ -9569,7 +9569,8 @@ VkResult PhysicalDevice::CreateDisplayMode(
{
pNewMode->palScreenMode.extent.width = pCreateInfo->parameters.visibleRegion.width;
pNewMode->palScreenMode.extent.height = pCreateInfo->parameters.visibleRegion.height;
pNewMode->palScreenMode.refreshRate = pCreateInfo->parameters.refreshRate;
pNewMode->palScreenMode.refreshRate.numerator = pCreateInfo->parameters.refreshRate;
pNewMode->palScreenMode.refreshRate.denominator = 1000;
pNewMode->palScreenMode.flags.u32All = 0;
pNewMode->pScreen = pScreen;
*pMode = reinterpret_cast<VkDisplayModeKHR>(pNewMode);
Expand Down

0 comments on commit 57cb1b9

Please sign in to comment.