From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/4] drm/i915: Keep plane->state updated on pageflip
Date: Fri, 30 Jan 2015 16:22:36 -0800 [thread overview]
Message-ID: <1422663759-21589-2-git-send-email-matthew.d.roper@intel.com> (raw)
In-Reply-To: <1422663759-21589-1-git-send-email-matthew.d.roper@intel.com>
Until all drivers have transitioned to atomic, the framebuffer
associated with a plane is tracked in both plane->fb (for legacy) and
plane->state->fb (for all the new atomic codeflow). All of our modeset
and plane updates use drm_plane->update_plane(), so in theory plane->fb
and plane->state->fb should always stay in sync and point at the same
thing for i915. However we forgot about the pageflip ioctl case, which
currently only updates plane->fb and leaves plane->state->fb at a stale
value.
Surprisingly, this doesn't cause any real problems at the moment since
internally we use the plane->fb pointer in most of the places that
matter, and on the next .update_plane() call, we use plane->fb to figure
out which framebuffer to cleanup. However when we switch to the full
atomic helpers for update_plane()/disable_plane(), those helpers use
plane->state->fb to figure out which framebuffer to cleanup, so not
having updated the plane->state->fb pointer causes things to blow up
following a pageflip ioctl.
The fix here is to just make sure we update plane->state->fb at the same
time we update plane->fb in the pageflip ioctl.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3d220a6..08e2bab 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9801,6 +9801,13 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
crtc->primary->fb = fb;
+ /* Keep state structure in sync */
+ if (crtc->primary->state->fb)
+ drm_framebuffer_unreference(crtc->primary->state->fb);
+ crtc->primary->state->fb = fb;
+ if (crtc->primary->state->fb)
+ drm_framebuffer_reference(crtc->primary->state->fb);
+
work->pending_flip_obj = obj;
atomic_inc(&intel_crtc->unpin_work_count);
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-01-31 0:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-31 0:22 [PATCH 0/4] More nuclear pageflip Matt Roper
2015-01-31 0:22 ` Matt Roper [this message]
2015-01-31 9:36 ` [PATCH 1/4] drm/i915: Keep plane->state updated on pageflip Daniel Vetter
2015-01-31 0:22 ` [PATCH 2/4] drm/i915: Switch planes from transitional helpers to full atomic helpers Matt Roper
2015-01-31 0:22 ` [PATCH 3/4] drm/i915: Enable asynchronous nuclear flips Matt Roper
2015-01-31 9:30 ` Daniel Vetter
2015-01-31 20:07 ` Matt Roper
2015-02-02 9:36 ` Daniel Vetter
2015-01-31 0:22 ` [PATCH 4/4] drm/i915: Use atomic helper for pageflips Matt Roper
2015-01-31 9:35 ` [PATCH 0/4] More nuclear pageflip Daniel Vetter
2015-01-31 20:22 ` Matt Roper
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=1422663759-21589-2-git-send-email-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox