[PATCH libdrm v2 07/13] freedreno: annotate public functions

Lucas De Marchi lucas.demarchi at intel.com
Thu Sep 13 23:57:18 UTC 2018


while read sym; do
	read f func line _ <<<$(cscope -d -L -1 $sym)
	if [ ! -z "$f" ]; then
		sed -i "${line}s/^/drm_public /" $f
	fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
freedreno-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 freedreno/freedreno_bo.c         | 32 ++++++++++++-------------
 freedreno/freedreno_device.c     | 12 +++++-----
 freedreno/freedreno_pipe.c       | 14 +++++------
 freedreno/freedreno_ringbuffer.c | 40 ++++++++++++++++----------------
 4 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 34c285fb..dbb87a5b 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -79,7 +79,7 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
 }
 
 struct fd_bo *
-fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
+drm_public fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
 {
 	struct fd_bo *bo = NULL;
 	uint32_t handle;
@@ -104,7 +104,7 @@ fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
 }
 
 struct fd_bo *
-fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size)
+drm_public fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size)
 {
 	struct fd_bo *bo = NULL;
 
@@ -125,7 +125,7 @@ out_unlock:
 }
 
 struct fd_bo *
-fd_bo_from_dmabuf(struct fd_device *dev, int fd)
+drm_public fd_bo_from_dmabuf(struct fd_device *dev, int fd)
 {
 	int ret, size;
 	uint32_t handle;
@@ -156,7 +156,7 @@ out_unlock:
 	return bo;
 }
 
-struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name)
+drm_public struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name)
 {
 	struct drm_gem_open req = {
 			.name = name,
@@ -191,23 +191,23 @@ out_unlock:
 	return bo;
 }
 
-uint64_t fd_bo_get_iova(struct fd_bo *bo)
+drm_public uint64_t fd_bo_get_iova(struct fd_bo *bo)
 {
 	return bo->funcs->iova(bo);
 }
 
-void fd_bo_put_iova(struct fd_bo *bo)
+drm_public void fd_bo_put_iova(struct fd_bo *bo)
 {
 	/* currently a no-op */
 }
 
-struct fd_bo * fd_bo_ref(struct fd_bo *bo)
+drm_public struct fd_bo * fd_bo_ref(struct fd_bo *bo)
 {
 	atomic_inc(&bo->refcnt);
 	return bo;
 }
 
-void fd_bo_del(struct fd_bo *bo)
+drm_public void fd_bo_del(struct fd_bo *bo)
 {
 	struct fd_device *dev = bo->dev;
 
@@ -250,7 +250,7 @@ drm_private void bo_del(struct fd_bo *bo)
 	bo->funcs->destroy(bo);
 }
 
-int fd_bo_get_name(struct fd_bo *bo, uint32_t *name)
+drm_public int fd_bo_get_name(struct fd_bo *bo, uint32_t *name)
 {
 	if (!bo->name) {
 		struct drm_gem_flink req = {
@@ -274,12 +274,12 @@ int fd_bo_get_name(struct fd_bo *bo, uint32_t *name)
 	return 0;
 }
 
-uint32_t fd_bo_handle(struct fd_bo *bo)
+drm_public uint32_t fd_bo_handle(struct fd_bo *bo)
 {
 	return bo->handle;
 }
 
-int fd_bo_dmabuf(struct fd_bo *bo)
+drm_public int fd_bo_dmabuf(struct fd_bo *bo)
 {
 	int ret, prime_fd;
 
@@ -295,12 +295,12 @@ int fd_bo_dmabuf(struct fd_bo *bo)
 	return prime_fd;
 }
 
-uint32_t fd_bo_size(struct fd_bo *bo)
+drm_public uint32_t fd_bo_size(struct fd_bo *bo)
 {
 	return bo->size;
 }
 
-void * fd_bo_map(struct fd_bo *bo)
+drm_public void * fd_bo_map(struct fd_bo *bo)
 {
 	if (!bo->map) {
 		uint64_t offset;
@@ -322,18 +322,18 @@ void * fd_bo_map(struct fd_bo *bo)
 }
 
 /* a bit odd to take the pipe as an arg, but it's a, umm, quirk of kgsl.. */
-int fd_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
+drm_public int fd_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
 {
 	return bo->funcs->cpu_prep(bo, pipe, op);
 }
 
-void fd_bo_cpu_fini(struct fd_bo *bo)
+drm_public void fd_bo_cpu_fini(struct fd_bo *bo)
 {
 	bo->funcs->cpu_fini(bo);
 }
 
 #if !HAVE_FREEDRENO_KGSL
-struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size)
+drm_public struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size)
 {
     return NULL;
 }
diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c
index 0b42561a..c5b8da96 100644
--- a/freedreno/freedreno_device.c
+++ b/freedreno/freedreno_device.c
@@ -38,7 +38,7 @@ static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
 struct fd_device * kgsl_device_new(int fd);
 struct fd_device * msm_device_new(int fd);
 
-struct fd_device * fd_device_new(int fd)
+drm_public struct fd_device * fd_device_new(int fd)
 {
 	struct fd_device *dev;
 	drmVersionPtr version;
@@ -89,7 +89,7 @@ out:
 /* like fd_device_new() but creates it's own private dup() of the fd
  * which is close()d when the device is finalized.
  */
-struct fd_device * fd_device_new_dup(int fd)
+drm_public struct fd_device * fd_device_new_dup(int fd)
 {
 	int dup_fd = dup(fd);
 	struct fd_device *dev = fd_device_new(dup_fd);
@@ -100,7 +100,7 @@ struct fd_device * fd_device_new_dup(int fd)
 	return dev;
 }
 
-struct fd_device * fd_device_ref(struct fd_device *dev)
+drm_public struct fd_device * fd_device_ref(struct fd_device *dev)
 {
 	atomic_inc(&dev->refcnt);
 	return dev;
@@ -124,7 +124,7 @@ drm_private void fd_device_del_locked(struct fd_device *dev)
 	fd_device_del_impl(dev);
 }
 
-void fd_device_del(struct fd_device *dev)
+drm_public void fd_device_del(struct fd_device *dev)
 {
 	if (!atomic_dec_and_test(&dev->refcnt))
 		return;
@@ -133,12 +133,12 @@ void fd_device_del(struct fd_device *dev)
 	pthread_mutex_unlock(&table_lock);
 }
 
-int fd_device_fd(struct fd_device *dev)
+drm_public int fd_device_fd(struct fd_device *dev)
 {
 	return dev->fd;
 }
 
-enum fd_version fd_device_version(struct fd_device *dev)
+drm_public enum fd_version fd_device_version(struct fd_device *dev)
 {
 	return dev->version;
 }
diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c
index 30d231c7..ea8d85f2 100644
--- a/freedreno/freedreno_pipe.c
+++ b/freedreno/freedreno_pipe.c
@@ -34,7 +34,7 @@
  * lower priorities
  */
 struct fd_pipe *
-fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio)
+drm_public fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio)
 {
 	struct fd_pipe *pipe;
 	uint64_t val;
@@ -66,36 +66,36 @@ fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio)
 }
 
 struct fd_pipe *
-fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
+drm_public fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
 {
 	return fd_pipe_new2(dev, id, 1);
 }
 
-struct fd_pipe * fd_pipe_ref(struct fd_pipe *pipe)
+drm_public struct fd_pipe * fd_pipe_ref(struct fd_pipe *pipe)
 {
 	atomic_inc(&pipe->refcnt);
 	return pipe;
 }
 
-void fd_pipe_del(struct fd_pipe *pipe)
+drm_public void fd_pipe_del(struct fd_pipe *pipe)
 {
 	if (!atomic_dec_and_test(&pipe->refcnt))
 		return;
 	pipe->funcs->destroy(pipe);
 }
 
-int fd_pipe_get_param(struct fd_pipe *pipe,
+drm_public int fd_pipe_get_param(struct fd_pipe *pipe,
 				 enum fd_param_id param, uint64_t *value)
 {
 	return pipe->funcs->get_param(pipe, param, value);
 }
 
-int fd_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
+drm_public int fd_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
 {
 	return fd_pipe_wait_timeout(pipe, timestamp, ~0);
 }
 
-int fd_pipe_wait_timeout(struct fd_pipe *pipe, uint32_t timestamp,
+drm_public int fd_pipe_wait_timeout(struct fd_pipe *pipe, uint32_t timestamp,
 		uint64_t timeout)
 {
 	return pipe->funcs->wait(pipe, timestamp, timeout);
diff --git a/freedreno/freedreno_ringbuffer.c b/freedreno/freedreno_ringbuffer.c
index eb6cd0ca..c41337fd 100644
--- a/freedreno/freedreno_ringbuffer.c
+++ b/freedreno/freedreno_ringbuffer.c
@@ -53,13 +53,13 @@ ringbuffer_new(struct fd_pipe *pipe, uint32_t size,
 }
 
 struct fd_ringbuffer *
-fd_ringbuffer_new(struct fd_pipe *pipe, uint32_t size)
+drm_public fd_ringbuffer_new(struct fd_pipe *pipe, uint32_t size)
 {
 	return ringbuffer_new(pipe, size, 0);
 }
 
 struct fd_ringbuffer *
-fd_ringbuffer_new_object(struct fd_pipe *pipe, uint32_t size)
+drm_public fd_ringbuffer_new_object(struct fd_pipe *pipe, uint32_t size)
 {
 	/* we can't really support "growable" rb's in general for
 	 * stateobj's since we need a single gpu addr (ie. can't
@@ -69,7 +69,7 @@ fd_ringbuffer_new_object(struct fd_pipe *pipe, uint32_t size)
 	return ringbuffer_new(pipe, size, FD_RINGBUFFER_OBJECT);
 }
 
-void fd_ringbuffer_del(struct fd_ringbuffer *ring)
+drm_public void fd_ringbuffer_del(struct fd_ringbuffer *ring)
 {
 	if (!(ring->flags & FD_RINGBUFFER_OBJECT))
 		fd_ringbuffer_reset(ring);
@@ -80,7 +80,7 @@ void fd_ringbuffer_del(struct fd_ringbuffer *ring)
  * the IB source) as it's parent before emitting reloc's, to ensure
  * the bookkeeping works out properly.
  */
-void fd_ringbuffer_set_parent(struct fd_ringbuffer *ring,
+drm_public void fd_ringbuffer_set_parent(struct fd_ringbuffer *ring,
 					 struct fd_ringbuffer *parent)
 {
 	/* state objects should not be parented! */
@@ -88,7 +88,7 @@ void fd_ringbuffer_set_parent(struct fd_ringbuffer *ring,
 	ring->parent = parent;
 }
 
-void fd_ringbuffer_reset(struct fd_ringbuffer *ring)
+drm_public void fd_ringbuffer_reset(struct fd_ringbuffer *ring)
 {
 	uint32_t *start = ring->start;
 	if (ring->pipe->id == FD_PIPE_2D)
@@ -98,18 +98,18 @@ void fd_ringbuffer_reset(struct fd_ringbuffer *ring)
 		ring->funcs->reset(ring);
 }
 
-int fd_ringbuffer_flush(struct fd_ringbuffer *ring)
+drm_public int fd_ringbuffer_flush(struct fd_ringbuffer *ring)
 {
 	return ring->funcs->flush(ring, ring->last_start, -1, NULL);
 }
 
-int fd_ringbuffer_flush2(struct fd_ringbuffer *ring, int in_fence_fd,
+drm_public int fd_ringbuffer_flush2(struct fd_ringbuffer *ring, int in_fence_fd,
 		int *out_fence_fd)
 {
 	return ring->funcs->flush(ring, ring->last_start, in_fence_fd, out_fence_fd);
 }
 
-void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords)
+drm_public void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords)
 {
 	assert(ring->funcs->grow);     /* unsupported on kgsl */
 
@@ -125,25 +125,25 @@ void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords)
 	ring->cur = ring->last_start = ring->start;
 }
 
-uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring)
+drm_public uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring)
 {
 	return ring->last_timestamp;
 }
 
-void fd_ringbuffer_reloc(struct fd_ringbuffer *ring,
+drm_public void fd_ringbuffer_reloc(struct fd_ringbuffer *ring,
 				    const struct fd_reloc *reloc)
 {
 	assert(ring->pipe->gpu_id < 500);
 	ring->funcs->emit_reloc(ring, reloc);
 }
 
-void fd_ringbuffer_reloc2(struct fd_ringbuffer *ring,
+drm_public void fd_ringbuffer_reloc2(struct fd_ringbuffer *ring,
 				     const struct fd_reloc *reloc)
 {
 	ring->funcs->emit_reloc(ring, reloc);
 }
 
-void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
+drm_public void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
 		struct fd_ringmarker *target, struct fd_ringmarker *end)
 {
 	uint32_t submit_offset, size;
@@ -158,7 +158,7 @@ void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
 	ring->funcs->emit_reloc_ring(ring, target->ring, 0, submit_offset, size);
 }
 
-uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring)
+drm_public uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring)
 {
 	if (!ring->funcs->cmd_count)
 		return 1;
@@ -166,7 +166,7 @@ uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring)
 }
 
 uint32_t
-fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
+drm_public fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
 		struct fd_ringbuffer *target, uint32_t cmd_idx)
 {
 	uint32_t size = offset_bytes(target->cur, target->start);
@@ -174,7 +174,7 @@ fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
 }
 
 uint32_t
-fd_ringbuffer_size(struct fd_ringbuffer *ring)
+drm_public fd_ringbuffer_size(struct fd_ringbuffer *ring)
 {
 	/* only really needed for stateobj ringbuffers, and won't really
 	 * do what you expect for growable rb's.. so lets just restrict
@@ -188,7 +188,7 @@ fd_ringbuffer_size(struct fd_ringbuffer *ring)
  * Deprecated ringmarker API:
  */
 
-struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
+drm_public struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
 {
 	struct fd_ringmarker *marker = NULL;
 
@@ -205,23 +205,23 @@ struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
 	return marker;
 }
 
-void fd_ringmarker_del(struct fd_ringmarker *marker)
+drm_public void fd_ringmarker_del(struct fd_ringmarker *marker)
 {
 	free(marker);
 }
 
-void fd_ringmarker_mark(struct fd_ringmarker *marker)
+drm_public void fd_ringmarker_mark(struct fd_ringmarker *marker)
 {
 	marker->cur = marker->ring->cur;
 }
 
-uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start,
+drm_public uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start,
 					 struct fd_ringmarker *end)
 {
 	return end->cur - start->cur;
 }
 
-int fd_ringmarker_flush(struct fd_ringmarker *marker)
+drm_public int fd_ringmarker_flush(struct fd_ringmarker *marker)
 {
 	struct fd_ringbuffer *ring = marker->ring;
 	return ring->funcs->flush(ring, marker->cur, -1, NULL);
-- 
2.17.1



More information about the dri-devel mailing list