mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
First fully working AMD Eyefinity implementation.
AMD Eyefinity now works just as well as the NVIDIA implementation... probably even more robustly than the NVIDIA one. Fixes #37 and #21. I'll now start on some other bugfixing and features in preparation for DisplayMagician v2.0.0
This commit is contained in:
parent
5a1960720a
commit
e0bb774fde
@ -1139,96 +1139,86 @@ namespace DisplayMagicianShared
|
|||||||
return _screens;
|
return _screens;
|
||||||
}
|
}
|
||||||
// Now we need to check for Spanned screens
|
// Now we need to check for Spanned screens
|
||||||
if (_nvidiaDisplayConfig.MosaicConfig.IsMosaicEnabled)
|
if (_amdDisplayConfig.SlsConfig.IsSlsEnabled)
|
||||||
{
|
{
|
||||||
// TODO: Make the NVIDIA displays show the individual screens and overlap!
|
for (int i = 0; i < _amdDisplayConfig.DisplayMaps.Count; i++)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a dictionary of all the screen sizes we want
|
|
||||||
//Dictionary<string,SpannedScreenPosition> MosaicScreens = new Dictionary<string,SpannedScreenPosition>();
|
|
||||||
for (int i = 0; i < _nvidiaDisplayConfig.MosaicConfig.MosaicGridCount; i++)
|
|
||||||
{
|
{
|
||||||
ScreenPosition screen = new ScreenPosition();
|
ScreenPosition screen = new ScreenPosition();
|
||||||
screen.Library = "NVIDIA";
|
screen.Library = "AMD";
|
||||||
screen.Colour = normalScreenColor;
|
screen.Colour = normalScreenColor;
|
||||||
if (_nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].DisplayCount > 1)
|
// This is multiple screens
|
||||||
{
|
|
||||||
// Set some basics about the screen
|
|
||||||
screen.SpannedScreens = new List<SpannedScreenPosition>();
|
screen.SpannedScreens = new List<SpannedScreenPosition>();
|
||||||
screen.Name = "NVIDIA Surround/Mosaic";
|
screen.Name = "AMD Eyefinity";
|
||||||
screen.IsSpanned = true;
|
//screen.IsSpanned = true;
|
||||||
screen.SpannedRows = (int)_nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].Rows;
|
screen.SpannedRows = _amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSMap.Grid.SLSGridRow;
|
||||||
screen.SpannedColumns = (int)_nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].Columns;
|
screen.SpannedColumns = _amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSMap.Grid.SLSGridColumn;
|
||||||
screen.Colour = spannedScreenColor;
|
screen.Colour = spannedScreenColor;
|
||||||
|
|
||||||
// This is a combined surround/mosaic screen
|
// This is a combined surround/mosaic screen
|
||||||
// We need to build the size of the screen to match it later so we check the MosaicViewports
|
// We need to build the size of the screen to match it later so we check the MosaicViewports
|
||||||
uint minX = 0;
|
/*int minX = 0;
|
||||||
uint minY = 0;
|
int minY = 0;
|
||||||
uint maxX = 0;
|
int maxX = 0;
|
||||||
uint maxY = 0;
|
int maxY = 0;
|
||||||
uint overallX = 0;
|
int overallX = 0;
|
||||||
uint overallY = 0;
|
int overallY = 0;
|
||||||
int overallWidth = 0;
|
int overallWidth = 0;
|
||||||
int overallHeight = 0;
|
int overallHeight = 0;
|
||||||
for (int j = 0; j < _nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].DisplayCount; j++)
|
for (int j = 0; j < _amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets.Count; j++)
|
||||||
{
|
{
|
||||||
SpannedScreenPosition spannedScreen = new SpannedScreenPosition();
|
SpannedScreenPosition spannedScreen = new SpannedScreenPosition();
|
||||||
spannedScreen.Name = _nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].Displays[j].DisplayId.ToString();
|
spannedScreen.Name = $"Display #{_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].DisplayTarget.DisplayID.DisplayLogicalIndex} on Adapter #{_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].DisplayTarget.DisplayID.DisplayLogicalAdapterIndex}";
|
||||||
spannedScreen.Colour = spannedScreenColor;
|
spannedScreen.Colour = spannedScreenColor;
|
||||||
|
|
||||||
// Calculate screen size
|
// Calculate screen size
|
||||||
NV_RECT viewRect = _nvidiaDisplayConfig.MosaicConfig.MosaicViewports[i][j];
|
spannedScreen.ScreenX = (int)_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].ViewSize.XPos;
|
||||||
if (viewRect.Left < minX)
|
spannedScreen.ScreenY = (int)_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].ViewSize.YPos;
|
||||||
|
spannedScreen.ScreenWidth = (int)_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].ViewSize.XRes;
|
||||||
|
spannedScreen.ScreenHeight = (int)_amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].ViewSize.YRes;
|
||||||
|
|
||||||
|
if (spannedScreen.ScreenX < minX)
|
||||||
{
|
{
|
||||||
minX = viewRect.Left;
|
minX = spannedScreen.ScreenX;
|
||||||
}
|
}
|
||||||
if (viewRect.Top < minY)
|
if (spannedScreen.ScreenY < minY)
|
||||||
{
|
{
|
||||||
minY = viewRect.Top;
|
minY = spannedScreen.ScreenY;
|
||||||
}
|
}
|
||||||
if (viewRect.Right > maxX)
|
if (spannedScreen.ScreenX + spannedScreen.ScreenWidth > maxX)
|
||||||
{
|
{
|
||||||
maxX = viewRect.Right;
|
maxX = spannedScreen.ScreenX + spannedScreen.ScreenWidth;
|
||||||
}
|
}
|
||||||
if (viewRect.Bottom > maxY)
|
if (spannedScreen.ScreenY + spannedScreen.ScreenHeight > maxY)
|
||||||
{
|
{
|
||||||
maxY = viewRect.Bottom;
|
maxY = spannedScreen.ScreenY + spannedScreen.ScreenHeight;
|
||||||
}
|
}
|
||||||
uint width = viewRect.Right - viewRect.Left + 1;
|
|
||||||
uint height = viewRect.Bottom - viewRect.Top + 1;
|
|
||||||
spannedScreen.ScreenX = (int)viewRect.Left;
|
|
||||||
spannedScreen.ScreenY = (int)viewRect.Top;
|
|
||||||
spannedScreen.ScreenWidth = (int)width;
|
|
||||||
spannedScreen.ScreenHeight = (int)height;
|
|
||||||
|
|
||||||
// Figure out the overall figures for the screen
|
// Figure out the overall figures for the screen
|
||||||
if (viewRect.Left < overallX)
|
if (spannedScreen.ScreenX < overallX)
|
||||||
{
|
{
|
||||||
overallX = viewRect.Left;
|
overallX = spannedScreen.ScreenX;
|
||||||
}
|
}
|
||||||
if (viewRect.Top < overallY)
|
if (spannedScreen.ScreenY < overallY)
|
||||||
{
|
{
|
||||||
overallY = viewRect.Top;
|
overallY = spannedScreen.ScreenY;
|
||||||
}
|
}
|
||||||
|
|
||||||
overallWidth = (int)maxX - (int)minX + 1;
|
overallWidth = (int)maxX - (int)minX + 1;
|
||||||
overallHeight = (int)maxY - (int)minY + 1;
|
overallHeight = (int)maxY - (int)minY + 1;
|
||||||
|
|
||||||
spannedScreen.Row = i + 1;
|
spannedScreen.Row = _amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].SLSGridPositionY;
|
||||||
spannedScreen.Column = j + 1;
|
spannedScreen.Column = _amdDisplayConfig.SlsConfig.SLSMapConfigs[i].SLSTargets[j].SLSGridPositionX;
|
||||||
|
|
||||||
// Add the spanned screen to the screen
|
// Add the spanned screen to the screen
|
||||||
screen.SpannedScreens.Add(spannedScreen);
|
screen.SpannedScreens.Add(spannedScreen);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//screen.Name = targetId.ToString();
|
//screen.Name = targetId.ToString();
|
||||||
//screen.DisplayConnector = displayMode.DisplayConnector;
|
//screen.DisplayConnector = displayMode.DisplayConnector;
|
||||||
screen.ScreenX = (int)overallX;
|
screen.ScreenX = _amdDisplayConfig.DisplayMaps[i].DisplayMode.XPos;
|
||||||
screen.ScreenY = (int)overallY;
|
screen.ScreenY = _amdDisplayConfig.DisplayMaps[i].DisplayMode.YPos;
|
||||||
screen.ScreenWidth = (int)overallWidth;
|
screen.ScreenWidth = _amdDisplayConfig.DisplayMaps[i].DisplayMode.XRes;
|
||||||
screen.ScreenHeight = (int)overallHeight;
|
screen.ScreenHeight = _amdDisplayConfig.DisplayMaps[i].DisplayMode.YRes;
|
||||||
|
|
||||||
// If we're at the 0,0 coordinate then we're the primary monitor
|
// If we're at the 0,0 coordinate then we're the primary monitor
|
||||||
if (screen.ScreenX == 0 && screen.ScreenY == 0)
|
if (screen.ScreenX == 0 && screen.ScreenY == 0)
|
||||||
@ -1242,45 +1232,6 @@ namespace DisplayMagicianShared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else if (_nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].DisplayCount == 1)
|
|
||||||
{
|
|
||||||
// This is a single screen with an adjoining mosaic screen
|
|
||||||
// Set some basics about the screen
|
|
||||||
uint displayId = _nvidiaDisplayConfig.MosaicConfig.MosaicGridTopos[i].Displays[0].DisplayId;
|
|
||||||
string windowsDisplayName = _nvidiaDisplayConfig.DisplayNames[displayId];
|
|
||||||
uint sourceIndex = _windowsDisplayConfig.DisplaySources[windowsDisplayName];
|
|
||||||
for (int x = 0; x < _windowsDisplayConfig.DisplayConfigModes.Length; x++)
|
|
||||||
{
|
|
||||||
// Skip this if its not a source info config type
|
|
||||||
if (_windowsDisplayConfig.DisplayConfigModes[x].InfoType != DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the source index matches the index of the source info object we're looking at, then process it!
|
|
||||||
if (_windowsDisplayConfig.DisplayConfigModes[x].Id == sourceIndex)
|
|
||||||
{
|
|
||||||
screen.Name = displayId.ToString();
|
|
||||||
|
|
||||||
screen.ScreenX = (int)_windowsDisplayConfig.DisplayConfigModes[x].SourceMode.Position.X;
|
|
||||||
screen.ScreenY = (int)_windowsDisplayConfig.DisplayConfigModes[x].SourceMode.Position.Y;
|
|
||||||
screen.ScreenWidth = (int)_windowsDisplayConfig.DisplayConfigModes[x].SourceMode.Width;
|
|
||||||
screen.ScreenHeight = (int)_windowsDisplayConfig.DisplayConfigModes[x].SourceMode.Height;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// If we're at the 0,0 coordinate then we're the primary monitor
|
|
||||||
if (screen.ScreenX == 0 && screen.ScreenY == 0)
|
|
||||||
{
|
|
||||||
screen.IsPrimary = true;
|
|
||||||
screen.Colour = primaryScreenColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
_screens.Add(screen);
|
_screens.Add(screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1293,7 +1244,7 @@ namespace DisplayMagicianShared
|
|||||||
{
|
{
|
||||||
// Set some basics about the screen
|
// Set some basics about the screen
|
||||||
ScreenPosition screen = new ScreenPosition();
|
ScreenPosition screen = new ScreenPosition();
|
||||||
screen.Library = "NVIDIA";
|
screen.Library = "AMD";
|
||||||
screen.IsSpanned = false;
|
screen.IsSpanned = false;
|
||||||
screen.Colour = normalScreenColor; // this is the default unless overridden by the primary screen
|
screen.Colour = normalScreenColor; // this is the default unless overridden by the primary screen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user