Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 149c86e7 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter
Browse files

drm/i915: Allocate context objects from stolen



As we never expose context objects directly to userspace, we can forgo
allocating a first-class GEM object for them and prefer to use the
limited resource of reserved/stolen memory for them. Note this means
that their initial contents are undefined.

However, a downside of using stolen objects for execlists is that we
cannot access the physical address directly (thanks MCH!) which prevents
their use.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d7b9ca2f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ i915_gem_alloc_context_obj(struct drm_device *dev, size_t size)
	struct drm_i915_gem_object *obj;
	int ret;

	obj = i915_gem_object_create_stolen(dev, size);
	if (obj == NULL)
		obj = i915_gem_alloc_object(dev, size);
	if (obj == NULL)
		return ERR_PTR(-ENOMEM);
+1 −1
Original line number Diff line number Diff line
@@ -1845,7 +1845,7 @@ int intel_lr_context_deferred_create(struct intel_context *ctx,

	context_size = round_up(get_lr_context_size(ring), 4096);

	ctx_obj = i915_gem_alloc_context_obj(dev, context_size);
	ctx_obj = i915_gem_alloc_object(dev, context_size);
	if (IS_ERR(ctx_obj)) {
		ret = PTR_ERR(ctx_obj);
		DRM_DEBUG_DRIVER("Alloc LRC backing obj failed: %d\n", ret);