All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr
@ 2016-04-13  9:52 Chris Wilson
  2016-04-13  9:52   ` Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Chris Wilson @ 2016-04-13  9:52 UTC (permalink / raw)
  To: intel-gfx

When setting up the overlay page, we pin it into the GGTT (when using
virtual addresses) and store the offset as overlay->flip_addr. Rather
than doing a lookup of the GGTT address everytime, we can use the known
address instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_overlay.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 6694e9230cd5..e487ff18b42f 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -198,7 +198,7 @@ intel_overlay_map_regs(struct intel_overlay *overlay)
 		regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_handle->vaddr;
 	else
 		regs = io_mapping_map_wc(ggtt->mappable,
-					 i915_gem_obj_ggtt_offset(overlay->reg_bo));
+					 overlay->flip_addr);
 
 	return regs;
 }
@@ -1493,7 +1493,7 @@ intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
 			overlay->reg_bo->phys_handle->vaddr;
 	else
 		regs = io_mapping_map_atomic_wc(ggtt->mappable,
-						i915_gem_obj_ggtt_offset(overlay->reg_bo));
+						overlay->flip_addr);
 
 	return regs;
 }
@@ -1523,10 +1523,7 @@ intel_overlay_capture_error_state(struct drm_device *dev)
 
 	error->dovsta = I915_READ(DOVSTA);
 	error->isr = I915_READ(ISR);
-	if (OVERLAY_NEEDS_PHYSICAL(overlay->dev))
-		error->base = (__force long)overlay->reg_bo->phys_handle->vaddr;
-	else
-		error->base = i915_gem_obj_ggtt_offset(overlay->reg_bo);
+	error->base = overlay->flip_addr;
 
 	regs = intel_overlay_map_regs_atomic(overlay);
 	if (!regs)
-- 
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 26+ messages in thread
* Re: [PATCH v2 4/4] drm/i915: Move ioremap_wc tracking onto VMA
@ 2016-04-18 12:08 Tvrtko Ursulin
  2016-04-18 14:54 ` [PATCH] " Chris Wilson
  0 siblings, 1 reply; 26+ messages in thread
From: Tvrtko Ursulin @ 2016-04-18 12:08 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx, Tvrtko Ursulin, Joonas Lahtinen


On 18/04/16 12:56, Chris Wilson wrote:
> On Mon, Apr 18, 2016 at 12:14:02PM +0100, Chris Wilson wrote:
>> By tracking the iomapping on the VMA itself, we can share that area
>> between multiple users. Also by only revoking the iomapping upon
>> unbinding from the mappable portion of the GGTT, we can keep that iomap
>> across multiple invocations (e.g. execlists context pinning).
>>
>> Note that by moving the iounnmap tracking to the VMA, we actually end up
>> fixing a leak of the iomapping in intel_fbdev.
>>
>> v1.5: Rebase prompted by Tvrtko
>> v2: Drop dev_priv parameter, we can recover the i915_ggtt from the vma.
>> v3: Move handling of ioremap space exhaustion to vmap_purge and also
>> allow vmallocs to recover old iomaps. Add Tvrtko's kerneldoc.
>> v4: Fix a use-after-free in shrinker and rearrange i915_vma_iomap
>> v5: Back to i915_vm_to_ggtt
>>
>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> #v4
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_gem.c          |  2 ++
>>   drivers/gpu/drm/i915/i915_gem_gtt.c      | 23 +++++++++++++++++++
>>   drivers/gpu/drm/i915/i915_gem_gtt.h      | 38 ++++++++++++++++++++++++++++++++
>>   drivers/gpu/drm/i915/i915_gem_shrinker.c | 28 ++++++++++++++++++-----
>>   drivers/gpu/drm/i915/intel_fbdev.c       | 22 +++++++++---------
>>   5 files changed, 97 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>> index 6ce2c31b9a81..82d0af3f1692 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -3378,6 +3378,8 @@ static int __i915_vma_unbind(struct i915_vma *vma, bool wait)
>>   		ret = i915_gem_object_put_fence(obj);
>>   		if (ret)
>>   			return ret;
>> +
>> +		i915_vma_iounmap(vma);
>>   	}
>>
>>   	trace_i915_vma_unbind(vma);
>> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
>> index b3af2e808b49..c894af7e0ea1 100644
>> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
>> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
>> @@ -3634,3 +3634,26 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,
>>   		return obj->base.size;
>>   	}
>>   }
>> +
>> +void *i915_vma_iomap(struct i915_vma *vma)
>
> I've been arguing with myself as to whether to make this
> i915_vma_pin_iomap (and so acquire the vma->pin_count as well).
>
> There will still be the requirement that the vma is already usuable, but
> it will mean that the returned iomap cannot be reaped for the critical
> section of its user.

I don't have a strong feeling either way. vma_pin_iomap would make the 
name (and usage model) more consistent with obj_pin_map and taking the 
pin count could potentially make it a little bit safer for the users 
where it would leak rather than crash. So maybe on the basis of those it 
would be a tiny bit better.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-04-19 17:30 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13  9:52 [PATCH 1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Chris Wilson
2016-04-13  9:52 ` [PATCH 2/3] io-mapping: Specify mapping size for io_mapping_map_wc() Chris Wilson
2016-04-13  9:52   ` Chris Wilson
2016-04-13  9:52   ` Chris Wilson
2016-04-13  9:52 ` [PATCH 3/3] drm/i915: Move ioremap_wc tracking onto VMA Chris Wilson
2016-04-13 12:30   ` Tvrtko Ursulin
2016-04-13 12:44     ` Chris Wilson
2016-04-13 14:47       ` [PATCH] " Chris Wilson
2016-04-13 15:07         ` kbuild test robot
2016-04-13 15:12         ` Chris Wilson
2016-04-15  9:40           ` Tvrtko Ursulin
2016-04-15 10:00             ` Chris Wilson
2016-04-15 10:19               ` Tvrtko Ursulin
2016-04-15 10:38                 ` Chris Wilson
2016-04-15 10:41                   ` Tvrtko Ursulin
2016-04-18 10:57                   ` Joonas Lahtinen
2016-04-13 12:10 ` [PATCH 1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Tvrtko Ursulin
2016-04-14 10:07 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr (rev2) Patchwork
2016-04-18 12:08 [PATCH v2 4/4] drm/i915: Move ioremap_wc tracking onto VMA Tvrtko Ursulin
2016-04-18 14:54 ` [PATCH] " Chris Wilson
2016-04-18 15:08   ` Tvrtko Ursulin
2016-04-18 15:22     ` Chris Wilson
2016-04-18 15:27       ` Tvrtko Ursulin
2016-04-19 11:06         ` Chris Wilson
2016-04-19 12:19           ` Tvrtko Ursulin
2016-04-19 17:33           ` kbuild test robot
2016-04-18 15:20   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.