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

Commit aff43766 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Daniel Vetter
Browse files

drm/i915: Move flags describing VMA mappings into the VMA



If these flags are on the object level it will be more difficult to allow
for multiple VMAs per object.

v2: Simplification and cleanup after code review comments (Chris Wilson).

Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 041df357
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static const char *get_tiling_flag(struct drm_i915_gem_object *obj)

static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
{
	return obj->has_global_gtt_mapping ? "g" : " ";
	return i915_gem_obj_to_ggtt(obj) ? "g" : " ";
}

static void
+0 −2
Original line number Diff line number Diff line
@@ -1856,8 +1856,6 @@ struct drm_i915_gem_object {
	unsigned long gt_ro:1;
	unsigned int cache_level:3;

	unsigned int has_aliasing_ppgtt_mapping:1;
	unsigned int has_global_gtt_mapping:1;
	unsigned int has_dma_mapping:1;

	unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS;
+2 −2
Original line number Diff line number Diff line
@@ -3701,7 +3701,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
		list_for_each_entry(vma, &obj->vma_list, vma_link)
			if (drm_mm_node_allocated(&vma->node))
				vma->bind_vma(vma, cache_level,
					      obj->has_global_gtt_mapping ? GLOBAL_BIND : 0);
						vma->bound & GLOBAL_BIND);
	}

	list_for_each_entry(vma, &obj->vma_list, vma_link)
@@ -4097,7 +4097,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
			return PTR_ERR(vma);
	}

	if (flags & PIN_GLOBAL && !obj->has_global_gtt_mapping)
	if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND))
		vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND);

	vma->pin_count++;
+5 −5
Original line number Diff line number Diff line
@@ -522,6 +522,7 @@ static int do_switch(struct intel_engine_cs *ring,
	struct intel_context *from = ring->last_context;
	u32 hw_flags = 0;
	bool uninitialized = false;
	struct i915_vma *vma;
	int ret, i;

	if (from != NULL && ring == &dev_priv->ring[RCS]) {
@@ -571,11 +572,10 @@ static int do_switch(struct intel_engine_cs *ring,
	if (ret)
		goto unpin_out;

	if (!to->legacy_hw_ctx.rcs_state->has_global_gtt_mapping) {
		struct i915_vma *vma = i915_gem_obj_to_vma(to->legacy_hw_ctx.rcs_state,
							   &dev_priv->gtt.base);
		vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND);
	}
	vma = i915_gem_obj_to_ggtt(to->legacy_hw_ctx.rcs_state);
	if (!(vma->bound & GLOBAL_BIND))
		vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level,
				GLOBAL_BIND);

	if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to))
		hw_flags |= MI_RESTORE_INHIBIT;
+3 −6
Original line number Diff line number Diff line
@@ -357,12 +357,9 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
	 * through the ppgtt for non_secure batchbuffers. */
	if (unlikely(IS_GEN6(dev) &&
	    reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION &&
	    !target_i915_obj->has_global_gtt_mapping)) {
		struct i915_vma *vma =
			list_first_entry(&target_i915_obj->vma_list,
					 typeof(*vma), vma_link);
		vma->bind_vma(vma, target_i915_obj->cache_level, GLOBAL_BIND);
	}
	    !(target_vma->bound & GLOBAL_BIND)))
		target_vma->bind_vma(target_vma, target_i915_obj->cache_level,
				GLOBAL_BIND);

	/* Validate that the target is in a valid r/w GPU domain */
	if (unlikely(reloc->write_domain & (reloc->write_domain - 1))) {
Loading