All of lore.kernel.org
 help / color / mirror / Atom feed
From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Cc: "Riley Andrews" <riandrews@android.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: [RFC 5/9] android/sync: Fix reversed sense of signaled fence
Date: Wed, 13 Jan 2016 17:57:31 +0000	[thread overview]
Message-ID: <1452707855-9791-6-git-send-email-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <1452707855-9791-1-git-send-email-John.C.Harrison@Intel.com>

From: Peter Lawthers <peter.lawthers@intel.com>

In the 3.14 kernel, a signaled fence was indicated by the status field
== 1. In 4.x, a status == 0 indicates signaled, status < 0 indicates error,
and status > 0 indicates active.

This patch wraps the check for a signaled fence in a function so that
callers no longer needs to know the underlying implementation.

v0.3: New patch for series.

Tracked-On: https://jira01.devtools.intel.com/browse/ACD-308
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Signed-off-by: Peter Lawthers <peter.lawthers@intel.com>
---
 drivers/android/sync.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/android/sync.h b/drivers/android/sync.h
index d57fa0a..75532d8 100644
--- a/drivers/android/sync.h
+++ b/drivers/android/sync.h
@@ -345,6 +345,27 @@ int sync_fence_cancel_async(struct sync_fence *fence,
  */
 int sync_fence_wait(struct sync_fence *fence, long timeout);
 
+/**
+ * sync_fence_is_signaled() - Return an indication if the fence is signaled
+ * @fence:	fence to check
+ *
+ * returns 1 if fence is signaled
+ * returns 0 if fence is not signaled
+ * returns < 0 if fence is in error state
+ */
+static inline int
+sync_fence_is_signaled(struct sync_fence *fence)
+{
+	int status;
+
+	status = atomic_read(&fence->status);
+	if (status == 0)
+		return 1;
+	if (status > 0)
+		return 0;
+	return status;
+}
+
 #ifdef CONFIG_DEBUG_FS
 
 void sync_timeline_debug_add(struct sync_timeline *obj);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-01-13 17:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 17:57 [RFC 0/9] Add native sync support to i915 driver John.C.Harrison
2016-01-13 17:57 ` [RFC 1/9] staging/android/sync: Support sync points created from dma-fences John.C.Harrison
2016-01-13 17:57 ` [RFC 2/9] staging/android/sync: add sync_fence_create_dma John.C.Harrison
2016-01-13 19:03   ` Gustavo Padovan
2016-01-13 17:57 ` [RFC 3/9] staging/android/sync: Move sync framework out of staging John.C.Harrison
2016-01-13 19:00   ` Gustavo Padovan
2016-01-14 11:31     ` John Harrison
2016-01-14 13:42       ` Gustavo Padovan
2016-01-14 14:19         ` John Harrison
2016-01-13 19:51   ` Gustavo Padovan
2016-01-14  4:55   ` Greg Kroah-Hartman
2016-01-13 17:57 ` [RFC 4/9] android/sync: Improved debug dump to dmesg John.C.Harrison
2016-01-13 17:57 ` John.C.Harrison [this message]
2016-01-13 17:57 ` [RFC 6/9] drm/i915: Add sync framework support to execbuff IOCTL John.C.Harrison
2016-01-13 18:43   ` Chris Wilson
2016-01-14 11:47     ` John Harrison
2016-01-14 12:07       ` Chris Wilson
2016-01-21 14:47         ` Maarten Lankhorst
2016-01-21 15:07           ` Chris Wilson
2016-01-13 17:57 ` [RFC 7/9] drm/i915: Add sync wait support to scheduler John.C.Harrison
2016-01-13 17:57 ` [RFC 8/9] drm/i915: Connecting execbuff fences " John.C.Harrison
2016-01-13 17:57 ` [RFC 9/9] drm/i915: Add sync support to the scheduler statistics and status dump John.C.Harrison
2016-01-19 16:04 ` [RFC] igt/gem_exec_fence: New test for sync/fence interface John.C.Harrison

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=1452707855-9791-6-git-send-email-John.C.Harrison@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    --cc=arve@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=riandrews@android.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 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.