All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Guang (George) Bai" <guang.bai@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 2/6] drm/i915: Only pin the fence for primary planes (and gen2/3)
Date: Wed, 21 Feb 2018 04:23:56 -0800	[thread overview]
Message-ID: <20180221042356.40f2452b@gbai-ub1604-LTS> (raw)
In-Reply-To: <20180221184807.577-1-ville.syrjala@linux.intel.com>

On Wed, 21 Feb 2018 20:48:07 +0200
Ville Syrjala <ville.syrjala@linux.intel.com> wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently we pin a fence on every plane doing tiled scanout. The
> number of planes we have available is fast apporaching the number
> of fences so we really should stop wasting them. Only FBC needs
> the fence on gen4+, so let's use fences only for the primary planes
> on those platforms.
> 
> v2: drop the tiling check from plane_uses_fence() as the obj is
>     NULL during initial_plane_config() and we don't rally need the
>     check since i915_vma_pin_fence() does the check anyway
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 14 +++++++++++++-
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  drivers/gpu/drm/i915/intel_fbdev.c   |  2 +-
>  3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c index
> 66b269bc24b9..f2c1bb715e7b 100644 ---
> a/drivers/gpu/drm/i915/intel_display.c +++
> b/drivers/gpu/drm/i915/intel_display.c @@ -2067,9 +2067,18 @@ static
> unsigned int intel_surf_alignment(const struct drm_framebuffer *fb, }
>  }
>  
> +static bool intel_plane_uses_fence(const struct intel_plane_state
> *plane_state) +{
> +	struct intel_plane *plane =
> to_intel_plane(plane_state->base.plane);
> +	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> +
> +	return INTEL_GEN(dev_priv) < 4 || plane->id == PLANE_PRIMARY;
> +}
> +
>  struct i915_vma *
>  intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
>  			   unsigned int rotation,
> +			   bool uses_fence,
>  			   unsigned long *out_flags)
>  {
>  	struct drm_device *dev = fb->dev;
> @@ -2122,7 +2131,7 @@ intel_pin_and_fence_fb_obj(struct
> drm_framebuffer *fb, if (IS_ERR(vma))
>  		goto err;
>  
> -	if (i915_vma_is_map_and_fenceable(vma)) {
> +	if (uses_fence && i915_vma_is_map_and_fenceable(vma)) {
>  		int ret;
>  
>  		/* Install a fence for tiled scan-out. Pre-i965
> always needs a @@ -2836,6 +2845,7 @@
> intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
> intel_state->vma = intel_pin_and_fence_fb_obj(fb,
>  					   primary->state->rotation,
> +
> intel_plane_uses_fence(intel_state), &intel_state->flags);
>  	mutex_unlock(&dev->struct_mutex);
>  	if (IS_ERR(intel_state->vma)) {
> @@ -12744,6 +12754,7 @@ intel_prepare_plane_fb(struct drm_plane
> *plane, 
>  		vma = intel_pin_and_fence_fb_obj(fb,
>  						 new_state->rotation,
> +
> intel_plane_uses_fence(to_intel_plane_state(new_state)),
> &to_intel_plane_state(new_state)->flags); if (!IS_ERR(vma))
>  			to_intel_plane_state(new_state)->vma = vma;
> @@ -13162,6 +13173,7 @@ intel_legacy_cursor_update(struct drm_plane
> *plane, } else {
>  		vma = intel_pin_and_fence_fb_obj(fb,
>  						 new_plane_state->rotation,
> +						 false,
>  						 &to_intel_plane_state(new_plane_state)->flags);
>  		if (IS_ERR(vma)) {
>  			DRM_DEBUG_KMS("failed to pin object\n");
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h index 50874f4035cf..e3f78fdae859
> 100644 --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1508,6 +1508,7 @@ void intel_release_load_detect_pipe(struct
> drm_connector *connector, struct i915_vma *
>  intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
>  			   unsigned int rotation,
> +			   bool uses_fence,
>  			   unsigned long *out_flags);
>  void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags);
>  struct drm_framebuffer *
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c
> b/drivers/gpu/drm/i915/intel_fbdev.c index 055f409f8b75..6f12adc06365
> 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -215,7 +215,7 @@ static int intelfb_create(struct drm_fb_helper
> *helper, */
>  	vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base,
>  					 DRM_MODE_ROTATE_0,
> -					 &flags);
> +					 false, &flags);
>  	if (IS_ERR(vma)) {
>  		ret = PTR_ERR(vma);
>  		goto out_unlock;

All these fence and fbc related changes will fix the gen9lp fence
starvation problems from virtualization use cases.
Thanks,
Guang
 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-02-21 19:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 16:02 [PATCH 0/6] drm/i915: Scanout fence fixes/cleanups Ville Syrjala
2018-02-21 16:02 ` [PATCH 1/6] drm/i915: Fail if we can't get a fence for gen2/3 tiled scanout Ville Syrjala
2018-02-21 21:52   ` Chris Wilson
2018-02-22 14:13     ` Ville Syrjälä
2018-02-22 14:21       ` Chris Wilson
2018-02-21 16:02 ` [PATCH 2/6] drm/i915: Only pin the fence for primary planes (and gen2/3) Ville Syrjala
2018-02-21 18:48   ` [PATCH v2 " Ville Syrjala
2018-02-21 12:23     ` Guang (George) Bai [this message]
2018-02-21 21:53     ` Chris Wilson
2018-02-21 16:02 ` [PATCH 3/6] drm/i915: Clean up fbc vs. plane checks Ville Syrjala
2018-02-21 17:31   ` [PATCH v3 " Ville Syrjala
2018-02-21 21:59     ` Chris Wilson
2018-02-22 14:07       ` Ville Syrjälä
2018-02-22 16:15         ` Ville Syrjälä
2018-02-21 16:02 ` [PATCH 4/6] drm/i915: Require fence only for FBC capable planes Ville Syrjala
2018-02-21 22:00   ` Chris Wilson
2018-02-21 16:02 ` [PATCH 5/6] drm/i915: Extract intel_plane_{pin, unpin}_fb() Ville Syrjala
2018-02-21 22:02   ` Chris Wilson
2018-02-21 16:02 ` [PATCH 6/6] drm/i915: Add a FIXME about FBC vs. fence. 90/270 degree rotation Ville Syrjala
2018-02-21 22:04   ` Chris Wilson
2018-02-21 16:28 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Scanout fence fixes/cleanups Patchwork
2018-02-21 16:44 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-02-21 18:00 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Scanout fence fixes/cleanups (rev2) Patchwork
2018-02-21 18:15 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-02-21 19:35 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Scanout fence fixes/cleanups (rev3) Patchwork
2018-02-21 19:51 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-22  0:30 ` ✓ 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=20180221042356.40f2452b@gbai-ub1604-LTS \
    --to=guang.bai@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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 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.