[RFC][PATCH 00/18] Provide a nice interface for TTM global state

Thomas Zimmermann tzimmermann at suse.de
Fri Oct 19 08:54:05 UTC 2018


This is the full patch set for cleaning up the TTM global-state handling
and offering a nice interface for drivers. The first 3 patches have been
discussed on dri-devel already.

Patch [01] adds struct ttm_global, a data structure that gives drivers
a handle ot the global TTM state.

Patches [02] to [13] convert all TTM drivers to struct ttm_global.

Patches [14] and [15] remove unused code.

Patches [16] to [18] merge the functionality of struct drm_global_reference
into the implementation of struct ttm_global and remove the former.

I'd really like to see patches [01] to [15] being merging in one way or the
other. Using struct ttm_global allows for sharing code that touches TTM
internals, and it gets drivers out of the way for the cleanup of the final
3 patches.

One question was if the current infrastructure around drm_global_reference
isn't over-engineered and could be simplified. For now, I took the existing
ref-counting as it is in drm_global.c. This can certainly be simplified if
prefered.

Thomas Zimmermann (18):
  drm/ttm: Provide struct ttm_global for referencing TTM global state
  drm/amdgpu: Replace TTM initialization/release with ttm_global
  drm/radeon: Replace TTM initialization/release with ttm_global
  drm/ast: Replace TTM initialization/release with ttm_global
  drm/bochs: Replace TTM initialization/release with ttm_global
  drm/cirrus: Replace TTM initialization/release with ttm_global
  drm/hisilicon: Replace TTM initialization/release with ttm_global
  drm/mgag200: Replace TTM initialization/release with ttm_global
  drm/nouveau: Replace TTM initialization/release with ttm_global
  drm/qlx: Replace TTM initialization/release with ttm_global
  drm/virtio: Replace TTM initialization/release with ttm_global
  drm/vmwgfx: Replace TTM initialization/release with ttm_global
  staging/vboxvideo: Replace TTM initialization/release with ttm_global
  drm/ttm: Remove struct ttm_bo_global_ref and helpers
  drm: Remove DRM_GLOBAL_TTM_OBJECT
  drm/ttm: Implement struct ttm_global_item and helpers
  drm/ttm: Implement struct ttm_global with struct ttm_global_ref
  drm: Remove drm_global.{c,h}

 drivers/gpu/drm/Makefile                      |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       |  63 +-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h       |   4 +-
 drivers/gpu/drm/ast/ast_drv.h                 |   5 +-
 drivers/gpu/drm/ast/ast_ttm.c                 |  49 +----
 drivers/gpu/drm/bochs/bochs.h                 |   5 +-
 drivers/gpu/drm/bochs/bochs_mm.c              |  47 +----
 drivers/gpu/drm/cirrus/cirrus_drv.h           |   5 +-
 drivers/gpu/drm/cirrus/cirrus_ttm.c           |  49 +----
 drivers/gpu/drm/drm_drv.c                     |   2 -
 drivers/gpu/drm/drm_global.c                  | 137 ------------
 drivers/gpu/drm/gma500/psb_drv.h              |   4 +-
 .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |   4 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   |  36 +---
 drivers/gpu/drm/mgag200/mgag200_drv.h         |   7 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c         |  49 +----
 drivers/gpu/drm/nouveau/nouveau_drv.h         |   5 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c         |  48 +----
 drivers/gpu/drm/qxl/qxl_drv.h                 |   4 +-
 drivers/gpu/drm/qxl/qxl_ttm.c                 |  40 +---
 drivers/gpu/drm/radeon/radeon.h               |   4 +-
 drivers/gpu/drm/radeon/radeon_ttm.c           |  40 +---
 drivers/gpu/drm/ttm/Makefile                  |   2 +-
 drivers/gpu/drm/ttm/ttm_global.c              | 198 ++++++++++++++++++
 drivers/gpu/drm/virtio/virtgpu_drv.h          |   4 +-
 drivers/gpu/drm/virtio/virtgpu_ttm.c          |  40 +---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c      |  44 +---
 drivers/staging/vboxvideo/vbox_drv.h          |   4 +-
 drivers/staging/vboxvideo/vbox_ttm.c          |  42 +---
 include/drm/drmP.h                            |   1 -
 include/drm/drm_global.h                      |  53 -----
 include/drm/ttm/ttm_bo_driver.h               |  40 ----
 include/drm/ttm/ttm_global.h                  | 100 +++++++++
 35 files changed, 401 insertions(+), 748 deletions(-)
 delete mode 100644 drivers/gpu/drm/drm_global.c
 create mode 100644 drivers/gpu/drm/ttm/ttm_global.c
 delete mode 100644 include/drm/drm_global.h
 create mode 100644 include/drm/ttm/ttm_global.h

--
2.19.1



More information about the amd-gfx mailing list