drm: use anon-inode instead of relying on cdevs
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 3 Jan 2014 13:24:19 +0000 (14:24 +0100)
committerSimon Horman <horms+renesas@verge.net.au>
Thu, 11 Dec 2014 01:21:24 +0000 (10:21 +0900)
commitba682e9bb9ece0e15b1ccdd411b35b84744e4f7c
treefdeb9acd866347e8e8c77a77fd93fb896e3489ca
parent0a3815d64602de784da3a7c9738b3dc78ef9cf93
drm: use anon-inode instead of relying on cdevs

DRM drivers share a common address_space across all character-devices of a
single DRM device. This allows simple buffer eviction and mapping-control.
However, DRM core currently waits for the first ->open() on any char-dev
to mark the underlying inode as backing inode of the device. This delayed
initialization causes ugly conditions all over the place:
  if (dev->dev_mapping)
    do_sth();

To avoid delayed initialization and to stop reusing the inode of the
char-dev, we allocate an anonymous inode for each DRM device and reset
filp->f_mapping to it on ->open().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 6796cb16c088905bf3af40548fda68c09e6f6ee5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
15 files changed:
drivers/gpu/drm/ast/ast_ttm.c
drivers/gpu/drm/bochs/bochs_mm.c
drivers/gpu/drm/cirrus/cirrus_ttm.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/drm_stub.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/mgag200/mgag200_ttm.c
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/omapdrm/omap_gem.c
drivers/gpu/drm/qxl/qxl_object.c
drivers/gpu/drm/qxl/qxl_ttm.c
drivers/gpu/drm/radeon/radeon_object.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
include/drm/drmP.h