Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Doubling your performance with a simple trick

  1. #1
    Join Date
    Sep 2011
    Posts
    5

    Default Doubling your performance with a simple trick

    Add to your /etc/drirc this :

    Code:
    <driconf>                                                                                                                                                                                                                                          
       <device screen="0" driver="dri2">                                                                                                                                                                                                               
          <application name="all">                                                                                                                                                                                                                     
             <!-- Always synchronize with vertical refresh to avoid tearing -->                                                                                                                                                                        
             <option name="vblank_mode" value="0"/>                                                                                                                                                                                                    
          </application>                                                                                                                                                                                                                               
    </device>                                                                                                                                                                                                                                          
    </driconf>
    It doubled performance for me everywhere.

    Proof (Lightsmark):

    VBLank option not set:


    VBlank option set:


    A similar thing happened with everything else (with different degrees of effectiveness) . For example with Kwin compisiting now I have 60 fps at the lower power state while before I was hovering a little over 30 fps.

    I have a Radeon 5850 and I also use in conjunction the "SwapBuffersWait false" and "ColorTiling true" in my xorg.conf (don't know if that matters).

    Now a my glxinfo

    Code:
    [hades@artemis pc-linux64]$  glxinfo                                                                                                                                                                                                               
    name of display: :0                                                                                                                                                                                                                                
    display: :0  screen: 0                                                                                                                                                                                                                             
    direct rendering: Yes                                                                                                                                                                                                                              
    server glx vendor string: SGI                                                                                                                                                                                                                      
    server glx version string: 1.4                                                                                                                                                                                                                     
    server glx extensions:                                                                                                                                                                                                                             
        GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,                                                                                                                                                                      
        GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,                                                                                                                                                                          
        GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control,                                                                                                                                                                          
        GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,                                                                                                                                                                                     
        GLX_SGIX_visual_select_group, GLX_INTEL_swap_event                                                                                                                                                                                             
    client glx vendor string: Mesa Project and SGI                                                                                                                                                                                                     
    client glx version string: 1.4                                                                                                                                                                                                                     
    client glx extensions:                                                                                                                                                                                                                             
        GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,                                                                                                                                                                         
        GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_framebuffer_sRGB,                                                                                                                                                                          
        GLX_MESA_copy_sub_buffer, GLX_MESA_multithread_makecurrent,                                                                                                                                                                                    
        GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,                                                                                                                                                                              
        GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,                                                                                                                                                                           
        GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,                                                                                                                                                                                     
        GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap,                                                                                                                                                                                     
        GLX_INTEL_swap_event                                                                                                                                                                                                                           
    GLX version: 1.4                                                                                                                                                                                                                                   
    GLX extensions:                                                                                                                                                                                                                                    
        GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,                                                                                                                                                                         
        GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,                                                                                                                                                                          
        GLX_MESA_multithread_makecurrent, GLX_MESA_swap_control,                                                                                                                                                                                       
        GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGI_make_current_read,                                                                                                                                                                          
        GLX_SGI_swap_control, GLX_SGI_video_sync, GLX_SGIS_multisample,                                                                                                                                                                                
        GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,                                                                                                                                                                             
        GLX_EXT_texture_from_pixmap, GLX_INTEL_swap_event                                                                                                                                                                                              
    OpenGL vendor string: X.Org                                                                                                                                                                                                                        
    OpenGL renderer string: Gallium 0.4 on AMD CYPRESS                                                                                                                                                                                                 
    OpenGL version string: 2.1 Mesa 7.12-devel (git-09b5f1f)                                                                                                                                                                                           
    OpenGL shading language version string: 1.20                                                                                                                                                                                                       
                                                                                                                                                                         
     ...
    Try it out and report thanks.

    Marcello

  2. #2
    Join Date
    Nov 2009
    Posts
    101

    Default

    Thanks for the olds.

  3. #3
    Join Date
    Dec 2007
    Posts
    2,404

    Default

    You've disable sync to vblank which means you will get better performance at the expense of tearing since buffer flips are no longer synced to vblank. You can also enable it via env var: vblank_mode=0

  4. #4
    Join Date
    Jul 2008
    Location
    Greece
    Posts
    3,801

    Default

    Quote Originally Posted by agd5f View Post
    You've disable sync to vblank which means you will get better performance at the expense of tearing since buffer flips are no longer synced to vblank.
    Not really. I have vblank_mode=0 but still no tearing. Tearing only occurs if I also set:

    Option "SwapbuffersWait" "FALSE"

    in xorg.conf, which makes the vblank_mode setting look rather like a performance hog without any benefits.

  5. #5
    Join Date
    Dec 2007
    Posts
    2,404

    Default

    There are two factors at play for buffer swaps:

    1. pageflipping
    2. blits

    The driver can use either depending on the situation. If vblank is enabled and pageflipping is enabled and the front and back buffer sizes are identical (e.g., fullscreen apps), the driver will use pageflipping. As currently implemented in DRI2, pageflips are always synced to vblank. If those conditions are not met, the driver uses blits. The SwapBuffersWait option controls whether the blit swaps tear or not by stalling the blit until scanout has passed the area of the blit. If you are running a fullscreen app, the blit is effectively synced to vblank as well. Setting vblank_mode=0 will disable pageflipping, but you will still hit the blit case which is controlled by the SwapBuffersWait option.

  6. #6
    Join Date
    Jul 2008
    Location
    Greece
    Posts
    3,801

    Default

    Hmm, does that mean that setting vblank_mode=0 and SwapbuffersWait to TRUE actually hurts performance? (While still wanting tear-free applications, of course.)

  7. #7
    Join Date
    Dec 2007
    Posts
    2,404

    Default

    Quote Originally Posted by RealNC View Post
    Hmm, does that mean that setting vblank_mode=0 and SwapbuffersWait to TRUE actually hurts performance? (While still wanting tear-free applications, of course.)
    Performance should be the same or better depending on the situation. If vblank is enabled with a fullscreen app, you'll get pageflipping which will be synced to vblank but will use pageflipping rather than the blitter, so it'll use less memory bandwidth. If vblank is disable, you'll end up with the blitter which for fullscreen apps will be basically equivalent to pageflipping. For non-fullscreen apps, you should see a performance increase as the blitter will not have to stall for the entire scanout frame.

  8. #8
    Join Date
    Dec 2009
    Location
    Italy
    Posts
    176

    Default

    Also, in my experience (HD4200), setting vblank_mode to 0 and swapbufferswait to true is the only way to have fluid and tear-free video playback, especially with high-bitrate sources. If vblank_mode is not set, I get stuttering (it took a while to find the cause), while if vblank_mode is 0 but swapbufferswait is not enabled I get tearing (obviously).

  9. #9
    Join Date
    Dec 2007
    Posts
    2,404

    Default

    Quote Originally Posted by kbios View Post
    Also, in my experience (HD4200), setting vblank_mode to 0 and swapbufferswait to true is the only way to have fluid and tear-free video playback, especially with high-bitrate sources. If vblank_mode is not set, I get stuttering (it took a while to find the cause), while if vblank_mode is 0 but swapbufferswait is not enabled I get tearing (obviously).
    You might try a newer kernel. There were some bugs in the early pageflipping code caused the driver to wait on non-related command buffers in some cases.

  10. #10
    Join Date
    Dec 2009
    Location
    Italy
    Posts
    176

    Default

    Quote Originally Posted by agd5f View Post
    You might try a newer kernel. There were some bugs in the early pageflipping code caused the driver to wait on non-related command buffers in some cases.
    Thanks, I'll try when I get back home, although I'm pretty sure it's already using the 2.6.38 kernel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •