From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects.
Date: Tue, 4 Apr 2017 14:27:27 +1000 [thread overview]
Message-ID: <20170404042733.17203-3-airlied@gmail.com> (raw)
In-Reply-To: <20170404042733.17203-1-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
These are just alloc and fdget interfaces needed by the drm sync
objects code.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/dma-buf/sync_file.c | 21 +++++++++++++++++++--
include/linux/sync_file.h | 3 ++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index b33af9d..153bf03 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -46,7 +46,16 @@ int sync_file_validate_type_flags(uint32_t type, uint32_t flags)
}
EXPORT_SYMBOL(sync_file_validate_type_flags);
-static struct sync_file *sync_file_alloc(uint32_t type, uint32_t flags)
+/**
+ * sync_file_alloc() - allocate an unfenced sync file
+ * @type: type of sync file object
+ * @flags: creation flags for sync file object
+ *
+ * Creates a sync_file.
+ * The sync_file can be released with fput(sync_file->file).
+ * Returns the sync_file or NULL in case of error.
+ */
+struct sync_file *sync_file_alloc(uint32_t type, uint32_t flags)
{
struct sync_file *sync_file;
int ret;
@@ -78,6 +87,7 @@ static struct sync_file *sync_file_alloc(uint32_t type, uint32_t flags)
kfree(sync_file);
return NULL;
}
+EXPORT_SYMBOL(sync_file_alloc);
static void fence_check_cb_func(struct dma_fence *f, struct dma_fence_cb *cb)
{
@@ -118,7 +128,13 @@ struct sync_file *sync_file_create(struct dma_fence *fence,
}
EXPORT_SYMBOL(sync_file_create);
-static struct sync_file *sync_file_fdget(int fd)
+/**
+ * sync_file_fdget - get a reference to the file and return sync_file.
+ * @fd - file descriptor pointing at a sync_file.
+ *
+ * Returns the corresponding sync_file object.
+ */
+struct sync_file *sync_file_fdget(int fd)
{
struct file *file = fget(fd);
@@ -134,6 +150,7 @@ static struct sync_file *sync_file_fdget(int fd)
fput(file);
return NULL;
}
+EXPORT_SYMBOL(sync_file_fdget);
/**
* sync_file_get_fence - get the fence related to the sync_file fd
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index ede4182..e683dd1 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -54,7 +54,8 @@ struct sync_file {
#define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS
int sync_file_validate_type_flags(uint32_t type, uint32_t flags);
+struct sync_file *sync_file_alloc(uint32_t type, uint32_t flags);
struct sync_file *sync_file_create(struct dma_fence *fence, uint32_t type, uint32_t flags);
struct dma_fence *sync_file_get_fence(int fd);
-
+struct sync_file *sync_file_fdget(int fd);
#endif /* _LINUX_SYNC_H */
--
2.9.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-04-04 4:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 4:27 [RFC] DRM synchronisation objects Dave Airlie
2017-04-04 4:27 ` [PATCH 1/8] sync_file: add type/flags to sync file object creation Dave Airlie
2017-04-04 7:08 ` Daniel Vetter
2017-04-04 4:27 ` Dave Airlie [this message]
2017-04-04 7:10 ` [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects Daniel Vetter
2017-04-04 4:27 ` [PATCH 3/8] drm: introduce sync objects as sync file objects with no fd Dave Airlie
2017-04-04 7:42 ` Daniel Vetter
[not found] ` <CAPM=9tyj6k4hqJWrwDW8Ch+TZCOoXRuAK2g71ciUm5vxpwmkuw@mail.gmail.com>
[not found] ` <CAKMK7uFoFvsREVtSxsoOeM6OPDM-iGOATtcAK6p65LzG39D6oQ@mail.gmail.com>
2017-04-11 6:00 ` Daniel Vetter
2017-04-04 4:27 ` [PATCH 4/8] sync_file: add a mutex to protect fence and callback members. (v4) Dave Airlie
2017-04-04 7:52 ` Daniel Vetter
2017-04-04 8:07 ` Christian König
2017-04-11 2:57 ` Dave Airlie
2017-04-04 4:27 ` [PATCH 5/8] sync_file: add support for a semaphore object Dave Airlie
2017-04-04 7:59 ` Daniel Vetter
2017-04-04 11:52 ` Chris Wilson
2017-04-04 11:59 ` Chris Wilson
2017-04-04 4:27 ` [PATCH 6/8] drm/syncobj: add semaphore support helpers Dave Airlie
2017-04-04 8:07 ` Daniel Vetter
2017-04-04 4:27 ` [PATCH 7/8] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-04-04 7:37 ` Christian König
2017-04-04 4:27 ` [PATCH 8/8] amdgpu: use sync file for shared semaphores (v2) Dave Airlie
2017-04-04 7:40 ` Christian König
2017-04-04 8:10 ` Daniel Vetter
2017-04-04 11:05 ` Christian König
2017-04-11 3:18 ` Dave Airlie
2017-04-11 6:55 ` Christian König
2017-04-04 4:35 ` [RFC] DRM synchronisation objects Dave Airlie
2017-04-04 8:02 ` Christian König
2017-04-04 8:11 ` Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2017-04-11 3:22 [repost] drm sync objects cleaned up Dave Airlie
[not found] ` <20170411032220.21101-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11 3:22 ` [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects Dave Airlie
2017-04-12 4:57 drm sync objects (vn+1) Dave Airlie
2017-04-12 4:57 ` [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects Dave Airlie
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=20170404042733.17203-3-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=dri-devel@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