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>
此提交包含在:
David Herrmann
2014-01-03 14:24:19 +01:00
父節點 31bbe16f6d
當前提交 6796cb16c0
共有 15 個檔案被更改,包括 44 行新增54 行删除

查看文件

@@ -82,8 +82,7 @@ int qxl_bo_create(struct qxl_device *qdev,
enum ttm_bo_type type;
int r;
if (unlikely(qdev->mman.bdev.dev_mapping == NULL))
qdev->mman.bdev.dev_mapping = qdev->ddev->dev_mapping;
qdev->mman.bdev.dev_mapping = qdev->ddev->anon_inode->i_mapping;
if (kernel)
type = ttm_bo_type_kernel;
else

查看文件

@@ -518,8 +518,7 @@ int qxl_ttm_init(struct qxl_device *qdev)
((unsigned)num_io_pages * PAGE_SIZE) / (1024 * 1024));
DRM_INFO("qxl: %uM of Surface memory size\n",
(unsigned)qdev->surfaceram_size / (1024 * 1024));
if (unlikely(qdev->mman.bdev.dev_mapping == NULL))
qdev->mman.bdev.dev_mapping = qdev->ddev->dev_mapping;
qdev->mman.bdev.dev_mapping = qdev->ddev->anon_inode->i_mapping;
r = qxl_ttm_debugfs_init(qdev);
if (r) {
DRM_ERROR("Failed to init debugfs\n");