mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 15:11:31 +00:00
[idd] transport: intersect frame capabilities
This commit is contained in:
@@ -69,6 +69,7 @@
|
|||||||
<ClCompile Include="transport\lgmp\CIVSHMEM.cpp" />
|
<ClCompile Include="transport\lgmp\CIVSHMEM.cpp" />
|
||||||
<ClCompile Include="transport\lgmp\CRecovery.cpp" />
|
<ClCompile Include="transport\lgmp\CRecovery.cpp" />
|
||||||
<ClCompile Include="transport\lgmp\CLGMPControl.cpp" />
|
<ClCompile Include="transport\lgmp\CLGMPControl.cpp" />
|
||||||
|
<ClCompile Include="transport\lgmp\CLGMPFrameCaps.cpp" />
|
||||||
<ClCompile Include="transport\lgmp\CLGMPFrameTransport.cpp" />
|
<ClCompile Include="transport\lgmp\CLGMPFrameTransport.cpp" />
|
||||||
<ClCompile Include="transport\lgmp\CLGMPHost.cpp" />
|
<ClCompile Include="transport\lgmp\CLGMPHost.cpp" />
|
||||||
<ClCompile Include="transport\lgmp\CLGMPInputTransport.cpp" />
|
<ClCompile Include="transport\lgmp\CLGMPInputTransport.cpp" />
|
||||||
@@ -116,7 +117,7 @@
|
|||||||
<ClInclude Include="transport\CInputHub.h" />
|
<ClInclude Include="transport\CInputHub.h" />
|
||||||
<ClInclude Include="transport\CTransportManager.h" />
|
<ClInclude Include="transport\CTransportManager.h" />
|
||||||
<ClInclude Include="transport\DirectFrameBufferMemory.h" />
|
<ClInclude Include="transport\DirectFrameBufferMemory.h" />
|
||||||
<ClInclude Include="transport\FrameMemoryLimits.h" />
|
<ClInclude Include="transport\FrameCaps.h" />
|
||||||
<ClInclude Include="transport\IControlSink.h" />
|
<ClInclude Include="transport\IControlSink.h" />
|
||||||
<ClInclude Include="transport\IControlTransport.h" />
|
<ClInclude Include="transport\IControlTransport.h" />
|
||||||
<ClInclude Include="transport\IFrameSink.h" />
|
<ClInclude Include="transport\IFrameSink.h" />
|
||||||
@@ -130,6 +131,7 @@
|
|||||||
<ClInclude Include="transport\lgmp\CIVSHMEM.h" />
|
<ClInclude Include="transport\lgmp\CIVSHMEM.h" />
|
||||||
<ClInclude Include="transport\lgmp\CRecovery.h" />
|
<ClInclude Include="transport\lgmp\CRecovery.h" />
|
||||||
<ClInclude Include="transport\lgmp\CLGMPControl.h" />
|
<ClInclude Include="transport\lgmp\CLGMPControl.h" />
|
||||||
|
<ClInclude Include="transport\lgmp\CLGMPFrameCaps.h" />
|
||||||
<ClInclude Include="transport\lgmp\CLGMPFrameTransport.h" />
|
<ClInclude Include="transport\lgmp\CLGMPFrameTransport.h" />
|
||||||
<ClInclude Include="transport\lgmp\CLGMPHost.h" />
|
<ClInclude Include="transport\lgmp\CLGMPHost.h" />
|
||||||
<ClInclude Include="transport\lgmp\CLGMPInputTransport.h" />
|
<ClInclude Include="transport\lgmp\CLGMPInputTransport.h" />
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
<ClInclude Include="transport\DirectFrameBufferMemory.h">
|
<ClInclude Include="transport\DirectFrameBufferMemory.h">
|
||||||
<Filter>Transport</Filter>
|
<Filter>Transport</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="transport\FrameMemoryLimits.h">
|
<ClInclude Include="transport\FrameCaps.h">
|
||||||
<Filter>Transport</Filter>
|
<Filter>Transport</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="transport\IControlSink.h">
|
<ClInclude Include="transport\IControlSink.h">
|
||||||
@@ -211,6 +211,9 @@
|
|||||||
<ClInclude Include="transport\lgmp\CLGMPControl.h">
|
<ClInclude Include="transport\lgmp\CLGMPControl.h">
|
||||||
<Filter>Transport\LGMP</Filter>
|
<Filter>Transport\LGMP</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="transport\lgmp\CLGMPFrameCaps.h">
|
||||||
|
<Filter>Transport\LGMP</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="transport\lgmp\CLGMPFrameTransport.h">
|
<ClInclude Include="transport\lgmp\CLGMPFrameTransport.h">
|
||||||
<Filter>Transport\LGMP</Filter>
|
<Filter>Transport\LGMP</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -342,6 +345,9 @@
|
|||||||
<ClCompile Include="transport\lgmp\CLGMPControl.cpp">
|
<ClCompile Include="transport\lgmp\CLGMPControl.cpp">
|
||||||
<Filter>Transport\LGMP</Filter>
|
<Filter>Transport\LGMP</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="transport\lgmp\CLGMPFrameCaps.cpp">
|
||||||
|
<Filter>Transport\LGMP</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="transport\lgmp\CLGMPFrameTransport.cpp">
|
<ClCompile Include="transport\lgmp\CLGMPFrameTransport.cpp">
|
||||||
<Filter>Transport\LGMP</Filter>
|
<Filter>Transport\LGMP</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ void CDeviceContext::InitAdapter()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DEBUG_TRACE("Loading configured display modes");
|
DEBUG_TRACE("Loading configured display modes");
|
||||||
if (!m_displayConfiguration.Load(m_transport->GetMemoryLimits()))
|
if (!m_displayConfiguration.Load(*m_transport))
|
||||||
{
|
{
|
||||||
m_initInProgress.store(0);
|
m_initInProgress.store(0);
|
||||||
return;
|
return;
|
||||||
@@ -405,8 +405,7 @@ void CDeviceContext::ReplugMonitor()
|
|||||||
|
|
||||||
void CDeviceContext::ReloadSettings()
|
void CDeviceContext::ReloadSettings()
|
||||||
{
|
{
|
||||||
if (!m_displayConfiguration.ReloadSettings(
|
if (!m_displayConfiguration.ReloadSettings(*m_transport))
|
||||||
m_transport->GetMemoryLimits()))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReplugMonitor();
|
ReplugMonitor();
|
||||||
@@ -449,7 +448,7 @@ void CDeviceContext::SetResolution(uint32_t width, uint32_t height)
|
|||||||
{
|
{
|
||||||
const CDisplayConfiguration::ResolutionResult result =
|
const CDisplayConfiguration::ResolutionResult result =
|
||||||
m_displayConfiguration.SetResolution(
|
m_displayConfiguration.SetResolution(
|
||||||
width, height, m_transport->GetMemoryLimits());
|
width, height, *m_transport);
|
||||||
|
|
||||||
switch (result.status)
|
switch (result.status)
|
||||||
{
|
{
|
||||||
@@ -464,6 +463,10 @@ void CDeviceContext::SetResolution(uint32_t width, uint32_t height)
|
|||||||
g_pipe.ResolutionRejected(width, height, result.requiredMiB);
|
g_pipe.ResolutionRejected(width, height, result.requiredMiB);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CDisplayConfiguration::ResolutionStatus::UNSUPPORTED:
|
||||||
|
g_pipe.ResolutionRejected(width, height, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,77 +23,9 @@
|
|||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
#include "CSRWLock.h"
|
#include "CSRWLock.h"
|
||||||
|
|
||||||
#include <d3d12.h>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
static const UINT64 FRAME_BYTES_PER_PIXEL = 4;
|
|
||||||
|
|
||||||
bool CDisplayConfiguration::AlignUp(
|
|
||||||
UINT64 value, UINT64 alignment, UINT64& result)
|
|
||||||
{
|
|
||||||
if (!alignment || (alignment & (alignment - 1)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const UINT64 mask = alignment - 1;
|
|
||||||
result = (value + mask) & ~mask;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CDisplayConfiguration::CalculateFrameSize(
|
|
||||||
uint32_t width, uint32_t height, UINT64& frameSize)
|
|
||||||
{
|
|
||||||
frameSize = 0;
|
|
||||||
if (!width || !height)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UINT64 pitch;
|
|
||||||
if (!AlignUp((UINT64)width * FRAME_BYTES_PER_PIXEL,
|
|
||||||
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT, pitch))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
frameSize = pitch * height;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CDisplayConfiguration::GetResolutionMemoryRequirements(
|
|
||||||
uint32_t width, uint32_t height, UINT64 alignment,
|
|
||||||
const FrameMemoryLimits& limits, UINT64& frameSize, UINT64& requiredSize)
|
|
||||||
{
|
|
||||||
frameSize = 0;
|
|
||||||
requiredSize = 0;
|
|
||||||
|
|
||||||
if (!alignment || !limits.frameMemoryOffset || !limits.bufferCount ||
|
|
||||||
!CalculateFrameSize(width, height, frameSize))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UINT64 frameAllocationSize;
|
|
||||||
if (!AlignUp(frameSize + alignment, alignment, frameAllocationSize))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UINT64 frameMemoryStart;
|
|
||||||
if (!AlignUp(limits.frameMemoryOffset, alignment, frameMemoryStart))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
requiredSize = frameMemoryStart +
|
|
||||||
frameAllocationSize * limits.bufferCount;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CDisplayConfiguration::RecommendedMemorySizeMiB(
|
|
||||||
UINT64 requiredSize)
|
|
||||||
{
|
|
||||||
UINT64 sizeMiB = requiredSize / 1048576;
|
|
||||||
if (requiredSize % 1048576)
|
|
||||||
++sizeMiB;
|
|
||||||
|
|
||||||
UINT64 result = 1;
|
|
||||||
while (result < sizeMiB && result <= UINT32_MAX / 2)
|
|
||||||
result <<= 1;
|
|
||||||
|
|
||||||
return result < sizeMiB ? UINT32_MAX : (uint32_t)result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAS_IDDCX_110
|
#ifdef HAS_IDDCX_110
|
||||||
static inline IDDCX_WIRE_BITS_PER_COMPONENT GetWireBitsPerComponent(bool hdr)
|
static inline IDDCX_WIRE_BITS_PER_COMPONENT GetWireBitsPerComponent(bool hdr)
|
||||||
{
|
{
|
||||||
@@ -117,7 +49,7 @@ CDisplayConfiguration::CDisplayConfiguration(CSettings& settings) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDisplayConfiguration::LoadModes(const FrameMemoryLimits& limits)
|
bool CDisplayConfiguration::LoadModes(const FrameCaps& caps)
|
||||||
{
|
{
|
||||||
const CSettings::DisplayModes configuredModes =
|
const CSettings::DisplayModes configuredModes =
|
||||||
m_settings.LoadModes();
|
m_settings.LoadModes();
|
||||||
@@ -127,17 +59,17 @@ bool CDisplayConfiguration::LoadModes(const FrameMemoryLimits& limits)
|
|||||||
CSettings::DisplayModes newModes;
|
CSettings::DisplayModes newModes;
|
||||||
newModes.reserve(configuredModes.size());
|
newModes.reserve(configuredModes.size());
|
||||||
|
|
||||||
const UINT64 alignment = limits.alignment ? limits.alignment :
|
|
||||||
D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
|
||||||
|
|
||||||
bool hasPreferred = false;
|
bool hasPreferred = false;
|
||||||
for (const auto& configuredMode : configuredModes)
|
for (const auto& configuredMode : configuredModes)
|
||||||
{
|
{
|
||||||
UINT64 frameSize;
|
const FrameMode frameMode =
|
||||||
UINT64 requiredMemorySize;
|
{
|
||||||
if (!GetResolutionMemoryRequirements(configuredMode.width,
|
configuredMode.width,
|
||||||
configuredMode.height, alignment, limits, frameSize,
|
configuredMode.height,
|
||||||
requiredMemorySize))
|
configuredMode.refreshMilliHz,
|
||||||
|
};
|
||||||
|
if (!frameMode.width || !frameMode.height ||
|
||||||
|
!frameMode.refreshMilliHz)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("Filtering invalid %s mode %ux%u@%.3f",
|
DEBUG_WARN("Filtering invalid %s mode %ux%u@%.3f",
|
||||||
configuredMode.extraMode ? "extra" : "configured",
|
configuredMode.extraMode ? "extra" : "configured",
|
||||||
@@ -145,16 +77,13 @@ bool CDisplayConfiguration::LoadModes(const FrameMemoryLimits& limits)
|
|||||||
configuredMode.refreshMilliHz / 1000.0);
|
configuredMode.refreshMilliHz / 1000.0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!caps.CanUseMode(frameMode))
|
||||||
if (requiredMemorySize > limits.capacity)
|
|
||||||
{
|
{
|
||||||
DEBUG_WARN(
|
DEBUG_WARN(
|
||||||
"Filtering %s mode %ux%u@%.3f: requires %llu bytes of transport memory, only %llu bytes are available",
|
"Filtering unsupported %s mode %ux%u@%.3f",
|
||||||
configuredMode.extraMode ? "extra" : "configured",
|
configuredMode.extraMode ? "extra" : "configured",
|
||||||
configuredMode.width, configuredMode.height,
|
configuredMode.width, configuredMode.height,
|
||||||
configuredMode.refreshMilliHz / 1000.0,
|
configuredMode.refreshMilliHz / 1000.0);
|
||||||
(unsigned long long)requiredMemorySize,
|
|
||||||
(unsigned long long)limits.capacity);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +98,7 @@ bool CDisplayConfiguration::LoadModes(const FrameMemoryLimits& limits)
|
|||||||
|
|
||||||
if (newModes.empty())
|
if (newModes.empty())
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("No configured display modes fit in transport memory");
|
DEBUG_ERROR("No configured display modes are supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,13 +112,13 @@ bool CDisplayConfiguration::LoadModes(const FrameMemoryLimits& limits)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDisplayConfiguration::Load(const FrameMemoryLimits& limits)
|
bool CDisplayConfiguration::Load(const FrameCaps& caps)
|
||||||
{
|
{
|
||||||
return LoadModes(limits);
|
return LoadModes(caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDisplayConfiguration::ReloadSettings(
|
bool CDisplayConfiguration::ReloadSettings(
|
||||||
const FrameMemoryLimits& limits)
|
const FrameCaps& caps)
|
||||||
{
|
{
|
||||||
bool modesLoaded = false;
|
bool modesLoaded = false;
|
||||||
{
|
{
|
||||||
@@ -209,7 +138,7 @@ bool CDisplayConfiguration::ReloadSettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settingsUpdated)
|
if (settingsUpdated)
|
||||||
modesLoaded = LoadModes(limits);
|
modesLoaded = LoadModes(caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!modesLoaded)
|
if (!modesLoaded)
|
||||||
@@ -219,43 +148,52 @@ bool CDisplayConfiguration::ReloadSettings(
|
|||||||
|
|
||||||
CDisplayConfiguration::ResolutionResult
|
CDisplayConfiguration::ResolutionResult
|
||||||
CDisplayConfiguration::SetResolution(
|
CDisplayConfiguration::SetResolution(
|
||||||
uint32_t width, uint32_t height, const FrameMemoryLimits& limits)
|
uint32_t width, uint32_t height, const FrameCaps& caps)
|
||||||
{
|
{
|
||||||
ResolutionResult result;
|
ResolutionResult result;
|
||||||
|
|
||||||
UINT64 frameSize;
|
|
||||||
UINT64 requiredMemorySize;
|
|
||||||
if (!GetResolutionMemoryRequirements(width, height, limits.alignment,
|
|
||||||
limits, frameSize, requiredMemorySize))
|
|
||||||
{
|
|
||||||
DEBUG_WARN("Ignoring invalid resolution request: %ux%u", width, height);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requiredMemorySize > limits.capacity)
|
|
||||||
{
|
|
||||||
result.status = ResolutionStatus::TOO_LARGE;
|
|
||||||
result.requiredMiB = RecommendedMemorySizeMiB(requiredMemorySize);
|
|
||||||
DEBUG_WARN(
|
|
||||||
"Refusing resolution %ux%u: frame requires %llu bytes, only %llu bytes are available; transport memory must be at least %u MiB",
|
|
||||||
width, height,
|
|
||||||
(unsigned long long)frameSize,
|
|
||||||
(unsigned long long)limits.maxFrameSize,
|
|
||||||
result.requiredMiB);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSettings::DisplayMode mode = {};
|
CSettings::DisplayMode mode = {};
|
||||||
mode.width = width;
|
mode.width = width;
|
||||||
mode.height = height;
|
mode.height = height;
|
||||||
mode.refreshMilliHz = m_settings.GetDefaultRefreshMilliHz();
|
mode.refreshMilliHz = m_settings.GetDefaultRefreshMilliHz();
|
||||||
mode.preferred = true;
|
mode.preferred = true;
|
||||||
|
|
||||||
|
if (!mode.width || !mode.height || !mode.refreshMilliHz)
|
||||||
|
{
|
||||||
|
DEBUG_WARN("Ignoring invalid resolution request: %ux%u", width, height);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FrameMode frameMode =
|
||||||
|
{
|
||||||
|
mode.width,
|
||||||
|
mode.height,
|
||||||
|
mode.refreshMilliHz,
|
||||||
|
};
|
||||||
|
if (!caps.CanUseMode(frameMode, &result.requiredMiB))
|
||||||
|
{
|
||||||
|
if (result.requiredMiB)
|
||||||
|
{
|
||||||
|
result.status = ResolutionStatus::TOO_LARGE;
|
||||||
|
DEBUG_WARN(
|
||||||
|
"Refusing resolution %ux%u: configured frame capacity must be at "
|
||||||
|
"least %u MiB",
|
||||||
|
width, height, result.requiredMiB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.status = ResolutionStatus::UNSUPPORTED;
|
||||||
|
DEBUG_WARN("Refusing unsupported resolution: %ux%u",
|
||||||
|
width, height);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CSRWExclusiveLock reloadLock(m_reloadLock);
|
CSRWExclusiveLock reloadLock(m_reloadLock);
|
||||||
if (!m_settings.SetExtraMode(mode))
|
if (!m_settings.SetExtraMode(mode))
|
||||||
result.status = ResolutionStatus::SETTINGS_FAILED;
|
result.status = ResolutionStatus::SETTINGS_FAILED;
|
||||||
else if (!LoadModes(limits))
|
else if (!LoadModes(caps))
|
||||||
result.status = ResolutionStatus::MODES_FAILED;
|
result.status = ResolutionStatus::MODES_FAILED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "config/CSettings.h"
|
#include "config/CSettings.h"
|
||||||
#include "display/CEdid.h"
|
#include "display/CEdid.h"
|
||||||
#include "display/IddCxCompat.h"
|
#include "display/IddCxCompat.h"
|
||||||
#include "transport/FrameMemoryLimits.h"
|
#include "transport/FrameCaps.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
SUCCESS,
|
SUCCESS,
|
||||||
INVALID,
|
INVALID,
|
||||||
TOO_LARGE,
|
TOO_LARGE,
|
||||||
|
UNSUPPORTED,
|
||||||
SETTINGS_FAILED,
|
SETTINGS_FAILED,
|
||||||
MODES_FAILED,
|
MODES_FAILED,
|
||||||
};
|
};
|
||||||
@@ -68,27 +69,19 @@ private:
|
|||||||
CEdid m_edid;
|
CEdid m_edid;
|
||||||
bool m_hdrEnabled = false;
|
bool m_hdrEnabled = false;
|
||||||
|
|
||||||
bool LoadModes(const FrameMemoryLimits& limits);
|
bool LoadModes(const FrameCaps& caps);
|
||||||
CSettings::DisplayModes SnapshotModes(bool * hdrEnabled = nullptr) const;
|
CSettings::DisplayModes SnapshotModes(bool * hdrEnabled = nullptr) const;
|
||||||
|
|
||||||
static bool AlignUp(UINT64 value, UINT64 alignment, UINT64& result);
|
|
||||||
static bool CalculateFrameSize(uint32_t width, uint32_t height,
|
|
||||||
UINT64& frameSize);
|
|
||||||
static bool GetResolutionMemoryRequirements(uint32_t width,
|
|
||||||
uint32_t height, UINT64 alignment, const FrameMemoryLimits& limits,
|
|
||||||
UINT64& frameSize, UINT64& requiredSize);
|
|
||||||
static uint32_t RecommendedMemorySizeMiB(UINT64 requiredSize);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDisplayConfiguration(CSettings& settings);
|
explicit CDisplayConfiguration(CSettings& settings);
|
||||||
|
|
||||||
CDisplayConfiguration(const CDisplayConfiguration&) = delete;
|
CDisplayConfiguration(const CDisplayConfiguration&) = delete;
|
||||||
CDisplayConfiguration& operator=(const CDisplayConfiguration&) = delete;
|
CDisplayConfiguration& operator=(const CDisplayConfiguration&) = delete;
|
||||||
|
|
||||||
bool Load(const FrameMemoryLimits& limits);
|
bool Load(const FrameCaps& caps);
|
||||||
bool ReloadSettings(const FrameMemoryLimits& limits);
|
bool ReloadSettings(const FrameCaps& caps);
|
||||||
ResolutionResult SetResolution(uint32_t width, uint32_t height,
|
ResolutionResult SetResolution(uint32_t width, uint32_t height,
|
||||||
const FrameMemoryLimits& limits);
|
const FrameCaps& caps);
|
||||||
|
|
||||||
void InitializeEdid(bool hdr);
|
void InitializeEdid(bool hdr);
|
||||||
void RebuildEdid(bool hdr);
|
void RebuildEdid(bool hdr);
|
||||||
|
|||||||
@@ -328,6 +328,8 @@ ITransport::OpenResult CTransportManager::OpenEntry(Entry& entry)
|
|||||||
bool CTransportManager::InitializeEntry(Entry& entry)
|
bool CTransportManager::InitializeEntry(Entry& entry)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ITransport> transport;
|
std::shared_ptr<ITransport> transport;
|
||||||
|
uint32_t services = 0;
|
||||||
|
bool required = false;
|
||||||
{
|
{
|
||||||
CSRWSharedLock entryLock(entry.lock);
|
CSRWSharedLock entryLock(entry.lock);
|
||||||
if (entry.state == State::INITIALIZED || entry.state == State::READY)
|
if (entry.state == State::INITIALIZED || entry.state == State::READY)
|
||||||
@@ -335,6 +337,8 @@ bool CTransportManager::InitializeEntry(Entry& entry)
|
|||||||
if (entry.state != State::OPEN)
|
if (entry.state != State::OPEN)
|
||||||
return false;
|
return false;
|
||||||
transport = entry.transport;
|
transport = entry.transport;
|
||||||
|
services = entry.config.services;
|
||||||
|
required = entry.required;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transport || !transport->Initialize())
|
if (!transport || !transport->Initialize())
|
||||||
@@ -344,12 +348,30 @@ bool CTransportManager::InitializeEntry(Entry& entry)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FrameMemoryLimits limits = transport->GetMemoryLimits();
|
std::shared_ptr<const FrameCaps> frameCaps;
|
||||||
|
if (services & TRANSPORT_SERVICE_FRAME)
|
||||||
|
{
|
||||||
|
frameCaps = transport->GetFrameCaps();
|
||||||
|
if (!frameCaps && required)
|
||||||
|
{
|
||||||
|
CSRWExclusiveLock entryLock(entry.lock);
|
||||||
|
entry.state = State::FAILED;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const bool hasFrameCaps = frameCaps != nullptr;
|
||||||
{
|
{
|
||||||
CSRWExclusiveLock entryLock(entry.lock);
|
CSRWExclusiveLock entryLock(entry.lock);
|
||||||
entry.limits = limits;
|
// The first successfully initialized instance fixes the advertised
|
||||||
entry.limitsValid = true;
|
// capability contract. Recreating an instance must not change the mode
|
||||||
entry.state = State::INITIALIZED;
|
// list during a runtime restart.
|
||||||
|
if (!entry.frameCaps)
|
||||||
|
entry.frameCaps = std::move(frameCaps);
|
||||||
|
// A best-effort instance without a capability contract can continue to
|
||||||
|
// provide its other configured services, but must not receive frames.
|
||||||
|
entry.frameAbsent = (services & TRANSPORT_SERVICE_FRAME) &&
|
||||||
|
!hasFrameCaps;
|
||||||
|
entry.state = State::INITIALIZED;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -627,8 +649,6 @@ void CTransportManager::RetryEntry(Entry& entry, uint64_t now,
|
|||||||
{
|
{
|
||||||
CSRWExclusiveLock entryLock(entry.lock);
|
CSRWExclusiveLock entryLock(entry.lock);
|
||||||
entry.transport.reset();
|
entry.transport.reset();
|
||||||
entry.limits = FrameMemoryLimits {};
|
|
||||||
entry.limitsValid = false;
|
|
||||||
entry.directMemory = DirectFrameBufferMemory {};
|
entry.directMemory = DirectFrameBufferMemory {};
|
||||||
entry.directMemoryValid = false;
|
entry.directMemoryValid = false;
|
||||||
entry.setupDone = false;
|
entry.setupDone = false;
|
||||||
@@ -1180,20 +1200,42 @@ void CTransportManager::RecoveryStatus(const SourceKey& source,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameMemoryLimits CTransportManager::GetMemoryLimits() const
|
bool CTransportManager::CanUseMode(const FrameMode& mode,
|
||||||
|
uint32_t * requiredSizeMiB) const
|
||||||
{
|
{
|
||||||
|
if (requiredSizeMiB)
|
||||||
|
*requiredSizeMiB = 0;
|
||||||
|
|
||||||
|
std::shared_ptr<const FrameCaps> caps[FRAME_MAX_SINKS];
|
||||||
|
unsigned capsCount = 0;
|
||||||
|
Entry * entries[FRAME_MAX_SINKS] = {};
|
||||||
|
const unsigned count = Entries(entries);
|
||||||
|
for (unsigned i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
CSRWSharedLock managerLock(m_lock);
|
Entry& entry = *entries[i];
|
||||||
if (m_stopping || m_stopped)
|
CSRWSharedLock entryLock(entry.lock);
|
||||||
return FrameMemoryLimits {};
|
if (!entry.required ||
|
||||||
|
!(entry.config.services & TRANSPORT_SERVICE_FRAME))
|
||||||
|
continue;
|
||||||
|
if (!entry.frameCaps)
|
||||||
|
return false;
|
||||||
|
caps[capsCount++] = entry.frameCaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry * primary = Primary();
|
if (!capsCount)
|
||||||
if (!primary)
|
return false;
|
||||||
return FrameMemoryLimits {};
|
|
||||||
|
|
||||||
CSRWSharedLock entryLock(primary->lock);
|
bool supported = true;
|
||||||
return primary->limitsValid ? primary->limits : FrameMemoryLimits {};
|
for (unsigned i = 0; i < capsCount; ++i)
|
||||||
|
{
|
||||||
|
uint32_t hint = 0;
|
||||||
|
if (caps[i]->CanUseMode(mode, capsCount == 1 ? &hint : nullptr))
|
||||||
|
continue;
|
||||||
|
supported = false;
|
||||||
|
if (requiredSizeMiB && capsCount == 1)
|
||||||
|
*requiredSizeMiB = hint;
|
||||||
|
}
|
||||||
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectFrameBufferMemory CTransportManager::GetDirectMemory() const
|
DirectFrameBufferMemory CTransportManager::GetDirectMemory() const
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
static_assert(TRANSPORT_MAX_INSTANCES == FRAME_MAX_SINKS,
|
static_assert(TRANSPORT_MAX_INSTANCES == FRAME_MAX_SINKS,
|
||||||
"The transport and frame limits must match");
|
"The transport and frame limits must match");
|
||||||
|
|
||||||
class CTransportManager final
|
class CTransportManager final : public FrameCaps
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using CreateFn = std::unique_ptr<ITransport> (*)(
|
using CreateFn = std::unique_ptr<ITransport> (*)(
|
||||||
@@ -117,8 +117,7 @@ private:
|
|||||||
bool syncPending = false;
|
bool syncPending = false;
|
||||||
bool recoveryPending = false;
|
bool recoveryPending = false;
|
||||||
RecoveryUpdate recovery;
|
RecoveryUpdate recovery;
|
||||||
FrameMemoryLimits limits;
|
std::shared_ptr<const FrameCaps> frameCaps;
|
||||||
bool limitsValid = false;
|
|
||||||
DirectFrameBufferMemory directMemory;
|
DirectFrameBufferMemory directMemory;
|
||||||
bool directMemoryValid = false;
|
bool directMemoryValid = false;
|
||||||
std::shared_ptr<ITransport> exposedTransport;
|
std::shared_ptr<ITransport> exposedTransport;
|
||||||
@@ -183,7 +182,8 @@ public:
|
|||||||
uint64_t session, uint32_t serial, bool active,
|
uint64_t session, uint32_t serial, bool active,
|
||||||
Recovery state, uint32_t error);
|
Recovery state, uint32_t error);
|
||||||
|
|
||||||
FrameMemoryLimits GetMemoryLimits() const;
|
bool CanUseMode(const FrameMode& mode,
|
||||||
|
uint32_t * requiredSizeMiB = nullptr) const override;
|
||||||
DirectFrameBufferMemory GetDirectMemory() const;
|
DirectFrameBufferMemory GetDirectMemory() const;
|
||||||
|
|
||||||
IFrameTransport& Frames();
|
IFrameTransport& Frames();
|
||||||
|
|||||||
41
idd/LGIdd/transport/FrameCaps.h
Normal file
41
idd/LGIdd/transport/FrameCaps.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* Looking Glass
|
||||||
|
* Copyright © 2017-2026 The Looking Glass Authors
|
||||||
|
* https://looking-glass.io
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||||
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
struct FrameMode
|
||||||
|
{
|
||||||
|
uint32_t width = 0;
|
||||||
|
uint32_t height = 0;
|
||||||
|
uint32_t refreshMilliHz = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FrameCaps
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~FrameCaps() = default;
|
||||||
|
|
||||||
|
// A rejecting implementation may provide a minimum configured-capacity
|
||||||
|
// hint. Zero means that no useful size recommendation is available.
|
||||||
|
virtual bool CanUseMode(const FrameMode& mode,
|
||||||
|
uint32_t * requiredSizeMiB = nullptr) const = 0;
|
||||||
|
};
|
||||||
@@ -21,9 +21,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "transport/DirectFrameBufferMemory.h"
|
#include "transport/DirectFrameBufferMemory.h"
|
||||||
#include "transport/FrameMemoryLimits.h"
|
#include "transport/FrameCaps.h"
|
||||||
#include "transport/TransportConfig.h"
|
#include "transport/TransportConfig.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -89,7 +90,14 @@ public:
|
|||||||
virtual void RecoveryStatus(
|
virtual void RecoveryStatus(
|
||||||
uint64_t, uint32_t, bool, Recovery, uint32_t) {}
|
uint64_t, uint32_t, bool, Recovery, uint32_t) {}
|
||||||
|
|
||||||
virtual FrameMemoryLimits GetMemoryLimits() const = 0;
|
// Frame capabilities describe the configured instance, not transient
|
||||||
|
// runtime state. CanUseMode answers are immutable for the returned
|
||||||
|
// object's lifetime, and recreating an instance from the same descriptor
|
||||||
|
// must provide the same capability contract.
|
||||||
|
virtual std::shared_ptr<const FrameCaps> GetFrameCaps() const
|
||||||
|
{
|
||||||
|
return std::shared_ptr<const FrameCaps>();
|
||||||
|
}
|
||||||
virtual DirectFrameBufferMemory GetDirectMemory() const = 0;
|
virtual DirectFrameBufferMemory GetDirectMemory() const = 0;
|
||||||
|
|
||||||
// Component pointers are fixed after Setup and remain valid until Stop.
|
// Component pointers are fixed after Setup and remain valid until Stop.
|
||||||
|
|||||||
112
idd/LGIdd/transport/lgmp/CLGMPFrameCaps.cpp
Normal file
112
idd/LGIdd/transport/lgmp/CLGMPFrameCaps.cpp
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* Looking Glass
|
||||||
|
* Copyright © 2017-2026 The Looking Glass Authors
|
||||||
|
* https://looking-glass.io
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||||
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "transport/lgmp/CLGMPFrameCaps.h"
|
||||||
|
|
||||||
|
#include <d3d12.h>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
static const uint64_t FRAME_BYTES_PER_PIXEL = 4;
|
||||||
|
|
||||||
|
bool AlignUp(uint64_t value, uint64_t alignment, uint64_t& result)
|
||||||
|
{
|
||||||
|
if (!alignment || (alignment & (alignment - 1)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const uint64_t mask = alignment - 1;
|
||||||
|
if (value > (std::numeric_limits<uint64_t>::max)() - mask)
|
||||||
|
return false;
|
||||||
|
result = (value + mask) & ~mask;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CalculateFrameSize(
|
||||||
|
const FrameMode& mode, uint64_t& frameSize)
|
||||||
|
{
|
||||||
|
frameSize = 0;
|
||||||
|
if (!mode.width || !mode.height || !mode.refreshMilliHz)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint64_t pitch;
|
||||||
|
if (!AlignUp((uint64_t)mode.width * FRAME_BYTES_PER_PIXEL,
|
||||||
|
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT, pitch) ||
|
||||||
|
pitch > (std::numeric_limits<uint64_t>::max)() / mode.height)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
frameSize = pitch * mode.height;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t RecommendedSizeMiB(uint64_t requiredSize)
|
||||||
|
{
|
||||||
|
uint64_t sizeMiB = requiredSize / 1048576;
|
||||||
|
if (requiredSize % 1048576)
|
||||||
|
++sizeMiB;
|
||||||
|
|
||||||
|
uint64_t result = 1;
|
||||||
|
while (result < sizeMiB && result <= UINT32_MAX / 2)
|
||||||
|
result <<= 1;
|
||||||
|
return result < sizeMiB ? UINT32_MAX : (uint32_t)result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLGMPFrameCaps::CLGMPFrameCaps(uint64_t capacity,
|
||||||
|
uint64_t frameMemoryOffset, uint32_t bufferCount) :
|
||||||
|
m_capacity(capacity),
|
||||||
|
m_frameMemoryOffset(frameMemoryOffset),
|
||||||
|
m_bufferCount(bufferCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLGMPFrameCaps::CanUseMode(const FrameMode& mode,
|
||||||
|
uint32_t * requiredSizeMiB) const
|
||||||
|
{
|
||||||
|
if (requiredSizeMiB)
|
||||||
|
*requiredSizeMiB = 0;
|
||||||
|
|
||||||
|
const uint64_t alignment =
|
||||||
|
D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||||
|
uint64_t frameSize;
|
||||||
|
if (!m_frameMemoryOffset || !m_bufferCount ||
|
||||||
|
!CalculateFrameSize(mode, frameSize) ||
|
||||||
|
frameSize > (std::numeric_limits<uint64_t>::max)() - alignment)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint64_t frameAllocationSize;
|
||||||
|
uint64_t frameMemoryStart;
|
||||||
|
if (!AlignUp(frameSize + alignment, alignment,
|
||||||
|
frameAllocationSize) ||
|
||||||
|
!AlignUp(m_frameMemoryOffset, alignment, frameMemoryStart) ||
|
||||||
|
frameAllocationSize >
|
||||||
|
((std::numeric_limits<uint64_t>::max)() - frameMemoryStart) /
|
||||||
|
m_bufferCount)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const uint64_t requiredSize = frameMemoryStart +
|
||||||
|
frameAllocationSize * m_bufferCount;
|
||||||
|
if (requiredSize <= m_capacity)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (requiredSizeMiB)
|
||||||
|
*requiredSizeMiB = RecommendedSizeMiB(requiredSize);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -20,13 +20,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "transport/FrameCaps.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct FrameMemoryLimits
|
class CLGMPFrameCaps final : public FrameCaps
|
||||||
{
|
{
|
||||||
uint64_t capacity = 0;
|
private:
|
||||||
uint64_t frameMemoryOffset = 0;
|
uint64_t m_capacity;
|
||||||
uint64_t alignment = 0;
|
uint64_t m_frameMemoryOffset;
|
||||||
uint64_t maxFrameSize = 0;
|
uint32_t m_bufferCount;
|
||||||
unsigned bufferCount = 0;
|
|
||||||
|
public:
|
||||||
|
CLGMPFrameCaps(uint64_t capacity, uint64_t frameMemoryOffset,
|
||||||
|
uint32_t bufferCount);
|
||||||
|
|
||||||
|
bool CanUseMode(const FrameMode& mode,
|
||||||
|
uint32_t * requiredSizeMiB = nullptr) const override;
|
||||||
};
|
};
|
||||||
@@ -21,10 +21,13 @@
|
|||||||
#include "transport/lgmp/CLGMPFrameTransport.h"
|
#include "transport/lgmp/CLGMPFrameTransport.h"
|
||||||
|
|
||||||
#include "transport/lgmp/CIVSHMEM.h"
|
#include "transport/lgmp/CIVSHMEM.h"
|
||||||
|
#include "transport/lgmp/CLGMPFrameCaps.h"
|
||||||
#include "transport/lgmp/CLGMPHost.h"
|
#include "transport/lgmp/CLGMPHost.h"
|
||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4200)
|
#pragma warning(disable: 4200)
|
||||||
@@ -245,15 +248,11 @@ void CLGMPFrameTransport::DeInit()
|
|||||||
memset(m_frameOwnerQueue, 0, sizeof(m_frameOwnerQueue));
|
memset(m_frameOwnerQueue, 0, sizeof(m_frameOwnerQueue));
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameMemoryLimits CLGMPFrameTransport::GetMemoryLimits() const
|
std::shared_ptr<const FrameCaps> CLGMPFrameTransport::GetFrameCaps() const
|
||||||
{
|
{
|
||||||
FrameMemoryLimits limits;
|
return std::shared_ptr<const FrameCaps>(new (std::nothrow)
|
||||||
limits.capacity = m_ivshmem.GetUsableSize();
|
CLGMPFrameCaps(m_ivshmem.GetUsableSize(), m_frameMemoryOffset,
|
||||||
limits.frameMemoryOffset = m_frameMemoryOffset;
|
LGMP_Q_FRAME_BUFFER_LEN));
|
||||||
limits.alignment = m_alignSize;
|
|
||||||
limits.maxFrameSize = m_maxFrameSize;
|
|
||||||
limits.bufferCount = LGMP_Q_FRAME_BUFFER_LEN;
|
|
||||||
return limits;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLGMPFrameTransport::SubscriberSnapshot
|
CLGMPFrameTransport::SubscriberSnapshot
|
||||||
|
|||||||
@@ -33,9 +33,11 @@ extern "C" {
|
|||||||
#include "common/KVMFR.h"
|
#include "common/KVMFR.h"
|
||||||
#include "capture/CFrameScheduler.h"
|
#include "capture/CFrameScheduler.h"
|
||||||
#include "capture/FramePipeline.h"
|
#include "capture/FramePipeline.h"
|
||||||
#include "transport/FrameMemoryLimits.h"
|
#include "transport/FrameCaps.h"
|
||||||
#include "transport/IFrameSink.h"
|
#include "transport/IFrameSink.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class CIVSHMEM;
|
class CIVSHMEM;
|
||||||
class CLGMPHost;
|
class CLGMPHost;
|
||||||
class CLGMPTransport;
|
class CLGMPTransport;
|
||||||
@@ -151,7 +153,7 @@ private:
|
|||||||
void SealMemoryLayout();
|
void SealMemoryLayout();
|
||||||
bool Setup(size_t alignSize);
|
bool Setup(size_t alignSize);
|
||||||
void DeInit();
|
void DeInit();
|
||||||
FrameMemoryLimits GetMemoryLimits() const;
|
std::shared_ptr<const FrameCaps> GetFrameCaps() const;
|
||||||
SubscriberSnapshot SnapshotSubscribers() const;
|
SubscriberSnapshot SnapshotSubscribers() const;
|
||||||
void FinalizeSubscribers(
|
void FinalizeSubscribers(
|
||||||
const SubscriberSnapshot& snapshot, uint64_t now);
|
const SubscriberSnapshot& snapshot, uint64_t now);
|
||||||
|
|||||||
@@ -239,9 +239,9 @@ void CLGMPTransport::RecoveryStatus(
|
|||||||
session, serial, active, wireState, wireError);
|
session, serial, active, wireState, wireError);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameMemoryLimits CLGMPTransport::GetMemoryLimits() const
|
std::shared_ptr<const FrameCaps> CLGMPTransport::GetFrameCaps() const
|
||||||
{
|
{
|
||||||
return m_frames.GetMemoryLimits();
|
return m_frames.GetFrameCaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectFrameBufferMemory CLGMPTransport::GetDirectMemory() const
|
DirectFrameBufferMemory CLGMPTransport::GetDirectMemory() const
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
uint64_t session, uint32_t serial, bool active,
|
uint64_t session, uint32_t serial, bool active,
|
||||||
Recovery state, uint32_t error) override;
|
Recovery state, uint32_t error) override;
|
||||||
|
|
||||||
FrameMemoryLimits GetMemoryLimits() const override;
|
std::shared_ptr<const FrameCaps> GetFrameCaps() const override;
|
||||||
DirectFrameBufferMemory GetDirectMemory() const override;
|
DirectFrameBufferMemory GetDirectMemory() const override;
|
||||||
|
|
||||||
IFrameSink * FrameSink() override { return &m_frames; }
|
IFrameSink * FrameSink() override { return &m_frames; }
|
||||||
|
|||||||
@@ -320,11 +320,15 @@ void CNotifyWindow::handleResolutionRejected(uint32_t width, uint32_t height,
|
|||||||
nid.dwInfoFlags = NIIF_WARNING;
|
nid.dwInfoFlags = NIIF_WARNING;
|
||||||
StringCbCopy(nid.szInfoTitle, sizeof nid.szInfoTitle,
|
StringCbCopy(nid.szInfoTitle, sizeof nid.szInfoTitle,
|
||||||
L"Resolution change refused");
|
L"Resolution change refused");
|
||||||
StringCbPrintf(nid.szInfo, sizeof nid.szInfo,
|
if (requiredSizeMiB)
|
||||||
L"The requested resolution %ux%u does not fit in shared memory. "
|
StringCbPrintf(nid.szInfo, sizeof nid.szInfo,
|
||||||
L"Change the total IVSHMEM size to at least %u MiB.",
|
L"The requested resolution %ux%u requires at least %u MiB of "
|
||||||
width, height,
|
L"configured frame capacity.",
|
||||||
requiredSizeMiB);
|
width, height, requiredSizeMiB);
|
||||||
|
else
|
||||||
|
StringCbPrintf(nid.szInfo, sizeof nid.szInfo,
|
||||||
|
L"The requested resolution %ux%u is not supported by the current "
|
||||||
|
L"configuration.", width, height);
|
||||||
|
|
||||||
if (!Shell_NotifyIcon(NIM_MODIFY, &nid))
|
if (!Shell_NotifyIcon(NIM_MODIFY, &nid))
|
||||||
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_MODIFY)");
|
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_MODIFY)");
|
||||||
|
|||||||
Reference in New Issue
Block a user