All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects.
Date: Wed, 12 Apr 2017 14:57:20 +1000	[thread overview]
Message-ID: <20170412045726.13689-3-airlied@gmail.com> (raw)
In-Reply-To: <20170412045726.13689-1-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

These are just alloc and fdget interfaces needed by the drm sync
objects code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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 4342d92..8667b48 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)
 {
@@ -120,7 +130,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);
 
@@ -136,6 +152,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

  reply	other threads:[~2017-04-12  4:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  4:57 drm sync objects (vn+1) Dave Airlie
2017-04-12  4:57 ` Dave Airlie [this message]
2017-04-12  4:57 ` [PATCH 5/8] sync_file: add support for a semaphore object (v2) Dave Airlie
     [not found] ` <20170412045726.13689-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-12  4:57   ` [PATCH 1/8] sync_file: add type/flags to sync file object creation Dave Airlie
2017-04-12  4:57   ` [PATCH 3/8] drm: introduce sync objects as sync file objects with no fd (v2.1) Dave Airlie
2017-04-12 13:08     ` Emil Velikov
2017-04-12  4:57   ` [PATCH 4/8] sync_file: add a mutex to protect fence and callback members. (v4) Dave Airlie
2017-04-12  4:57   ` [PATCH 6/8] drm/syncobj: add semaphore support helpers. (v2) Dave Airlie
2017-04-12  4:57   ` [PATCH 7/8] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-04-12  4:57   ` [PATCH 8/8] amdgpu: use sync file for shared semaphores (v3) Dave Airlie
     [not found]     ` <20170412045726.13689-9-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-12  9:55       ` Christian König
     [not found]         ` <43ed515c-7278-3687-022b-9ecd650669fb-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-12 10:18           ` Chris Wilson
2017-04-12 10:25             ` Christian König
2017-04-12 15:31       ` Alex Deucher
  -- 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-04  4:27 [RFC] DRM synchronisation objects Dave Airlie
2017-04-04  4:27 ` [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects Dave Airlie
2017-04-04  7:10   ` Daniel Vetter

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=20170412045726.13689-3-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --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 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.