Skip to content

Commit 81340cf

Browse files
committed
drm/i915/uapi: reject set_domain for discrete
The CPU domain should be static for discrete, and on DG1 we don't need any flushing since everything is already coherent, so really all this does is an object wait, for which we have an ioctl. Longer term the desired caching should be an immutable creation time property for the BO, which can be set with something like gem_create_ext. One other user is iris + userptr, which uses the set_domain to probe all the pages to check if the GUP succeeds, however we now have a PROBE flag for this purpose. v2: add some more kernel doc, also add the implicit rules with caching Suggested-by: Daniel Vetter <[email protected]> Signed-off-by: Matthew Auld <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Kenneth Graunke <[email protected]> Cc: Jason Ekstrand <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Ramalingam C <[email protected]> Reviewed-by: Ramalingam C <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent eea97e4 commit 81340cf

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

drivers/gpu/drm/i915/gem/i915_gem_domain.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
490490
u32 write_domain = args->write_domain;
491491
int err;
492492

493+
if (IS_DGFX(to_i915(dev)))
494+
return -ENODEV;
495+
493496
/* Only handle setting domains to types used by the CPU. */
494497
if ((write_domain | read_domains) & I915_GEM_GPU_DOMAINS)
495498
return -EINVAL;

include/uapi/drm/i915_drm.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,25 @@ struct drm_i915_gem_mmap_offset {
923923
* - I915_GEM_DOMAIN_GTT: Mappable aperture domain
924924
*
925925
* All other domains are rejected.
926+
*
927+
* Note that for discrete, starting from DG1, this is no longer supported, and
928+
* is instead rejected. On such platforms the CPU domain is effectively static,
929+
* where we also only support a single &drm_i915_gem_mmap_offset cache mode,
930+
* which can't be set explicitly and instead depends on the object placements,
931+
* as per the below.
932+
*
933+
* Implicit caching rules, starting from DG1:
934+
*
935+
* - If any of the object placements (see &drm_i915_gem_create_ext_memory_regions)
936+
* contain I915_MEMORY_CLASS_DEVICE then the object will be allocated and
937+
* mapped as write-combined only.
938+
*
939+
* - Everything else is always allocated and mapped as write-back, with the
940+
* guarantee that everything is also coherent with the GPU.
941+
*
942+
* Note that this is likely to change in the future again, where we might need
943+
* more flexibility on future devices, so making this all explicit as part of a
944+
* new &drm_i915_gem_create_ext extension is probable.
926945
*/
927946
struct drm_i915_gem_set_domain {
928947
/** @handle: Handle for the object. */

0 commit comments

Comments
 (0)