drm: Branch 'master' - 3 commits

[email protected] (Rob Clark)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 freedreno/freedreno_bo.c       |   26 +++++++++++---------------
 freedreno/freedreno_priv.h     |    1 -
 freedreno/kgsl/kgsl_bo.c       |    1 -
 freedreno/msm/msm_bo.c         |    1 -
 freedreno/msm/msm_ringbuffer.c |    4 ++--
 5 files changed, 13 insertions(+), 20 deletions(-)

New commits:
commit 14968e4cf63d16f5beaea5eb8edba7578bb90501
Author: Rob Clark <[email protected]>
Date:   Fri Sep 4 11:44:33 2015 -0400

    freedreno: debug msg cleanup
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c
index ee6af0b..becf245 100644
--- a/freedreno/msm/msm_ringbuffer.c
+++ b/freedreno/msm/msm_ringbuffer.c
@@ -253,7 +253,7 @@ static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start
 		cmd->nr_relocs = (b > a) ? b - a : 0;
 	}
 
-	DEBUG_MSG("nr_cmds=%u, nr_bos=%u\n", req.nr_cmds, req.nr_bos);
+	DEBUG_MSG("nr_cmds=%u, nr_bos=%u", req.nr_cmds, req.nr_bos);
 
 	ret = drmCommandWriteRead(ring->pipe->dev->fd, DRM_MSM_GEM_SUBMIT,
 			&req, sizeof(req));
@@ -267,7 +267,7 @@ static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start
 		for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
 			struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i];
 			struct drm_msm_gem_submit_reloc *relocs = U642VOID(cmd->relocs);
-			ERROR_MSG("  cmd[%d]: type=%u, submit_idx=%u, submit_offset=%u, size=%u\n",
+			ERROR_MSG("  cmd[%d]: type=%u, submit_idx=%u, submit_offset=%u, size=%u",
 					i, cmd->type, cmd->submit_idx, cmd->submit_offset, cmd->size);
 			for (j = 0; j < cmd->nr_relocs; j++) {
 				struct drm_msm_gem_submit_reloc *r = &relocs[j];
commit 76a1e97eae3948827ccc100c593d1e96d7a8ce74
Author: Rob Clark <[email protected]>
Date:   Fri Sep 4 11:41:47 2015 -0400

    freedreno: drop exported dmabuf fd tracking
    
    There is really no reason to keep around the fd, it just consumes an
    extra file handle.
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index fee32fc..a23c65d 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -298,11 +298,6 @@ void fd_bo_del(struct fd_bo *bo)
 	if (!atomic_dec_and_test(&bo->refcnt))
 		return;
 
-	if (bo->fd >= 0) {
-		close(bo->fd);
-		bo->fd = -1;
-	}
-
 	pthread_mutex_lock(&table_lock);
 
 	if (bo->bo_reuse) {
@@ -386,19 +381,18 @@ uint32_t fd_bo_handle(struct fd_bo *bo)
 
 int fd_bo_dmabuf(struct fd_bo *bo)
 {
-	if (bo->fd < 0) {
-		int ret, prime_fd;
-
-		ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
-					&prime_fd);
-		if (ret) {
-			return ret;
-		}
+	int ret, prime_fd;
 
-		bo->fd = prime_fd;
-		bo->bo_reuse = 0;
+	ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
+			&prime_fd);
+	if (ret) {
+		ERROR_MSG("failed to get dmabuf fd: %d", ret);
+		return ret;
 	}
-	return dup(bo->fd);
+
+	bo->bo_reuse = 0;
+
+	return prime_fd;
 }
 
 uint32_t fd_bo_size(struct fd_bo *bo)
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 4e442e4..53817b1 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -138,7 +138,6 @@ struct fd_bo {
 	uint32_t size;
 	uint32_t handle;
 	uint32_t name;
-	int fd;          /* dmabuf handle */
 	void *map;
 	atomic_t refcnt;
 	const struct fd_bo_funcs *funcs;
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index b8ac102..2b45b5e 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -168,7 +168,6 @@ drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
 
 	bo = &kgsl_bo->base;
 	bo->funcs = &funcs;
-	bo->fd = -1;
 
 	for (i = 0; i < ARRAY_SIZE(kgsl_bo->list); i++)
 		list_inithead(&kgsl_bo->list[i]);
diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c
index ee668ab..cd05a6c 100644
--- a/freedreno/msm/msm_bo.c
+++ b/freedreno/msm/msm_bo.c
@@ -136,7 +136,6 @@ drm_private struct fd_bo * msm_bo_from_handle(struct fd_device *dev,
 
 	bo = &msm_bo->base;
 	bo->funcs = &funcs;
-	bo->fd = -1;
 
 	return bo;
 }
commit 691d14c9a85acd806f83664fd58bd87bd32683eb
Author: Rob Clark <[email protected]>
Date:   Sat Aug 29 12:49:28 2015 -0400

    freedreno: don't reuse exported buffers
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 1cb6759..fee32fc 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -371,6 +371,7 @@ int fd_bo_get_name(struct fd_bo *bo, uint32_t *name)
 		pthread_mutex_lock(&table_lock);
 		set_name(bo, req.name);
 		pthread_mutex_unlock(&table_lock);
+		bo->bo_reuse = 0;
 	}
 
 	*name = bo->name;
@@ -395,6 +396,7 @@ int fd_bo_dmabuf(struct fd_bo *bo)
 		}
 
 		bo->fd = prime_fd;
+		bo->bo_reuse = 0;
 	}
 	return dup(bo->fd);
 }

------------------------------------------------------------------------------
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.