Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, daniel@ffwll.ch, lucas.demarchi@intel.com,
	rodrigo.vivi@intel.com, jani.nikula@linux.intel.com,
	ray.huang@amd.com, christian.koenig@amd.com, kraxel@redhat.com,
	airlied@redhat.com, suijingfeng@loongson.cn
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 0/6] drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe
Date: Fri, 14 Jun 2024 15:21:54 +0200	[thread overview]
Message-ID: <20240614133556.11378-1-tzimmermann@suse.de> (raw)

Add ttm_bo_kmap()'s features to ttm_bo_vmap() and convert xe to
use the latter helper. ttm_bo_vmap() returns mappings in an instance
of struct iosys_map, which simplifies driver code in several places.

Patches 1 and 2 allow ttm_bo_vmap() to store the method of allocation
in the iosys_map instance. This simplifies the unmap and driver code.

Patch 3 adds support for partial mappings to ttm_bo_vmap(). That's
another feature of ttm_bo_kmap(). It is now possible to map only a
subrange of a buffer object's memory buffer. This requires a trivial
change to existing callers, so that they still map the full buffer
range.

Patch 4 adds support for kmap()-based mappings in certain cases to
ttm_bo_vmap().

Patches 5 and 6 convert xe to ttm_bo_vmap(). ttm_bo_vmap() tests if
the caller holds the object's reservation lock; and therefore cannot
be called while relasing the buffer object. Patch 5 resolves this
problem in xe. Patch 6 then replaces ttm_bo_kmap() with ttm_bo_vmap()
and also updates the callers to use struct iosys_map everywhere.

Tested on Intel ARC hardware.

Future direction: DRM's TTM-based drivers use a mixture of ttm_bo_kmap()
and ttm_bo_vmap(). After merging these updates for ttm_bo_vmap(), the
other drivers can be converted and ttm_bo_kmap() can be removed.

Thomas Zimmermann (6):
  iosys-map: Add allocator flags
  drm/ttm: Store the bo_kmap_type in struct iosys_map
  drm/ttm: Support partial buffer mappings for ttm_bo_vmap()
  drm/ttm: Support kmap for single-page mappings in ttm_bo_vmap()
  drm/xe: Remove vunmap calls object-freeing code
  drm/xe: Replace ttm_bo_kmap() with ttm_bo_vmap()

 drivers/gpu/drm/drm_gem_ttm_helper.c          |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c         |  2 +-
 drivers/gpu/drm/loongson/lsdc_gem.c           |  2 +-
 drivers/gpu/drm/qxl/qxl_object.c              |  2 +-
 drivers/gpu/drm/ttm/ttm_bo_util.c             | 94 +++++++++++++------
 .../compat-i915-headers/gem/i915_gem_object.h | 17 +---
 drivers/gpu/drm/xe/display/intel_fb_bo.c      | 12 ++-
 drivers/gpu/drm/xe/xe_bo.c                    | 46 ++++-----
 drivers/gpu/drm/xe/xe_bo.h                    | 23 ++---
 drivers/gpu/drm/xe/xe_bo_types.h              |  2 -
 drivers/gpu/drm/xe/xe_lrc.c                   |  3 +-
 drivers/gpu/drm/xe/xe_vm.c                    |  2 +-
 include/drm/ttm/ttm_bo.h                      |  4 +-
 include/linux/iosys-map.h                     | 13 ++-
 14 files changed, 131 insertions(+), 93 deletions(-)

-- 
2.45.2


             reply	other threads:[~2024-06-14 13:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 13:21 Thomas Zimmermann [this message]
2024-06-14 13:21 ` [PATCH 1/6] iosys-map: Add allocator flags Thomas Zimmermann
2024-06-14 13:21 ` [PATCH 2/6] drm/ttm: Store the bo_kmap_type in struct iosys_map Thomas Zimmermann
2024-06-14 14:31   ` Christian König
2024-06-17 12:32     ` Thomas Zimmermann
2024-06-17 12:56       ` Christian König
2024-06-14 13:21 ` [PATCH 3/6] drm/ttm: Support partial buffer mappings for ttm_bo_vmap() Thomas Zimmermann
2024-06-14 14:33   ` Christian König
2024-06-17 13:00     ` Thomas Zimmermann
2024-06-14 13:21 ` [PATCH 4/6] drm/ttm: Support kmap for single-page mappings in ttm_bo_vmap() Thomas Zimmermann
2024-06-14 13:21 ` [PATCH 5/6] drm/xe: Remove vunmap calls object-freeing code Thomas Zimmermann
2024-06-14 13:22 ` [PATCH 6/6] drm/xe: Replace ttm_bo_kmap() with ttm_bo_vmap() Thomas Zimmermann
2024-06-14 13:41 ` ✓ CI.Patch_applied: success for drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe Patchwork
2024-06-14 13:41 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-14 13:42 ` ✓ CI.KUnit: success " Patchwork
2024-06-14 13:54 ` ✓ CI.Build: " Patchwork
2024-06-14 13:56 ` ✗ CI.Hooks: failure " Patchwork
2024-06-14 13:58 ` ✗ CI.checksparse: warning " Patchwork
2024-06-14 14:28 ` ✗ CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614133556.11378-1-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kraxel@redhat.com \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=suijingfeng@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox