From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/i915: Consolidate common error handling in intel_pin_and_map_ringbuffer_obj
Date: Wed, 6 Apr 2016 10:02:48 +0100 [thread overview]
Message-ID: <5704D0B8.9010408@linux.intel.com> (raw)
In-Reply-To: <1459861057-25931-3-git-send-email-chris@chris-wilson.co.uk>
On 05/04/16 13:57, Chris Wilson wrote:
> After we pin the ringbuffer into the GGTT, all error paths need to unpin
> it again. Move this common step into one block, and make the unable to
> iomap error code consistent (i.e. treat it as out of memory to avoid
> confusing it with a invalid argument).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/intel_ringbuffer.c | 25 ++++++++++++-------------
> 1 file changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 2e864b7a528b..c6ae92529fdc 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -2121,15 +2121,13 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
> return ret;
>
> ret = i915_gem_object_set_to_cpu_domain(obj, true);
> - if (ret) {
> - i915_gem_object_ggtt_unpin(obj);
> - return ret;
> - }
> + if (ret)
> + goto err_unpin;
>
> ringbuf->virtual_start = vmap_obj(obj);
> if (ringbuf->virtual_start == NULL) {
> - i915_gem_object_ggtt_unpin(obj);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto err_unpin;
> }
> } else {
> ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, PIN_MAPPABLE);
> @@ -2137,10 +2135,8 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
> return ret;
>
> ret = i915_gem_object_set_to_gtt_domain(obj, true);
> - if (ret) {
> - i915_gem_object_ggtt_unpin(obj);
> - return ret;
> - }
> + if (ret)
> + goto err_unpin;
>
> /* Access through the GTT requires the device to be awake. */
> assert_rpm_wakelock_held(dev_priv);
> @@ -2148,14 +2144,17 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
> ringbuf->virtual_start = ioremap_wc(ggtt->mappable_base +
> i915_gem_obj_ggtt_offset(obj), ringbuf->size);
> if (ringbuf->virtual_start == NULL) {
> - i915_gem_object_ggtt_unpin(obj);
> - return -EINVAL;
> + ret = -ENOMEM;
> + goto err_unpin;
> }
> }
>
> ringbuf->vma = i915_gem_obj_to_ggtt(obj);
> -
O_o :D
> return 0;
> +
> +err_unpin:
> + i915_gem_object_ggtt_unpin(obj);
> + return ret;
> }
>
> static void intel_destroy_ringbuffer_obj(struct intel_ringbuffer *ringbuf)
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-06 9:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 12:57 vmap consolidation Chris Wilson
2016-04-05 12:57 ` [PATCH 1/6] drm/i915/dmabuf: Tighten struct_mutex for unmap_dma_buf Chris Wilson
2016-04-06 8:57 ` Tvrtko Ursulin
2016-04-05 12:57 ` [PATCH 2/6] drm/i915: Consolidate common error handling in intel_pin_and_map_ringbuffer_obj Chris Wilson
2016-04-06 9:02 ` Tvrtko Ursulin [this message]
2016-04-05 12:57 ` [PATCH 3/6] drm/i915: Refactor duplicate object vmap functions Chris Wilson
2016-04-06 9:30 ` Tvrtko Ursulin
2016-04-06 9:58 ` Chris Wilson
2016-04-05 12:57 ` [PATCH 4/6] drm/i915/shrinker: Restrict vmap purge to objects with vmaps Chris Wilson
2016-04-05 12:57 ` [PATCH 5/6] drm,i915: Introduce drm_malloc_gfp() Chris Wilson
2016-04-05 13:05 ` Chris Wilson
2016-04-06 9:40 ` Tvrtko Ursulin
2016-04-06 9:47 ` Chris Wilson
2016-04-05 12:57 ` [PATCH 6/6] drm/i915: Avoid allocating a vmap arena for a single page Chris Wilson
2016-04-05 13:01 ` Chris Wilson
2016-04-05 13:14 ` Matthew Auld
2016-04-06 9:49 ` Tvrtko Ursulin
2016-04-06 10:05 ` Chris Wilson
2016-04-06 11:36 ` Tvrtko Ursulin
2016-04-06 13:52 ` Dave Gordon
2016-04-05 15:57 ` ✗ Fi.CI.BAT: failure for series starting with [1/6] drm/i915/dmabuf: Tighten struct_mutex for unmap_dma_buf Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5704D0B8.9010408@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.