From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 4/4] drm/i915: Add function to clear scanout flag for vmas
Date: Fri, 02 Jun 2023 19:52:55 +0300 [thread overview]
Message-ID: <87jzwldcwo.fsf@intel.com> (raw)
In-Reply-To: <20230530061417.2384188-5-jouni.hogander@intel.com>
On Tue, 30 May 2023, Jouni Högander <jouni.hogander@intel.com> 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>
I don't really have confidence on what the right placement of the
function should be, but it does what it says on the box.
Reviewed-by: Jani Nikula <jani.nikula@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 41ac65c98720..29ac068b8fa5 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 c66ff2157f6a..c6be96206ee5 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
>
> /**
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-06-02 16:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 6:14 [Intel-gfx] [PATCH v2 0/4] Do not access i915_gem_object members from frontbuffer tracking Jouni Högander
2023-05-30 6:14 ` [Intel-gfx] [PATCH v2 1/4] drm/i915: Add macros to get i915 device from i915_gem_object Jouni Högander
2023-06-02 16:46 ` Jani Nikula
2023-05-30 6:14 ` [Intel-gfx] [PATCH v2 2/4] drm/i915: Add getter/setter for i915_gem_object->frontbuffer Jouni Högander
2023-06-02 16:50 ` Jani Nikula
2023-06-05 8:43 ` Hogander, Jouni
2023-05-30 6:14 ` [Intel-gfx] [PATCH v2 3/4] drm/i915/display: Remove i915_gem_object_types.h from intel_frontbuffer.h Jouni Högander
2023-05-30 6:14 ` [Intel-gfx] [PATCH v2 4/4] drm/i915: Add function to clear scanout flag for vmas Jouni Högander
2023-06-02 16:52 ` Jani Nikula [this message]
2023-05-31 2:51 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Do not access i915_gem_object members from frontbuffer tracking (rev2) Patchwork
2023-05-31 3:07 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-06-01 8:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=87jzwldcwo.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--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