• Daniel Vetter's avatar
    drm: only take the crtc lock for ->cursor_set · bfb89928
    Daniel Vetter authored
    First convert ->cursor_set to only take the crtc lock, since that
    seems to be the function with the least amount of state - the core
    ioctl function doesn't check anything which can change at runtime, so
    we don't have any object lifetime issues to contend.
    
    The only thing which is important is that the driver's implementation
    doesn't touch any state outside of that single crtc which is not yet
    properly protected by other locking:
    
    - ast: access the global ast->cache_kmap. Luckily we only have on crtc
      on this driver, so this is fine. Add a comment.
    
    - gma500: calls gma_power_begin|and and psb_gtt_pin|unpin, both which
      have their own locking to protect their state. Everything else is
      crtc-local.
    
    - i915: touches a bit of global gem state, all protected by the One
      Lock to Rule Them All (dev->struct_mutex).
    
    - nouveau: Pre-nv50 is all nice, nv50+ uses the evo channels to queue
      up all display changes. And some of these channels are device
      global. But this is fine now since the previous patch introduced an
      evo channel mutex.
    
    - radeon: Uses some indirect register access for cursor updates, but
      with the previous patches to protect these indirect 2-register
      access patterns with a spinlock, this should be fine now, too.
    
    - vmwgfx: I have no idea how that works - update_cursor_position
      doesn't take any per-crtc argument and I haven't figured out any
      other place where this could be set in some form of a side-channel.
      But vmwgfx definitely has more than one crtc (or at least can
      register more than one), so I have no idea how this is supposed to
      not fail with the current code already. Hence take the easy way out
      and simply acquire all locks (which requires dropping the crtc lock
      the core acquired for us). That way it's not worse off for
      consistency than the old code.
    Reviewed-by: default avatarRob Clark <rob@ti.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    bfb89928
vmwgfx_kms.c 54.4 KB