Announcement

Collapse
No announcement yet.

AMDGPU DC Code Improvements Bring Better Page-Flipping

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    What is this? *Finally* freesync over hdmi?? Awesome!

    Comment


    • #12
      Originally posted by Azpegath View Post
      I'm running it on a R290, so I guess I'm an outlier
      AFAIK AMDGPU only officially supports GCN 1.2 or newer and the R290/390 is a GCN 1.1 part. When you use something that's technically, but not officially, supported issues like this are more or less to be expected. Having been out of production for several years there isn't even a business case for bothering to extend support and all of the work required to do so.
      "Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it."

      Comment


      • #13
        Originally posted by tildearrow View Post
        I have a question only partially related to page-flipping.

        Is it possible to disable Adaptive-VSync in Mesa? It seems to be always on and I've been unable to find a way to disable it... (by this I do not mean Adaptive-Sync AKA FreeSync, but rather the technique that disables VSync if the game is running too slow by not waiting for VBlank when swapping but rather doing so on the next command)
        That doesn't sound like any functionality Mesa has. Not sure what exactly you mean by "disables VSync if the game is running too slow by not waiting for VBlank when swapping but rather doing so on the next command" though, maybe try elaborating on the symptoms.

        Comment


        • #14
          Originally posted by L_A_G View Post

          AFAIK AMDGPU only officially supports GCN 1.2 or newer and the R290/390 is a GCN 1.1 part. When you use something that's technically, but not officially, supported issues like this are more or less to be expected. Having been out of production for several years there isn't even a business case for bothering to extend support and all of the work required to do so.
          Yes, that is my take on it as well. I'm glad that dc seems to work quite well at least.

          Comment


          • #15
            Hopefully AMD will make some sort of official control center to configure displays some day like there is on Windows. Getting multiple monitors to work and work at the correct refresh rates, color bit depths, and resolutions is like playing musical chairs with DP and HDMI cables.

            *plug in display*
            "Did it work? No. Not this time."
            *unplug display, plug in display*
            "Did it work? It's the right resolution this time at least but it's cropping half the logical desktop space. Try again I guess."
            *unplug display, plug in display*
            "Did it work? Nope, just black this time."
            *and so on*
            Last edited by Particle; 01-23-2019, 11:01 AM.

            Comment


            • #16
              Originally posted by Azpegath View Post

              I read through your bug report, and perhaps you are able to speed up the process by bisecting the issue. I know it's a hassle to constantly rebuild the kernel and reboot (I've done it once, and am not longing to do it again), but it will help the devs a lot. Have you tried bisecting before, or would you like some info on it?
              Thanks but for the moment I have 2 easy workarounds available and I just have no time to learn bisecting. Kids, job, kids, sleep, kids, job, kids, sleep - you know the drill

              Comment


              • #17
                Originally posted by xception View Post

                I believe it's vblank_mode=0 before the commandline.
                just "glxgears" as command gives me "301 frames in 5.0 seconds = 60.001 FPS"
                while "vblank_mode=0 glxgears" outputs after a warning "101447 frames in 5.0 seconds = 20289.314 FPS"
                There is a second switch in xorg.conf, for the old radeon driver it was:
                Option "swapbufferswait" "0"
                I don't know what the equivalent is for amdgpu or if it's needed at all
                you can add vblank_mode=0 to your environment so all applications start in that mode if you prefer
                vblank_mode=0 disables Vsync...
                What I want is true VSync without Adaptive.

                Comment


                • #18
                  Originally posted by tildearrow View Post

                  vblank_mode=0 disables Vsync...
                  What I want is true VSync without Adaptive.
                  Have you tried adding Option "VariableRefresh" "off" to your 10-amdgpu.conf ? Located in usr/share/xorg.conf.d
                  My monitor is too old and doesn't support freesync bad things happen with openmw if it's set to auto or on

                  Code:
                  [ 1721.038384] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:47:crtc-0] flip_done timed out
                  [ 1731.278388] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:59:DP-1] flip_done timed out
                  [ 1741.518282] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:45:plane-5] flip_done timed out
                  [ 1751.758165] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:46:plane-6] flip_done timed out
                  [ 1751.758370] [drm:amdgpu_dm_atomic_commit_tail [amdgpu]] *ERROR* amdgpu_dm_commit_planes: acrtc 0, already busy
                  [ 1751.758630] WARNING: CPU: 2 PID: 1387 at drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4859 amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1751.758632] Modules linked in: rfcomm cmac bnep binfmt_misc nls_iso8859_1 pktcdvd edac_mce_amd snd_hda_codec_realtek btusb snd_hda_codec_generic kvm_amd ledtrig_audio ccp snd_
                  hda_codec_hdmi btrtl eeepc_wmi btbcm kvm btintel snd_hda_intel snd_seq_dummy bluetooth asus_wmi snd_hda_codec irqbypass snd_seq_oss joydev input_leds sparse_keymap video snd_hda_
                  core snd_seq_midi snd_hwdep ecdh_generic wmi_bmof snd_seq_midi_event snd_pcm snd_rawmidi k10temp fam15h_power snd_seq snd_seq_device snd_timer snd soundcore ip6t_REJECT nf_reject
                  _ipv6 mac_hid nf_log_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 nf_log_ipv4 nf_log_common xt_LOG xt_limit xt_tcpudp xt_addrtype xt_conntrack ip6table_filter ip6_tables nf_connt
                  rack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp sch_fq_codel nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter parport_pc bpfilter ppdev lp parp
                  ort ip_tables x_tables autofs4 btrfs zstd_compress algif_skcipher af_alg dm_crypt raid10 raid456 async_raid6_recov
                  [ 1751.758686]  async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear dm_mirror dm_region_hash dm_log hid_generic usbhid hid amdgpu crct10d
                  if_pclmul crc32_pclmul ghash_clmulni_intel chash amd_iommu_v2 aesni_intel gpu_sched i2c_algo_bit ttm drm_kms_helper syscopyarea aes_x86_64 sysfillrect crypto_simd sysimgblt crypt
                  d fb_sys_fops mxm_wmi glue_helper drm e1000e i2c_piix4 ahci libahci wmi
                  [ 1751.758720] CPU: 2 PID: 1387 Comm: InputThread Not tainted 5.0.0-994-lowlatency #201901171655
                  [ 1751.758722] Hardware name: To be filled by O.E.M. To be filled by O.E.M./CROSSHAIR V FORMULA-Z, BIOS 2201 03/23/2015
                  [ 1751.758889] RIP: 0010:amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1751.758892] Code: 49 8b 47 08 e9 0e fc ff ff 41 8b 96 d0 04 00 00 48 c7 c6 50 21 5a c0 48 c7 c7 66 62 60 c0 48 89 85 48 ff ff ff e8 03 1c d7 ff <0f> 0b 48 8b 85 48 ff ff ff 4c
                  8b 5d a8 48 8b 4d b0 e9 3f fb ff ff
                  [ 1751.758894] RSP: 0018:ffffb61802b6b918 EFLAGS: 00010046
                  [ 1751.758897] RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000000006
                  [ 1751.758899] RDX: 0000000000000000 RSI: 0000000000000082 RDI: ffff8f4f2ea96440
                  [ 1751.758901] RBP: ffffb61802b6b9d0 R08: 0000000000000509 R09: ffffffff9a161474
                  [ 1751.758903] R10: 0000000000000072 R11: ffffb61802b6b720 R12: ffff8f4f1d466800
                  [ 1751.758905] R13: ffff8f4f202a0f00 R14: ffff8f4f1d466800 R15: ffff8f4f25e24b00
                  [ 1751.758908] FS:  00007f9260b3f700(0000) GS:ffff8f4f2ea80000(0000) knlGS:0000000000000000
                  [ 1751.758910] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
                  [ 1751.758912] CR2: 0000218920d2d000 CR3: 0000000423f56000 CR4: 00000000000406e0
                  [ 1751.758915] Call Trace:
                  [ 1751.758938]  commit_tail+0x42/0x70 [drm_kms_helper]
                  [ 1751.758957]  drm_atomic_helper_commit+0x113/0x120 [drm_kms_helper]
                  [ 1751.759123]  amdgpu_dm_atomic_commit+0x8d/0xa0 [amdgpu]
                  [ 1751.759166]  drm_atomic_commit+0x4a/0x50 [drm]
                  [ 1751.759184]  drm_atomic_helper_update_plane+0xe9/0x100 [drm_kms_helper]
                  [ 1751.759217]  __setplane_atomic+0xd6/0x120 [drm]
                  [ 1751.759251]  drm_mode_cursor_universal+0x145/0x270 [drm]
                  [ 1751.759287]  drm_mode_cursor_common+0x18f/0x200 [drm]
                  [ 1751.759292]  ? __switch_to_asm+0x40/0x70
                  [ 1751.759326]  ? drm_mode_setplane+0x2a0/0x2a0 [drm]
                  [ 1751.759359]  drm_mode_cursor_ioctl+0x4a/0x60 [drm]
                  [ 1751.759389]  drm_ioctl_kernel+0xad/0xf0 [drm]
                  [ 1751.759420]  drm_ioctl+0x233/0x410 [drm]
                  [ 1751.759453]  ? drm_mode_setplane+0x2a0/0x2a0 [drm]
                  [ 1751.759460]  ? dput.part.33+0x56/0x140
                  [ 1751.759584]  amdgpu_drm_ioctl+0x4f/0x80 [amdgpu]
                  [ 1751.759590]  do_vfs_ioctl+0xa9/0x640
                  [ 1751.759595]  ? __fget+0x73/0xa0
                  [ 1751.759600]  ksys_ioctl+0x67/0x90
                  [ 1751.759605]  __x64_sys_ioctl+0x1a/0x20
                  [ 1751.759610]  do_syscall_64+0x5a/0x110
                  [ 1751.759613]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
                  [ 1751.759617] RIP: 0033:0x7f9293dee5d7
                  [ 1751.759620] Code: b3 66 90 48 8b 05 b1 48 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48
                  8b 0d 81 48 2d 00 f7 d8 64 89 01 48
                  [ 1751.759622] RSP: 002b:00007f9260b3d348 EFLAGS: 00003246 ORIG_RAX: 0000000000000010
                  [ 1751.759625] RAX: ffffffffffffffda RBX: 000055ce5bc60ee0 RCX: 00007f9293dee5d7
                  [ 1751.759627] RDX: 00007f9260b3d380 RSI: 00000000c01c64a3 RDI: 0000000000000017
                  [ 1751.759629] RBP: 00007f9260b3d380 R08: 0000000000000001 R09: 0000000000000780
                  [ 1751.759630] R10: 000055ce5c1456a0 R11: 0000000000003246 R12: 00000000c01c64a3
                  [ 1751.759632] R13: 0000000000000017 R14: 000000000000042d R15: 0000000000000000
                  [ 1751.759801] WARNING: CPU: 2 PID: 1387 at drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4859 amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1751.759803] ---[ end trace 5e694e35567e4fe9 ]---
                  [ 1770.701897] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:47:crtc-0] flip_done timed out
                  [ 1780.941714] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:59:DP-1] flip_done timed out
                  [ 1791.181507] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:45:plane-5] flip_done timed out
                  [ 1801.421313] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:46:plane-6] flip_done timed out
                  [ 1801.421512] [drm:amdgpu_dm_atomic_commit_tail [amdgpu]] *ERROR* amdgpu_dm_commit_planes: acrtc 0, already busy
                  [ 1801.421772] WARNING: CPU: 0 PID: 1387 at drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4859 amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1801.421774] Modules linked in: rfcomm cmac bnep binfmt_misc nls_iso8859_1 pktcdvd edac_mce_amd snd_hda_codec_realtek btusb snd_hda_codec_generic kvm_amd ledtrig_audio ccp snd_
                  hda_codec_hdmi btrtl eeepc_wmi btbcm kvm btintel snd_hda_intel snd_seq_dummy bluetooth asus_wmi snd_hda_codec irqbypass snd_seq_oss joydev input_leds sparse_keymap video snd_hda_
                  core snd_seq_midi snd_hwdep ecdh_generic wmi_bmof snd_seq_midi_event snd_pcm snd_rawmidi k10temp fam15h_power snd_seq snd_seq_device snd_timer snd soundcore ip6t_REJECT nf_reject
                  _ipv6 mac_hid nf_log_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 nf_log_ipv4 nf_log_common xt_LOG xt_limit xt_tcpudp xt_addrtype xt_conntrack ip6table_filter ip6_tables nf_connt
                  rack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp sch_fq_codel nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter parport_pc bpfilter ppdev lp parp
                  ort ip_tables x_tables autofs4 btrfs zstd_compress algif_skcipher af_alg dm_crypt raid10 raid456 async_raid6_recov
                  [ 1801.421829]  async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear dm_mirror dm_region_hash dm_log hid_generic usbhid hid amdgpu crct10d
                  if_pclmul crc32_pclmul ghash_clmulni_intel chash amd_iommu_v2 aesni_intel gpu_sched i2c_algo_bit ttm drm_kms_helper syscopyarea aes_x86_64 sysfillrect crypto_simd sysimgblt crypt
                  d fb_sys_fops mxm_wmi glue_helper drm e1000e i2c_piix4 ahci libahci wmi
                  [ 1801.421863] CPU: 0 PID: 1387 Comm: InputThread Tainted: G        W         5.0.0-994-lowlatency #201901171655
                  [ 1801.421865] Hardware name: To be filled by O.E.M. To be filled by O.E.M./CROSSHAIR V FORMULA-Z, BIOS 2201 03/23/2015
                  [ 1801.422030] RIP: 0010:amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1801.422034] Code: 49 8b 47 08 e9 0e fc ff ff 41 8b 96 d0 04 00 00 48 c7 c6 50 21 5a c0 48 c7 c7 66 62 60 c0 48 89 85 48 ff ff ff e8 03 1c d7 ff <0f> 0b 48 8b 85 48 ff ff ff 4c
                  8b 5d a8 48 8b 4d b0 e9 3f fb ff ff
                  [ 1801.422036] RSP: 0018:ffffb61802b6b918 EFLAGS: 00010046
                  [ 1801.422039] RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000000006
                  [ 1801.422041] RDX: 0000000000000000 RSI: 0000000000000082 RDI: ffff8f4f2ea16440
                  [ 1801.422043] RBP: ffffb61802b6b9d0 R08: 000000000000053f R09: ffffffff9a162a64
                  [ 1801.422045] R10: 0000000000000072 R11: ffffb61802b6b720 R12: ffff8f4f1d466800
                  [ 1801.422047] R13: ffff8f4f202a0f00 R14: ffff8f4f1d466800 R15: ffff8f4f25e24280
                  [ 1801.422050] FS:  00007f9260b3f700(0000) GS:ffff8f4f2ea00000(0000) knlGS:0000000000000000
                  [ 1801.422052] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
                  [ 1801.422054] CR2: 00003e4897d48000 CR3: 0000000423f56000 CR4: 00000000000406f0
                  [ 1801.422056] Call Trace:
                  [ 1801.422080]  commit_tail+0x42/0x70 [drm_kms_helper]
                  [ 1801.422098]  drm_atomic_helper_commit+0x113/0x120 [drm_kms_helper]
                  [ 1801.422263]  amdgpu_dm_atomic_commit+0x8d/0xa0 [amdgpu]
                  [ 1801.422305]  drm_atomic_commit+0x4a/0x50 [drm]
                  [ 1801.422323]  drm_atomic_helper_update_plane+0xe9/0x100 [drm_kms_helper]
                  [ 1801.422356]  __setplane_atomic+0xd6/0x120 [drm]
                  [ 1801.422390]  drm_mode_cursor_universal+0x145/0x270 [drm]
                  [ 1801.422426]  drm_mode_cursor_common+0x18f/0x200 [drm]
                  [ 1801.422431]  ? __switch_to_asm+0x40/0x70
                  [ 1801.422465]  ? drm_mode_setplane+0x2a0/0x2a0 [drm]
                  [ 1801.422498]  drm_mode_cursor_ioctl+0x4a/0x60 [drm]
                  [ 1801.422528]  drm_ioctl_kernel+0xad/0xf0 [drm]
                  [ 1801.422559]  drm_ioctl+0x233/0x410 [drm]
                  [ 1801.422591]  ? drm_mode_setplane+0x2a0/0x2a0 [drm]
                  [ 1801.422598]  ? dput.part.33+0x56/0x140
                  [ 1801.422722]  amdgpu_drm_ioctl+0x4f/0x80 [amdgpu]
                  [ 1801.422728]  do_vfs_ioctl+0xa9/0x640
                  [ 1801.422733]  ? __fget+0x73/0xa0
                  [ 1801.422738]  ksys_ioctl+0x67/0x90
                  [ 1801.422743]  __x64_sys_ioctl+0x1a/0x20
                  [ 1801.422748]  do_syscall_64+0x5a/0x110
                  [ 1801.422751]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
                  [ 1801.422754] RIP: 0033:0x7f9293dee5d7
                  [ 1801.422758] Code: b3 66 90 48 8b 05 b1 48 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48
                  8b 0d 81 48 2d 00 f7 d8 64 89 01 48
                  [ 1801.422760] RSP: 002b:00007f9260b3d348 EFLAGS: 00003246 ORIG_RAX: 0000000000000010
                  [ 1801.422763] RAX: ffffffffffffffda RBX: 000055ce5bc60ee0 RCX: 00007f9293dee5d7
                  [ 1801.422765] RDX: 00007f9260b3d380 RSI: 00000000c01c64a3 RDI: 0000000000000017
                  [ 1801.422767] RBP: 00007f9260b3d380 R08: 0000000000000001 R09: 0000000000000780
                  [ 1801.422768] R10: 000055ce5c1456a0 R11: 0000000000003246 R12: 00000000c01c64a3
                  [ 1801.422770] R13: 0000000000000017 R14: 0000000000000511 R15: 0000000000000000
                  [ 1801.422940] WARNING: CPU: 0 PID: 1387 at drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4859 amdgpu_dm_atomic_commit_tail+0xa0d/0xba0 [amdgpu]
                  [ 1801.422942] ---[ end trace 5e694e35567e4fea ]---

                  Comment


                  • #19
                    Woa, tested merging 5.1-wip+this patch series into my torvalds 5.0.0-rc3 build. Took me some effort to get the merging right but seems to be working fine. I'm pretty sure I have less input latency than before now, and vsynctester stopped spiking when I switch windows, really cool improvements. Sad that its too late for 5.0, I'll have to hack kernels around until 5.1 as always :P

                    edit: freesync is also smoother at least in unigine-valley

                    Comment


                    • #20
                      Originally posted by MrCooper View Post
                      That doesn't sound like any functionality Mesa has. Not sure what exactly you mean by "disables VSync if the game is running too slow by not waiting for VBlank when swapping but rather doing so on the next command" though, maybe try elaborating on the symptoms.
                      Mesa does have that functionality since 2013 (https://phoronix.com/scan.php?page=news_item&px=MTU0NDE), and at some point in time it became a permanent default.

                      Sure. I'll explain.

                      ​​​​​​The draw procedure of an application goes like this:

                      1. clear
                      2. draw
                      3. present (AKA swap buffers)

                      If VSync is on, in a proper driver, present must wait until the vertical blank has been reached, and then swap buffers.

                      Code:
                      A display frame (in this example, rate 50Hz (period 20ms)):
                      Every line indicates a millisecond
                      L GPU              CPU
                      @ *Pre-VBlank*     Update Logic (CPU) (e.g. 4ms)
                      |                  .
                      |                  .
                      | *Visible Raster* .
                      |                  Clear (e.g. 1ms)
                      | .                Draw (e.g. 6ms)
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      |                  SwapBuffers is requested here
                      | |
                      | |
                      | | The driver
                      | | waits for
                      | | VBlank
                      | *Post-VBlank*    <- SwapBuffers happens here
                      |                  (rest of actions)
                      |                  .
                      However, if we spend too much time in a frame, it will halve our FPS:

                      Code:
                      L GPU              CPU
                      @ *Pre-VBlank*     Update Logic (CPU) (e.g. 4ms)
                      |                  .
                      |                  .
                      | *Visible Raster* .
                      |                  Clear (e.g. 1ms)
                      | .                Draw (e.g. 23ms)
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | *Post-VBlank*    .
                      | .                .
                      | .                .
                      @ *Pre-VBlank*     .
                      | .                .
                      | .                .
                      | *Visible Raster* .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | |                SwapBuffers is requested here
                      | | Driver waits
                      | | for VBlank
                      | |
                      | |
                      | |
                      | |
                      | |
                      | |
                      | *Post-VBlank*    <- SwapBuffers happens here
                      |                  (rest of actions)
                      |                  .
                      In order to fix this "problem", NVIDIA invented Adaptive-VSync, and then this method was ported to Mesa.

                      This way we no longer wait for VSync when swapping buffers, but rather put the frame in a "queue" that will be popped on the next VBlank.
                      The wait only happens if you send another command (e.g. clear).

                      Code:
                      L GPU              CPU
                      @ *Pre-VBlank*     Update Logic (CPU) (e.g. 4ms)
                      |                  .
                      |                  .
                      | *Visible Raster* .
                      |                  Clear (e.g. 1ms)
                      | .                Draw (e.g. 6ms)
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      | .                .
                      |                  SwapBuffers happens right here
                      | Frame remains    Update Logic (CPU)
                      | in a queue       .
                      | and returns      .
                      | immediately      .
                      |                  Clear
                      | *Post-VBlank*    Draw      
                      | Popped from      .
                      | queue            .
                      However, this is undesirable for applications like compositors and UI toolkits with animation, as it will prevent us from knowing when do we exactly hit VBlank.

                      (If you're wondering why do we want to know when does VBlank happen, it's for lag reduction techniques)

                      Furthermore in Mesa's implementation the catch-up issue appears.

                      Code:
                      Display    | Machine
                      frame 0    | frame 0
                      frame 1    | frame 1
                      frame 2    | frame 2
                      frame 3    | say we lag here for ~250ms
                      frame 4    | frame 2
                      frame 5    | .
                      frame 6    | .
                      frame 7    | .
                      frame 8    | .
                      frame 9    | .
                      frame 10   | .
                      frame 11   | .
                      frame 12   | .
                      frame 13   | .
                      frame 14   | .
                      frame 15   | .
                      frame 16   | .
                      frame 17   | .
                      frame 18   | frame 2 frame 3 frame 4 frame \
                      frame 19   | 5 frame 6 frame 7 frame 8 fra |
                      frame 20   | me 9 frame 10 frame 11 frame  |
                      frame 21   | 12 frame 13 frame 14 frame 15 | Catch-up
                      frame 22   | frame 16 frame 17 frame 18 fr |
                      frame 23   | ame 19 frame 20 frame 21 fram |
                      frame 24   | e 22 frame 23 frame 24        /
                      frame 25   | frame 25
                      frame 26   | frame 26
                      frame 27   | frame 27
                      frame 28   | frame 28
                      frame 29   | frame 29
                      In other words, say I make an application that intentionally waits 500ms after rendering 30 frames of a spinning triangle.

                      Under a proper driver, this would happen:

                      (60Hz display)

                      1. Triangle rotates for 0.5s
                      2. Triangle stops rotating and application waits 0.5s
                      3. Triangle continues rotating for 0.5s
                      4. Triangle stops rotating and application waits 0.5s
                      5. Loop from 1

                      However, under Mesa, this happens:

                      1. Triangle rotates for 0.5s
                      2. Triangle stops rotating and application waits 0.5s
                      3. Triangle suddenly skips to a different rotation
                      4. Application waits 0.5s
                      5. Triangle suddenly skips to a different rotation
                      6. Application waits 0.5s
                      7. Loop from 3

                      (sorry for the crude explanation... I'll post a GIF soon)

                      How can I stop this behavior and go back to the good old true waiting VSync?
                      Last edited by tildearrow; 01-23-2019, 02:05 PM.

                      Comment

                      Working...
                      X