aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Stimson <dale.b.stimson@intel.com>2014-09-09 08:17:26 +0800
committerEd Tam <etam@google.com>2014-11-22 15:03:57 -0800
commitba8f7342feb749eeeca3423cb231110b00124ac5 (patch)
tree9c1fd1e32b4abc63423235c337df6cd4954f0263
parent77bfea2e6a3dc1e30a17780b48b7b231eef77255 (diff)
downloadlibwsbm-ba8f7342feb749eeeca3423cb231110b00124ac5.tar.gz
ION support in libwsbm.
When creat surface from user pointer, it will also pass down buffer fd to kernel, which help to find physical pages if ION is enabled. Orig-Author: Randy Xu <randy.xu@intel.com> BZ: 224134 Bug: 17316531 Depends-on: Ife9513fe58e06ea2829987f328668f975a44b4e0 Depends-on: I4b8422d48b06419af6e48b631bacbe6c7169574e Depends-on: Ia4c5bc80df952024a0973f2bacc42992301dfbf9 Depends-on: I172cdcb8cc86fd6fa3d3adadbab19b6fd3e6a18e Depends-on: I2a2e721719349f755033c15bdeb732e7fb5c89ac Depends-on: I48deabb107cc3abfa59eff5e012b51293fe6d74f Depends-on: I0ca0f06491e3fb498b3b41b70cbe1b6cf39e1918 Change-Id: If2be266fc9063d7a2b701f85e8ace26aaf484ff5 Signed-off-by: mahongpe <hongpeng.ma@intel.com>
-rw-r--r--src/wsbm_manager.c8
-rw-r--r--src/wsbm_manager.h2
-rw-r--r--src/wsbm_ttmpool.c3
3 files changed, 7 insertions, 6 deletions
diff --git a/src/wsbm_manager.c b/src/wsbm_manager.c
index e7c8f5d..0cbf9de 100644
--- a/src/wsbm_manager.c
+++ b/src/wsbm_manager.c
@@ -613,7 +613,7 @@ wsbmBOData(struct _WsbmBufferObject *buf,
int
wsbmBODataUB(struct _WsbmBufferObject *buf,
unsigned size, const void *data, struct _WsbmBufferPool *newPool,
- uint32_t placement, const unsigned long *user_ptr)
+ uint32_t placement, const unsigned long *user_ptr, int fd)
{
int newBuffer;
int retval = 0;
@@ -624,7 +624,7 @@ wsbmBODataUB(struct _WsbmBufferObject *buf,
extern struct _WsbmBufStorage *
ttm_pool_ub_create(struct _WsbmBufferPool *pool,
unsigned long size, uint32_t placement, unsigned alignment,
- const unsigned long *user_ptr);
+ const unsigned long *user_ptr, int fd);
if (buf->bufferType == WSBM_BUFFER_SIMPLE)
return -EINVAL;
@@ -659,7 +659,7 @@ wsbmBODataUB(struct _WsbmBufferObject *buf,
}
buf->storage =
- ttm_pool_ub_create(newPool, size, placement, buf->alignment, user_ptr);
+ ttm_pool_ub_create(newPool, size, placement, buf->alignment, user_ptr, fd);
if (!buf->storage) {
retval = -ENOMEM;
goto out;
@@ -681,7 +681,7 @@ wsbmBODataUB(struct _WsbmBufferObject *buf,
curPool = storage->pool;
tmp_storage =
- ttm_pool_ub_create(curPool, size, placement, buf->alignment, user_ptr);
+ ttm_pool_ub_create(curPool, size, placement, buf->alignment, user_ptr, fd);
if (tmp_storage) {
wsbmBufStorageUnref(&buf->storage);
diff --git a/src/wsbm_manager.h b/src/wsbm_manager.h
index aa2eb5f..1fd5e39 100644
--- a/src/wsbm_manager.h
+++ b/src/wsbm_manager.h
@@ -95,7 +95,7 @@ extern int wsbmBOData(struct _WsbmBufferObject *r_buf,
extern int wsbmBODataUB(struct _WsbmBufferObject *buf,
unsigned size, const void *data, struct _WsbmBufferPool *newPool,
- uint32_t placement, const unsigned long *user_ptr);
+ uint32_t placement, const unsigned long *user_ptr, int fd);
extern int wsbmBOSetStatus(struct _WsbmBufferObject *buf,
uint32_t setPlacement, uint32_t clrPlacement);
diff --git a/src/wsbm_ttmpool.c b/src/wsbm_ttmpool.c
index 0ea32bd..3b594b3 100644
--- a/src/wsbm_ttmpool.c
+++ b/src/wsbm_ttmpool.c
@@ -529,7 +529,7 @@ wsbmTTMPoolInit(int fd, unsigned int devOffset)
}
struct _WsbmBufStorage *
-ttm_pool_ub_create(struct _WsbmBufferPool *pool, unsigned long size, uint32_t placement, unsigned alignment, const unsigned long *user_ptr)
+ttm_pool_ub_create(struct _WsbmBufferPool *pool, unsigned long size, uint32_t placement, unsigned alignment, const unsigned long *user_ptr, int fd)
{
struct _TTMBuffer *dBuf = (struct _TTMBuffer *)
calloc(1, sizeof(*dBuf));
@@ -556,6 +556,7 @@ ttm_pool_ub_create(struct _WsbmBufferPool *pool, unsigned long size, uint32_t pl
arg.req.placement = placement;
arg.req.page_alignment = alignment / pageSize;
arg.req.user_address = (unsigned long)user_ptr;
+ arg.req.fd = fd;
DRMRESTARTCOMMANDWRITEREAD(pool->fd, ttmPool->devOffset + TTM_PL_CREATE_UB,
arg, ret);