aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-10-14 09:17:11 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-19 06:16:46 -0400
commitfa8848f27895bd19e16aed77868f464be24034e6 (patch)
tree574d5262ba138457d11eb7b7c9e83a1d9254ac97
parentdef0c5f6b0cd58cfc0b5702b1e1b1f5078debc35 (diff)
drm/i915: Report context GTT size
Since the beginning we have conflated the size of the global GTT with that of the per-process context sizes. In recent times (gen8+), those are no longer the same where the global GTT is limited to 2/4GiB but the per-process GTT may be anything up to 256TiB. Userspace knows nothing of this discrepancy and outside of one or two hacks, uses the getaperture ioctl to determine the maximum size it can use. Let's leave that as reporting the global GTT and use the context reporting method to describe the per-process value (which naturally fallsback to reporting the aliasing or global on older platforms, so userspace can always use this method where available). Testcase: igt/gem_userptr_blits/minor-normal-sync Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90065 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c8
-rw-r--r--include/uapi/drm/i915_drm.h5
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 8c688a5f1589..204dc7c0b2d6 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -925,6 +925,14 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
925 case I915_CONTEXT_PARAM_NO_ZEROMAP: 925 case I915_CONTEXT_PARAM_NO_ZEROMAP:
926 args->value = ctx->flags & CONTEXT_NO_ZEROMAP; 926 args->value = ctx->flags & CONTEXT_NO_ZEROMAP;
927 break; 927 break;
928 case I915_CONTEXT_PARAM_GTT_SIZE:
929 if (ctx->ppgtt)
930 args->value = ctx->ppgtt->base.total;
931 else if (to_i915(dev)->mm.aliasing_ppgtt)
932 args->value = to_i915(dev)->mm.aliasing_ppgtt->base.total;
933 else
934 args->value = to_i915(dev)->gtt.base.total;
935 break;
928 default: 936 default:
929 ret = -EINVAL; 937 ret = -EINVAL;
930 break; 938 break;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 484a9fb20479..67cebe6d978f 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1125,8 +1125,9 @@ struct drm_i915_gem_context_param {
1125 __u32 ctx_id; 1125 __u32 ctx_id;
1126 __u32 size; 1126 __u32 size;
1127 __u64 param; 1127 __u64 param;
1128#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 1128#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
1129#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 1129#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
1130#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
1130 __u64 value; 1131 __u64 value;
1131}; 1132};
1132 1133