From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Make plane fb tracking work correctly.
Date: Tue, 15 Sep 2015 09:29:31 +0200 [thread overview]
Message-ID: <55F7C8DB.9030406@linux.intel.com> (raw)
In-Reply-To: <1441183361-24507-2-git-send-email-maarten.lankhorst@linux.intel.com>
Op 02-09-15 om 10:42 schreef Maarten Lankhorst:
> atomic->disabled_planes is a hack that had to exist because
> prepare_fb was only called when a new fb was set. This messed
> up fb tracking in some circumstances like aborts from
> interruptible waits. As a result interruptible waiting in
> prepare_plane_fb was forbidden, but other errors could still
> cause frontbuffer tracking to be messed up.
>
> Now that prepare_fb is always called, this hack is no longer
> required and prepare_fb may fail without consequences.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++----------------------
> drivers/gpu/drm/i915/intel_drv.h | 1 -
> 2 files changed, 18 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index edcf8746440e..6ebc7661ec8c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4718,17 +4718,6 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
> struct drm_device *dev = crtc->base.dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
> - struct drm_plane *p;
> -
> - /* Track fb's for any planes being disabled */
> - drm_for_each_plane_mask(p, dev, atomic->disabled_planes) {
> - struct intel_plane *plane = to_intel_plane(p);
> -
> - mutex_lock(&dev->struct_mutex);
> - i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL,
> - plane->frontbuffer_bit);
> - mutex_unlock(&dev->struct_mutex);
> - }
>
> if (atomic->wait_for_flips)
> intel_crtc_wait_for_pending_flips(&crtc->base);
> @@ -11511,14 +11500,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
> return ret;
> }
>
> - /*
> - * Disabling a plane is always okay; we just need to update
> - * fb tracking in a special way since cleanup_fb() won't
> - * get called by the plane helpers.
> - */
> - if (old_plane_state->base.fb && !fb)
> - intel_crtc->atomic.disabled_planes |= 1 << i;
> -
> was_visible = old_plane_state->visible;
> visible = to_intel_plane_state(plane_state)->visible;
>
> @@ -13272,15 +13253,17 @@ intel_prepare_plane_fb(struct drm_plane *plane,
> struct drm_framebuffer *fb = new_state->fb;
> struct intel_plane *intel_plane = to_intel_plane(plane);
> struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> - struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
> + struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
> int ret = 0;
>
> - if (!obj)
> + if (!obj && !old_obj)
> return 0;
>
> mutex_lock(&dev->struct_mutex);
>
> - if (plane->type == DRM_PLANE_TYPE_CURSOR &&
> + if (!obj) {
> + ret = 0;
> + } else if (plane->type == DRM_PLANE_TYPE_CURSOR &&
> INTEL_INFO(dev)->cursor_needs_physical) {
> int align = IS_I830(dev) ? 16 * 1024 : 256;
> ret = i915_gem_object_attach_phys(obj, align);
> @@ -13310,17 +13293,23 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
> const struct drm_plane_state *old_state)
> {
> struct drm_device *dev = plane->dev;
> - struct drm_i915_gem_object *obj = intel_fb_obj(old_state->fb);
> + struct intel_plane *intel_plane = to_intel_plane(plane);
> + struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);
> + struct drm_i915_gem_object *obj = intel_fb_obj(plane->fb);
^Oops, this one needs to be plane->state->fb, or a frontbuffer tracking mismatch would still occur when applying the interruptible pinning series.
> - if (!obj)
> + if (!obj && !old_obj)
> return;
>
> - if (plane->type != DRM_PLANE_TYPE_CURSOR ||
> - !INTEL_INFO(dev)->cursor_needs_physical) {
> - mutex_lock(&dev->struct_mutex);
> + mutex_lock(&dev->struct_mutex);
> + if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
> + !INTEL_INFO(dev)->cursor_needs_physical))
> intel_unpin_fb_obj(old_state->fb, old_state);
> - mutex_unlock(&dev->struct_mutex);
> - }
> +
> + /* prepare_fb aborted? */
> + if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
> + (obj && !(obj->frontbuffer_bits & intel_plane->frontbuffer_bit)))
> + i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
> + mutex_unlock(&dev->struct_mutex);
> }
>
> int
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 104a7f8b650d..176f0a15e41b 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -505,7 +505,6 @@ struct intel_crtc_atomic_commit {
> bool disable_cxsr;
> bool pre_disable_primary;
> bool update_wm_pre, update_wm_post;
> - unsigned disabled_planes;
>
> /* Sleepable operations to perform after commit */
> unsigned fb_bits;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-09-15 7:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 8:42 [PATCH 1/2] drm/atomic: Make prepare_fb/cleanup_fb only take state, v3 Maarten Lankhorst
2015-09-02 8:42 ` [PATCH 2/2] drm/i915: Make plane fb tracking work correctly Maarten Lankhorst
2015-09-15 7:29 ` Maarten Lankhorst [this message]
2015-09-02 14:36 ` [PATCH 1/2] drm/atomic: Make prepare_fb/cleanup_fb only take state, v3 Daniel Stone
2015-09-02 15:24 ` Daniel Vetter
2015-09-14 11:07 ` Maarten Lankhorst
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=55F7C8DB.9030406@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--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.