From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 1/2] drm/atomic: move waiting for hw_done to a helper
Date: Wed, 14 Jun 2017 20:11:18 +0200 [thread overview]
Message-ID: <5283f25d-9a90-1761-aa4c-bf48ff452f3c@linux.intel.com> (raw)
In-Reply-To: <20170614145235.GO12629@intel.com>
Op 14-06-17 om 16:52 schreef Ville Syrjälä:
> On Wed, Jun 14, 2017 at 11:08:41AM +0200, Maarten Lankhorst wrote:
>> Moving the wait to a helper allows callers outside of the core to
>> wait for pending updates to complete.
>>
>> This can be used to prevent races against nonblocking modesets.
>> Only the hw_done call in swap_state is moved to a helper, doing
>> it for the other callers requires too many changes and I think this
>> is the only useful one to export.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>> drivers/gpu/drm/drm_atomic_helper.c | 51 +++++++++++++++++++++++++++----------
>> include/drm/drm_atomic_helper.h | 1 +
>> 2 files changed, 38 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index 86d3093c6c9b..1b068ce1aea9 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -2067,6 +2067,41 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
>> EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes);
>>
>> /**
>> + * drm_atomic_helper_wait_for_hw_done - wait for all previous hw updates to complete.
>> + * @crtc: crtc to wait on.
>> + *
>> + * This function waits for all previous hardware updates queued on @crtc
>> + * to complete.
>> + *
>> + * Returns:
>> + * 0 on success, negative error code on failure.
>> + */
>> +int drm_atomic_helper_wait_for_hw_done(struct drm_crtc *crtc)
>> +{
>> + struct drm_crtc_commit *commit;
>> + long ret;
>> +
>> + spin_lock(&crtc->commit_lock);
>> + commit = list_first_entry_or_null(&crtc->commit_list,
>> + struct drm_crtc_commit, commit_entry);
>> + if (commit)
>> + drm_crtc_commit_get(commit);
>> + spin_unlock(&crtc->commit_lock);
>> +
>> + if (!commit)
>> + return 0;
>> +
>> + ret = wait_for_completion_timeout(&commit->hw_done, 10 * HZ);
>> + drm_crtc_commit_put(commit);
>> +
>> + if (ret == 0)
>> + return -EBUSY;
> -ETIMEDOUT ?
ETIMEDOUT -> /* Connection timed out */
No I don't think that would match.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-06-14 18:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 9:08 [PATCH v2 1/2] drm/atomic: move waiting for hw_done to a helper Maarten Lankhorst
2017-06-14 9:08 ` [PATCH v2 2/2] drm/i915: Wait for pending modesets to complete before trying link training, v2 Maarten Lankhorst
2017-06-14 13:44 ` Ville Syrjälä
2017-06-26 9:24 ` Maarten Lankhorst
2017-06-14 14:52 ` [PATCH v2 1/2] drm/atomic: move waiting for hw_done to a helper Ville Syrjälä
2017-06-14 18:11 ` Maarten Lankhorst [this message]
2017-06-14 18:35 ` [Intel-gfx] " Ville Syrjälä
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=5283f25d-9a90-1761-aa4c-bf48ff452f3c@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox