mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed inconsistent NVIDIA HDR display setting
THere was an unneeded check that prevented the NVIDIA HDR settings being applied when it should have been. This in turn meant that the display profile equality matching wasn't working as the applied display profile was sufficiently different to the one selected and applied that it wouldn't match, and would instead display the brand new profile interface. This has been corrected now.
This commit is contained in:
parent
28a8f131b3
commit
6bd9898ea8
@ -56,8 +56,8 @@ namespace DisplayMagician.UIForms
|
||||
// Apply the Profile
|
||||
if (ProfileRepository.ApplyProfile(_selectedProfile) == ApplyProfileResult.Successful)
|
||||
{
|
||||
/*logger.Error($"DisplayProfileForm/Apply_Click: Waiting 0.5 sec for the display to apply");
|
||||
System.Threading.Thread.Sleep(500);*/
|
||||
logger.Error($"DisplayProfileForm/Apply_Click: Waiting 0.5 sec for the display to apply");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
ChangeSelectedProfile(_selectedProfile);
|
||||
}
|
||||
}
|
||||
|
@ -1250,40 +1250,36 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
// Now, we have the current HDR settings, and the existing HDR settings, so we go through and we attempt to set each display color settings
|
||||
foreach (var wantedHdrColorData in displayConfig.HdrConfig.HdrColorData)
|
||||
{
|
||||
// If we have HDR settings stored for the display, then attempt to set them
|
||||
if (currentDisplayConfig.HdrConfig.HdrColorData.ContainsKey(wantedHdrColorData.Key))
|
||||
// Now we set the HDR colour settings of the display
|
||||
NV_HDR_COLOR_DATA_V2 hdrColorData = wantedHdrColorData.Value;
|
||||
NVStatus = NVImport.NvAPI_Disp_HdrColorControl(wantedHdrColorData.Key, ref hdrColorData);
|
||||
if (NVStatus == NVAPI_STATUS.NVAPI_OK)
|
||||
{
|
||||
// Now we set the HDR colour settings of the display
|
||||
NV_HDR_COLOR_DATA_V2 hdrColorData = wantedHdrColorData.Value;
|
||||
NVStatus = NVImport.NvAPI_Disp_HdrColorControl(wantedHdrColorData.Key, ref hdrColorData);
|
||||
if (NVStatus == NVAPI_STATUS.NVAPI_OK)
|
||||
{
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: NvAPI_Disp_HdrColorControl returned OK. We just successfully set the HDR mode to {hdrColorData.HdrMode.ToString("G")}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The input buffer is not large enough to hold it's contents. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_INVALID_DISPLAY_ID)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The input monitor is either not connected or is not a DP or HDMI panel. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_API_NOT_INITIALIZED)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The NvAPI API needs to be initialized first. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_NO_IMPLEMENTATION)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: This entry point not available in this NVIDIA Driver. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_ERROR)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: A miscellaneous error occurred. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else
|
||||
{
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Some non standard error occurred while getting Mosaic Topology! NvAPI_Disp_HdrColorControl() returned error code {NVStatus}. It's most likely that your monitor {wantedHdrColorData.Key} doesn't support HDR.");
|
||||
}
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: NvAPI_Disp_HdrColorControl returned OK. We just successfully set the HDR mode to {hdrColorData.HdrMode.ToString("G")}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The input buffer is not large enough to hold it's contents. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_INVALID_DISPLAY_ID)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The input monitor is either not connected or is not a DP or HDMI panel. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_API_NOT_INITIALIZED)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: The NvAPI API needs to be initialized first. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_NO_IMPLEMENTATION)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: This entry point not available in this NVIDIA Driver. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else if (NVStatus == NVAPI_STATUS.NVAPI_ERROR)
|
||||
{
|
||||
SharedLogger.logger.Warn($"NVIDIALibrary/SetActiveConfig: A miscellaneous error occurred. NvAPI_Disp_HdrColorControl() returned error code {NVStatus}");
|
||||
}
|
||||
else
|
||||
{
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Some non standard error occurred while getting Mosaic Topology! NvAPI_Disp_HdrColorControl() returned error code {NVStatus}. It's most likely that your monitor {wantedHdrColorData.Key} doesn't support HDR.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user