Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: Re: [Intel-gfx] [PATCH v4 4/4] drm/i915: Add function to clear scanout flag for vmas
Date: Mon, 31 Jul 2023 11:47:39 +0200	[thread overview]
Message-ID: <12f9c5bb-42fc-0d18-e478-65861cc62a4c@linux.intel.com> (raw)
In-Reply-To: <20230727064142.751976-5-jouni.hogander@intel.com>


On 7/27/2023 8:41 AM, Jouni Högander wrote:
> Currently frontbuffer tracking code is directly iterating over object vmas
> and clearing scanout flags for them. Add function to clear scanout flag for
> vmas and use it from frontbuffer tracking code.
>
> v2: describe function parameter.
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>


> ---
>   .../gpu/drm/i915/display/intel_frontbuffer.c  |  8 +-------
>   drivers/gpu/drm/i915/i915_vma.c               | 20 +++++++++++++++++++
>   drivers/gpu/drm/i915/i915_vma.h               |  2 ++
>   3 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
> index 56f45370fee0..22392f94b626 100644
> --- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
> +++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
> @@ -226,16 +226,10 @@ static void frontbuffer_release(struct kref *ref)
>   	struct intel_frontbuffer *front =
>   		container_of(ref, typeof(*front), ref);
>   	struct drm_i915_gem_object *obj = front->obj;
> -	struct i915_vma *vma;
>   
>   	drm_WARN_ON(&intel_bo_to_i915(obj)->drm, atomic_read(&front->bits));
>   
> -	spin_lock(&obj->vma.lock);
> -	for_each_ggtt_vma(vma, obj) {
> -		i915_vma_clear_scanout(vma);
> -		vma->display_alignment = I915_GTT_MIN_ALIGNMENT;
> -	}
> -	spin_unlock(&obj->vma.lock);
> +	i915_ggtt_clear_scanout(obj);
>   
>   	i915_gem_object_set_frontbuffer(obj, NULL);
>   	spin_unlock(&intel_bo_to_i915(obj)->display.fb_tracking.lock);
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index e90b9c812180..63e111266de1 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -1629,6 +1629,26 @@ int i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
>   	return err;
>   }
>   
> +/**
> + * i915_ggtt_clear_scanout - Clear scanout flag for all objects ggtt vmas
> + * @obj: i915 GEM object
> + * This function clears scanout flags for objects ggtt vmas. These flags are set
> + * when object is pinned for display use and this function to clear them all is
> + * targeted to be called by frontbuffer tracking code when the frontbuffer is
> + * about to be released.
> + */
> +void i915_ggtt_clear_scanout(struct drm_i915_gem_object *obj)
> +{
> +	struct i915_vma *vma;
> +
> +	spin_lock(&obj->vma.lock);
> +	for_each_ggtt_vma(vma, obj) {
> +		i915_vma_clear_scanout(vma);
> +		vma->display_alignment = I915_GTT_MIN_ALIGNMENT;
> +	}
> +	spin_unlock(&obj->vma.lock);
> +}
> +
>   static void __vma_close(struct i915_vma *vma, struct intel_gt *gt)
>   {
>   	/*
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 9a9729205d5b..eaa310864370 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -435,6 +435,8 @@ static inline void i915_vma_clear_scanout(struct i915_vma *vma)
>   	clear_bit(I915_VMA_SCANOUT_BIT, __i915_vma_flags(vma));
>   }
>   
> +void i915_ggtt_clear_scanout(struct drm_i915_gem_object *obj);
> +
>   #define for_each_until(cond) if (cond) break; else
>   
>   /**

  reply	other threads:[~2023-07-31  9:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  6:41 [Intel-gfx] [PATCH v4 0/4] Do not access i915_gem_object members from frontbuffer tracking Jouni Högander
2023-07-27  6:41 ` [Intel-gfx] [PATCH v4 1/4] drm/i915: Add macros to get i915 device from i915_gem_object Jouni Högander
2023-07-31  9:32   ` Nirmoy Das
2023-07-27  6:41 ` [Intel-gfx] [PATCH v4 2/4] drm/i915: Add getter/setter for i915_gem_object->frontbuffer Jouni Högander
2023-07-31  9:34   ` Nirmoy Das
2023-07-27  6:41 ` [Intel-gfx] [PATCH v4 3/4] drm/i915/display: Remove i915_gem_object_types.h from intel_frontbuffer.h Jouni Högander
2023-08-01  5:26   ` B, Jeevan
2023-07-27  6:41 ` [Intel-gfx] [PATCH v4 4/4] drm/i915: Add function to clear scanout flag for vmas Jouni Högander
2023-07-31  9:47   ` Nirmoy Das [this message]
2023-07-27  7:17 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Do not access i915_gem_object members from frontbuffer tracking (rev4) Patchwork
2023-07-27  7:36 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-27  8:53 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-08-01  7:04 ` [Intel-gfx] [PATCH v4 0/4] Do not access i915_gem_object members from frontbuffer tracking Hogander, Jouni

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=12f9c5bb-42fc-0d18-e478-65861cc62a4c@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jouni.hogander@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox