summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel van Vugt <vanvugt@gmail.com>2016-05-31 09:18:55 (GMT)
committerRobert Ancell <robert.ancell@canonical.com>2016-05-31 22:25:31 (GMT)
commit4003bec9f46c725b840f6da05936add439d85ad2 (patch)
treeef409d1d46b59ad549eef2e8418fff84c03f29ed
parentf0336d939303330f473804db1183b1c3ca4c61a5 (diff)
Implement fake GLX frame notification/timing.
In theory this should fix GLX apps that rely on it but in practice nothing I use seems to be improving yet.
-rw-r--r--hw/xmir/xmir-dri2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hw/xmir/xmir-dri2.c b/hw/xmir/xmir-dri2.c
index b24d4b9..e1d02f0 100644
--- a/hw/xmir/xmir-dri2.c
+++ b/hw/xmir/xmir-dri2.c
@@ -489,10 +489,16 @@ xmir_dri2_swap_limit_validate(DrawablePtr draw, int swap_limit)
static int xmir_dri_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
{
- /* TODO: Implement this?
- * At least doing nothing like this is enough to shut up Chromium
- * error messages.
- */
+ /* TODO: Implement this properly after Mir implements it. */
+ const uint64_t now_us = GetTimeInMicros();
+ const uint64_t fake_frame_rate_hz = 60;
+ const uint64_t fake_frame_time_us = 1000000 / fake_frame_rate_hz;
+ const uint64_t fake_msc = now_us / fake_frame_time_us;
+ const uint64_t fake_ust = fake_msc * fake_frame_time_us;
+ if (ust)
+ *(uint64_t*)ust = fake_ust;
+ if (msc)
+ *(uint64_t*)msc = fake_msc;
return Success;
}