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>
This commit is contained in:
David Herrmann
2014-01-03 14:24:19 +01:00
parent 31bbe16f6d
commit 6796cb16c0
15 changed files with 44 additions and 54 deletions

View File

@@ -145,7 +145,7 @@ int radeon_bo_create(struct radeon_device *rdev,
size = ALIGN(size, PAGE_SIZE);
rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping;
rdev->mman.bdev.dev_mapping = rdev->ddev->anon_inode->i_mapping;
if (kernel) {
type = ttm_bo_type_kernel;
} else if (sg) {