Re: [PATCH 09/13] drm/i915: Move semaphore object creation into intel_ring_init_semaphores

Chris Wilson
2016-06-29T15:30:16Z

On Wed, Jun 29, 2016 at 04:09:28PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> The object needs to be created before semaphores can be initialized
> on any ring and it makes sense to pull it out to this semaphore
> dedicated helper.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/intel_ringbuffer.c | 45 ++++++++++++++++++---------------
> 1 file changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index d0401bb800a6..77d663fcdff1 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -2876,6 +2876,30 @@ static int gen6_ring_flush(struct drm_i915_gem_request *req,
> static void intel_ring_init_semaphores(struct drm_i915_private *dev_priv,
> struct intel_engine_cs *engine)
> {
> + struct drm_i915_gem_object *obj;
> + int ret;
> +
> + if (!i915_semaphore_is_enabled(dev_priv))
> + return;
> +
> + if (INTEL_GEN(dev_priv) >= 8 && !dev_priv->semaphore_obj) {

struct drm_i915_gem_object *obj;

Probably best to scope this object locally since we don't carry it
forward into the next loop.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

--
Chris Wilson, Intel Open Source Technology Centre