From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>,
Chris Wilson <chris@chris-wilson.co.uk>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [PATCH v2] drm/atomic: Fix outdated comment.
Date: Wed, 4 Jan 2017 12:34:00 +0100 [thread overview]
Message-ID: <7acd1c78-ea86-7776-d98d-c846186e4b88@linux.intel.com> (raw)
In-Reply-To: <20170104112810.ozpfxohzvtynsap7@phenom.ffwll.local>
Op 04-01-17 om 12:28 schreef Daniel Vetter:
> On Wed, Jan 04, 2017 at 11:22:54AM +0000, Chris Wilson wrote:
>> On Wed, Jan 04, 2017 at 12:15:55PM +0100, Maarten Lankhorst wrote:
>>> Op 15-12-16 om 16:19 schreef Daniel Vetter:
>>>> On Thu, Dec 15, 2016 at 03:29:42PM +0100, Maarten Lankhorst wrote:
>>>>> drm_atomic_state_put is called unconditionally, so TEST_ONLY is no
>>>>> different from commit.
>>>>>
>>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>>> I think it'd be good to update the kerneldoc for the atomic_commit
>>>> callback to mention that drivers should grab their own references using
>>>> drm_atomic_state_get() when they need it.
>>>>
>>>> Applied this one meanwhile, thanks.
>>> --->8---
>>> Commit 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
>>> adds reference counting to atomic state, but didn't update the comments
>>> in drm_atomic_(nonblocking_)commit. Clarify lifetime a bit more.
>>>
>>> Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
>>> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
>>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> ---
>>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>>> index 681d5f97639d..6492546476b4 100644
>>> --- a/drivers/gpu/drm/drm_atomic.c
>>> +++ b/drivers/gpu/drm/drm_atomic.c
>>> @@ -1599,10 +1599,9 @@ EXPORT_SYMBOL(drm_atomic_check_only);
>>> * more locks but encountered a deadlock. The caller must then do the usual w/w
>>> * backoff dance and restart. All other errors are fatal.
>>> *
>>> - * Also note that on successful execution ownership of @state is transferred
>>> - * from the caller of this function to the function itself. The caller must not
>>> - * free or in any other way access @state. If the function fails then the caller
>>> - * must clean up @state itself.
>>> + * In earlier versions of the atomic api, the caller was handing its reference
>>> + * of @state over to this function on success. This is no longer the case, and
>>> + * callers should always call drm_atomic_state_put().
>>> *
>>> * Returns:
>>> * 0 on success, negative error code on failure.
>>> @@ -1630,10 +1629,9 @@ EXPORT_SYMBOL(drm_atomic_commit);
>>> * more locks but encountered a deadlock. The caller must then do the usual w/w
>>> * backoff dance and restart. All other errors are fatal.
>>> *
>>> - * Also note that on successful execution ownership of @state is transferred
>>> - * from the caller of this function to the function itself. The caller must not
>>> - * free or in any other way access @state. If the function fails then the caller
>>> - * must clean up @state itself.
>>> + * In earlier versions of the atomic api, the caller was handing its reference
>>> + * of @state over to this function on success. This is no longer the case, and
>>> + * callers should always call drm_atomic_state_put().
>> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>>
>> But do we really want the confusion of mentioning what the api doesn't do
>> any more?
> Agreed, kerneldoc should state what is (and why), maybe with a FIXME if it
> only makes sense with some hystorical context and what should be done
> instead. git blame is for figuring out what was.
>
> Maarten, can you pls respin?
> -Daniel
----8<---
Commit 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
adds reference counting to atomic state, but didn't update the comments
in drm_atomic_(nonblocking_)commit. Clarify lifetime a bit more.
Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 681d5f97639d..672f1de84d6c 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1599,10 +1599,8 @@ EXPORT_SYMBOL(drm_atomic_check_only);
* more locks but encountered a deadlock. The caller must then do the usual w/w
* backoff dance and restart. All other errors are fatal.
*
- * Also note that on successful execution ownership of @state is transferred
- * from the caller of this function to the function itself. The caller must not
- * free or in any other way access @state. If the function fails then the caller
- * must clean up @state itself.
+ * This function will take its own reference on @state.
+ * Callers should always release their reference with drm_atomic_state_put().
*
* Returns:
* 0 on success, negative error code on failure.
@@ -1630,10 +1628,8 @@ EXPORT_SYMBOL(drm_atomic_commit);
* more locks but encountered a deadlock. The caller must then do the usual w/w
* backoff dance and restart. All other errors are fatal.
*
- * Also note that on successful execution ownership of @state is transferred
- * from the caller of this function to the function itself. The caller must not
- * free or in any other way access @state. If the function fails then the caller
- * must clean up @state itself.
+ * This function will take its own reference on @state.
+ * Callers should always release their reference with drm_atomic_state_put().
*
* Returns:
* 0 on success, negative error code on failure.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-01-04 11:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 14:29 [PATCH 0/4] drm: Resurrect atomic rmfb code Maarten Lankhorst
2016-12-15 14:29 ` [PATCH 1/4] drm/atomic: Delete wrong comment Maarten Lankhorst
2016-12-15 15:19 ` [Intel-gfx] " Daniel Vetter
2017-01-04 11:15 ` [PATCH] drm/atomic: Fix outdated comment Maarten Lankhorst
2017-01-04 11:22 ` Chris Wilson
2017-01-04 11:28 ` Daniel Vetter
2017-01-04 11:34 ` Maarten Lankhorst [this message]
2017-01-04 15:41 ` [PATCH v2] " Daniel Vetter
2016-12-15 14:29 ` [PATCH 2/4] drm/i915: Fix POWER_DOMAIN_AUDIO refcounting Maarten Lankhorst
2017-01-11 16:13 ` Daniel Vetter
2017-01-16 11:00 ` Maarten Lankhorst
2017-01-23 7:43 ` [Intel-gfx] " Daniel Vetter
2016-12-15 14:29 ` [PATCH 3/4] drm/i915: Disable all crtcs during driver unload Maarten Lankhorst
2017-01-11 16:15 ` Daniel Vetter
2016-12-15 14:29 ` [PATCH 4/4] drm: Resurrect atomic rmfb code, v2 Maarten Lankhorst
2017-01-11 16:15 ` Daniel Vetter
2017-01-24 21:44 ` Matt Roper
2017-01-25 4:54 ` Daniel Vetter
2017-01-25 8:09 ` Thomas Hellstrom
2017-01-25 8:36 ` Maarten Lankhorst
2017-01-25 18:05 ` Sinclair Yeh
2017-01-26 9:55 ` Maarten Lankhorst
2017-01-26 18:39 ` Sinclair Yeh
2017-02-09 12:29 ` Maarten Lankhorst
2017-02-09 15:58 ` Sinclair Yeh
2017-01-25 11:30 ` [PATCH v3 4/4] drm: Resurrect atomic rmfb code, v3 Maarten Lankhorst
2017-02-15 13:56 ` Jani Nikula
2017-02-15 16:28 ` [Intel-gfx] " Sinclair Yeh
2017-02-16 9:45 ` Jani Nikula
2017-02-16 11:00 ` [Intel-gfx] " Maarten Lankhorst
2016-12-15 16:23 ` ✗ Fi.CI.BAT: warning for drm: Resurrect atomic rmfb code Patchwork
2016-12-15 16:25 ` 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=7acd1c78-ea86-7776-d98d-c846186e4b88@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).