On Wed, 12 Feb 2020 13:23:28 +0200 Pekka Paalanen <ppaala...@gmail.com> said:
> On Wed, 12 Feb 2020 11:07:56 +0000 > Carsten Haitzler <ras...@rasterman.com> wrote: > > > On Wed, 12 Feb 2020 12:40:15 +0200 Pekka Paalanen <ppaala...@gmail.com> > > said: > > > > > On Wed, 12 Feb 2020 10:21:02 +0000 > > > Carsten Haitzler (The Rasterman) <ras...@rasterman.com> wrote: > > > > > > > even better - if the /dev/dri/card0 > > > > device exists, dlopen libdrm and get some symbols from it and ... use > > > > it to request the drm device sent you vsync events so you can use the > > > > vsync interrupt as your frame event. this will be another fd to listen > > > > on in select() and of course you can turn this vblank event stream on > > > > and off. > > > > > > Please don't. Talk to the X server instead. > > > > and what vsync events does the xserver provide? > > You don't want vsync events. You have no idea what they > correspond to, or even if you opened the right device. > > https://gitlab.freedesktop.org/xorg/proto/xorgproto/blob/master/presentproto.txt I wrote the drm support before the present extension existed. The drm path is easy to support - only open if a single card exists (if multiple - don't do it and fall back to timer based animation) and you can filter for multiple screens as you get events for all screens. Yes - you end up syncing with a single chosen screen if you filter for just one of the vblank events, but it's better than using the system clock. At least you're synced to SOMETHING related to the display and it's a lot better than a client-side arbitrary clock. At least I did it also with timeouts that handle if the vsync events don't get produced and then there is a fallback to timer based ones. So you end up having something that works if you dot your i's and cross your t's. I have found x present XPresentNotifyMSC() to be unreliable where the drm back-door above is far more reliable. For example - on my amdgpu driver here it just refuses to produce any events (yes - extension is there), but at home it works on on my intel laptop it works. here i just get no present notifies at all but my drm back-door works. so i'd need to do the same probe, try, timeout and then fall back (and fall back to the drm path above and if that fails fall back to timer). -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- Carsten Haitzler - ras...@rasterman.com _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel