[PATCH v2 00/20] Unified VMA Offset Manager v2 (+Render Node RFC)

David Herrmann dh.herrmann at gmail.com
Sun Jul 7 10:17:16 PDT 2013


Hi

This is v2 of the unified VMA offset manager series. The first draft is
available at LWN [1]. This series replaces the VMA offset managers in GEM and
TTM with a unified implementation.

The first 4 patches contain the new VMA offset manager and are the only patches
that I propose for mainline inclusion.
Patches 5-8 clean up drm_mm and are informational-only. Daniel has similar
patches in i915-next and I will rebase them once it is merged. Ignore
them if you're not interested.
Patches 9-19 implement mmap access control. Comments are welcome! They are
intended for mainline inclusion, too, but probably require some more review
rounds. I'd really appreciate if driver authors could comment on the
implementation.
Patch 20 shows the main motivation behind this whole series: render nodes. It is
marked RFC and I will resend once the VMA manager is merged upstream. Feel free
to test it.

One more note regarding DRM-Master: Render-clients are independent of DRM-Master
(see the DocBook documentation). It really doesn't make sense to create/bind a
DRM-Master object to render-clients. However, a lot of core DRM code depends on
 ->master != NULL. Drivers need to take care not to call into those core modules
if they implement DRIVER_RENDER.
I plan on removing multiple-master-support in the next series. So there will be
only one global master and each open-file is bound to it. This will make it very
easy to phase out "drm_master". The planned "modeset" nodes provide a nice
replacement. If anyone knows a **currently used** use-case for multiple-masters,
please tell me. I couldn't find one that _actually works_. (SetMaster+DropMaster
will obviously stay functional even with drm_master removed).


(series available at: https://github.com/dvdhrm/linux/tree/rnodes)

Comments welcome!
Cheers
David


Changes in v2:
 - Drop drm_mm_init() fix (already applied in drm-next)
 - Drop drm_mm_node_linked() in favor of drm_mm_node_allocated()
 - Adjust DocBook integration
 - Rebased on drm-next (and compile tested on ARM)
 - Removed unnecessary likely/unlikely marks (except for rbtree paths)
 - small fixes (see commit messages for more)

New in v2:
 - Cleanup patches for drm_mm. Note that these are marked RFC as Daniel has
   similar patches pending in i915-next. But the patches show that most of
   drm_mm is obsolete and can be removed.
   I will rebase them once i915-next is merged into drm-next and resend.
 - Access Management API: Following Dave's proposal, this series implements
   mmap-offset access managamenet via a "file_priv" lookup-tree for each node.
 - Render-Nodes: Following krh's proposal, I revived render nodes which no
   longer have the mmap security problem. Driver-implementations still missing,
   but you can find working examples for i915 and nouveau on dri-devel or [2].

Still To Do:
 - See whether _DRM_GEM can be dropped. I haven't checked legacy user-space so
   far.
 - Patch #16 (vmwgfx) has a TODO marker. I couldn't figure out whether the
   proposed replacement does the same as the old code (with all the
   side-effects). Would be nice if Thomas could comment on that (CC'ed).
 - Patch #18 (gem mmap) adds filp to all VMAs during open and removes them
   during close. This is not necessary for TTM+GEM drivers which don't use
   gem_mmap(). However, it works for now and I wanted to avoid 20 more patches
   fixing each GEM driver. I will provide that in the final series.


[1] Unified VMA Offset Manager v1: https://lwn.net/Articles/557265/
[2] Render-node driver patches: https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commits/render_nodes


David Herrmann (20):
  drm: add unified vma offset manager
  drm/gem: convert to new unified vma manager
  drm/ttm: convert to unified vma offset manager
  drm/vma: provide drm_vma_node_unmap() helper
  drm/mm: add "best_match" to drm_mm_insert_node()
  drm/ttm: replace drm_mm_pre_get() by direct alloc
  drm/i915: pre-alloc instead of drm_mm search/get_block
  drm/mm: remove unused API
  drm/vma: add access management helpers
  drm/ast: implement mmap access managament
  drm/cirrus: implement mmap access managament
  drm/mgag200: implement mmap access managament
  drm/nouveau: implement mmap access managament
  drm/radeon: implement mmap access managament
  drm/qxl: implement mmap access managament
  drm/vmwgfx: implement mmap access managament
  drm/ttm: prevent mmap access to unauthorized users
  drm/gem: implement mmap access management
  drm: fix minor number range calculation
  drm: implement render nodes

 Documentation/DocBook/drm.tmpl             |  77 ++++++
 drivers/gpu/drm/Makefile                   |   2 +-
 drivers/gpu/drm/ast/ast_drv.c              |   2 +
 drivers/gpu/drm/ast/ast_drv.h              |   4 +
 drivers/gpu/drm/ast/ast_main.c             |  17 +-
 drivers/gpu/drm/cirrus/cirrus_drv.h        |   4 +
 drivers/gpu/drm/cirrus/cirrus_main.c       |  17 +-
 drivers/gpu/drm/drm_drv.c                  |  15 +-
 drivers/gpu/drm/drm_fops.c                 |  14 +-
 drivers/gpu/drm/drm_gem.c                  | 111 +++-----
 drivers/gpu/drm/drm_gem_cma_helper.c       |   9 +-
 drivers/gpu/drm/drm_mm.c                   | 139 ++--------
 drivers/gpu/drm/drm_pci.c                  |   9 +
 drivers/gpu/drm/drm_platform.c             |   9 +
 drivers/gpu/drm/drm_stub.c                 |  17 +-
 drivers/gpu/drm/drm_usb.c                  |   9 +
 drivers/gpu/drm/drm_vma_manager.c          | 408 +++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_gem.c    |   7 +-
 drivers/gpu/drm/gma500/gem.c               |   8 +-
 drivers/gpu/drm/i915/i915_gem.c            |  25 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c     |  72 +++--
 drivers/gpu/drm/mgag200/mgag200_drv.c      |   2 +
 drivers/gpu/drm/mgag200/mgag200_drv.h      |   4 +
 drivers/gpu/drm/mgag200/mgag200_main.c     |  17 +-
 drivers/gpu/drm/nouveau/nouveau_display.c  |   2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c      |  21 +-
 drivers/gpu/drm/omapdrm/omap_gem.c         |  11 +-
 drivers/gpu/drm/omapdrm/omap_gem_helpers.c |  49 +---
 drivers/gpu/drm/qxl/qxl_gem.c              |   7 +-
 drivers/gpu/drm/qxl/qxl_object.h           |   2 +-
 drivers/gpu/drm/qxl/qxl_release.c          |   2 +-
 drivers/gpu/drm/radeon/radeon_gem.c        |   7 +
 drivers/gpu/drm/radeon/radeon_object.h     |   5 +-
 drivers/gpu/drm/sis/sis_mm.c               |   4 +-
 drivers/gpu/drm/ttm/ttm_bo.c               |  79 +-----
 drivers/gpu/drm/ttm/ttm_bo_manager.c       |  40 ++-
 drivers/gpu/drm/ttm/ttm_bo_util.c          |   3 +-
 drivers/gpu/drm/ttm/ttm_bo_vm.c            |  82 +++---
 drivers/gpu/drm/udl/udl_gem.c              |   6 +-
 drivers/gpu/drm/via/via_mm.c               |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c   |  33 ++-
 include/drm/drmP.h                         |  15 +-
 include/drm/drm_mm.h                       | 110 ++------
 include/drm/drm_vma_manager.h              | 170 ++++++++++++
 include/drm/ttm/ttm_bo_api.h               |  15 +-
 include/drm/ttm/ttm_bo_driver.h            |   7 +-
 include/uapi/drm/drm.h                     |   2 +-
 47 files changed, 1074 insertions(+), 600 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_vma_manager.c
 create mode 100644 include/drm/drm_vma_manager.h

-- 
1.8.3.2



More information about the dri-devel mailing list