[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dri-patches
Subject:    drm: Branch 'master' - 3 commits
From:       robclark () kemper ! freedesktop ! org (Rob Clark)
Date:       2015-08-23 16:34:49
Message-ID: 20150823163449.4675E76245 () kemper ! freedesktop ! org
[Download RAW message or body]

 freedreno/freedreno_bo.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 1eba47a76365576447d6346868a074dca24de1bf
Author: Varad Gautam <varadgautam@gmail.com>
Date:   Fri Aug 21 22:14:35 2015 +0530

    freedreno: get bo size for imported dma-buf
    
    Signed-off-by: Varad Gautam <varadgautam@gmail.com>
    Signed-off-by: Rob Clark <robclark@freedesktop.org>

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index eabffe9..596bfbc 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -237,8 +237,9 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
 		return NULL;
 	}
 
-	/* hmm, would be nice if we had a way to figure out the size.. */
-	size = 0;
+	/* lseek() to get bo size */
+	size = lseek(fd, 0, SEEK_END);
+	lseek(fd, 0, SEEK_CUR);
 
 	bo = fd_bo_from_handle(dev, req.handle, size);
 	bo->fd = fd;
commit 425c8e5af7e57d473cb94f1931baa427e58ef2f7
Author: Varad Gautam <varadgautam@gmail.com>
Date:   Fri Aug 21 22:14:34 2015 +0530

    freedreno: fill bo->fd when importing
    
    Signed-off-by: Varad Gautam <varadgautam@gmail.com>
    Signed-off-by: Rob Clark <robclark@freedesktop.org>

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 972ee17..eabffe9 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -230,6 +230,7 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
 			.fd = fd,
 	};
 	int ret, size;
+	struct fd_bo *bo;
 
 	ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &req);
 	if (ret) {
@@ -239,7 +240,10 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
 	/* hmm, would be nice if we had a way to figure out the size.. */
 	size = 0;
 
-	return fd_bo_from_handle(dev, req.handle, size);
+	bo = fd_bo_from_handle(dev, req.handle, size);
+	bo->fd = fd;
+
+	return bo;
 }
 
 struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name)
commit 857c22e5ecf016bcd15508fec6e6d435bf69b58d
Author: Varad Gautam <varadgautam@gmail.com>
Date:   Fri Aug 21 22:14:33 2015 +0530

    freedreno: fix a bo cache segfault with imported bo's
    
    Importing a bo whose handle is still in the bo cache crashes during cleanup.
    Remove bo from cache when importing.
    
    Signed-off-by: Varad Gautam <varadgautam@gmail.com>
    Signed-off-by: Rob Clark <robclark@freedesktop.org>

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index eec218c..972ee17 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -52,6 +52,9 @@ static struct fd_bo * lookup_bo(void *tbl, uint32_t key)
 	if (!drmHashLookup(tbl, key, (void **)&bo)) {
 		/* found, incr refcnt and return: */
 		bo = fd_bo_ref(bo);
+
+		/* don't break the bucket if this bo was found in one */
+		list_delinit(&bo->list);
 	}
 	return bo;
 }

------------------------------------------------------------------------------
--
_______________________________________________
Dri-patches mailing list
Dri-patches@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-patches
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic