Skip to content
  • George Kyriazis's avatar
    swr: Handle resource across context changes · b9aa0fa7
    George Kyriazis authored
    
    
    Swr caches fb contents in tiles.  Those tiles are stored on a per-context
    basis.
    
    When switching contexts that share resources we need to make sure that
    the tiles of the old context are being stored and the tiles of the new
    context are being invalidated (marked as invalid, hence contents need
    to be reloaded).
    
    The context does not get any dirty bits to identify this case.  This has
    to be, then, coordinated by the resources that are being shared between
    the contexts.
    
    Add a "curr_pipe" hook in swr_resource that will allow us to identify a
    MakeCurrent of the above form during swr_update_derived().  At that time,
    we invalidate the tiles of the new context.  The old context, will need to
    have already store its tiles by that time, which happens during glFlush().
    glFlush() is being called at the beginning of MakeCurrent.
    
    So, the sequence of operations is:
    - At the beginning of glXMakeCurrent(), glFlush() will store the tiles
      of all bound surfaces of the old context.
    - After the store, a fence will guarantee that the all tile store make
      it to the surface
    - During swr_update_derived(), when we validate the new context, we check
      all resources to see what changed, and if so, we invalidate the
      current tiles.
    
    Fixes rendering problems with CEI/Ensight.
    
    Reviewed-by: default avatarBruce Cherniak <bruce.cherniak@intel.com>
    b9aa0fa7