1. 28 Jul, 2013 1 commit
  2. 24 Jul, 2013 1 commit
  3. 22 Apr, 2013 1 commit
    • Siarhei Siamashka's avatar
      test: race condition on DRI2 buffers allocation when going fullscreen · d147e25f
      Siarhei Siamashka authored
      
      
      This test program exposes a problem related to window resizing
      (or going fullscreen), which is may happen exactly between "back"
      and "front" DRI2 buffers allocation.
      
      The xtrace log with some annotations:
      
      000:<:004c:  8: DRI2-Request(151,3): CreateDrawable drawable=0x02200001
      000:<:004d: 16: DRI2-Request(151,5): GetBuffers drawable=0x02200001 attachments={attachment=BackLeft(0x00000001)};
      000:>:004d:52: Reply to GetBuffers: width=480 height=480 buffers={attachment=BackLeft(0x00000001)
                                          name=0x00000157 pitch=1920 cpp=4 flags=0x00000000};
      
      Get the BackLeft buffer.
      
      000:<:004e:  4: Request(43): GetInputFocus
      000:>:004e:32: Reply to GetInputFocus: revert-to=PointerRoot(0x01) focus=0x02200001
      000:<:004f: 24: Request(16): InternAtom only-if-exists=false(0x00) name='_NET_WM_STATE'
      000:>:004f:32: Reply to InternAtom: atom=0xff("_NET_WM_STATE")
      000:<:0050: 32: Request(16): InternAtom only-if-exists=false(0x00) name='_NET_WM_STATE_FULLSCREEN'
      000:>:0050:32: Reply to InternAtom: atom=0x102("_NET_WM_STATE_FULLSCREEN")
      000:<:0051: 44: Request(25): SendEvent propagate=false(0x00) destination=0x00000170 event-mask=SubstructureNotify,SubstructureRedirect
                                   ClientMessage(33) format=0x20 window=0x02200001 type=0xff("_NET_WM_STATE")
                                   data=0x01,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;
      000:<:0052:  4: Request(43): GetInputFocus
      000:>:0052: Event DRI2-InvalidateBuffers(102) drawable=0x02200001
      
      Here the X server attempts to notify the client side DRI2 code in the Mali blob
      that the DRI2 buffer must be requested again. But this event gets happily ignored.
      
      000:>:0052: Event Expose(12) window=0x02200001 x=0 y=0 width=1920 height=1080 count=0x0000
      000:>:0052:32: Reply to GetInputFocus: revert-to=PointerRoot(0x01) focus=0x02200001
      000:<:0053:  8: Request(3): GetWindowAttributes window=0x02200001
      000:<:0054:  8: Request(14): GetGeometry drawable=0x02200001
      000:>:0053:44: Reply to GetWindowAttributes: backing-store=NotUseful(0x00) visual=0x00000021 class=InputOutput(0x0001)
                                                   bit-gravity=Forget(0x00) win-gravity=NorthWest(0x01) backing-planes=0xffffffff
                                                   backing-pixel=0x00000000 save-under=false(0x00) map-is-installed=true(0x01)
                                                   map-state=Viewable(0x02) override-redirect=false(0x00) colormap=0x00000020
                                                   all-event-masks=PointerMotion,Exposure,StructureNotify,FocusChange,PropertyChange
                                                   your-event-mask=PointerMotion,Exposure do-not-propagate-mask=0 unused=0x0000
      000:>:0054:32: Reply to GetGeometry: depth=0x18 root=0x00000170 x=0 y=0 width=1920 height=1080 border-width=0
      001:<:000c: 12: Request(98): QueryExtension name='DRI2'
      001:>:000c:32: Reply to QueryExtension: present=true(0x01) major-opcode=151 first-event=101 first-error=0
      001:<:000d: 32: DRI2-Request(151,8): SwapBuffers drawable=0x02200001 target_msc_hi=0 target_msc_lo=0
                                           divisor_hi=0 divisor_lo=0 remainder_hi=0 remainder_lo=0
      001:>:000d: Event DRI2-BufferSwapComplete(101) drawable=0x00000002 ust_hi=35651585 ust_lo=0 msc_hi=0 msc_lo=0 sbc_hi=0 sbc_lo=1
      
      Here the DRI2 code from the Mali blob tries to swap buffers (with the
      hope that the allocated BackLeft would go to front)
      
      001:>:000d:32: Reply to SwapBuffers: swap_hi=0 swap_lo=4096
      000:<:0055:  8: DRI2-Request(151,3): CreateDrawable drawable=0x02200001
      000:<:0056: 16: DRI2-Request(151,5): GetBuffers drawable=0x02200001 attachments={attachment=BackLeft(0x00000001)};
      000:>:0056:52: Reply to GetBuffers: width=1920 height=1080 buffers={attachment=BackLeft(0x00000001)
                                          name=0x00000159 pitch=7680 cpp=4 flags=0x00000000};
      
      And requests for the new BackLeft DRI2 buffer.
      
      000:<:0057:  4: Request(43): GetInputFocus
      000:>:0057:32: Reply to GetInputFocus: revert-to=PointerRoot(0x01) focus=0x02200001
      000:<:0058:  8: Request(3): GetWindowAttributes window=0x02200001
      000:<:0059:  8: Request(14): GetGeometry drawable=0x02200001
      000:>:0058:44: Reply to GetWindowAttributes: backing-store=NotUseful(0x00) visual=0x00000021 class=InputOutput(0x0001)
                                                   bit-gravity=Forget(0x00) win-gravity=NorthWest(0x01) backing-planes=0xffffffff
                                                   backing-pixel=0x00000000 save-under=false(0x00) map-is-installed=true(0x01)
                                                   map-state=Viewable(0x02) override-redirect=false(0x00) colormap=0x00000020
                                                   all-event-masks=PointerMotion,Exposure,StructureNotify,FocusChange,PropertyChange
                                                   your-event-mask=PointerMotion,Exposure do-not-propagate-mask=0 unused=0x0000
      000:>:0059:32: Reply to GetGeometry: depth=0x18 root=0x00000170 x=0 y=0 width=1920 height=1080 border-width=0
      000:<:005a:  8: Request(3): GetWindowAttributes window=0x02200001
      000:<:005b:  8: Request(14): GetGeometry drawable=0x02200001
      000:>:005a:44: Reply to GetWindowAttributes: backing-store=NotUseful(0x00) visual=0x00000021 class=InputOutput(0x0001)
                                                   bit-gravity=Forget(0x00) win-gravity=NorthWest(0x01) backing-planes=0xffffffff
                                                   backing-pixel=0x00000000 save-under=false(0x00) map-is-installed=true(0x01)
                                                   map-state=Viewable(0x02) override-redirect=false(0x00) colormap=0x00000020
                                                   all-event-masks=PointerMotion,Exposure,StructureNotify,FocusChange,PropertyChange
                                                   your-event-mask=PointerMotion,Exposure do-not-propagate-mask=0 unused=0x0000
      000:>:005b:32: Reply to GetGeometry: depth=0x18 root=0x00000170 x=0 y=0 width=1920 height=1080 border-width=0
      001:<:000e: 32: DRI2-Request(151,8): SwapBuffers drawable=0x02200001 target_msc_hi=0 target_msc_lo=0
                                           divisor_hi=0 divisor_lo=0 remainder_hi=0 remainder_lo=0
      001:>:000e: Event DRI2-BufferSwapComplete(101) drawable=0x00000002 ust_hi=35651585 ust_lo=0 msc_hi=0 msc_lo=0 sbc_hi=0 sbc_lo=2
      
      And here it is simply swapping the buffers.
      
      001:>:000e:32: Reply to SwapBuffers: swap_hi=0 swap_lo=4096
      000:<:005c:  8: Request(3): GetWindowAttributes window=0x02200001
      000:<:005d:  8: Request(14): GetGeometry drawable=0x02200001
      000:>:005c:44: Reply to GetWindowAttributes: backing-store=NotUseful(0x00) visual=0x00000021 class=InputOutput(0x0001)
                                                   bit-gravity=Forget(0x00) win-gravity=NorthWest(0x01) backing-planes=0xffffffff
                                                   backing-pixel=0x00000000 save-under=false(0x00) map-is-installed=true(0x01)
                                                   map-state=Viewable(0x02) override-redirect=false(0x00) colormap=0x00000020
                                                   all-event-masks=PointerMotion,Exposure,StructureNotify,FocusChange,PropertyChange
                                                   your-event-mask=PointerMotion,Exposure do-not-propagate-mask=0 unused=0x0000
      000:>:005d:32: Reply to GetGeometry: depth=0x18 root=0x00000170 x=0 y=0 width=1920 height=1080 border-width=0
      
      And now it is polling for the change of window geometry. The same
      "SwapBuffers -> GetGeometry -> SwapBuffers" pattern keeps repeating.
      Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
      d147e25f