]> git.ipfire.org Git - people/ms/linux.git/commit - drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drm: only take the crtc lock for ->cursor_set
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 2 Dec 2012 12:48:21 +0000 (13:48 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 20 Jan 2013 21:16:55 +0000 (22:16 +0100)
commitbfb899282f500eeb9dff2600729904aad0fd39e7
tree817752a33cd9ddb8d789e1a4318a7fad080d9676
parent29494c174dc4793ebd236aa522a2a1ed73b7180e
drm: only take the crtc lock for ->cursor_set

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: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/ast/ast_drv.h
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c