From: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
To: Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: Dave Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH v3 1/7] drm: Add consistency check for page-flipping
Date: Wed, 13 Feb 2013 20:20:09 +0100 [thread overview]
Message-ID: <20130213192009.GP5813@phenom.ffwll.local> (raw)
In-Reply-To: <1360771506-17849-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
On Wed, Feb 13, 2013 at 05:05:00PM +0100, Thierry Reding wrote:
> Driver implementations of the drm_crtc's .page_flip() function are
> required to update the crtc->fb field on success to reflect that the new
> framebuffer is now in use. This is important to keep reference counting
> on the framebuffers balanced.
>
> While at it, document this requirement to keep others from falling into
> the same trap.
>
> Suggested-by: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Reviewed-by: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
> ---
> Documentation/DocBook/drm.tmpl | 6 ++++++
> drivers/gpu/drm/drm_crtc.c | 7 +++++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
> index fae8018..8dfaeb0 100644
> --- a/Documentation/DocBook/drm.tmpl
> +++ b/Documentation/DocBook/drm.tmpl
> @@ -1161,6 +1161,12 @@ int max_width, max_height;</synopsis>
> any new rendering to the frame buffer until the page flip completes.
> </para>
> <para>
> + If a page flip can be successfully scheduled the driver must set the
> + <code>drm_crtc-<fb</code> field to the new framebuffer pointed to
> + by <code>fb</code>. This is important so that the reference counting
> + on framebuffers stays balanced.
> + </para>
> + <para>
> If a page flip is already pending, the
> <methodname>page_flip</methodname> operation must return
> -<errorname>EBUSY</errorname>.
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 838c9b6..d86edc1 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3766,6 +3766,13 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> /* Keep the old fb, don't unref it. */
> old_fb = NULL;
> } else {
> + /*
> + * Warn if the driver hasn't properly updated the crtc->fb
> + * field to reflect that the new framebuffer is now used.
> + * Failing to do so will screw with the reference counting
> + * on framebuffers.
> + */
> + WARN_ON(crtc->fb != fb);
> /* Unref only the old framebuffer. */
> fb = NULL;
> }
> --
> 1.8.1.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-02-13 19:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 16:04 [PATCH v3 0/7] drm/tegra: Miscellaneous enhancements Thierry Reding
[not found] ` <1360771506-17849-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-13 16:05 ` [PATCH v3 1/7] drm: Add consistency check for page-flipping Thierry Reding
[not found] ` <1360771506-17849-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-13 19:20 ` Daniel Vetter [this message]
2013-02-13 16:05 ` [PATCH v3 2/7] drm/tegra: Add plane support Thierry Reding
[not found] ` <1360771506-17849-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-18 6:06 ` Mark Zhang
[not found] ` <5121C500.3000000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 6:40 ` Thierry Reding
[not found] ` <20130218064002.GA30856-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 6:55 ` Mark Zhang
[not found] ` <5121D048.6080202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:01 ` Thierry Reding
[not found] ` <20130218070119.GA31132-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 7:12 ` Mark Zhang
2013-02-13 16:05 ` [PATCH v3 3/7] drm/tegra: Implement .mode_set_base() Thierry Reding
[not found] ` <1360771506-17849-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2013-02-18 6:17 ` Mark Zhang
[not found] ` <5121C791.3040903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 6:28 ` Mark Zhang
2013-02-18 6:48 ` Thierry Reding
[not found] ` <20130218064832.GB30856-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 7:06 ` Mark Zhang
[not found] ` <5121D2E2.7080905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:20 ` Thierry Reding
[not found] ` <20130218072057.GA31486-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-18 8:40 ` Mark Zhang
[not found] ` <5121E8EB.1050102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 9:07 ` Mark Zhang
2013-02-13 16:05 ` [PATCH v3 4/7] drm/tegra: Implement VBLANK support Thierry Reding
2013-02-13 16:05 ` [PATCH v3 5/7] drm/tegra: Implement page-flipping support Thierry Reding
2013-02-13 16:05 ` [PATCH v3 6/7] drm/tegra: Split DC_CMD_STATE_CONTROL register write Thierry Reding
2013-02-13 16:05 ` [PATCH v3 7/7] drm/tegra: Add list of framebuffers to debugfs Thierry Reding
2013-02-18 7:42 ` [PATCH v3 0/7] drm/tegra: Miscellaneous enhancements Mark Zhang
[not found] ` <5121DB6F.60503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-18 7:48 ` Thierry Reding
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=20130213192009.GP5813@phenom.ffwll.local \
--to=daniel-/w4ywyx8dfk@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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.