Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible deadlock in monitor layer #874

Open
TonyBarbour opened this issue Aug 9, 2019 · 2 comments
Open

Possible deadlock in monitor layer #874

TonyBarbour opened this issue Aug 9, 2019 · 2 comments
Labels
Project - monitor layer Monitor Layer Issues

Comments

@TonyBarbour
Copy link
Contributor

Because the LUNARG_monitor layer calls SetWindowText at present time, it will block until the thread processing window events processes the message. If that thread is blocked waiting for present to finish, there is deadlock.

A possible solution would be to avoid the call to SetWindowText and render the FPS measurement directly into the present buffer (see the overlay sample in VulkanSamples). The problem was that rendering the FPS using the method in the overlay sample affected the FPS seen by high frame rate Vulkan apps. Finding a low overhead means of rendering the FPS into the present buffer or an overlay buffer would be one way to avoid the possible deadlock.

@KarenGhavam-lunarG KarenGhavam-lunarG added the Project - monitor layer Monitor Layer Issues label Jun 12, 2020
@martty
Copy link

martty commented Jul 30, 2022

I encountered this deadlock today, is there no alternative way to change the window title that is not susceptible to deadlocking?

@charles-lunarg
Copy link
Contributor

I believe the crux of the problem is that GetWindowText is a thinly veiled SendMessage(WM_GETTEXT) which only returns when the message pump has processed the message, hence the deadlock. It may be possible to send such a request to the message queue and setup a callback.

Issue with this fix is simply "is it worth fixing versus rewriting the layer entirely?". The layer is very simple, which makes it nice as a quick & dirty FPS monitor, but it could contain breakdown of the FPS, frametime, variance, and all sorts of other features that the current monitor layer just can't do with a single titlebar. But of course, who's going to do that? Do other layers exists that do similar things, and should those layers be preferred? (aka shipped in the SDK). I don't have answers to those questions, only a vague gesturing towards "never enough time to do everything you want".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project - monitor layer Monitor Layer Issues
Projects
None yet
Development

No branches or pull requests

4 participants