linux-stable/drivers/gpu/drm
Daniel Vetter 362063619c drm: revamp framebuffer cleanup interfaces
We have two classes of framebuffer
- Created by the driver (atm only for fbdev), and the driver holds
  onto the last reference count until destruction.
- Created by userspace and associated with a given fd. These
  framebuffers will be reaped when their assoiciated fb is closed.

Now these two cases are set up differently, the framebuffers are on
different lists and hence destruction needs to clean up different
things. Also, for userspace framebuffers we remove them from any
current usage, whereas for internal framebuffers it is assumed that
the driver has done this already.

Long story short, we need two different ways to cleanup such drivers.
Three functions are involved in total:
- drm_framebuffer_remove: Convenience function which removes the fb
  from all active usage and then drops the passed-in reference.
- drm_framebuffer_unregister_private: Will remove driver-private
  framebuffers from relevant lists and drop the corresponding
  references. Should be called for driver-private framebuffers before
  dropping the last reference (or like for a lot of the drivers where
  the fbdev is embedded someplace else, before doing the cleanup
  manually).
- drm_framebuffer_cleanup: Final cleanup for both classes of fbs,
  should be called by the driver's ->destroy callback once the last
  reference is gone.

This patch just rolls out the new interfaces and updates all drivers
(by adding calls to drm_framebuffer_unregister_private at all the
right places)- no functional changes yet. Follow-on patches will move
drm core code around and update the lifetime management for
framebuffers, so that we are no longer required to keep framebuffers
alive by locking mode_config.mutex.

I've also updated the kerneldoc already.

vmwgfx seems to again be a bit special, at least I haven't figured out
how the fbdev support in that driver works. It smells like it's
external though.

v2: The i915 driver creates another private framebuffer in the
load-detect code. Adjust its cleanup code, too.

Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-01-20 22:17:00 +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
i915 drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
mga
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
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
tdfx
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
vmwgfx drm: create drm_framebuffer_lookup 2013-01-20 22:16:59 +01:00
ati_pcigart.c
drm_agpsupport.c
drm_auth.c
drm_buffer.c
drm_bufs.c
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
drm_crtc.c drm: revamp framebuffer cleanup interfaces 2013-01-20 22:17:00 +01:00
drm_crtc_helper.c drm: add drm_modeset_lock|unlock_all 2013-01-20 22:16:38 +01:00
drm_debugfs.c
drm_dma.c
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
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_global.c
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
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
drm_memory.c
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
drm_proc.c
drm_scatter.c
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
drm_usb.c
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