summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Höglund <fredrik@kde.org>2015-09-10 23:33:20 +0200
committerAdam Jackson <ajax@redhat.com>2015-09-30 16:06:26 -0400
commitf6ce23fbfc8804204fa103f98b94478387b94040 (patch)
tree81623913cf5061f5c44436401cb84711a8a59800
parentc1f5f9022f31ca4d662cc125fa80cb25386da6d1 (diff)
present: Don't stash the MSC value when present_get_ust_msc fails
Otherwise we stash an uninitalized value, and later use it to compute the msc_offset for the window. Also initialize ust and crtc_msc so we never use uninitalized values when present_get_ust_msc fails. This fixes clients getting stuck waiting indefinitely for an idle event when a CRTC is turned off. Signed-off-by: Fredrik Höglund <fredrik@kde.org> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--present/present.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/present/present.c b/present/present.c
index a6346015e..7ddffbd28 100644
--- a/present/present.c
+++ b/present/present.c
@@ -710,9 +710,9 @@ present_pixmap(WindowPtr window,
present_notify_ptr notifies,
int num_notifies)
{
- uint64_t ust;
+ uint64_t ust = 0;
uint64_t target_msc;
- uint64_t crtc_msc;
+ uint64_t crtc_msc = 0;
int ret;
present_vblank_ptr vblank, tmp;
ScreenPtr screen = window->drawable.pScreen;
@@ -734,13 +734,15 @@ present_pixmap(WindowPtr window,
target_crtc = present_get_crtc(window);
}
- present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
+ ret = present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc);
- /* Stash the current MSC away in case we need it later
- */
- window_priv->msc = crtc_msc;
+ if (ret == Success) {
+ /* Stash the current MSC away in case we need it later
+ */
+ window_priv->msc = crtc_msc;
+ }
/* Adjust target_msc to match modulus
*/