[PATCH 0/6] drm: Support CMA per allocation kernel mappings

Rob Herring robh at kernel.org
Mon Oct 21 21:45:44 UTC 2019


This series adds support for CMA/DMA users to skip kernel mappings for
GEM allocations. The DMA API only guarantees a kernel mapping at
allocation time. Creating mappings with vmap() after allocation may or
may not work as not all allocations have a struct page. As virtual
memory space is limited on 32-bit systems some drivers will skip kernel
mappings when possible. This prevents those drivers from using CMA
helpers and the generic fbdev emulation which results in a lot of
duplicated code.

In order to distinguish between kernel and userspace allocations,
a new flag, DRM_MODE_DUMB_KERNEL_MAP, for drm_mode_create_dumb() is
introduced. This allows drivers to override the default behavior for
CMA helpers of always creating a kernel mapping.

Mediatek is converted to CMA helpers and Rockchip is converted to generic
fbdev support. I also have patches to convert Rockchip to CMA and shmem
helpers, but they need a bit more work. Exynos can also probably be
converted to use CMA helpers.

Compile tested only. I did test fbdev on Rockchip, but the h/w I have
has an IOMMU, so the CMA code path doesn't get tested.

Rob

Rob Herring (6):
  drm/kirin: Use DRM_GEM_CMA_VMAP_DRIVER_OPS
  drm: Introduce DRM_MODE_DUMB_KERNEL_MAP flag
  drm/cma-helper: Use the dma_*_attr API variant
  drm/cma-helper: Support DRM_MODE_DUMB_KERNEL_MAP flag
  drm/mediatek: Convert to use CMA helpers
  drm/rockchip: Convert to use generic fbdev emulation

 .../gpu/drm/arm/display/komeda/komeda_kms.c   |   1 +
 drivers/gpu/drm/arm/malidp_drv.c              |   1 +
 drivers/gpu/drm/drm_client.c                  |   1 +
 drivers/gpu/drm/drm_dumb_buffers.c            |   5 +-
 drivers/gpu/drm/drm_gem_cma_helper.c          |  68 +++--
 .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   |  11 +-
 drivers/gpu/drm/mediatek/Makefile             |   1 -
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       |   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  28 +-
 drivers/gpu/drm/mediatek/mtk_drm_fb.c         |   1 -
 drivers/gpu/drm/mediatek/mtk_drm_gem.c        | 289 ------------------
 drivers/gpu/drm/mediatek/mtk_drm_gem.h        |  51 ----
 drivers/gpu/drm/mediatek/mtk_drm_plane.c      |   7 +-
 drivers/gpu/drm/meson/meson_drv.c             |   1 +
 drivers/gpu/drm/rcar-du/rcar_du_kms.c         |   1 +
 drivers/gpu/drm/rockchip/Makefile             |   1 -
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |  10 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   2 -
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  14 -
 drivers/gpu/drm/rockchip/rockchip_drm_fb.h    |   6 -
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 170 -----------
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h |  24 --
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   |   6 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.h   |   4 -
 drivers/gpu/drm/stm/drv.c                     |   1 +
 drivers/gpu/drm/sun4i/sun4i_drv.c             |   1 +
 include/drm/drm_gem_cma_helper.h              |   1 +
 include/uapi/drm/drm_mode.h                   |   2 +
 28 files changed, 78 insertions(+), 632 deletions(-)
 delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.c
 delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.h
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h

--
2.20.1


More information about the dri-devel mailing list