[PATCH 00/20] prime/flink fixes and related stuff

Daniel Vetter daniel.vetter at ffwll.ch
Tue Jul 16 00:11:51 PDT 2013


Hi all,

This patch series is my 2nd real stab at fixing up the locking issues around our
two buffer sharing mechanisms in gem: flink and prime.

I think the approach taken here is much better than my first stab, and it also
seems to no longer leak buffers ;-) There some assorted cleanup and prep work
(and one i915 fix) thrown into the mix, it's all stuff I've stumbled over while
digging through the code.

Open issues left in prime-land after these patches:
- exynos probably wants a similar patch to "drm/i915: explicit store base gem
  object in dma_buf->priv". The current code should be correct, but it's a bit
  tricky. I've opted not to do that since last time around I've touched exynos a
  bit it broke horribly ;-)
- The prime core should now no longer depend upon obj->import_attach being set
  by drivers in their prime_import callback. This should allos us to fix udl
  which really doesn't need (nor want, it confuses swiotlb among other things)
  a device attachment. Didn't write that patch since my displaylink seems to
  have died.
- There's still the issue Inki's team pointed out where if you import a foreign
  object on different fds you'll get different gem objects. So we need some form
  of a per-device import cache (on top of the per-file-priv dma-buf cache we
  already have). Didn't do this yet since I want to have good test coverage
  (already started a bit), it looks like a bit more work and I'm not sure about
  the exact design of the code yet.

Review and testing highly welcome.

Cheers, Daniel

Daniel Vetter (20):
  drm: use common drm_gem_dmabuf_release in i915/exynos drivers
  drm/i915: unpin backing storage in dmabuf_unmap
  drm/i915: explicit store base gem object in dma_buf->priv
  drm/prime: add a bit of documentation about gem_obj->import_attach
  drm/gem: remove drm_gem_object_handle_unreference
  drm/gem: inline drm_gem_object_handle_reference
  drm/gem: move drm_gem_object_handle_unreference_unlocked into
    drm_gem.c
  drm/gem: remove bogus NULL check from
    drm_gem_object_handle_unreference_unlocked
  drm/gem: WARN about unbalanced handle refcounts
  drm/gem: fix up flink name create race
  drm/prime: fix error path in drm_gem_prime_fd_to_handle
  drm/gem: make drm_gem_object_handle_unreference_unlocked static
  drm/gem: create drm_gem_dumb_destroy
  drm/prime: use proper pointer in drm_gem_prime_handle_to_fd
  drm/prime: shrink critical section protected by prime lock
  drm/prime: clarify logic a bit in drm_gem_prime_fd_to_handle
  drm/gem: switch dev->object_name_lock to a mutex
  drm/gem: completely close gem_open vs. gem_close races
  drm/prime: proper locking+refcounting for obj->dma_buf link
  drm/prime: Simplify drm_gem_remove_prime_handles

 drivers/gpu/drm/ast/ast_drv.c              |   2 +-
 drivers/gpu/drm/ast/ast_drv.h              |   3 -
 drivers/gpu/drm/ast/ast_main.c             |   7 --
 drivers/gpu/drm/cirrus/cirrus_drv.c        |   2 +-
 drivers/gpu/drm/cirrus/cirrus_drv.h        |   3 -
 drivers/gpu/drm/cirrus/cirrus_main.c       |   7 --
 drivers/gpu/drm/drm_fops.c                 |   1 +
 drivers/gpu/drm/drm_gem.c                  | 192 ++++++++++++++++++++---------
 drivers/gpu/drm/drm_gem_cma_helper.c       |  10 --
 drivers/gpu/drm/drm_info.c                 |   2 +-
 drivers/gpu/drm/drm_prime.c                |  96 ++++++++++-----
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |  23 +---
 drivers/gpu/drm/exynos/exynos_drm_drv.c    |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.c    |  22 +---
 drivers/gpu/drm/exynos/exynos_drm_gem.h    |   9 --
 drivers/gpu/drm/gma500/gem.c               |  17 ---
 drivers/gpu/drm/gma500/psb_drv.c           |   2 +-
 drivers/gpu/drm/gma500/psb_drv.h           |   2 -
 drivers/gpu/drm/i915/i915_drv.c            |   2 +-
 drivers/gpu/drm/i915/i915_drv.h            |   2 -
 drivers/gpu/drm/i915/i915_gem.c            |   7 --
 drivers/gpu/drm/i915/i915_gem_dmabuf.c     |  34 +++--
 drivers/gpu/drm/mgag200/mgag200_drv.c      |   2 +-
 drivers/gpu/drm/mgag200/mgag200_drv.h      |   3 -
 drivers/gpu/drm/mgag200/mgag200_main.c     |   7 --
 drivers/gpu/drm/nouveau/nouveau_display.c  |   7 --
 drivers/gpu/drm/nouveau/nouveau_display.h  |   2 -
 drivers/gpu/drm/nouveau/nouveau_drm.c      |   2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c         |   2 +-
 drivers/gpu/drm/omapdrm/omap_drv.h         |   2 -
 drivers/gpu/drm/omapdrm/omap_gem.c         |  15 ---
 drivers/gpu/drm/qxl/qxl_drv.c              |   2 +-
 drivers/gpu/drm/qxl/qxl_drv.h              |   3 -
 drivers/gpu/drm/qxl/qxl_dumb.c             |   7 --
 drivers/gpu/drm/radeon/radeon.h            |   3 -
 drivers/gpu/drm/radeon/radeon_drv.c        |   5 +-
 drivers/gpu/drm/radeon/radeon_gem.c        |   7 --
 drivers/gpu/drm/rcar-du/rcar_du_drv.c      |   2 +-
 drivers/gpu/drm/shmobile/shmob_drm_drv.c   |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c        |   2 +-
 drivers/gpu/drm/udl/udl_drv.c              |   2 +-
 drivers/gpu/drm/udl/udl_drv.h              |   2 -
 drivers/gpu/drm/udl/udl_gem.c              |   6 -
 drivers/gpu/host1x/drm/drm.c               |   2 +-
 drivers/gpu/host1x/drm/gem.c               |   6 -
 drivers/gpu/host1x/drm/gem.h               |   2 -
 drivers/staging/imx-drm/imx-drm-core.c     |   2 +-
 include/drm/drmP.h                         |  94 +++++++-------
 include/drm/drm_gem_cma_helper.h           |   8 --
 49 files changed, 279 insertions(+), 367 deletions(-)

-- 
1.8.3.2



More information about the dri-devel mailing list