mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-24 12:38:10 +00:00
[client] wayland: do not crash when presentation time is unavailable
We don't need the presentation time protocol, so fail gracefully when it's unavailable.
This commit is contained in:
parent
26f16a3734
commit
3f7261d7d9
1 changed files with 10 additions and 3 deletions
|
@ -80,17 +80,21 @@ static const struct wp_presentation_feedback_listener presentationFeedbackListen
|
||||||
};
|
};
|
||||||
|
|
||||||
bool waylandPresentationInit(void)
|
bool waylandPresentationInit(void)
|
||||||
|
{
|
||||||
|
if (wlWm.presentation)
|
||||||
{
|
{
|
||||||
wlWm.photonTimings = ringbuffer_new(256, sizeof(float));
|
wlWm.photonTimings = ringbuffer_new(256, sizeof(float));
|
||||||
wlWm.photonGraph = app_registerGraph("PHOTON", wlWm.photonTimings);
|
wlWm.photonGraph = app_registerGraph("PHOTON", wlWm.photonTimings);
|
||||||
|
|
||||||
if (wlWm.presentation)
|
|
||||||
wp_presentation_add_listener(wlWm.presentation, &presentationListener, NULL);
|
wp_presentation_add_listener(wlWm.presentation, &presentationListener, NULL);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void waylandPresentationFree(void)
|
void waylandPresentationFree(void)
|
||||||
{
|
{
|
||||||
|
if (!wlWm.presentation)
|
||||||
|
return;
|
||||||
|
|
||||||
wp_presentation_destroy(wlWm.presentation);
|
wp_presentation_destroy(wlWm.presentation);
|
||||||
app_unregisterGraph(wlWm.photonGraph);
|
app_unregisterGraph(wlWm.photonGraph);
|
||||||
ringbuffer_free(&wlWm.photonTimings);
|
ringbuffer_free(&wlWm.photonTimings);
|
||||||
|
@ -98,6 +102,9 @@ void waylandPresentationFree(void)
|
||||||
|
|
||||||
void waylandPresentationFrame(void)
|
void waylandPresentationFrame(void)
|
||||||
{
|
{
|
||||||
|
if (!wlWm.presentation)
|
||||||
|
return;
|
||||||
|
|
||||||
struct FrameData * data = malloc(sizeof(struct FrameData));
|
struct FrameData * data = malloc(sizeof(struct FrameData));
|
||||||
if (clock_gettime(wlWm.clkId, &data->sent))
|
if (clock_gettime(wlWm.clkId, &data->sent))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue