steamcompmgr: Handle dummy overlay plane scale for external displays

Fixes that stutter on external displays.
This commit is contained in:
Joshua Ashton 2023-11-16 00:41:51 +00:00
parent fe3dbc6ba6
commit 444bbc61a8
3 changed files with 16 additions and 10 deletions

View file

@ -2738,11 +2738,15 @@ std::shared_ptr<CVulkanTexture> vulkan_create_debug_blank_texture()
flags.bSampled = true;
flags.bTransferDst = true;
auto texture = std::make_shared<CVulkanTexture>();
assert( texture->BInit( g_nOutputWidth, g_nOutputHeight, 1u, VulkanFormatToDRM( VK_FORMAT_B8G8R8A8_UNORM ), flags ) );
// To match Steam's scaling, which is capped at 1080p
int width = std::min<int>( g_nOutputWidth, 1920 );
int height = std::min<int>( g_nOutputHeight, 1080 );
void* dst = g_device.uploadBufferData( g_nOutputWidth * g_nOutputHeight * 4 );
memset( dst, 0x0, g_nOutputWidth * g_nOutputHeight * 4 );
auto texture = std::make_shared<CVulkanTexture>();
assert( texture->BInit( width, height, 1u, VulkanFormatToDRM( VK_FORMAT_B8G8R8A8_UNORM ), flags ) );
void* dst = g_device.uploadBufferData( width * height * 4 );
memset( dst, 0x0, width * height * 4 );
auto cmdBuffer = g_device.commandBuffer();
cmdBuffer->copyBufferToImage(g_device.uploadBuffer(), 0, 0, texture);

View file

@ -717,7 +717,7 @@ public:
return ret;
}
static const uint32_t upload_buffer_size = 1024 * 1024 * 4;
static const uint32_t upload_buffer_size = 1920 * 1080 * 4;
inline VkDevice device() { return m_device; }
inline VkPhysicalDevice physDev() {return m_physDev; }
@ -738,7 +738,7 @@ public:
inline void *uploadBufferData(uint32_t size)
{
assert(size < upload_buffer_size);
assert(size <= upload_buffer_size);
m_uploadBufferOffset = align(m_uploadBufferOffset, 16);
if (m_uploadBufferOffset + size > upload_buffer_size)

View file

@ -2548,8 +2548,10 @@ paint_all(bool async)
FrameInfo_t::Layer_t *layer = &frameInfo.layers[ curLayer ];
layer->scale.x = 1.0f;
layer->scale.y = 1.0f;
auto tex = vulkan_get_hacky_blank_texture();
layer->scale.x = g_nOutputWidth == tex->width() ? 1.0f : tex->width() / (float)g_nOutputWidth;
layer->scale.y = g_nOutputHeight == tex->height() ? 1.0f : tex->height() / (float)g_nOutputHeight;
layer->offset.x = 0.0f;
layer->offset.y = 0.0f;
layer->opacity = 1.0f; // BLAH
@ -2558,8 +2560,8 @@ paint_all(bool async)
layer->colorspace = GAMESCOPE_APP_TEXTURE_COLORSPACE_LINEAR;
layer->ctm = nullptr;
layer->tex = vulkan_get_hacky_blank_texture();
layer->fbid = layer->tex->fbid();
layer->tex = tex;
layer->fbid = tex->fbid();
layer->filter = GamescopeUpscaleFilter::NEAREST;
layer->blackBorder = true;