alistair23-linux/drivers/gpu/drm
Daniel Vetter b4d5e7d1db drm: only grab the crtc lock for pageflips
The pagelip ioctl itself is rather simply, so the hard work for this
patch is auditing all the drivers:

- exynos: Pageflip is protect with dev->struct_mutex and ...
  synchronous. But nothing fancy going on, besides a check whether the
  crtc is enabled, which should probably be somewhere in the drm core
  so that we have unified behaviour across all drivers.

- i915: hw-state is protected with dev->struct_mutex, the delayed
  unpin work together with the other stuff the pageflip complete irq
  handler needs is protected by the event_lock spinlock.

- nouveau: With the pin/unpin functions fixed, everything looks safe:
  A bit of ttm wrestling and refcounting, and a few channel accesses.
  The later are either already proteced sufficiently, or are now safe
  with the channel locking introduced to make cursor updates safe.

- radeon: The irq_get/put functions look a bit race, since the
  atomic_inc/dec isn't protect with locks. Otoh they're all per-crtc,
  so we should be safe with per-crtc locking from the drm core. Then
  there's tons of per-crtc register access, which could potentially go
  through the indirect reg acces. But that's fixed to make cursor
  updates concurrent. Bookeeping for the drm even is also protected
  with the even_lock, which also protects against the pageflip irq
  handler since radeon hw seems to have no way to queue these up
  asynchronously. Otherwise just a bit of ttm-based buffer handling
  and fencing, which is now safe with the previous patch to hold
  bdev->fence_lock while grabbing the ttm fence.

- shmob: Only one crtc. That's an easy one ...

- vmwgfx: As usual a bit special with tons different things:
  - Flippable check using is_implicit and num_implicit. Changes to
    those seem to be nicely covered with the global modeset lock, so
    we should be fine.
  - Some dirty cliprect handling stuff, or at least that is my guess.
    Looks like it's fine since either it's per-crtc, invariant or
    (like the execbuf stuff launched) protected otherwise.
  - Adding the actual flip to the fence_event list. On a quick look
    this seems to have solid locking in place, too.
  ... but generally this is all way over my head.

- imx: Impressive display of races between the page_flip
  implementation and the irq handler. Also, ipu_drm_set_base which
  gets eventually called from the irq handler to update the display
  base isn't really protected against concurrent set_config calls from
  process context.  In any case, going for per-crtc locking won't make
  this worse, so nothing to do.

- omap: The new async callback code merged into 3.8 seems to have
  solid locking in place, and there doesn't seem to be any shared
  state at risk. Especially since the callbacks still use
  modeset_lock_all and are so not converted.

v2: Update omapdrm analysis to 3.8 code per the discussion with Rob
Clark.

Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-01-20 22:17:13 +01:00
..
ast drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
cirrus drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
exynos drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
gma500 drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
i2c drm: encapsulate crtc->set_config calls 2013-01-20 15:57:58 +01:00
i810 UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
i915 drm/i915: dump refcount into framebuffer debugfs file 2013-01-20 22:17:10 +01:00
mga UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
mgag200 drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
nouveau drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
r128 UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
radeon drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
savage Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
shmobile drm/shmobile: use drm_modeset_lock_all 2013-01-20 22:16:51 +01:00
sis UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
tdfx UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
tegra Revert "drm: tegra: protect DC register access with mutex" 2012-12-30 21:58:20 +10:00
ttm drm/ttm: fix fence locking in ttm_buffer_object_transfer 2013-01-08 18:35:31 +10:00
udl drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
via UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx drm/vmwgfx: add proper framebuffer refcounting 2013-01-20 22:17:11 +01:00
ati_pcigart.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_agpsupport.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_auth.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_buffer.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_bufs.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_cache.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
drm_context.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_crtc.c drm: only grab the crtc lock for pageflips 2013-01-20 22:17:13 +01:00
drm_crtc_helper.c drm: add drm_modeset_lock|unlock_all 2013-01-20 22:16:38 +01:00
drm_debugfs.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_dma.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_dp_helper.c drm/doc: add new dp helpers into drm DocBook 2012-11-28 20:26:53 +10:00
drm_drv.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
drm_edid.c Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-next 2012-12-16 06:05:03 +00:00
drm_edid_load.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
drm_edid_modes.h Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
drm_encoder_slave.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_fb_cma_helper.c drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
drm_fb_helper.c drm: add drm_modeset_lock|unlock_all 2013-01-20 22:16:38 +01:00
drm_fops.c drm: revamp locking around fb creation/destruction 2013-01-20 22:16:58 +01:00
drm_gem.c mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
drm_gem_cma_helper.c DRM: Add DRM GEM CMA helper 2012-09-18 12:28:21 +02:00
drm_global.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_hashtab.c drm: Add a hash-tab rcu-safe API 2012-11-28 18:36:05 +10:00
drm_info.c drm/debugfs: remove redundant info from gem_names 2012-10-23 10:15:04 +10:00
drm_ioc32.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_ioctl.c drm: add support for monotonic vblank timestamps 2012-11-20 16:06:16 +10:00
drm_irq.c drm: hold event_lock while accessing vblank_event_list 2012-11-29 03:30:34 -08:00
drm_lock.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_memory.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_mm.c drm: Only evict the blocks required to create the requested hole 2013-01-08 11:52:02 +01:00
drm_modes.c drm: Constify some function arguments 2012-11-07 10:09:16 +10:00
drm_pci.c drm/pci: add missing variable initialization 2012-11-29 18:20:31 +10:00
drm_platform.c drm: platform: Don't initialize driver-private data 2012-10-23 10:15:11 +10:00
drm_prime.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_proc.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_scatter.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_stub.c drm: add support for monotonic vblank timestamps 2012-11-20 16:06:16 +10:00
drm_sysfs.c drm: remove legacy drm_connector_property fxns 2012-11-30 10:30:48 -06:00
drm_trace.h
drm_trace_points.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_usb.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
drm_vm.c mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
Kconfig drm: Add NVIDIA Tegra20 support 2012-11-20 15:43:41 +10:00
Makefile drm: only build ati_pcigart if PCI enabled 2012-11-28 20:12:29 +10:00
README.drm

************************************************************
* For the very latest on DRI development, please see:      *
*     http://dri.freedesktop.org/                          *
************************************************************

The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
Infrastructure (DRI).

The DRM supports the Direct Rendering Infrastructure (DRI) in four major
ways:

    1. The DRM provides synchronized access to the graphics hardware via
       the use of an optimized two-tiered lock.

    2. The DRM enforces the DRI security policy for access to the graphics
       hardware by only allowing authenticated X11 clients access to
       restricted regions of memory.

    3. The DRM provides a generic DMA engine, complete with multiple
       queues and the ability to detect the need for an OpenGL context
       switch.

    4. The DRM is extensible via the use of small device-specific modules
       that rely extensively on the API exported by the DRM module.


Documentation on the DRI is available from:
    http://dri.freedesktop.org/wiki/Documentation
    http://sourceforge.net/project/showfiles.php?group_id=387
    http://dri.sourceforge.net/doc/

For specific information about kernel-level support, see:

    The Direct Rendering Manager, Kernel Support for the Direct Rendering
    Infrastructure
    http://dri.sourceforge.net/doc/drm_low_level.html

    Hardware Locking for the Direct Rendering Infrastructure
    http://dri.sourceforge.net/doc/hardware_locking_low_level.html

    A Security Analysis of the Direct Rendering Infrastructure
    http://dri.sourceforge.net/doc/security_low_level.html