All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm v2 00/13] hide library symbols by default
@ 2018-09-13 23:57 Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 01/13] intel: annotate public functions Lucas De Marchi
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

Rely on -fvisibility=hidden to hide the symbols. Previous version of
this series applying only to drm_intel.so is

	Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

but it's not included here since I changed the approach for the build
system change.

drm_private can also be removed from other symbols but it proved to be
a lot of manual work to re-align all the fields, so I decided to leave
it to be done on top as a cleanup.

There were lots of changes to param alignement that had to be done
manually, I may have missed some.

Changes from v1:
	- Include changes for all other sub-libraries
	- Include changes to autotools
	- Make main Makefil.am and meson.build define the required
	  flag

This is build-tested locally and on gitlab:
https://gitlab.freedesktop.org/demarchi/drm/pipelines/4339

Lucas De Marchi (13):
  intel: annotate public functions
  libkms: annotate public functions
  nouveau: annotate public functions
  libkms: annotate public functions
  libdrm: annotate public functions
  etnaviv: annotate public functions
  freedreno: annotate public functions
  omap: annotate public functions
  radeon: annotate public functions
  tegra: annotate public functions
  exynos: annotate public functions
  meson: make symbols hidden by default
  autotools: make symbols hidden by default

 Makefile.am                      |   1 +
 amdgpu/Makefile.am               |   1 +
 amdgpu/amdgpu_bo.c               | 104 ++++++------
 amdgpu/amdgpu_cs.c               | 137 +++++++--------
 amdgpu/amdgpu_device.c           |  19 ++-
 amdgpu/amdgpu_gpu_info.c         |  51 +++---
 amdgpu/amdgpu_vamgr.c            |  24 +--
 amdgpu/amdgpu_vm.c               |   5 +-
 amdgpu/meson.build               |   2 +-
 etnaviv/Makefile.am              |   1 +
 etnaviv/etnaviv_bo.c             |  25 +--
 etnaviv/etnaviv_cmd_stream.c     |  21 ++-
 etnaviv/etnaviv_device.c         |  10 +-
 etnaviv/etnaviv_gpu.c            |   6 +-
 etnaviv/etnaviv_perfmon.c        |   8 +-
 etnaviv/etnaviv_pipe.c           |   8 +-
 etnaviv/meson.build              |   2 +-
 exynos/Makefile.am               |   1 +
 exynos/exynos_drm.c              |  30 ++--
 exynos/exynos_fimg2d.c           |  20 +--
 exynos/meson.build               |   2 +-
 freedreno/Makefile.am            |   1 +
 freedreno/freedreno_bo.c         |  32 ++--
 freedreno/freedreno_device.c     |  12 +-
 freedreno/freedreno_pipe.c       |  14 +-
 freedreno/freedreno_ringbuffer.c |  40 ++---
 freedreno/meson.build            |   2 +-
 intel/Makefile.am                |   1 +
 intel/intel_bufmgr.c             |  64 +++----
 intel/intel_bufmgr_fake.c        |  10 +-
 intel/intel_bufmgr_gem.c         |  73 ++++----
 intel/intel_decode.c             |  14 +-
 intel/meson.build                |   4 +-
 libdrm_macros.h                  |   2 +
 libkms/Makefile.am               |   1 +
 libkms/api.c                     |  16 +-
 libkms/meson.build               |   2 +-
 meson.build                      |   5 +-
 nouveau/Makefile.am              |   1 +
 nouveau/bufctx.c                 |  10 +-
 nouveau/meson.build              |   2 +-
 nouveau/nouveau.c                |  50 +++---
 nouveau/pushbuf.c                |  18 +-
 omap/Makefile.am                 |   1 +
 omap/meson.build                 |   2 +-
 omap/omap_drm.c                  |  36 ++--
 radeon/Makefile.am               |   1 +
 radeon/meson.build               |   2 +-
 radeon/radeon_bo.c               |  24 +--
 radeon/radeon_bo_gem.c           |  16 +-
 radeon/radeon_cs.c               |  24 +--
 radeon/radeon_cs_gem.c           |   4 +-
 radeon/radeon_cs_space.c         |   6 +-
 radeon/radeon_surface.c          |   8 +-
 tegra/Makefile.am                |   3 +-
 tegra/meson.build                |   2 +-
 tegra/tegra.c                    |  26 +--
 tests/Makefile.am                |   1 +
 tests/amdgpu/Makefile.am         |   1 +
 tests/etnaviv/Makefile.am        |   1 +
 tests/exynos/Makefile.am         |   1 +
 tests/exynos/meson.build         |   6 +-
 tests/kms/Makefile.am            |   3 +-
 tests/kms/meson.build            |   2 +-
 tests/kmstest/Makefile.am        |   1 +
 tests/kmstest/meson.build        |   2 +-
 tests/meson.build                |   8 +-
 tests/modeprint/Makefile.am      |   1 +
 tests/modeprint/meson.build      |   2 +-
 tests/modetest/Makefile.am       |   1 +
 tests/modetest/meson.build       |   2 +-
 tests/nouveau/Makefile.am        |   1 +
 tests/nouveau/meson.build        |   2 +-
 tests/proptest/Makefile.am       |   1 +
 tests/proptest/meson.build       |   2 +-
 tests/radeon/Makefile.am         |   1 +
 tests/radeon/meson.build         |   2 +-
 tests/tegra/Makefile.am          |   4 +-
 tests/tegra/meson.build          |   2 +-
 tests/vbltest/Makefile.am        |   1 +
 tests/vbltest/meson.build        |   2 +-
 vc4/Makefile.am                  |   1 +
 xf86drm.c                        | 276 ++++++++++++++++---------------
 xf86drmHash.c                    |  15 +-
 xf86drmMode.c                    | 158 ++++++++++--------
 xf86drmRandom.c                  |   9 +-
 xf86drmSL.c                      |  23 +--
 87 files changed, 803 insertions(+), 736 deletions(-)

-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 01/13] intel: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 02/13] libkms: " Lucas De Marchi
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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

Then some corner cases were manually fixed. "a.txt" above contains the
symbols collected from intel/intel-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@intel.com>
---
 intel/intel_bufmgr.c      | 64 +++++++++++++++++-----------------
 intel/intel_bufmgr_fake.c | 10 +++---
 intel/intel_bufmgr_gem.c  | 73 +++++++++++++++++++--------------------
 intel/intel_decode.c      | 14 ++++----
 libdrm_macros.h           |  2 ++
 5 files changed, 82 insertions(+), 81 deletions(-)

diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index 192de093..68d97c0e 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -45,21 +45,21 @@
  * Convenience functions for buffer management methods.
  */
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
 		   unsigned long size, unsigned int alignment)
 {
 	return bufmgr->bo_alloc(bufmgr, name, size, alignment);
 }
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_alloc_for_render(drm_intel_bufmgr *bufmgr, const char *name,
 			      unsigned long size, unsigned int alignment)
 {
 	return bufmgr->bo_alloc_for_render(bufmgr, name, size, alignment);
 }
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_alloc_userptr(drm_intel_bufmgr *bufmgr,
 			   const char *name, void *addr,
 			   uint32_t tiling_mode,
@@ -73,7 +73,7 @@ drm_intel_bo_alloc_userptr(drm_intel_bufmgr *bufmgr,
 	return NULL;
 }
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
                         int x, int y, int cpp, uint32_t *tiling_mode,
                         unsigned long *pitch, unsigned long flags)
@@ -82,13 +82,13 @@ drm_intel_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
 				      tiling_mode, pitch, flags);
 }
 
-void
+drm_public void
 drm_intel_bo_reference(drm_intel_bo *bo)
 {
 	bo->bufmgr->bo_reference(bo);
 }
 
-void
+drm_public void
 drm_intel_bo_unreference(drm_intel_bo *bo)
 {
 	if (bo == NULL)
@@ -97,26 +97,26 @@ drm_intel_bo_unreference(drm_intel_bo *bo)
 	bo->bufmgr->bo_unreference(bo);
 }
 
-int
+drm_public int
 drm_intel_bo_map(drm_intel_bo *buf, int write_enable)
 {
 	return buf->bufmgr->bo_map(buf, write_enable);
 }
 
-int
+drm_public int
 drm_intel_bo_unmap(drm_intel_bo *buf)
 {
 	return buf->bufmgr->bo_unmap(buf);
 }
 
-int
+drm_public int
 drm_intel_bo_subdata(drm_intel_bo *bo, unsigned long offset,
 		     unsigned long size, const void *data)
 {
 	return bo->bufmgr->bo_subdata(bo, offset, size, data);
 }
 
-int
+drm_public int
 drm_intel_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
 			 unsigned long size, void *data)
 {
@@ -135,26 +135,26 @@ drm_intel_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
 	return 0;
 }
 
-void
+drm_public void
 drm_intel_bo_wait_rendering(drm_intel_bo *bo)
 {
 	bo->bufmgr->bo_wait_rendering(bo);
 }
 
-void
+drm_public void
 drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr)
 {
 	bufmgr->destroy(bufmgr);
 }
 
-int
+drm_public int
 drm_intel_bo_exec(drm_intel_bo *bo, int used,
 		  drm_clip_rect_t * cliprects, int num_cliprects, int DR4)
 {
 	return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
 }
 
-int
+drm_public int
 drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
 		drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
 		unsigned int rings)
@@ -174,19 +174,19 @@ drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
 	}
 }
 
-void
+drm_public void
 drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
 {
 	bufmgr->debug = enable_debug;
 }
 
-int
+drm_public int
 drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count)
 {
 	return bo_array[0]->bufmgr->check_aperture_space(bo_array, count);
 }
 
-int
+drm_public int
 drm_intel_bo_flink(drm_intel_bo *bo, uint32_t * name)
 {
 	if (bo->bufmgr->bo_flink)
@@ -195,7 +195,7 @@ drm_intel_bo_flink(drm_intel_bo *bo, uint32_t * name)
 	return -ENODEV;
 }
 
-int
+drm_public int
 drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 			drm_intel_bo *target_bo, uint32_t target_offset,
 			uint32_t read_domains, uint32_t write_domain)
@@ -206,7 +206,7 @@ drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
 }
 
 /* For fence registers, not GL fences */
-int
+drm_public int
 drm_intel_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset,
 			      drm_intel_bo *target_bo, uint32_t target_offset,
 			      uint32_t read_domains, uint32_t write_domain)
@@ -217,7 +217,7 @@ drm_intel_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset,
 }
 
 
-int
+drm_public int
 drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
 {
 	if (bo->bufmgr->bo_pin)
@@ -226,7 +226,7 @@ drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
 	return -ENODEV;
 }
 
-int
+drm_public int
 drm_intel_bo_unpin(drm_intel_bo *bo)
 {
 	if (bo->bufmgr->bo_unpin)
@@ -235,7 +235,7 @@ drm_intel_bo_unpin(drm_intel_bo *bo)
 	return -ENODEV;
 }
 
-int
+drm_public int
 drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
 			uint32_t stride)
 {
@@ -246,7 +246,7 @@ drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
 			uint32_t * swizzle_mode)
 {
@@ -258,7 +258,7 @@ drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset)
 {
 	if (bo->bufmgr->bo_set_softpin_offset)
@@ -267,7 +267,7 @@ drm_intel_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset)
 	return -ENODEV;
 }
 
-int
+drm_public int
 drm_intel_bo_disable_reuse(drm_intel_bo *bo)
 {
 	if (bo->bufmgr->bo_disable_reuse)
@@ -275,7 +275,7 @@ drm_intel_bo_disable_reuse(drm_intel_bo *bo)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_bo_is_reusable(drm_intel_bo *bo)
 {
 	if (bo->bufmgr->bo_is_reusable)
@@ -283,7 +283,7 @@ drm_intel_bo_is_reusable(drm_intel_bo *bo)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_bo_busy(drm_intel_bo *bo)
 {
 	if (bo->bufmgr->bo_busy)
@@ -291,7 +291,7 @@ drm_intel_bo_busy(drm_intel_bo *bo)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_bo_madvise(drm_intel_bo *bo, int madv)
 {
 	if (bo->bufmgr->bo_madvise)
@@ -299,7 +299,7 @@ drm_intel_bo_madvise(drm_intel_bo *bo, int madv)
 	return -1;
 }
 
-int
+drm_public int
 drm_intel_bo_use_48b_address_range(drm_intel_bo *bo, uint32_t enable)
 {
 	if (bo->bufmgr->bo_use_48b_address_range) {
@@ -310,13 +310,13 @@ drm_intel_bo_use_48b_address_range(drm_intel_bo *bo, uint32_t enable)
 	return -ENODEV;
 }
 
-int
+drm_public int
 drm_intel_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo)
 {
 	return bo->bufmgr->bo_references(bo, target_bo);
 }
 
-int
+drm_public int
 drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
 {
 	if (bufmgr->get_pipe_from_crtc_id)
@@ -360,7 +360,7 @@ drm_intel_probe_agp_aperture_size(int fd)
 }
 #endif
 
-int
+drm_public int
 drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total)
 {
 
diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index 3b24b81b..57cbc536 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -764,7 +764,7 @@ drm_intel_fake_bo_wait_rendering(drm_intel_bo *bo)
  *  -- just evict everything
  *  -- and wait for idle
  */
-void
+drm_public void
 drm_intel_bufmgr_fake_contended_lock_take(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *) bufmgr;
@@ -860,7 +860,7 @@ drm_intel_fake_bo_alloc_tiled(drm_intel_bufmgr * bufmgr,
 				       4096);
 }
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_fake_alloc_static(drm_intel_bufmgr *bufmgr,
 			       const char *name,
 			       unsigned long offset,
@@ -1532,7 +1532,7 @@ drm_intel_fake_check_aperture_space(drm_intel_bo ** bo_array, int count)
  * Used by the X Server on LeaveVT, when the card memory is no longer our
  * own.
  */
-void
+drm_public void
 drm_intel_bufmgr_fake_evict_all(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *) bufmgr;
@@ -1567,7 +1567,7 @@ drm_intel_bufmgr_fake_evict_all(drm_intel_bufmgr *bufmgr)
 	pthread_mutex_unlock(&bufmgr_fake->lock);
 }
 
-void
+drm_public void
 drm_intel_bufmgr_fake_set_last_dispatch(drm_intel_bufmgr *bufmgr,
 					volatile unsigned int
 					*last_dispatch)
@@ -1577,7 +1577,7 @@ drm_intel_bufmgr_fake_set_last_dispatch(drm_intel_bufmgr *bufmgr,
 	bufmgr_fake->last_dispatch = (volatile int *)last_dispatch;
 }
 
-drm_intel_bufmgr *
+drm_public drm_intel_bufmgr *
 drm_intel_bufmgr_fake_init(int fd, unsigned long low_offset,
 			   void *low_virtual, unsigned long size,
 			   volatile unsigned int *last_dispatch)
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index d6587b76..fbf48730 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1075,7 +1075,7 @@ check_bo_alloc_userptr(drm_intel_bufmgr *bufmgr,
  * This can be used when one application needs to pass a buffer object
  * to another.
  */
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
 				  const char *name,
 				  unsigned int handle)
@@ -1562,7 +1562,7 @@ map_gtt(drm_intel_bo *bo)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -1621,7 +1621,7 @@ drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
  * undefined).
  */
 
-int
+drm_public int
 drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -1710,7 +1710,7 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
 	return ret;
 }
 
-int
+drm_public int
 drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo)
 {
 	return drm_intel_gem_bo_unmap(bo);
@@ -1835,7 +1835,7 @@ drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
  * Note that some kernels have broken the inifite wait for negative values
  * promise, upgrade to latest stable kernels if this is the case.
  */
-int
+drm_public int
 drm_intel_gem_bo_wait(drm_intel_bo *bo, int64_t timeout_ns)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -1871,7 +1871,7 @@ drm_intel_gem_bo_wait(drm_intel_bo *bo, int64_t timeout_ns)
  * In combination with drm_intel_gem_bo_pin() and manual fence management, we
  * can do tiled pixmaps this way.
  */
-void
+drm_public void
 drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -2098,7 +2098,7 @@ drm_intel_gem_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset,
 				read_domains, write_domain, true);
 }
 
-int
+drm_public int
 drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo)
 {
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -2121,7 +2121,7 @@ drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo)
  *
  * This also removes all softpinned targets being referenced by the BO.
  */
-void
+drm_public void
 drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -2277,7 +2277,7 @@ drm_intel_update_buffer_offsets2 (drm_intel_bufmgr_gem *bufmgr_gem)
 	}
 }
 
-void
+drm_public void
 drm_intel_gem_bo_aub_dump_bmp(drm_intel_bo *bo,
 			      int x1, int y1, int width, int height,
 			      enum aub_dump_bmp_format format,
@@ -2479,14 +2479,14 @@ drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
 			-1, NULL, flags);
 }
 
-int
+drm_public int
 drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx,
 			      int used, unsigned int flags)
 {
 	return do_exec2(bo, used, ctx, NULL, 0, 0, -1, NULL, flags);
 }
 
-int
+drm_public int
 drm_intel_gem_bo_fence_exec(drm_intel_bo *bo,
 			    drm_intel_context *ctx,
 			    int used,
@@ -2627,7 +2627,7 @@ drm_intel_gem_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset)
 	return 0;
 }
 
-drm_intel_bo *
+drm_public drm_intel_bo *
 drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr, int prime_fd, int size)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
@@ -2710,7 +2710,7 @@ err:
 	return NULL;
 }
 
-int
+drm_public int
 drm_intel_bo_gem_export_to_prime(drm_intel_bo *bo, int *prime_fd)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -2762,7 +2762,7 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t * name)
  * size is only bounded by how many buffers of that size we've managed to have
  * in flight at once.
  */
-void
+drm_public void
 drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
@@ -2784,7 +2784,7 @@ drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr)
  * which can be checked using drm_intel_bufmgr_can_disable_implicit_sync,
  * or subsequent execbufs involving the bo will generate EINVAL.
  */
-void
+drm_public void
 drm_intel_gem_bo_disable_implicit_sync(drm_intel_bo *bo)
 {
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -2803,7 +2803,7 @@ drm_intel_gem_bo_disable_implicit_sync(drm_intel_bo *bo)
  * function can be used to restore the implicit sync before subsequent
  * rendering.
  */
-void
+drm_public void
 drm_intel_gem_bo_enable_implicit_sync(drm_intel_bo *bo)
 {
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -2815,7 +2815,7 @@ drm_intel_gem_bo_enable_implicit_sync(drm_intel_bo *bo)
  * Query whether the kernel supports disabling of its implicit synchronisation
  * before execbuf. See drm_intel_gem_bo_disable_implicit_sync()
  */
-int
+drm_public int
 drm_intel_bufmgr_gem_can_disable_implicit_sync(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
@@ -2830,7 +2830,7 @@ drm_intel_bufmgr_gem_can_disable_implicit_sync(drm_intel_bufmgr *bufmgr)
  * allocation.  If this option is not enabled, all relocs will have fence
  * register allocated.
  */
-void
+drm_public void
 drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
@@ -3109,7 +3109,7 @@ init_cache_buckets(drm_intel_bufmgr_gem *bufmgr_gem)
 	}
 }
 
-void
+drm_public void
 drm_intel_bufmgr_gem_set_vma_cache_size(drm_intel_bufmgr *bufmgr, int limit)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
@@ -3178,7 +3178,7 @@ get_pci_device_id(drm_intel_bufmgr_gem *bufmgr_gem)
 	return devid;
 }
 
-int
+drm_public int
 drm_intel_bufmgr_gem_get_devid(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
@@ -3192,7 +3192,7 @@ drm_intel_bufmgr_gem_get_devid(drm_intel_bufmgr *bufmgr)
  * This function has to be called before drm_intel_bufmgr_gem_set_aub_dump()
  * for it to have any effect.
  */
-void
+drm_public void
 drm_intel_bufmgr_gem_set_aub_filename(drm_intel_bufmgr *bufmgr,
 				      const char *filename)
 {
@@ -3206,7 +3206,7 @@ drm_intel_bufmgr_gem_set_aub_filename(drm_intel_bufmgr *bufmgr,
  * You can set up a GTT and upload your objects into the referenced
  * space, then send off batchbuffers and get BMPs out the other end.
  */
-void
+drm_public void
 drm_intel_bufmgr_gem_set_aub_dump(drm_intel_bufmgr *bufmgr, int enable)
 {
 	fprintf(stderr, "libdrm aub dumping is deprecated.\n\n"
@@ -3216,7 +3216,7 @@ drm_intel_bufmgr_gem_set_aub_dump(drm_intel_bufmgr *bufmgr, int enable)
 		"See the intel_aubdump man page for more details.\n");
 }
 
-drm_intel_context *
+drm_public drm_intel_context *
 drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
@@ -3243,7 +3243,7 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
 	return context;
 }
 
-int
+drm_public int
 drm_intel_gem_context_get_id(drm_intel_context *ctx, uint32_t *ctx_id)
 {
 	if (ctx == NULL)
@@ -3254,7 +3254,7 @@ drm_intel_gem_context_get_id(drm_intel_context *ctx, uint32_t *ctx_id)
 	return 0;
 }
 
-void
+drm_public void
 drm_intel_gem_context_destroy(drm_intel_context *ctx)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem;
@@ -3277,7 +3277,7 @@ drm_intel_gem_context_destroy(drm_intel_context *ctx)
 	free(ctx);
 }
 
-int
+drm_public int
 drm_intel_get_reset_stats(drm_intel_context *ctx,
 			  uint32_t *reset_count,
 			  uint32_t *active,
@@ -3311,7 +3311,7 @@ drm_intel_get_reset_stats(drm_intel_context *ctx,
 	return ret;
 }
 
-int
+drm_public int
 drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
 		   uint32_t offset,
 		   uint64_t *result)
@@ -3329,7 +3329,7 @@ drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
 	return ret;
 }
 
-int
+drm_public int
 drm_intel_get_subslice_total(int fd, unsigned int *subslice_total)
 {
 	drm_i915_getparam_t gp;
@@ -3345,7 +3345,7 @@ drm_intel_get_subslice_total(int fd, unsigned int *subslice_total)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_get_eu_total(int fd, unsigned int *eu_total)
 {
 	drm_i915_getparam_t gp;
@@ -3361,7 +3361,7 @@ drm_intel_get_eu_total(int fd, unsigned int *eu_total)
 	return 0;
 }
 
-int
+drm_public int
 drm_intel_get_pooled_eu(int fd)
 {
 	drm_i915_getparam_t gp;
@@ -3376,7 +3376,7 @@ drm_intel_get_pooled_eu(int fd)
 	return ret;
 }
 
-int
+drm_public int
 drm_intel_get_min_eu_in_pool(int fd)
 {
 	drm_i915_getparam_t gp;
@@ -3412,8 +3412,7 @@ drm_intel_get_min_eu_in_pool(int fd)
  * default state (no annotations), call this function with a \c count
  * of zero.
  */
-void
-drm_intel_bufmgr_gem_set_aub_annotations(drm_intel_bo *bo,
+drm_public void drm_intel_bufmgr_gem_set_aub_annotations(drm_intel_bo *bo,
 					 drm_intel_aub_annotation *annotations,
 					 unsigned count)
 {
@@ -3454,7 +3453,7 @@ drm_intel_bufmgr_gem_unref(drm_intel_bufmgr *bufmgr)
 	}
 }
 
-void *drm_intel_gem_bo_map__gtt(drm_intel_bo *bo)
+drm_public void *drm_intel_gem_bo_map__gtt(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -3502,7 +3501,7 @@ void *drm_intel_gem_bo_map__gtt(drm_intel_bo *bo)
 	return bo_gem->gtt_virtual;
 }
 
-void *drm_intel_gem_bo_map__cpu(drm_intel_bo *bo)
+drm_public void *drm_intel_gem_bo_map__cpu(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -3546,7 +3545,7 @@ void *drm_intel_gem_bo_map__cpu(drm_intel_bo *bo)
 	return bo_gem->mem_virtual;
 }
 
-void *drm_intel_gem_bo_map__wc(drm_intel_bo *bo)
+drm_public void *drm_intel_gem_bo_map__wc(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
@@ -3595,7 +3594,7 @@ void *drm_intel_gem_bo_map__wc(drm_intel_bo *bo)
  *
  * \param fd File descriptor of the opened DRM device.
  */
-drm_intel_bufmgr *
+drm_public drm_intel_bufmgr *
 drm_intel_bufmgr_gem_init(int fd, int batch_size)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem;
diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 0ff095bc..e0a51664 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -3811,7 +3811,7 @@ decode_3d_i830(struct drm_intel_decode *ctx)
 	return 1;
 }
 
-struct drm_intel_decode *
+drm_public struct drm_intel_decode *
 drm_intel_decode_context_alloc(uint32_t devid)
 {
 	struct drm_intel_decode *ctx;
@@ -3845,20 +3845,20 @@ drm_intel_decode_context_alloc(uint32_t devid)
 	return ctx;
 }
 
-void
+drm_public void
 drm_intel_decode_context_free(struct drm_intel_decode *ctx)
 {
 	free(ctx);
 }
 
-void
+drm_public void
 drm_intel_decode_set_dump_past_end(struct drm_intel_decode *ctx,
 				   int dump_past_end)
 {
 	ctx->dump_past_end = !!dump_past_end;
 }
 
-void
+drm_public void
 drm_intel_decode_set_batch_pointer(struct drm_intel_decode *ctx,
 				   void *data, uint32_t hw_offset, int count)
 {
@@ -3867,7 +3867,7 @@ drm_intel_decode_set_batch_pointer(struct drm_intel_decode *ctx,
 	ctx->base_count = count;
 }
 
-void
+drm_public void
 drm_intel_decode_set_head_tail(struct drm_intel_decode *ctx,
 			       uint32_t head, uint32_t tail)
 {
@@ -3875,7 +3875,7 @@ drm_intel_decode_set_head_tail(struct drm_intel_decode *ctx,
 	ctx->tail = tail;
 }
 
-void
+drm_public void
 drm_intel_decode_set_output_file(struct drm_intel_decode *ctx,
 				 FILE *output)
 {
@@ -3889,7 +3889,7 @@ drm_intel_decode_set_output_file(struct drm_intel_decode *ctx,
  * \param count number of DWORDs to decode in the batch buffer
  * \param hw_offset hardware address for the buffer
  */
-void
+drm_public void
 drm_intel_decode(struct drm_intel_decode *ctx)
 {
 	int ret;
diff --git a/libdrm_macros.h b/libdrm_macros.h
index 211fab21..95f0ef55 100644
--- a/libdrm_macros.h
+++ b/libdrm_macros.h
@@ -25,8 +25,10 @@
 
 #if HAVE_VISIBILITY
 #  define drm_private __attribute__((visibility("hidden")))
+#  define drm_public  __attribute__((visibility("default")))
 #else
 #  define drm_private
+#  define drm_public
 #endif
 
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 02/13] libkms: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 01/13] intel: annotate public functions Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 03/13] nouveau: " Lucas De Marchi
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

This was done with:
nm --dynamic --defined-only build/libkms/libkms.so | \
	grep kms_ | \
	cut -d' ' -f3 > /tmp/a.txt

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

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@intel.com>
---
 libkms/api.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libkms/api.c b/libkms/api.c
index 22dd32d7..caca1a87 100644
--- a/libkms/api.c
+++ b/libkms/api.c
@@ -33,12 +33,12 @@
 #include "libdrm_macros.h"
 #include "internal.h"
 
-int kms_create(int fd, struct kms_driver **out)
+drm_public int kms_create(int fd, struct kms_driver **out)
 {
 	return linux_create(fd, out);
 }
 
-int kms_get_prop(struct kms_driver *kms, unsigned key, unsigned *out)
+drm_public int kms_get_prop(struct kms_driver *kms, unsigned key, unsigned *out)
 {
 	switch (key) {
 	case KMS_BO_TYPE:
@@ -49,7 +49,7 @@ int kms_get_prop(struct kms_driver *kms, unsigned key, unsigned *out)
 	return kms->get_prop(kms, key, out);
 }
 
-int kms_destroy(struct kms_driver **kms)
+drm_public int kms_destroy(struct kms_driver **kms)
 {
 	if (!(*kms))
 		return 0;
@@ -59,7 +59,7 @@ int kms_destroy(struct kms_driver **kms)
 	return 0;
 }
 
-int kms_bo_create(struct kms_driver *kms, const unsigned *attr, struct kms_bo **out)
+drm_public int kms_bo_create(struct kms_driver *kms, const unsigned *attr, struct kms_bo **out)
 {
 	unsigned width = 0;
 	unsigned height = 0;
@@ -97,7 +97,7 @@ int kms_bo_create(struct kms_driver *kms, const unsigned *attr, struct kms_bo **
 	return kms->bo_create(kms, width, height, type, attr, out);
 }
 
-int kms_bo_get_prop(struct kms_bo *bo, unsigned key, unsigned *out)
+drm_public int kms_bo_get_prop(struct kms_bo *bo, unsigned key, unsigned *out)
 {
 	switch (key) {
 	case KMS_PITCH:
@@ -113,17 +113,17 @@ int kms_bo_get_prop(struct kms_bo *bo, unsigned key, unsigned *out)
 	return 0;
 }
 
-int kms_bo_map(struct kms_bo *bo, void **out)
+drm_public int kms_bo_map(struct kms_bo *bo, void **out)
 {
 	return bo->kms->bo_map(bo, out);
 }
 
-int kms_bo_unmap(struct kms_bo *bo)
+drm_public int kms_bo_unmap(struct kms_bo *bo)
 {
 	return bo->kms->bo_unmap(bo);
 }
 
-int kms_bo_destroy(struct kms_bo **bo)
+drm_public int kms_bo_destroy(struct kms_bo **bo)
 {
 	int ret;
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 03/13] nouveau: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 01/13] intel: annotate public functions Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 02/13] libkms: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 04/13] libkms: " Lucas De Marchi
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

This was done with:
nm --dynamic --defined-only build/nouveau/libdrm_nouveau.so | \
	grep nouveau_ | \
	cut -d ' ' -f3 > /tmp/a.txt

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

Then some corner cases were manually fixed. 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@intel.com>
---
 nouveau/bufctx.c  | 10 +++++-----
 nouveau/nouveau.c | 50 +++++++++++++++++++++++------------------------
 nouveau/pushbuf.c | 18 ++++++++---------
 3 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/nouveau/bufctx.c b/nouveau/bufctx.c
index 67b7570e..00924b3c 100644
--- a/nouveau/bufctx.c
+++ b/nouveau/bufctx.c
@@ -58,7 +58,7 @@ nouveau_bufctx(struct nouveau_bufctx *bctx)
 	return (struct nouveau_bufctx_priv *)bctx;
 }
 
-int
+drm_public int
 nouveau_bufctx_new(struct nouveau_client *client, int bins,
 		   struct nouveau_bufctx **pbctx)
 {
@@ -78,7 +78,7 @@ nouveau_bufctx_new(struct nouveau_client *client, int bins,
 	return -ENOMEM;
 }
 
-void
+drm_public void
 nouveau_bufctx_del(struct nouveau_bufctx **pbctx)
 {
 	struct nouveau_bufctx_priv *pctx = nouveau_bufctx(*pbctx);
@@ -95,7 +95,7 @@ nouveau_bufctx_del(struct nouveau_bufctx **pbctx)
 	}
 }
 
-void
+drm_public void
 nouveau_bufctx_reset(struct nouveau_bufctx *bctx, int bin)
 {
 	struct nouveau_bufctx_priv *pctx = nouveau_bufctx(bctx);
@@ -113,7 +113,7 @@ nouveau_bufctx_reset(struct nouveau_bufctx *bctx, int bin)
 	pbin->relocs  = 0;
 }
 
-struct nouveau_bufref *
+drm_public struct nouveau_bufref *
 nouveau_bufctx_refn(struct nouveau_bufctx *bctx, int bin,
 		    struct nouveau_bo *bo, uint32_t flags)
 {
@@ -140,7 +140,7 @@ nouveau_bufctx_refn(struct nouveau_bufctx *bctx, int bin,
 	return &pref->base;
 }
 
-struct nouveau_bufref *
+drm_public struct nouveau_bufref *
 nouveau_bufctx_mthd(struct nouveau_bufctx *bctx, int bin, uint32_t packet,
 		    struct nouveau_bo *bo, uint64_t data, uint32_t flags,
 		    uint32_t vor, uint32_t tor)
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 55593517..5be0611e 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -88,7 +88,7 @@ nouveau_object_ioctl(struct nouveau_object *obj, void *data, uint32_t size)
 	return drmCommandWriteRead(drm->fd, DRM_NOUVEAU_NVIF, args, argc);
 }
 
-int
+drm_public int
 nouveau_object_mthd(struct nouveau_object *obj,
 		    uint32_t mthd, void *data, uint32_t size)
 {
@@ -123,14 +123,14 @@ nouveau_object_mthd(struct nouveau_object *obj,
 	return ret;
 }
 
-void
+drm_public void
 nouveau_object_sclass_put(struct nouveau_sclass **psclass)
 {
 	free(*psclass);
 	*psclass = NULL;
 }
 
-int
+drm_public int
 nouveau_object_sclass_get(struct nouveau_object *obj,
 			  struct nouveau_sclass **psclass)
 {
@@ -180,7 +180,7 @@ nouveau_object_sclass_get(struct nouveau_object *obj,
 	return ret;
 }
 
-int
+drm_public int
 nouveau_object_mclass(struct nouveau_object *obj,
 		      const struct nouveau_mclass *mclass)
 {
@@ -282,7 +282,7 @@ nouveau_object_init(struct nouveau_object *parent, uint32_t handle,
 	return 0;
 }
 
-int
+drm_public int
 nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
 		   uint32_t oclass, void *data, uint32_t length,
 		   struct nouveau_object **pobj)
@@ -303,7 +303,7 @@ nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
 	return 0;
 }
 
-void
+drm_public void
 nouveau_object_del(struct nouveau_object **pobj)
 {
 	struct nouveau_object *obj = *pobj;
@@ -314,14 +314,14 @@ nouveau_object_del(struct nouveau_object **pobj)
 	}
 }
 
-void
+drm_public void
 nouveau_drm_del(struct nouveau_drm **pdrm)
 {
 	free(*pdrm);
 	*pdrm = NULL;
 }
 
-int
+drm_public int
 nouveau_drm_new(int fd, struct nouveau_drm **pdrm)
 {
 	struct nouveau_drm *drm;
@@ -353,14 +353,14 @@ nouveau_drm_new(int fd, struct nouveau_drm **pdrm)
  * is kept here to prevent AIGLX from crashing if the DDX is linked against
  * the new libdrm, but the DRI driver against the old
  */
-int
+drm_public int
 nouveau_device_open_existing(struct nouveau_device **pdev, int close, int fd,
 			     drm_context_t ctx)
 {
 	return -EACCES;
 }
 
-int
+drm_public int
 nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
 		   void *data, uint32_t size, struct nouveau_device **pdev)
 {
@@ -454,7 +454,7 @@ done:
 	return ret;
 }
 
-int
+drm_public int
 nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
 {
 	struct nouveau_drm *drm;
@@ -482,7 +482,7 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
 	return 0;
 }
 
-int
+drm_public int
 nouveau_device_open(const char *busid, struct nouveau_device **pdev)
 {
 	int ret = -ENODEV, fd = drmOpen("nouveau", busid);
@@ -494,7 +494,7 @@ nouveau_device_open(const char *busid, struct nouveau_device **pdev)
 	return ret;
 }
 
-void
+drm_public void
 nouveau_device_del(struct nouveau_device **pdev)
 {
 	struct nouveau_device_priv *nvdev = nouveau_device(*pdev);
@@ -513,7 +513,7 @@ nouveau_device_del(struct nouveau_device **pdev)
 	}
 }
 
-int
+drm_public int
 nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value)
 {
 	struct nouveau_drm *drm = nouveau_drm(&dev->object);
@@ -524,7 +524,7 @@ nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value)
 	return ret;
 }
 
-int
+drm_public int
 nouveau_setparam(struct nouveau_device *dev, uint64_t param, uint64_t value)
 {
 	struct nouveau_drm *drm = nouveau_drm(&dev->object);
@@ -532,7 +532,7 @@ nouveau_setparam(struct nouveau_device *dev, uint64_t param, uint64_t value)
 	return drmCommandWrite(drm->fd, DRM_NOUVEAU_SETPARAM, &r, sizeof(r));
 }
 
-int
+drm_public int
 nouveau_client_new(struct nouveau_device *dev, struct nouveau_client **pclient)
 {
 	struct nouveau_device_priv *nvdev = nouveau_device(dev);
@@ -571,7 +571,7 @@ unlock:
 	return ret;
 }
 
-void
+drm_public void
 nouveau_client_del(struct nouveau_client **pclient)
 {
 	struct nouveau_client_priv *pcli = nouveau_client(*pclient);
@@ -618,7 +618,7 @@ nouveau_bo_del(struct nouveau_bo *bo)
 	free(nvbo);
 }
 
-int
+drm_public int
 nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, uint32_t align,
 	       uint64_t size, union nouveau_bo_config *config,
 	       struct nouveau_bo **pbo)
@@ -709,7 +709,7 @@ nouveau_bo_make_global(struct nouveau_bo_priv *nvbo)
 	}
 }
 
-int
+drm_public int
 nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
 		struct nouveau_bo **pbo)
 {
@@ -721,7 +721,7 @@ nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
 	return ret;
 }
 
-int
+drm_public int
 nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
 		    struct nouveau_bo **pbo)
 {
@@ -750,7 +750,7 @@ nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
 	return ret;
 }
 
-int
+drm_public int
 nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name)
 {
 	struct drm_gem_flink req = { .handle = bo->handle };
@@ -772,7 +772,7 @@ nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name)
 	return 0;
 }
 
-void
+drm_public void
 nouveau_bo_ref(struct nouveau_bo *bo, struct nouveau_bo **pref)
 {
 	struct nouveau_bo *ref = *pref;
@@ -786,7 +786,7 @@ nouveau_bo_ref(struct nouveau_bo *bo, struct nouveau_bo **pref)
 	*pref = bo;
 }
 
-int
+drm_public int
 nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
 			    struct nouveau_bo **bo)
 {
@@ -806,7 +806,7 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
 	return ret;
 }
 
-int
+drm_public int
 nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
 {
 	struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
@@ -821,7 +821,7 @@ nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
 	return 0;
 }
 
-int
+drm_public int
 nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access,
 		struct nouveau_client *client)
 {
diff --git a/nouveau/pushbuf.c b/nouveau/pushbuf.c
index 445c966e..856ae7ee 100644
--- a/nouveau/pushbuf.c
+++ b/nouveau/pushbuf.c
@@ -528,7 +528,7 @@ pushbuf_validate(struct nouveau_pushbuf *push, bool retry)
 	return ret;
 }
 
-int
+drm_public int
 nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan,
 		    int nr, uint32_t size, bool immediate,
 		    struct nouveau_pushbuf **ppush)
@@ -599,7 +599,7 @@ nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan,
 	return 0;
 }
 
-void
+drm_public void
 nouveau_pushbuf_del(struct nouveau_pushbuf **ppush)
 {
 	struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(*ppush);
@@ -625,7 +625,7 @@ nouveau_pushbuf_del(struct nouveau_pushbuf **ppush)
 	*ppush = NULL;
 }
 
-struct nouveau_bufctx *
+drm_public struct nouveau_bufctx *
 nouveau_pushbuf_bufctx(struct nouveau_pushbuf *push, struct nouveau_bufctx *ctx)
 {
 	struct nouveau_bufctx *prev = push->bufctx;
@@ -633,7 +633,7 @@ nouveau_pushbuf_bufctx(struct nouveau_pushbuf *push, struct nouveau_bufctx *ctx)
 	return prev;
 }
 
-int
+drm_public int
 nouveau_pushbuf_space(struct nouveau_pushbuf *push,
 		      uint32_t dwords, uint32_t relocs, uint32_t pushes)
 {
@@ -697,7 +697,7 @@ nouveau_pushbuf_space(struct nouveau_pushbuf *push,
 	return flushed ? pushbuf_validate(push, false) : 0;
 }
 
-void
+drm_public void
 nouveau_pushbuf_data(struct nouveau_pushbuf *push, struct nouveau_bo *bo,
 		     uint64_t offset, uint64_t length)
 {
@@ -735,7 +735,7 @@ nouveau_pushbuf_refn(struct nouveau_pushbuf *push,
 	return pushbuf_refn(push, true, refs, nr);
 }
 
-void
+drm_public void
 nouveau_pushbuf_reloc(struct nouveau_pushbuf *push, struct nouveau_bo *bo,
 		      uint32_t data, uint32_t flags, uint32_t vor, uint32_t tor)
 {
@@ -743,13 +743,13 @@ nouveau_pushbuf_reloc(struct nouveau_pushbuf *push, struct nouveau_bo *bo,
 	push->cur++;
 }
 
-int
+drm_public int
 nouveau_pushbuf_validate(struct nouveau_pushbuf *push)
 {
 	return pushbuf_validate(push, true);
 }
 
-uint32_t
+drm_public uint32_t
 nouveau_pushbuf_refd(struct nouveau_pushbuf *push, struct nouveau_bo *bo)
 {
 	struct drm_nouveau_gem_pushbuf_bo *kref;
@@ -767,7 +767,7 @@ nouveau_pushbuf_refd(struct nouveau_pushbuf *push, struct nouveau_bo *bo)
 	return flags;
 }
 
-int
+drm_public int
 nouveau_pushbuf_kick(struct nouveau_pushbuf *push, struct nouveau_object *chan)
 {
 	if (!push->channel)
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 04/13] libkms: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (2 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 03/13] nouveau: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-14  8:02   ` Michel Dänzer
  2018-09-13 23:57 ` [PATCH libdrm v2 05/13] libdrm: " Lucas De Marchi
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

This was done with:
nm --dynamic --defined-only build/amdgpu/libdrm_amdgpu.so | \
	grep amdgpu_ | \
	cut -d' ' -f3 > /tmp/a.txt

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

Then the alignment of function arguments were manually fixed all over.
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@intel.com>
---
 amdgpu/amdgpu_bo.c       | 104 ++++++++++++++---------------
 amdgpu/amdgpu_cs.c       | 137 ++++++++++++++++++++-------------------
 amdgpu/amdgpu_device.c   |  19 +++---
 amdgpu/amdgpu_gpu_info.c |  51 ++++++++-------
 amdgpu/amdgpu_vamgr.c    |  24 +++----
 amdgpu/amdgpu_vm.c       |   5 +-
 6 files changed, 173 insertions(+), 167 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6a95929c..cd29c014 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -69,9 +69,9 @@ static int amdgpu_bo_create(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_bo_alloc(amdgpu_device_handle dev,
-		    struct amdgpu_bo_alloc_request *alloc_buffer,
-		    amdgpu_bo_handle *buf_handle)
+drm_public int amdgpu_bo_alloc(amdgpu_device_handle dev,
+			       struct amdgpu_bo_alloc_request *alloc_buffer,
+			       amdgpu_bo_handle *buf_handle)
 {
 	union drm_amdgpu_gem_create args;
 	unsigned heap = alloc_buffer->preferred_heap;
@@ -112,8 +112,8 @@ out:
 	return r;
 }
 
-int amdgpu_bo_set_metadata(amdgpu_bo_handle bo,
-			   struct amdgpu_bo_metadata *info)
+drm_public int amdgpu_bo_set_metadata(amdgpu_bo_handle bo,
+				      struct amdgpu_bo_metadata *info)
 {
 	struct drm_amdgpu_gem_metadata args = {};
 
@@ -135,8 +135,8 @@ int amdgpu_bo_set_metadata(amdgpu_bo_handle bo,
 				   &args, sizeof(args));
 }
 
-int amdgpu_bo_query_info(amdgpu_bo_handle bo,
-			 struct amdgpu_bo_info *info)
+drm_public int amdgpu_bo_query_info(amdgpu_bo_handle bo,
+				    struct amdgpu_bo_info *info)
 {
 	struct drm_amdgpu_gem_metadata metadata = {};
 	struct drm_amdgpu_gem_create_in bo_info = {};
@@ -232,9 +232,9 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
 	return r;
 }
 
-int amdgpu_bo_export(amdgpu_bo_handle bo,
-		     enum amdgpu_bo_handle_type type,
-		     uint32_t *shared_handle)
+drm_public int amdgpu_bo_export(amdgpu_bo_handle bo,
+				enum amdgpu_bo_handle_type type,
+				uint32_t *shared_handle)
 {
 	int r;
 
@@ -260,9 +260,9 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 	return -EINVAL;
 }
 
-int amdgpu_bo_import(amdgpu_device_handle dev,
-		     enum amdgpu_bo_handle_type type,
-		     uint32_t shared_handle,
+drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
+				enum amdgpu_bo_handle_type type,
+				uint32_t shared_handle,
 		     struct amdgpu_bo_import_result *output)
 {
 	struct drm_gem_open open_arg = {};
@@ -406,7 +406,7 @@ unlock:
 	return r;
 }
 
-int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
+drm_public int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
 {
 	struct amdgpu_device *dev;
 	struct amdgpu_bo *bo = buf_handle;
@@ -438,12 +438,12 @@ int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
 	return 0;
 }
 
-void amdgpu_bo_inc_ref(amdgpu_bo_handle bo)
+drm_public void amdgpu_bo_inc_ref(amdgpu_bo_handle bo)
 {
 	atomic_inc(&bo->refcount);
 }
 
-int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)
+drm_public int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)
 {
 	union drm_amdgpu_gem_mmap args;
 	void *ptr;
@@ -491,7 +491,7 @@ int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)
 	return 0;
 }
 
-int amdgpu_bo_cpu_unmap(amdgpu_bo_handle bo)
+drm_public int amdgpu_bo_cpu_unmap(amdgpu_bo_handle bo)
 {
 	int r;
 
@@ -517,7 +517,7 @@ int amdgpu_bo_cpu_unmap(amdgpu_bo_handle bo)
 	return r;
 }
 
-int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev,
+drm_public int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev,
 				struct amdgpu_buffer_size_alignments *info)
 {
 	info->size_local = dev->dev_info.pte_fragment_size;
@@ -525,8 +525,8 @@ int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
-			    uint64_t timeout_ns,
+drm_public int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
+				       uint64_t timeout_ns,
 			    bool *busy)
 {
 	union drm_amdgpu_gem_wait_idle args;
@@ -548,11 +548,11 @@ int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
 	}
 }
 
-int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
-				  void *cpu,
-				  uint64_t size,
-				  amdgpu_bo_handle *buf_handle,
-				  uint64_t *offset_in_bo)
+drm_public int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
+					     void *cpu,
+					     uint64_t size,
+					     amdgpu_bo_handle *buf_handle,
+					     uint64_t *offset_in_bo)
 {
 	struct amdgpu_bo *bo;
 	uint32_t i;
@@ -590,10 +590,10 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
 	return r;
 }
 
-int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
-				    void *cpu,
-				    uint64_t size,
-				    amdgpu_bo_handle *buf_handle)
+drm_public int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
+					      void *cpu,
+					      uint64_t size,
+					      amdgpu_bo_handle *buf_handle)
 {
 	int r;
 	struct drm_amdgpu_gem_userptr args;
@@ -623,11 +623,11 @@ out:
 	return r;
 }
 
-int amdgpu_bo_list_create(amdgpu_device_handle dev,
-			  uint32_t number_of_resources,
-			  amdgpu_bo_handle *resources,
-			  uint8_t *resource_prios,
-			  amdgpu_bo_list_handle *result)
+drm_public int amdgpu_bo_list_create(amdgpu_device_handle dev,
+				     uint32_t number_of_resources,
+				     amdgpu_bo_handle *resources,
+				     uint8_t *resource_prios,
+				     amdgpu_bo_list_handle *result)
 {
 	struct drm_amdgpu_bo_list_entry *list;
 	union drm_amdgpu_bo_list args;
@@ -678,7 +678,7 @@ int amdgpu_bo_list_create(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_bo_list_destroy(amdgpu_bo_list_handle list)
+drm_public int amdgpu_bo_list_destroy(amdgpu_bo_list_handle list)
 {
 	union drm_amdgpu_bo_list args;
 	int r;
@@ -696,10 +696,10 @@ int amdgpu_bo_list_destroy(amdgpu_bo_list_handle list)
 	return r;
 }
 
-int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
-			  uint32_t number_of_resources,
-			  amdgpu_bo_handle *resources,
-			  uint8_t *resource_prios)
+drm_public int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
+				     uint32_t number_of_resources,
+				     amdgpu_bo_handle *resources,
+				     uint8_t *resource_prios)
 {
 	struct drm_amdgpu_bo_list_entry *list;
 	union drm_amdgpu_bo_list args;
@@ -737,12 +737,12 @@ int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
 	return r;
 }
 
-int amdgpu_bo_va_op(amdgpu_bo_handle bo,
-		     uint64_t offset,
-		     uint64_t size,
-		     uint64_t addr,
-		     uint64_t flags,
-		     uint32_t ops)
+drm_public int amdgpu_bo_va_op(amdgpu_bo_handle bo,
+			       uint64_t offset,
+			       uint64_t size,
+			       uint64_t addr,
+			       uint64_t flags,
+			       uint32_t ops)
 {
 	amdgpu_device_handle dev = bo->dev;
 
@@ -754,13 +754,13 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,
 				   AMDGPU_VM_PAGE_EXECUTABLE, ops);
 }
 
-int amdgpu_bo_va_op_raw(amdgpu_device_handle dev,
-			amdgpu_bo_handle bo,
-			uint64_t offset,
-			uint64_t size,
-			uint64_t addr,
-			uint64_t flags,
-			uint32_t ops)
+drm_public int amdgpu_bo_va_op_raw(amdgpu_device_handle dev,
+				   amdgpu_bo_handle bo,
+				   uint64_t offset,
+				   uint64_t size,
+				   uint64_t addr,
+				   uint64_t flags,
+				   uint32_t ops)
 {
 	struct drm_amdgpu_gem_va va;
 	int r;
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 3c9be6c2..3b8231aa 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -48,8 +48,9 @@ static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem);
  *
  * \return  0 on success otherwise POSIX Error code
 */
-int amdgpu_cs_ctx_create2(amdgpu_device_handle dev, uint32_t priority,
-							amdgpu_context_handle *context)
+drm_public int amdgpu_cs_ctx_create2(amdgpu_device_handle dev,
+				     uint32_t priority,
+				     amdgpu_context_handle *context)
 {
 	struct amdgpu_context *gpu_context;
 	union drm_amdgpu_ctx args;
@@ -93,8 +94,8 @@ error:
 	return r;
 }
 
-int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
-			 amdgpu_context_handle *context)
+drm_public int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
+				    amdgpu_context_handle *context)
 {
 	return amdgpu_cs_ctx_create2(dev, AMDGPU_CTX_PRIORITY_NORMAL, context);
 }
@@ -107,7 +108,7 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
  *
  * \return  0 on success otherwise POSIX Error code
 */
-int amdgpu_cs_ctx_free(amdgpu_context_handle context)
+drm_public int amdgpu_cs_ctx_free(amdgpu_context_handle context)
 {
 	union drm_amdgpu_ctx args;
 	int i, j, k;
@@ -141,8 +142,8 @@ int amdgpu_cs_ctx_free(amdgpu_context_handle context)
 	return r;
 }
 
-int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
-				uint32_t *state, uint32_t *hangs)
+drm_public int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
+					   uint32_t *state, uint32_t *hangs)
 {
 	union drm_amdgpu_ctx args;
 	int r;
@@ -323,10 +324,10 @@ error_unlock:
 	return r;
 }
 
-int amdgpu_cs_submit(amdgpu_context_handle context,
-		     uint64_t flags,
-		     struct amdgpu_cs_request *ibs_request,
-		     uint32_t number_of_requests)
+drm_public int amdgpu_cs_submit(amdgpu_context_handle context,
+				uint64_t flags,
+				struct amdgpu_cs_request *ibs_request,
+				uint32_t number_of_requests)
 {
 	uint32_t i;
 	int r;
@@ -407,10 +408,10 @@ static int amdgpu_ioctl_wait_cs(amdgpu_context_handle context,
 	return 0;
 }
 
-int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
-				 uint64_t timeout_ns,
-				 uint64_t flags,
-				 uint32_t *expired)
+drm_public int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
+					    uint64_t timeout_ns,
+					    uint64_t flags,
+					    uint32_t *expired)
 {
 	bool busy = true;
 	int r;
@@ -478,12 +479,12 @@ static int amdgpu_ioctl_wait_fences(struct amdgpu_cs_fence *fences,
 	return 0;
 }
 
-int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
-			  uint32_t fence_count,
-			  bool wait_all,
-			  uint64_t timeout_ns,
-			  uint32_t *status,
-			  uint32_t *first)
+drm_public int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
+				     uint32_t fence_count,
+				     bool wait_all,
+				     uint64_t timeout_ns,
+				     uint32_t *status,
+				     uint32_t *first)
 {
 	uint32_t i;
 
@@ -506,7 +507,7 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences,
 					timeout_ns, status, first);
 }
 
-int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem)
+drm_public int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem)
 {
 	struct amdgpu_semaphore *gpu_semaphore;
 
@@ -523,8 +524,8 @@ int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem)
 	return 0;
 }
 
-int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx,
-			       uint32_t ip_type,
+drm_public int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx,
+					  uint32_t ip_type,
 			       uint32_t ip_instance,
 			       uint32_t ring,
 			       amdgpu_semaphore_handle sem)
@@ -549,8 +550,8 @@ int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx,
 	return 0;
 }
 
-int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
-			     uint32_t ip_type,
+drm_public int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
+					uint32_t ip_type,
 			     uint32_t ip_instance,
 			     uint32_t ring,
 			     amdgpu_semaphore_handle sem)
@@ -595,14 +596,14 @@ static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem)
 	return 0;
 }
 
-int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem)
+drm_public int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem)
 {
 	return amdgpu_cs_unreference_sem(sem);
 }
 
-int amdgpu_cs_create_syncobj2(amdgpu_device_handle dev,
-			      uint32_t  flags,
-			      uint32_t *handle)
+drm_public int amdgpu_cs_create_syncobj2(amdgpu_device_handle dev,
+					 uint32_t  flags,
+					 uint32_t *handle)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -610,8 +611,8 @@ int amdgpu_cs_create_syncobj2(amdgpu_device_handle dev,
 	return drmSyncobjCreate(dev->fd, flags, handle);
 }
 
-int amdgpu_cs_create_syncobj(amdgpu_device_handle dev,
-			     uint32_t *handle)
+drm_public int amdgpu_cs_create_syncobj(amdgpu_device_handle dev,
+					uint32_t *handle)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -619,8 +620,8 @@ int amdgpu_cs_create_syncobj(amdgpu_device_handle dev,
 	return drmSyncobjCreate(dev->fd, 0, handle);
 }
 
-int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev,
-			      uint32_t handle)
+drm_public int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev,
+					 uint32_t handle)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -628,8 +629,9 @@ int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev,
 	return drmSyncobjDestroy(dev->fd, handle);
 }
 
-int amdgpu_cs_syncobj_reset(amdgpu_device_handle dev,
-			    const uint32_t *syncobjs, uint32_t syncobj_count)
+drm_public int amdgpu_cs_syncobj_reset(amdgpu_device_handle dev,
+				       const uint32_t *syncobjs,
+				       uint32_t syncobj_count)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -637,8 +639,9 @@ int amdgpu_cs_syncobj_reset(amdgpu_device_handle dev,
 	return drmSyncobjReset(dev->fd, syncobjs, syncobj_count);
 }
 
-int amdgpu_cs_syncobj_signal(amdgpu_device_handle dev,
-			     const uint32_t *syncobjs, uint32_t syncobj_count)
+drm_public int amdgpu_cs_syncobj_signal(amdgpu_device_handle dev,
+					const uint32_t *syncobjs,
+					uint32_t syncobj_count)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -646,10 +649,10 @@ int amdgpu_cs_syncobj_signal(amdgpu_device_handle dev,
 	return drmSyncobjSignal(dev->fd, syncobjs, syncobj_count);
 }
 
-int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev,
-			   uint32_t *handles, unsigned num_handles,
-			   int64_t timeout_nsec, unsigned flags,
-			   uint32_t *first_signaled)
+drm_public int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev,
+				      uint32_t *handles, unsigned num_handles,
+				      int64_t timeout_nsec, unsigned flags,
+				      uint32_t *first_signaled)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -658,9 +661,9 @@ int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev,
 			      flags, first_signaled);
 }
 
-int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
-			     uint32_t handle,
-			     int *shared_fd)
+drm_public int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
+					uint32_t handle,
+					int *shared_fd)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -668,9 +671,9 @@ int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
 	return drmSyncobjHandleToFD(dev->fd, handle, shared_fd);
 }
 
-int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
-			     int shared_fd,
-			     uint32_t *handle)
+drm_public int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
+					int shared_fd,
+					uint32_t *handle)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -678,9 +681,9 @@ int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
 	return drmSyncobjFDToHandle(dev->fd, shared_fd, handle);
 }
 
-int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
-				       uint32_t syncobj,
-				       int *sync_file_fd)
+drm_public int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
+						  uint32_t syncobj,
+						  int *sync_file_fd)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -688,9 +691,9 @@ int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
 	return drmSyncobjExportSyncFile(dev->fd, syncobj, sync_file_fd);
 }
 
-int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
-				       uint32_t syncobj,
-				       int sync_file_fd)
+drm_public int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
+						  uint32_t syncobj,
+						  int sync_file_fd)
 {
 	if (NULL == dev)
 		return -EINVAL;
@@ -698,12 +701,12 @@ int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
 	return drmSyncobjImportSyncFile(dev->fd, syncobj, sync_file_fd);
 }
 
-int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
-			 amdgpu_context_handle context,
-			 amdgpu_bo_list_handle bo_list_handle,
-			 int num_chunks,
-			 struct drm_amdgpu_cs_chunk *chunks,
-			 uint64_t *seq_no)
+drm_public int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
+				    amdgpu_context_handle context,
+				    amdgpu_bo_list_handle bo_list_handle,
+				    int num_chunks,
+				    struct drm_amdgpu_cs_chunk *chunks,
+				    uint64_t *seq_no)
 {
 	union drm_amdgpu_cs cs = {0};
 	uint64_t *chunk_array;
@@ -728,15 +731,15 @@ int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
 	return 0;
 }
 
-void amdgpu_cs_chunk_fence_info_to_data(struct amdgpu_cs_fence_info *fence_info,
+drm_public void amdgpu_cs_chunk_fence_info_to_data(struct amdgpu_cs_fence_info *fence_info,
 					struct drm_amdgpu_cs_chunk_data *data)
 {
 	data->fence_data.handle = fence_info->handle->handle;
 	data->fence_data.offset = fence_info->offset * sizeof(uint64_t);
 }
 
-void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence,
-				  struct drm_amdgpu_cs_chunk_dep *dep)
+drm_public void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence,
+					struct drm_amdgpu_cs_chunk_dep *dep)
 {
 	dep->ip_type = fence->ip_type;
 	dep->ip_instance = fence->ip_instance;
@@ -745,10 +748,10 @@ void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence,
 	dep->handle = fence->fence;
 }
 
-int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev,
-			      struct amdgpu_cs_fence *fence,
-			      uint32_t what,
-			      uint32_t *out_handle)
+drm_public int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev,
+					 struct amdgpu_cs_fence *fence,
+					 uint32_t what,
+					 uint32_t *out_handle)
 {
 	union drm_amdgpu_fence_to_handle fth = {0};
 	int r;
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 73eeeed6..362494b1 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -133,17 +133,17 @@ static void amdgpu_device_free_internal(amdgpu_device_handle dev)
  *    // incremented. dst is freed if its reference counter is 0.
  */
 static void amdgpu_device_reference(struct amdgpu_device **dst,
-			     struct amdgpu_device *src)
+				    struct amdgpu_device *src)
 {
 	if (update_references(&(*dst)->refcount, &src->refcount))
 		amdgpu_device_free_internal(*dst);
 	*dst = src;
 }
 
-int amdgpu_device_initialize(int fd,
-			     uint32_t *major_version,
-			     uint32_t *minor_version,
-			     amdgpu_device_handle *device_handle)
+drm_public int amdgpu_device_initialize(int fd,
+					uint32_t *major_version,
+					uint32_t *minor_version,
+					amdgpu_device_handle *device_handle)
 {
 	struct amdgpu_device *dev;
 	drmVersionPtr version;
@@ -279,19 +279,20 @@ cleanup:
 	return r;
 }
 
-int amdgpu_device_deinitialize(amdgpu_device_handle dev)
+drm_public int amdgpu_device_deinitialize(amdgpu_device_handle dev)
 {
 	amdgpu_device_reference(&dev, NULL);
 	return 0;
 }
 
-const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
+drm_public const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
 {
 	return dev->marketing_name;
 }
 
-int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
-			 void *value)
+drm_public int amdgpu_query_sw_info(amdgpu_device_handle dev,
+				    enum amdgpu_sw_info info,
+				    void *value)
 {
 	uint32_t *val32 = (uint32_t*)value;
 
diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
index b68e1c4f..777087f2 100644
--- a/amdgpu/amdgpu_gpu_info.c
+++ b/amdgpu/amdgpu_gpu_info.c
@@ -30,8 +30,8 @@
 #include "amdgpu_internal.h"
 #include "xf86drm.h"
 
-int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
-		      unsigned size, void *value)
+drm_public int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
+				 unsigned size, void *value)
 {
 	struct drm_amdgpu_info request;
 
@@ -44,8 +44,8 @@ int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
 			       sizeof(struct drm_amdgpu_info));
 }
 
-int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
-			      int32_t *result)
+drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
+					 int32_t *result)
 {
 	struct drm_amdgpu_info request;
 
@@ -59,9 +59,9 @@ int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
 			       sizeof(struct drm_amdgpu_info));
 }
 
-int amdgpu_read_mm_registers(amdgpu_device_handle dev, unsigned dword_offset,
-			     unsigned count, uint32_t instance, uint32_t flags,
-			     uint32_t *values)
+drm_public int amdgpu_read_mm_registers(amdgpu_device_handle dev,
+		unsigned dword_offset, unsigned count, uint32_t instance,
+		uint32_t flags, uint32_t *values)
 {
 	struct drm_amdgpu_info request;
 
@@ -78,8 +78,9 @@ int amdgpu_read_mm_registers(amdgpu_device_handle dev, unsigned dword_offset,
 			       sizeof(struct drm_amdgpu_info));
 }
 
-int amdgpu_query_hw_ip_count(amdgpu_device_handle dev, unsigned type,
-			     uint32_t *count)
+drm_public int amdgpu_query_hw_ip_count(amdgpu_device_handle dev,
+					unsigned type,
+					uint32_t *count)
 {
 	struct drm_amdgpu_info request;
 
@@ -93,9 +94,9 @@ int amdgpu_query_hw_ip_count(amdgpu_device_handle dev, unsigned type,
 			       sizeof(struct drm_amdgpu_info));
 }
 
-int amdgpu_query_hw_ip_info(amdgpu_device_handle dev, unsigned type,
-			    unsigned ip_instance,
-			    struct drm_amdgpu_info_hw_ip *info)
+drm_public int amdgpu_query_hw_ip_info(amdgpu_device_handle dev, unsigned type,
+				       unsigned ip_instance,
+				       struct drm_amdgpu_info_hw_ip *info)
 {
 	struct drm_amdgpu_info request;
 
@@ -110,9 +111,9 @@ int amdgpu_query_hw_ip_info(amdgpu_device_handle dev, unsigned type,
 			       sizeof(struct drm_amdgpu_info));
 }
 
-int amdgpu_query_firmware_version(amdgpu_device_handle dev, unsigned fw_type,
-				  unsigned ip_instance, unsigned index,
-				  uint32_t *version, uint32_t *feature)
+drm_public int amdgpu_query_firmware_version(amdgpu_device_handle dev,
+		unsigned fw_type, unsigned ip_instance, unsigned index,
+		uint32_t *version, uint32_t *feature)
 {
 	struct drm_amdgpu_info request;
 	struct drm_amdgpu_info_firmware firmware = {};
@@ -227,8 +228,8 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 	return 0;
 }
 
-int amdgpu_query_gpu_info(amdgpu_device_handle dev,
-			struct amdgpu_gpu_info *info)
+drm_public int amdgpu_query_gpu_info(amdgpu_device_handle dev,
+				     struct amdgpu_gpu_info *info)
 {
 	if (!dev || !info)
 		return -EINVAL;
@@ -239,10 +240,10 @@ int amdgpu_query_gpu_info(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_query_heap_info(amdgpu_device_handle dev,
-			uint32_t heap,
-			uint32_t flags,
-			struct amdgpu_heap_info *info)
+drm_public int amdgpu_query_heap_info(amdgpu_device_handle dev,
+				      uint32_t heap,
+				      uint32_t flags,
+				      struct amdgpu_heap_info *info)
 {
 	struct drm_amdgpu_info_vram_gtt vram_gtt_info = {};
 	int r;
@@ -291,8 +292,8 @@ int amdgpu_query_heap_info(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_query_gds_info(amdgpu_device_handle dev,
-			struct amdgpu_gds_resource_info *gds_info)
+drm_public int amdgpu_query_gds_info(amdgpu_device_handle dev,
+				     struct amdgpu_gds_resource_info *gds_info)
 {
 	struct drm_amdgpu_info_gds gds_config = {};
         int r;
@@ -316,8 +317,8 @@ int amdgpu_query_gds_info(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type,
-			     unsigned size, void *value)
+drm_public int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type,
+					unsigned size, void *value)
 {
 	struct drm_amdgpu_info request;
 
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index 1de9f952..d25d4216 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -29,9 +29,9 @@
 #include "amdgpu_internal.h"
 #include "util_math.h"
 
-int amdgpu_va_range_query(amdgpu_device_handle dev,
-			  enum amdgpu_gpu_va_range type,
-			  uint64_t *start, uint64_t *end)
+drm_public int amdgpu_va_range_query(amdgpu_device_handle dev,
+				     enum amdgpu_gpu_va_range type,
+				     uint64_t *start, uint64_t *end)
 {
 	if (type != amdgpu_gpu_va_range_general)
 		return -EINVAL;
@@ -186,14 +186,14 @@ out:
 	pthread_mutex_unlock(&mgr->bo_va_mutex);
 }
 
-int amdgpu_va_range_alloc(amdgpu_device_handle dev,
-			  enum amdgpu_gpu_va_range va_range_type,
-			  uint64_t size,
-			  uint64_t va_base_alignment,
-			  uint64_t va_base_required,
-			  uint64_t *va_base_allocated,
-			  amdgpu_va_handle *va_range_handle,
-			  uint64_t flags)
+drm_public int amdgpu_va_range_alloc(amdgpu_device_handle dev,
+				     enum amdgpu_gpu_va_range va_range_type,
+				     uint64_t size,
+				     uint64_t va_base_alignment,
+				     uint64_t va_base_required,
+				     uint64_t *va_base_allocated,
+				     amdgpu_va_handle *va_range_handle,
+				     uint64_t flags)
 {
 	struct amdgpu_bo_va_mgr *vamgr;
 
@@ -250,7 +250,7 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
 	return 0;
 }
 
-int amdgpu_va_range_free(amdgpu_va_handle va_range_handle)
+drm_public int amdgpu_va_range_free(amdgpu_va_handle va_range_handle)
 {
 	if(!va_range_handle || !va_range_handle->address)
 		return 0;
diff --git a/amdgpu/amdgpu_vm.c b/amdgpu/amdgpu_vm.c
index da9d07f8..7e6e28f0 100644
--- a/amdgpu/amdgpu_vm.c
+++ b/amdgpu/amdgpu_vm.c
@@ -26,7 +26,7 @@
 #include "xf86drm.h"
 #include "amdgpu_internal.h"
 
-int amdgpu_vm_reserve_vmid(amdgpu_device_handle dev, uint32_t flags)
+drm_public int amdgpu_vm_reserve_vmid(amdgpu_device_handle dev, uint32_t flags)
 {
 	union drm_amdgpu_vm vm;
 
@@ -37,7 +37,8 @@ int amdgpu_vm_reserve_vmid(amdgpu_device_handle dev, uint32_t flags)
 				   &vm, sizeof(vm));
 }
 
-int amdgpu_vm_unreserve_vmid(amdgpu_device_handle dev, uint32_t flags)
+drm_public int amdgpu_vm_unreserve_vmid(amdgpu_device_handle dev,
+					uint32_t flags)
 {
 	union drm_amdgpu_vm vm;
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 05/13] libdrm: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (3 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 04/13] libkms: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 06/13] etnaviv: " Lucas De Marchi
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

This was done with:
nm --dynamic --defined-only build/libdrm.so | \
	grep " T " | \
	grep -v _fini | grep -v _init | \
	cut -d' ' -f3 > /tmp/a.txt

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

Then the alignment of function arguments were manually fixed all over.
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@intel.com>
---
 xf86drm.c       | 276 +++++++++++++++++++++++++-----------------------
 xf86drmHash.c   |  15 +--
 xf86drmMode.c   | 158 ++++++++++++++-------------
 xf86drmRandom.c |   9 +-
 xf86drmSL.c     |  23 ++--
 5 files changed, 254 insertions(+), 227 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index b2388194..49150d74 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -121,7 +121,7 @@ struct drm_pciinfo {
 
 static drmServerInfoPtr drm_server_info;
 
-void drmSetServerInfo(drmServerInfoPtr info)
+drm_public void drmSetServerInfo(drmServerInfoPtr info)
 {
     drm_server_info = info;
 }
@@ -141,7 +141,7 @@ drmDebugPrint(const char *format, va_list ap)
     return vfprintf(stderr, format, ap);
 }
 
-void
+drm_public void
 drmMsg(const char *format, ...)
 {
     va_list ap;
@@ -161,17 +161,17 @@ drmMsg(const char *format, ...)
 
 static void *drmHashTable = NULL; /* Context switch callbacks */
 
-void *drmGetHashTable(void)
+drm_public void *drmGetHashTable(void)
 {
     return drmHashTable;
 }
 
-void *drmMalloc(int size)
+drm_public void *drmMalloc(int size)
 {
     return calloc(1, size);
 }
 
-void drmFree(void *pt)
+drm_public void drmFree(void *pt)
 {
     free(pt);
 }
@@ -179,7 +179,7 @@ void drmFree(void *pt)
 /**
  * Call ioctl, restarting if it is interupted
  */
-int
+drm_public int
 drmIoctl(int fd, unsigned long request, void *arg)
 {
     int ret;
@@ -199,7 +199,7 @@ static unsigned long drmGetKeyFromFd(int fd)
     return st.st_rdev;
 }
 
-drmHashEntry *drmGetEntry(int fd)
+drm_public drmHashEntry *drmGetEntry(int fd)
 {
     unsigned long key = drmGetKeyFromFd(fd);
     void          *value;
@@ -490,7 +490,7 @@ static int drmOpenMinor(int minor, int create, int type)
  * minor and get version information.  For backward compatibility with older
  * Linux implementations, /proc/dri is also checked.
  */
-int drmAvailable(void)
+drm_public int drmAvailable(void)
 {
     drmVersionPtr version;
     int           retval = 0;
@@ -725,7 +725,7 @@ static int drmOpenByName(const char *name, int type)
  * It calls drmOpenByBusid() if \p busid is specified or drmOpenByName()
  * otherwise.
  */
-int drmOpen(const char *name, const char *busid)
+drm_public int drmOpen(const char *name, const char *busid)
 {
     return drmOpenWithType(name, busid, DRM_NODE_PRIMARY);
 }
@@ -746,7 +746,7 @@ int drmOpen(const char *name, const char *busid)
  * It calls drmOpenByBusid() if \p busid is specified or drmOpenByName()
  * otherwise.
  */
-int drmOpenWithType(const char *name, const char *busid, int type)
+drm_public int drmOpenWithType(const char *name, const char *busid, int type)
 {
     if (!drmAvailable() && name != NULL && drm_server_info &&
         drm_server_info->load_module) {
@@ -769,12 +769,12 @@ int drmOpenWithType(const char *name, const char *busid, int type)
     return -1;
 }
 
-int drmOpenControl(int minor)
+drm_public int drmOpenControl(int minor)
 {
     return drmOpenMinor(minor, 0, DRM_NODE_CONTROL);
 }
 
-int drmOpenRender(int minor)
+drm_public int drmOpenRender(int minor)
 {
     return drmOpenMinor(minor, 0, DRM_NODE_RENDER);
 }
@@ -788,7 +788,7 @@ int drmOpenRender(int minor)
  * It frees the memory pointed by \p %v as well as all the non-null strings
  * pointers in it.
  */
-void drmFreeVersion(drmVersionPtr v)
+drm_public void drmFreeVersion(drmVersionPtr v)
 {
     if (!v)
         return;
@@ -858,7 +858,7 @@ static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s)
  * first with zeros to get the string lengths, and then the actually strings.
  * It also null-terminates them since they might not be already.
  */
-drmVersionPtr drmGetVersion(int fd)
+drm_public drmVersionPtr drmGetVersion(int fd)
 {
     drmVersionPtr retval;
     drm_version_t *version = drmMalloc(sizeof(*version));
@@ -906,7 +906,7 @@ drmVersionPtr drmGetVersion(int fd)
  * This function allocates and fills a drm_version structure with a hard coded
  * version number.
  */
-drmVersionPtr drmGetLibVersion(int fd)
+drm_public drmVersionPtr drmGetLibVersion(int fd)
 {
     drm_version_t *version = drmMalloc(sizeof(*version));
 
@@ -927,7 +927,7 @@ drmVersionPtr drmGetLibVersion(int fd)
     return (drmVersionPtr)version;
 }
 
-int drmGetCap(int fd, uint64_t capability, uint64_t *value)
+drm_public int drmGetCap(int fd, uint64_t capability, uint64_t *value)
 {
     struct drm_get_cap cap;
     int ret;
@@ -943,7 +943,7 @@ int drmGetCap(int fd, uint64_t capability, uint64_t *value)
     return 0;
 }
 
-int drmSetClientCap(int fd, uint64_t capability, uint64_t value)
+drm_public int drmSetClientCap(int fd, uint64_t capability, uint64_t value)
 {
     struct drm_set_client_cap cap;
 
@@ -962,7 +962,7 @@ int drmSetClientCap(int fd, uint64_t capability, uint64_t value)
  * \internal
  * This function is just frees the memory pointed by \p busid.
  */
-void drmFreeBusid(const char *busid)
+drm_public void drmFreeBusid(const char *busid)
 {
     drmFree((void *)busid);
 }
@@ -980,7 +980,7 @@ void drmFreeBusid(const char *busid)
  * get the string length and data, passing the arguments in a drm_unique
  * structure.
  */
-char *drmGetBusid(int fd)
+drm_public char *drmGetBusid(int fd)
 {
     drm_unique_t u;
 
@@ -1011,7 +1011,7 @@ char *drmGetBusid(int fd)
  * This function is a wrapper around the DRM_IOCTL_SET_UNIQUE ioctl, passing
  * the arguments in a drm_unique structure.
  */
-int drmSetBusid(int fd, const char *busid)
+drm_public int drmSetBusid(int fd, const char *busid)
 {
     drm_unique_t u;
 
@@ -1025,7 +1025,7 @@ int drmSetBusid(int fd, const char *busid)
     return 0;
 }
 
-int drmGetMagic(int fd, drm_magic_t * magic)
+drm_public int drmGetMagic(int fd, drm_magic_t * magic)
 {
     drm_auth_t auth;
 
@@ -1038,7 +1038,7 @@ int drmGetMagic(int fd, drm_magic_t * magic)
     return 0;
 }
 
-int drmAuthMagic(int fd, drm_magic_t magic)
+drm_public int drmAuthMagic(int fd, drm_magic_t magic)
 {
     drm_auth_t auth;
 
@@ -1099,8 +1099,8 @@ int drmAuthMagic(int fd, drm_magic_t magic)
  * This function is a wrapper around the DRM_IOCTL_ADD_MAP ioctl, passing
  * the arguments in a drm_map structure.
  */
-int drmAddMap(int fd, drm_handle_t offset, drmSize size, drmMapType type,
-              drmMapFlags flags, drm_handle_t *handle)
+drm_public int drmAddMap(int fd, drm_handle_t offset, drmSize size, drmMapType type,
+                         drmMapFlags flags, drm_handle_t *handle)
 {
     drm_map_t map;
 
@@ -1116,7 +1116,7 @@ int drmAddMap(int fd, drm_handle_t offset, drmSize size, drmMapType type,
     return 0;
 }
 
-int drmRmMap(int fd, drm_handle_t handle)
+drm_public int drmRmMap(int fd, drm_handle_t handle)
 {
     drm_map_t map;
 
@@ -1144,8 +1144,8 @@ int drmRmMap(int fd, drm_handle_t handle)
  *
  * \sa drm_buf_desc.
  */
-int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags,
-               int agp_offset)
+drm_public int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags,
+                          int agp_offset)
 {
     drm_buf_desc_t request;
 
@@ -1160,7 +1160,7 @@ int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags,
     return request.count;
 }
 
-int drmMarkBufs(int fd, double low, double high)
+drm_public int drmMarkBufs(int fd, double low, double high)
 {
     drm_buf_info_t info;
     int            i;
@@ -1211,7 +1211,7 @@ int drmMarkBufs(int fd, double low, double high)
  * This function is a wrapper around the DRM_IOCTL_FREE_BUFS ioctl, passing
  * the arguments in a drm_buf_free structure.
  */
-int drmFreeBufs(int fd, int count, int *list)
+drm_public int drmFreeBufs(int fd, int count, int *list)
 {
     drm_buf_free_t request;
 
@@ -1232,7 +1232,7 @@ int drmFreeBufs(int fd, int count, int *list)
  * \internal
  * This function closes the file descriptor.
  */
-int drmClose(int fd)
+drm_public int drmClose(int fd)
 {
     unsigned long key    = drmGetKeyFromFd(fd);
     drmHashEntry  *entry = drmGetEntry(fd);
@@ -1263,7 +1263,8 @@ int drmClose(int fd)
  * \internal
  * This function is a wrapper for mmap().
  */
-int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)
+drm_public int drmMap(int fd, drm_handle_t handle, drmSize size,
+                      drmAddressPtr address)
 {
     static unsigned long pagesize_mask = 0;
 
@@ -1293,12 +1294,12 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)
  * \internal
  * This function is a wrapper for munmap().
  */
-int drmUnmap(drmAddress address, drmSize size)
+drm_public int drmUnmap(drmAddress address, drmSize size)
 {
     return drm_munmap(address, size);
 }
 
-drmBufInfoPtr drmGetBufInfo(int fd)
+drm_public drmBufInfoPtr drmGetBufInfo(int fd)
 {
     drm_buf_info_t info;
     drmBufInfoPtr  retval;
@@ -1348,7 +1349,7 @@ drmBufInfoPtr drmGetBufInfo(int fd)
  * information about the buffers in a drm_buf_map structure into the
  * client-visible data structures.
  */
-drmBufMapPtr drmMapBufs(int fd)
+drm_public drmBufMapPtr drmMapBufs(int fd)
 {
     drm_buf_map_t bufs;
     drmBufMapPtr  retval;
@@ -1393,7 +1394,7 @@ drmBufMapPtr drmMapBufs(int fd)
  * Calls munmap() for every buffer stored in \p bufs and frees the
  * memory allocated by drmMapBufs().
  */
-int drmUnmapBufs(drmBufMapPtr bufs)
+drm_public int drmUnmapBufs(drmBufMapPtr bufs)
 {
     int i;
 
@@ -1421,7 +1422,7 @@ int drmUnmapBufs(drmBufMapPtr bufs)
  * Assemble the arguments into a drm_dma structure and keeps issuing the
  * DRM_IOCTL_DMA ioctl until success or until maximum number of retries.
  */
-int drmDMA(int fd, drmDMAReqPtr request)
+drm_public int drmDMA(int fd, drmDMAReqPtr request)
 {
     drm_dma_t dma;
     int ret, i = 0;
@@ -1464,7 +1465,7 @@ int drmDMA(int fd, drmDMAReqPtr request)
  * This function translates the arguments into a drm_lock structure and issue
  * the DRM_IOCTL_LOCK ioctl until the lock is successfully acquired.
  */
-int drmGetLock(int fd, drm_context_t context, drmLockFlags flags)
+drm_public int drmGetLock(int fd, drm_context_t context, drmLockFlags flags)
 {
     drm_lock_t lock;
 
@@ -1495,7 +1496,7 @@ int drmGetLock(int fd, drm_context_t context, drmLockFlags flags)
  * This function is a wrapper around the DRM_IOCTL_UNLOCK ioctl, passing the
  * argument in a drm_lock structure.
  */
-int drmUnlock(int fd, drm_context_t context)
+drm_public int drmUnlock(int fd, drm_context_t context)
 {
     drm_lock_t lock;
 
@@ -1504,7 +1505,7 @@ int drmUnlock(int fd, drm_context_t context)
     return drmIoctl(fd, DRM_IOCTL_UNLOCK, &lock);
 }
 
-drm_context_t *drmGetReservedContextList(int fd, int *count)
+drm_public drm_context_t *drmGetReservedContextList(int fd, int *count)
 {
     drm_ctx_res_t res;
     drm_ctx_t     *list;
@@ -1541,7 +1542,7 @@ err_free_context:
     return NULL;
 }
 
-void drmFreeReservedContextList(drm_context_t *pt)
+drm_public void drmFreeReservedContextList(drm_context_t *pt)
 {
     drmFree(pt);
 }
@@ -1564,7 +1565,7 @@ void drmFreeReservedContextList(drm_context_t *pt)
  * This function is a wrapper around the DRM_IOCTL_ADD_CTX ioctl, passing the
  * argument in a drm_ctx structure.
  */
-int drmCreateContext(int fd, drm_context_t *handle)
+drm_public int drmCreateContext(int fd, drm_context_t *handle)
 {
     drm_ctx_t ctx;
 
@@ -1575,7 +1576,7 @@ int drmCreateContext(int fd, drm_context_t *handle)
     return 0;
 }
 
-int drmSwitchToContext(int fd, drm_context_t context)
+drm_public int drmSwitchToContext(int fd, drm_context_t context)
 {
     drm_ctx_t ctx;
 
@@ -1586,7 +1587,8 @@ int drmSwitchToContext(int fd, drm_context_t context)
     return 0;
 }
 
-int drmSetContextFlags(int fd, drm_context_t context, drm_context_tFlags flags)
+drm_public int drmSetContextFlags(int fd, drm_context_t context,
+                                  drm_context_tFlags flags)
 {
     drm_ctx_t ctx;
 
@@ -1607,8 +1609,8 @@ int drmSetContextFlags(int fd, drm_context_t context, drm_context_tFlags flags)
     return 0;
 }
 
-int drmGetContextFlags(int fd, drm_context_t context,
-                       drm_context_tFlagsPtr flags)
+drm_public int drmGetContextFlags(int fd, drm_context_t context,
+                                  drm_context_tFlagsPtr flags)
 {
     drm_ctx_t ctx;
 
@@ -1641,7 +1643,7 @@ int drmGetContextFlags(int fd, drm_context_t context,
  * This function is a wrapper around the DRM_IOCTL_RM_CTX ioctl, passing the
  * argument in a drm_ctx structure.
  */
-int drmDestroyContext(int fd, drm_context_t handle)
+drm_public int drmDestroyContext(int fd, drm_context_t handle)
 {
     drm_ctx_t ctx;
 
@@ -1652,7 +1654,7 @@ int drmDestroyContext(int fd, drm_context_t handle)
     return 0;
 }
 
-int drmCreateDrawable(int fd, drm_drawable_t *handle)
+drm_public int drmCreateDrawable(int fd, drm_drawable_t *handle)
 {
     drm_draw_t draw;
 
@@ -1663,7 +1665,7 @@ int drmCreateDrawable(int fd, drm_drawable_t *handle)
     return 0;
 }
 
-int drmDestroyDrawable(int fd, drm_drawable_t handle)
+drm_public int drmDestroyDrawable(int fd, drm_drawable_t handle)
 {
     drm_draw_t draw;
 
@@ -1674,9 +1676,9 @@ int drmDestroyDrawable(int fd, drm_drawable_t handle)
     return 0;
 }
 
-int drmUpdateDrawableInfo(int fd, drm_drawable_t handle,
-                          drm_drawable_info_type_t type, unsigned int num,
-                          void *data)
+drm_public int drmUpdateDrawableInfo(int fd, drm_drawable_t handle,
+                                     drm_drawable_info_type_t type,
+                                     unsigned int num, void *data)
 {
     drm_update_draw_t update;
 
@@ -1692,7 +1694,8 @@ int drmUpdateDrawableInfo(int fd, drm_drawable_t handle,
     return 0;
 }
 
-int drmCrtcGetSequence(int fd, uint32_t crtcId, uint64_t *sequence, uint64_t *ns)
+drm_public int drmCrtcGetSequence(int fd, uint32_t crtcId, uint64_t *sequence,
+                                  uint64_t *ns)
 {
     struct drm_crtc_get_sequence get_seq;
     int ret;
@@ -1710,8 +1713,10 @@ int drmCrtcGetSequence(int fd, uint32_t crtcId, uint64_t *sequence, uint64_t *ns
     return 0;
 }
 
-int drmCrtcQueueSequence(int fd, uint32_t crtcId, uint32_t flags, uint64_t sequence,
-                         uint64_t *sequence_queued, uint64_t user_data)
+drm_public int drmCrtcQueueSequence(int fd, uint32_t crtcId, uint32_t flags,
+                                    uint64_t sequence,
+                                    uint64_t *sequence_queued,
+                                    uint64_t user_data)
 {
     struct drm_crtc_queue_sequence queue_seq;
     int ret;
@@ -1741,7 +1746,7 @@ int drmCrtcQueueSequence(int fd, uint32_t crtcId, uint32_t flags, uint64_t seque
  * \internal
  * This function is a wrapper around the DRM_IOCTL_AGP_ACQUIRE ioctl.
  */
-int drmAgpAcquire(int fd)
+drm_public int drmAgpAcquire(int fd)
 {
     if (drmIoctl(fd, DRM_IOCTL_AGP_ACQUIRE, NULL))
         return -errno;
@@ -1759,7 +1764,7 @@ int drmAgpAcquire(int fd)
  * \internal
  * This function is a wrapper around the DRM_IOCTL_AGP_RELEASE ioctl.
  */
-int drmAgpRelease(int fd)
+drm_public int drmAgpRelease(int fd)
 {
     if (drmIoctl(fd, DRM_IOCTL_AGP_RELEASE, NULL))
         return -errno;
@@ -1779,7 +1784,7 @@ int drmAgpRelease(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_ENABLE ioctl, passing the
  * argument in a drm_agp_mode structure.
  */
-int drmAgpEnable(int fd, unsigned long mode)
+drm_public int drmAgpEnable(int fd, unsigned long mode)
 {
     drm_agp_mode_t m;
 
@@ -1807,8 +1812,8 @@ int drmAgpEnable(int fd, unsigned long mode)
  * This function is a wrapper around the DRM_IOCTL_AGP_ALLOC ioctl, passing the
  * arguments in a drm_agp_buffer structure.
  */
-int drmAgpAlloc(int fd, unsigned long size, unsigned long type,
-                unsigned long *address, drm_handle_t *handle)
+drm_public int drmAgpAlloc(int fd, unsigned long size, unsigned long type,
+                           unsigned long *address, drm_handle_t *handle)
 {
     drm_agp_buffer_t b;
 
@@ -1837,7 +1842,7 @@ int drmAgpAlloc(int fd, unsigned long size, unsigned long type,
  * This function is a wrapper around the DRM_IOCTL_AGP_FREE ioctl, passing the
  * argument in a drm_agp_buffer structure.
  */
-int drmAgpFree(int fd, drm_handle_t handle)
+drm_public int drmAgpFree(int fd, drm_handle_t handle)
 {
     drm_agp_buffer_t b;
 
@@ -1862,7 +1867,7 @@ int drmAgpFree(int fd, drm_handle_t handle)
  * This function is a wrapper around the DRM_IOCTL_AGP_BIND ioctl, passing the
  * argument in a drm_agp_binding structure.
  */
-int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset)
+drm_public int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset)
 {
     drm_agp_binding_t b;
 
@@ -1887,7 +1892,7 @@ int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset)
  * This function is a wrapper around the DRM_IOCTL_AGP_UNBIND ioctl, passing
  * the argument in a drm_agp_binding structure.
  */
-int drmAgpUnbind(int fd, drm_handle_t handle)
+drm_public int drmAgpUnbind(int fd, drm_handle_t handle)
 {
     drm_agp_binding_t b;
 
@@ -1910,7 +1915,7 @@ int drmAgpUnbind(int fd, drm_handle_t handle)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-int drmAgpVersionMajor(int fd)
+drm_public int drmAgpVersionMajor(int fd)
 {
     drm_agp_info_t i;
 
@@ -1933,7 +1938,7 @@ int drmAgpVersionMajor(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-int drmAgpVersionMinor(int fd)
+drm_public int drmAgpVersionMinor(int fd)
 {
     drm_agp_info_t i;
 
@@ -1956,7 +1961,7 @@ int drmAgpVersionMinor(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned long drmAgpGetMode(int fd)
+drm_public unsigned long drmAgpGetMode(int fd)
 {
     drm_agp_info_t i;
 
@@ -1979,7 +1984,7 @@ unsigned long drmAgpGetMode(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned long drmAgpBase(int fd)
+drm_public unsigned long drmAgpBase(int fd)
 {
     drm_agp_info_t i;
 
@@ -2002,7 +2007,7 @@ unsigned long drmAgpBase(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned long drmAgpSize(int fd)
+drm_public unsigned long drmAgpSize(int fd)
 {
     drm_agp_info_t i;
 
@@ -2025,7 +2030,7 @@ unsigned long drmAgpSize(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned long drmAgpMemoryUsed(int fd)
+drm_public unsigned long drmAgpMemoryUsed(int fd)
 {
     drm_agp_info_t i;
 
@@ -2048,7 +2053,7 @@ unsigned long drmAgpMemoryUsed(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned long drmAgpMemoryAvail(int fd)
+drm_public unsigned long drmAgpMemoryAvail(int fd)
 {
     drm_agp_info_t i;
 
@@ -2071,7 +2076,7 @@ unsigned long drmAgpMemoryAvail(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned int drmAgpVendorId(int fd)
+drm_public unsigned int drmAgpVendorId(int fd)
 {
     drm_agp_info_t i;
 
@@ -2094,7 +2099,7 @@ unsigned int drmAgpVendorId(int fd)
  * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
  * necessary information in a drm_agp_info structure.
  */
-unsigned int drmAgpDeviceId(int fd)
+drm_public unsigned int drmAgpDeviceId(int fd)
 {
     drm_agp_info_t i;
 
@@ -2105,7 +2110,8 @@ unsigned int drmAgpDeviceId(int fd)
     return i.id_device;
 }
 
-int drmScatterGatherAlloc(int fd, unsigned long size, drm_handle_t *handle)
+drm_public int drmScatterGatherAlloc(int fd, unsigned long size,
+                                     drm_handle_t *handle)
 {
     drm_scatter_gather_t sg;
 
@@ -2119,7 +2125,7 @@ int drmScatterGatherAlloc(int fd, unsigned long size, drm_handle_t *handle)
     return 0;
 }
 
-int drmScatterGatherFree(int fd, drm_handle_t handle)
+drm_public int drmScatterGatherFree(int fd, drm_handle_t handle)
 {
     drm_scatter_gather_t sg;
 
@@ -2141,7 +2147,7 @@ int drmScatterGatherFree(int fd, drm_handle_t handle)
  * \internal
  * This function is a wrapper around the DRM_IOCTL_WAIT_VBLANK ioctl.
  */
-int drmWaitVBlank(int fd, drmVBlankPtr vbl)
+drm_public int drmWaitVBlank(int fd, drmVBlankPtr vbl)
 {
     struct timespec timeout, cur;
     int ret;
@@ -2173,7 +2179,7 @@ out:
     return ret;
 }
 
-int drmError(int err, const char *label)
+drm_public int drmError(int err, const char *label)
 {
     switch (err) {
     case DRM_ERR_NO_DEVICE:
@@ -2210,7 +2216,7 @@ int drmError(int err, const char *label)
  * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the
  * argument in a drm_control structure.
  */
-int drmCtlInstHandler(int fd, int irq)
+drm_public int drmCtlInstHandler(int fd, int irq)
 {
     drm_control_t ctl;
 
@@ -2234,7 +2240,7 @@ int drmCtlInstHandler(int fd, int irq)
  * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the
  * argument in a drm_control structure.
  */
-int drmCtlUninstHandler(int fd)
+drm_public int drmCtlUninstHandler(int fd)
 {
     drm_control_t ctl;
 
@@ -2246,7 +2252,7 @@ int drmCtlUninstHandler(int fd)
     return 0;
 }
 
-int drmFinish(int fd, int context, drmLockFlags flags)
+drm_public int drmFinish(int fd, int context, drmLockFlags flags)
 {
     drm_lock_t lock;
 
@@ -2277,7 +2283,8 @@ int drmFinish(int fd, int context, drmLockFlags flags)
  * This function is a wrapper around the DRM_IOCTL_IRQ_BUSID ioctl, passing the
  * arguments in a drm_irq_busid structure.
  */
-int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum)
+drm_public int drmGetInterruptFromBusID(int fd, int busnum, int devnum,
+                                        int funcnum)
 {
     drm_irq_busid_t p;
 
@@ -2290,7 +2297,7 @@ int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum)
     return p.irq;
 }
 
-int drmAddContextTag(int fd, drm_context_t context, void *tag)
+drm_public int drmAddContextTag(int fd, drm_context_t context, void *tag)
 {
     drmHashEntry  *entry = drmGetEntry(fd);
 
@@ -2301,14 +2308,14 @@ int drmAddContextTag(int fd, drm_context_t context, void *tag)
     return 0;
 }
 
-int drmDelContextTag(int fd, drm_context_t context)
+drm_public int drmDelContextTag(int fd, drm_context_t context)
 {
     drmHashEntry  *entry = drmGetEntry(fd);
 
     return drmHashDelete(entry->tagTable, context);
 }
 
-void *drmGetContextTag(int fd, drm_context_t context)
+drm_public void *drmGetContextTag(int fd, drm_context_t context)
 {
     drmHashEntry  *entry = drmGetEntry(fd);
     void          *value;
@@ -2319,8 +2326,8 @@ void *drmGetContextTag(int fd, drm_context_t context)
     return value;
 }
 
-int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id,
-                                drm_handle_t handle)
+drm_public int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id,
+                                           drm_handle_t handle)
 {
     drm_ctx_priv_map_t map;
 
@@ -2333,8 +2340,8 @@ int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id,
     return 0;
 }
 
-int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
-                                drm_handle_t *handle)
+drm_public int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
+                                           drm_handle_t *handle)
 {
     drm_ctx_priv_map_t map;
 
@@ -2349,9 +2356,9 @@ int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
     return 0;
 }
 
-int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size,
-              drmMapType *type, drmMapFlags *flags, drm_handle_t *handle,
-              int *mtrr)
+drm_public int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size,
+                         drmMapType *type, drmMapFlags *flags,
+                         drm_handle_t *handle, int *mtrr)
 {
     drm_map_t map;
 
@@ -2368,8 +2375,8 @@ int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size,
     return 0;
 }
 
-int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
-                 unsigned long *magic, unsigned long *iocs)
+drm_public int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
+                            unsigned long *magic, unsigned long *iocs)
 {
     drm_client_t client;
 
@@ -2385,7 +2392,7 @@ int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
     return 0;
 }
 
-int drmGetStats(int fd, drmStatsT *stats)
+drm_public int drmGetStats(int fd, drmStatsT *stats)
 {
     drm_stats_t s;
     unsigned    i;
@@ -2523,7 +2530,7 @@ int drmGetStats(int fd, drmStatsT *stats)
  * It issues a read-write ioctl given by
  * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
  */
-int drmSetInterfaceVersion(int fd, drmSetVersion *version)
+drm_public int drmSetInterfaceVersion(int fd, drmSetVersion *version)
 {
     int retcode = 0;
     drm_set_version_t sv;
@@ -2558,7 +2565,7 @@ int drmSetInterfaceVersion(int fd, drmSetVersion *version)
  * It issues a ioctl given by
  * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
  */
-int drmCommandNone(int fd, unsigned long drmCommandIndex)
+drm_public int drmCommandNone(int fd, unsigned long drmCommandIndex)
 {
     unsigned long request;
 
@@ -2585,8 +2592,8 @@ int drmCommandNone(int fd, unsigned long drmCommandIndex)
  * It issues a read ioctl given by
  * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
  */
-int drmCommandRead(int fd, unsigned long drmCommandIndex, void *data,
-                   unsigned long size)
+drm_public int drmCommandRead(int fd, unsigned long drmCommandIndex,
+                              void *data, unsigned long size)
 {
     unsigned long request;
 
@@ -2614,8 +2621,8 @@ int drmCommandRead(int fd, unsigned long drmCommandIndex, void *data,
  * It issues a write ioctl given by
  * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
  */
-int drmCommandWrite(int fd, unsigned long drmCommandIndex, void *data,
-                    unsigned long size)
+drm_public int drmCommandWrite(int fd, unsigned long drmCommandIndex,
+                               void *data, unsigned long size)
 {
     unsigned long request;
 
@@ -2643,8 +2650,8 @@ int drmCommandWrite(int fd, unsigned long drmCommandIndex, void *data,
  * It issues a read-write ioctl given by
  * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
  */
-int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data,
-                        unsigned long size)
+drm_public int drmCommandWriteRead(int fd, unsigned long drmCommandIndex,
+                                   void *data, unsigned long size)
 {
     unsigned long request;
 
@@ -2666,14 +2673,13 @@ static struct {
 
 static int nr_fds = 0;
 
-int drmOpenOnce(void *unused,
-                const char *BusID,
-                int *newlyopened)
+drm_public int drmOpenOnce(void *unused, const char *BusID, int *newlyopened)
 {
     return drmOpenOnceWithType(BusID, newlyopened, DRM_NODE_PRIMARY);
 }
 
-int drmOpenOnceWithType(const char *BusID, int *newlyopened, int type)
+drm_public int drmOpenOnceWithType(const char *BusID, int *newlyopened,
+                                   int type)
 {
     int i;
     int fd;
@@ -2706,7 +2712,7 @@ int drmOpenOnceWithType(const char *BusID, int *newlyopened, int type)
     return fd;
 }
 
-void drmCloseOnce(int fd)
+drm_public void drmCloseOnce(int fd)
 {
     int i;
 
@@ -2725,17 +2731,17 @@ void drmCloseOnce(int fd)
     }
 }
 
-int drmSetMaster(int fd)
+drm_public int drmSetMaster(int fd)
 {
         return drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL);
 }
 
-int drmDropMaster(int fd)
+drm_public int drmDropMaster(int fd)
 {
         return drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL);
 }
 
-char *drmGetDeviceNameFromFd(int fd)
+drm_public char *drmGetDeviceNameFromFd(int fd)
 {
     char name[128];
     struct stat sbuf;
@@ -2761,7 +2767,7 @@ char *drmGetDeviceNameFromFd(int fd)
     return strdup(name);
 }
 
-int drmGetNodeTypeFromFd(int fd)
+drm_public int drmGetNodeTypeFromFd(int fd)
 {
     struct stat sbuf;
     int maj, min, type;
@@ -2783,7 +2789,8 @@ int drmGetNodeTypeFromFd(int fd)
     return type;
 }
 
-int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd)
+drm_public int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags,
+                                  int *prime_fd)
 {
     struct drm_prime_handle args;
     int ret;
@@ -2800,7 +2807,7 @@ int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd)
     return 0;
 }
 
-int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
+drm_public int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
 {
     struct drm_prime_handle args;
     int ret;
@@ -2900,12 +2907,12 @@ static char *drmGetMinorNameForFD(int fd, int type)
 #endif
 }
 
-char *drmGetPrimaryDeviceNameFromFd(int fd)
+drm_public char *drmGetPrimaryDeviceNameFromFd(int fd)
 {
     return drmGetMinorNameForFD(fd, DRM_NODE_PRIMARY);
 }
 
-char *drmGetRenderDeviceNameFromFd(int fd)
+drm_public char *drmGetRenderDeviceNameFromFd(int fd)
 {
     return drmGetMinorNameForFD(fd, DRM_NODE_RENDER);
 }
@@ -3069,7 +3076,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
 #endif
 }
 
-int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b)
+drm_public int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b)
 {
     if (a == NULL || b == NULL)
         return 0;
@@ -3269,7 +3276,7 @@ static void drmFreeHost1xDevice(drmDevicePtr device)
     }
 }
 
-void drmFreeDevice(drmDevicePtr *device)
+drm_public void drmFreeDevice(drmDevicePtr *device)
 {
     if (device == NULL)
         return;
@@ -3290,7 +3297,7 @@ void drmFreeDevice(drmDevicePtr *device)
     *device = NULL;
 }
 
-void drmFreeDevices(drmDevicePtr devices[], int count)
+drm_public void drmFreeDevices(drmDevicePtr devices[], int count)
 {
     int i;
 
@@ -3812,7 +3819,7 @@ drm_device_has_rdev(drmDevicePtr device, dev_t find_rdev)
  * \note Unlike drmGetDevice it does not retrieve the pci device revision field
  * unless the DRM_DEVICE_GET_PCI_REVISION \p flag is set.
  */
-int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
+drm_public int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
 {
 #ifdef __OpenBSD__
     /*
@@ -3960,7 +3967,7 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
  *
  * \return zero on success, negative error code otherwise.
  */
-int drmGetDevice(int fd, drmDevicePtr *device)
+drm_public int drmGetDevice(int fd, drmDevicePtr *device)
 {
     return drmGetDevice2(fd, DRM_DEVICE_GET_PCI_REVISION, device);
 }
@@ -3981,7 +3988,8 @@ int drmGetDevice(int fd, drmDevicePtr *device)
  * \note Unlike drmGetDevices it does not retrieve the pci device revision field
  * unless the DRM_DEVICE_GET_PCI_REVISION \p flag is set.
  */
-int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
+drm_public int drmGetDevices2(uint32_t flags, drmDevicePtr devices[],
+                              int max_devices)
 {
     drmDevicePtr local_devices[MAX_DRM_NODES];
     drmDevicePtr device;
@@ -4044,12 +4052,12 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
  *         alternatively the number of devices stored in devices[], which is
  *         capped by the max_devices.
  */
-int drmGetDevices(drmDevicePtr devices[], int max_devices)
+drm_public int drmGetDevices(drmDevicePtr devices[], int max_devices)
 {
     return drmGetDevices2(DRM_DEVICE_GET_PCI_REVISION, devices, max_devices);
 }
 
-char *drmGetDeviceNameFromFd2(int fd)
+drm_public char *drmGetDeviceNameFromFd2(int fd)
 {
 #ifdef __linux__
     struct stat sbuf;
@@ -4121,7 +4129,7 @@ char *drmGetDeviceNameFromFd2(int fd)
 #endif
 }
 
-int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle)
+drm_public int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle)
 {
     struct drm_syncobj_create args;
     int ret;
@@ -4136,7 +4144,7 @@ int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle)
     return 0;
 }
 
-int drmSyncobjDestroy(int fd, uint32_t handle)
+drm_public int drmSyncobjDestroy(int fd, uint32_t handle)
 {
     struct drm_syncobj_destroy args;
 
@@ -4145,7 +4153,7 @@ int drmSyncobjDestroy(int fd, uint32_t handle)
     return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_DESTROY, &args);
 }
 
-int drmSyncobjHandleToFD(int fd, uint32_t handle, int *obj_fd)
+drm_public int drmSyncobjHandleToFD(int fd, uint32_t handle, int *obj_fd)
 {
     struct drm_syncobj_handle args;
     int ret;
@@ -4160,7 +4168,7 @@ int drmSyncobjHandleToFD(int fd, uint32_t handle, int *obj_fd)
     return 0;
 }
 
-int drmSyncobjFDToHandle(int fd, int obj_fd, uint32_t *handle)
+drm_public int drmSyncobjFDToHandle(int fd, int obj_fd, uint32_t *handle)
 {
     struct drm_syncobj_handle args;
     int ret;
@@ -4175,7 +4183,8 @@ int drmSyncobjFDToHandle(int fd, int obj_fd, uint32_t *handle)
     return 0;
 }
 
-int drmSyncobjImportSyncFile(int fd, uint32_t handle, int sync_file_fd)
+drm_public int drmSyncobjImportSyncFile(int fd, uint32_t handle,
+                                        int sync_file_fd)
 {
     struct drm_syncobj_handle args;
 
@@ -4186,7 +4195,8 @@ int drmSyncobjImportSyncFile(int fd, uint32_t handle, int sync_file_fd)
     return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args);
 }
 
-int drmSyncobjExportSyncFile(int fd, uint32_t handle, int *sync_file_fd)
+drm_public int drmSyncobjExportSyncFile(int fd, uint32_t handle,
+                                        int *sync_file_fd)
 {
     struct drm_syncobj_handle args;
     int ret;
@@ -4202,9 +4212,9 @@ int drmSyncobjExportSyncFile(int fd, uint32_t handle, int *sync_file_fd)
     return 0;
 }
 
-int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
-                   int64_t timeout_nsec, unsigned flags,
-                   uint32_t *first_signaled)
+drm_public int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
+                              int64_t timeout_nsec, unsigned flags,
+                              uint32_t *first_signaled)
 {
     struct drm_syncobj_wait args;
     int ret;
@@ -4224,7 +4234,8 @@ int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
     return ret;
 }
 
-int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count)
+drm_public int drmSyncobjReset(int fd, const uint32_t *handles,
+                               uint32_t handle_count)
 {
     struct drm_syncobj_array args;
     int ret;
@@ -4237,7 +4248,8 @@ int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count)
     return ret;
 }
 
-int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count)
+drm_public int drmSyncobjSignal(int fd, const uint32_t *handles,
+                                uint32_t handle_count)
 {
     struct drm_syncobj_array args;
     int ret;
diff --git a/xf86drmHash.c b/xf86drmHash.c
index b2fa414e..467498cc 100644
--- a/xf86drmHash.c
+++ b/xf86drmHash.c
@@ -71,6 +71,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "libdrm_macros.h"
 #include "xf86drm.h"
 #include "xf86drmHash.h"
 
@@ -101,7 +102,7 @@ static unsigned long HashHash(unsigned long key)
     return hash;
 }
 
-void *drmHashCreate(void)
+drm_public void *drmHashCreate(void)
 {
     HashTablePtr table;
     int          i;
@@ -118,7 +119,7 @@ void *drmHashCreate(void)
     return table;
 }
 
-int drmHashDestroy(void *t)
+drm_public int drmHashDestroy(void *t)
 {
     HashTablePtr  table = (HashTablePtr)t;
     HashBucketPtr bucket;
@@ -169,7 +170,7 @@ static HashBucketPtr HashFind(HashTablePtr table,
     return NULL;
 }
 
-int drmHashLookup(void *t, unsigned long key, void **value)
+drm_public int drmHashLookup(void *t, unsigned long key, void **value)
 {
     HashTablePtr  table = (HashTablePtr)t;
     HashBucketPtr bucket;
@@ -182,7 +183,7 @@ int drmHashLookup(void *t, unsigned long key, void **value)
     return 0;			/* Found */
 }
 
-int drmHashInsert(void *t, unsigned long key, void *value)
+drm_public int drmHashInsert(void *t, unsigned long key, void *value)
 {
     HashTablePtr  table = (HashTablePtr)t;
     HashBucketPtr bucket;
@@ -201,7 +202,7 @@ int drmHashInsert(void *t, unsigned long key, void *value)
     return 0;			/* Added to table */
 }
 
-int drmHashDelete(void *t, unsigned long key)
+drm_public int drmHashDelete(void *t, unsigned long key)
 {
     HashTablePtr  table = (HashTablePtr)t;
     unsigned long hash;
@@ -218,7 +219,7 @@ int drmHashDelete(void *t, unsigned long key)
     return 0;
 }
 
-int drmHashNext(void *t, unsigned long *key, void **value)
+drm_public int drmHashNext(void *t, unsigned long *key, void **value)
 {
     HashTablePtr  table = (HashTablePtr)t;
 
@@ -235,7 +236,7 @@ int drmHashNext(void *t, unsigned long *key, void **value)
     return 0;
 }
 
-int drmHashFirst(void *t, unsigned long *key, void **value)
+drm_public int drmHashFirst(void *t, unsigned long *key, void **value)
 {
     HashTablePtr  table = (HashTablePtr)t;
 
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 9a15b5e7..8f8633ed 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -48,6 +48,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 
+#include "libdrm_macros.h"
 #include "xf86drmMode.h"
 #include "xf86drm.h"
 #include <drm.h>
@@ -92,7 +93,7 @@ static void* drmAllocCpy(char *array, int count, int entry_size)
  * A couple of free functions.
  */
 
-void drmModeFreeModeInfo(drmModeModeInfoPtr ptr)
+drm_public void drmModeFreeModeInfo(drmModeModeInfoPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -100,7 +101,7 @@ void drmModeFreeModeInfo(drmModeModeInfoPtr ptr)
 	drmFree(ptr);
 }
 
-void drmModeFreeResources(drmModeResPtr ptr)
+drm_public void drmModeFreeResources(drmModeResPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -112,7 +113,7 @@ void drmModeFreeResources(drmModeResPtr ptr)
 	drmFree(ptr);
 }
 
-void drmModeFreeFB(drmModeFBPtr ptr)
+drm_public void drmModeFreeFB(drmModeFBPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -121,7 +122,7 @@ void drmModeFreeFB(drmModeFBPtr ptr)
 	drmFree(ptr);
 }
 
-void drmModeFreeCrtc(drmModeCrtcPtr ptr)
+drm_public void drmModeFreeCrtc(drmModeCrtcPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -129,7 +130,7 @@ void drmModeFreeCrtc(drmModeCrtcPtr ptr)
 	drmFree(ptr);
 }
 
-void drmModeFreeConnector(drmModeConnectorPtr ptr)
+drm_public void drmModeFreeConnector(drmModeConnectorPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -141,7 +142,7 @@ void drmModeFreeConnector(drmModeConnectorPtr ptr)
 	drmFree(ptr);
 }
 
-void drmModeFreeEncoder(drmModeEncoderPtr ptr)
+drm_public void drmModeFreeEncoder(drmModeEncoderPtr ptr)
 {
 	drmFree(ptr);
 }
@@ -150,7 +151,7 @@ void drmModeFreeEncoder(drmModeEncoderPtr ptr)
  * ModeSetting functions.
  */
 
-drmModeResPtr drmModeGetResources(int fd)
+drm_public drmModeResPtr drmModeGetResources(int fd)
 {
 	struct drm_mode_card_res res, counts;
 	drmModeResPtr r = 0;
@@ -244,9 +245,10 @@ err_allocs:
 	return r;
 }
 
-int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
-		 uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
-		 uint32_t *buf_id)
+
+drm_public int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
+                            uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
+                            uint32_t *buf_id)
 {
 	struct drm_mode_fb_cmd f;
 	int ret;
@@ -266,10 +268,10 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
 	return 0;
 }
 
-int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
-                               uint32_t pixel_format, const uint32_t bo_handles[4],
-                               const uint32_t pitches[4], const uint32_t offsets[4],
-                               const uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
+drm_public int drmModeAddFB2WithModifiers(int fd, uint32_t width,
+		uint32_t height, uint32_t pixel_format, const uint32_t bo_handles[4],
+		const uint32_t pitches[4], const uint32_t offsets[4],
+		const uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
 {
 	struct drm_mode_fb_cmd2 f;
 	int ret;
@@ -292,10 +294,10 @@ int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
 	return 0;
 }
 
-int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
-                  uint32_t pixel_format, const uint32_t bo_handles[4],
-                  const uint32_t pitches[4], const uint32_t offsets[4],
-                  uint32_t *buf_id, uint32_t flags)
+drm_public int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
+		uint32_t pixel_format, const uint32_t bo_handles[4],
+		const uint32_t pitches[4], const uint32_t offsets[4],
+		uint32_t *buf_id, uint32_t flags)
 {
 	return drmModeAddFB2WithModifiers(fd, width, height,
 					  pixel_format, bo_handles,
@@ -303,12 +305,12 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
 					  buf_id, flags);
 }
 
-int drmModeRmFB(int fd, uint32_t bufferId)
+drm_public int drmModeRmFB(int fd, uint32_t bufferId)
 {
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId);
 }
 
-drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
+drm_public drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
 {
 	struct drm_mode_fb_cmd info;
 	drmModeFBPtr r;
@@ -333,7 +335,7 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
 	return r;
 }
 
-int drmModeDirtyFB(int fd, uint32_t bufferId,
+drm_public int drmModeDirtyFB(int fd, uint32_t bufferId,
 		   drmModeClipPtr clips, uint32_t num_clips)
 {
 	struct drm_mode_fb_dirty_cmd dirty;
@@ -350,7 +352,7 @@ int drmModeDirtyFB(int fd, uint32_t bufferId,
  * Crtc functions
  */
 
-drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
+drm_public drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
 {
 	struct drm_mode_crtc crtc;
 	drmModeCrtcPtr r;
@@ -382,7 +384,7 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
 	return r;
 }
 
-int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
+drm_public int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
 		   uint32_t x, uint32_t y, uint32_t *connectors, int count,
 		   drmModeModeInfoPtr mode)
 {
@@ -407,7 +409,8 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
  * Cursor manipulation
  */
 
-int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height)
+drm_public int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle,
+								uint32_t width, uint32_t height)
 {
 	struct drm_mode_cursor arg;
 
@@ -421,7 +424,9 @@ int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_CURSOR, &arg);
 }
 
-int drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height, int32_t hot_x, int32_t hot_y)
+drm_public int drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle,
+								 uint32_t width, uint32_t height, int32_t hot_x,
+								 int32_t hot_y)
 {
 	struct drm_mode_cursor2 arg;
 
@@ -437,7 +442,7 @@ int drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t widt
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_CURSOR2, &arg);
 }
 
-int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y)
+drm_public int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y)
 {
 	struct drm_mode_cursor arg;
 
@@ -453,7 +458,7 @@ int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y)
 /*
  * Encoder get
  */
-drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
+drm_public drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
 {
 	struct drm_mode_get_encoder enc;
 	drmModeEncoderPtr r = NULL;
@@ -585,17 +590,17 @@ err_allocs:
 	return r;
 }
 
-drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
+drm_public drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
 {
 	return _drmModeGetConnector(fd, connector_id, 1);
 }
 
-drmModeConnectorPtr drmModeGetConnectorCurrent(int fd, uint32_t connector_id)
+drm_public drmModeConnectorPtr drmModeGetConnectorCurrent(int fd, uint32_t connector_id)
 {
 	return _drmModeGetConnector(fd, connector_id, 0);
 }
 
-int drmModeAttachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_info)
+drm_public int drmModeAttachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_info)
 {
 	struct drm_mode_mode_cmd res;
 
@@ -606,7 +611,7 @@ int drmModeAttachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_inf
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_ATTACHMODE, &res);
 }
 
-int drmModeDetachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_info)
+drm_public int drmModeDetachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_info)
 {
 	struct drm_mode_mode_cmd res;
 
@@ -617,7 +622,7 @@ int drmModeDetachMode(int fd, uint32_t connector_id, drmModeModeInfoPtr mode_inf
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_DETACHMODE, &res);
 }
 
-drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
+drm_public drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
 {
 	struct drm_mode_get_property prop;
 	drmModePropertyPtr r;
@@ -671,7 +676,7 @@ err_allocs:
 	return r;
 }
 
-void drmModeFreeProperty(drmModePropertyPtr ptr)
+drm_public void drmModeFreeProperty(drmModePropertyPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -681,7 +686,8 @@ void drmModeFreeProperty(drmModePropertyPtr ptr)
 	drmFree(ptr);
 }
 
-drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id)
+drm_public drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd,
+														 uint32_t blob_id)
 {
 	struct drm_mode_get_blob blob;
 	drmModePropertyBlobPtr r;
@@ -712,7 +718,7 @@ err_allocs:
 	return r;
 }
 
-void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
+drm_public void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -721,8 +727,9 @@ void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
 	drmFree(ptr);
 }
 
-int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id,
-			     uint64_t value)
+drm_public int drmModeConnectorSetProperty(int fd, uint32_t connector_id,
+										   uint32_t property_id,
+										   uint64_t value)
 {
 	struct drm_mode_connector_set_property osp;
 
@@ -740,7 +747,7 @@ int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property
  *  -EINVAL or invalid bus id
  *  -ENOSYS if no modesetting support
 */
-int drmCheckModesettingSupported(const char *busid)
+drm_public int drmCheckModesettingSupported(const char *busid)
 {
 #if defined (__linux__)
 	char pci_dev_dir[1024];
@@ -848,8 +855,9 @@ int drmCheckModesettingSupported(const char *busid)
 	return -ENOSYS;
 }
 
-int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
-			uint16_t *red, uint16_t *green, uint16_t *blue)
+drm_public int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
+								   uint16_t *red, uint16_t *green,
+								   uint16_t *blue)
 {
 	struct drm_mode_crtc_lut l;
 
@@ -863,8 +871,9 @@ int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_GETGAMMA, &l);
 }
 
-int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
-			uint16_t *red, uint16_t *green, uint16_t *blue)
+drm_public int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
+								   uint16_t *red, uint16_t *green,
+								   uint16_t *blue)
 {
 	struct drm_mode_crtc_lut l;
 
@@ -878,7 +887,7 @@ int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_SETGAMMA, &l);
 }
 
-int drmHandleEvent(int fd, drmEventContextPtr evctx)
+drm_public int drmHandleEvent(int fd, drmEventContextPtr evctx)
 {
 	char buffer[1024];
 	int len, i;
@@ -946,7 +955,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 	return 0;
 }
 
-int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
+drm_public int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
 		    uint32_t flags, void *user_data)
 {
 	struct drm_mode_crtc_page_flip flip;
@@ -960,7 +969,7 @@ int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip);
 }
 
-int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
+drm_public int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
 			  uint32_t flags, void *user_data,
 			  uint32_t target_vblank)
 {
@@ -976,7 +985,7 @@ int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip_target);
 }
 
-int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
+drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
 		    uint32_t fb_id, uint32_t flags,
 		    int32_t crtc_x, int32_t crtc_y,
 		    uint32_t crtc_w, uint32_t crtc_h,
@@ -1002,7 +1011,7 @@ int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_SETPLANE, &s);
 }
 
-drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
+drm_public drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
 {
 	struct drm_mode_get_plane ovr, counts;
 	drmModePlanePtr r = 0;
@@ -1053,7 +1062,7 @@ err_allocs:
 	return r;
 }
 
-void drmModeFreePlane(drmModePlanePtr ptr)
+drm_public void drmModeFreePlane(drmModePlanePtr ptr)
 {
 	if (!ptr)
 		return;
@@ -1062,7 +1071,7 @@ void drmModeFreePlane(drmModePlanePtr ptr)
 	drmFree(ptr);
 }
 
-drmModePlaneResPtr drmModeGetPlaneResources(int fd)
+drm_public drmModePlaneResPtr drmModeGetPlaneResources(int fd)
 {
 	struct drm_mode_get_plane_res res, counts;
 	drmModePlaneResPtr r = 0;
@@ -1107,7 +1116,7 @@ err_allocs:
 	return r;
 }
 
-void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
+drm_public void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -1116,7 +1125,7 @@ void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
 	drmFree(ptr);
 }
 
-drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
+drm_public drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
 						      uint32_t object_id,
 						      uint32_t object_type)
 {
@@ -1177,7 +1186,7 @@ err_allocs:
 	return ret;
 }
 
-void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr)
+drm_public void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr)
 {
 	if (!ptr)
 		return;
@@ -1186,7 +1195,7 @@ void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr)
 	drmFree(ptr);
 }
 
-int drmModeObjectSetProperty(int fd, uint32_t object_id, uint32_t object_type,
+drm_public int drmModeObjectSetProperty(int fd, uint32_t object_id, uint32_t object_type,
 			     uint32_t property_id, uint64_t value)
 {
 	struct drm_mode_obj_set_property prop;
@@ -1214,7 +1223,7 @@ struct _drmModeAtomicReq {
 	drmModeAtomicReqItemPtr items;
 };
 
-drmModeAtomicReqPtr drmModeAtomicAlloc(void)
+drm_public drmModeAtomicReqPtr drmModeAtomicAlloc(void)
 {
 	drmModeAtomicReqPtr req;
 
@@ -1229,7 +1238,7 @@ drmModeAtomicReqPtr drmModeAtomicAlloc(void)
 	return req;
 }
 
-drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
+drm_public drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
 {
 	drmModeAtomicReqPtr new;
 
@@ -1258,7 +1267,8 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
 	return new;
 }
 
-int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment)
+drm_public int drmModeAtomicMerge(drmModeAtomicReqPtr base,
+                                  drmModeAtomicReqPtr augment)
 {
 	if (!base)
 		return -EINVAL;
@@ -1287,23 +1297,23 @@ int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment)
 	return 0;
 }
 
-int drmModeAtomicGetCursor(drmModeAtomicReqPtr req)
+drm_public int drmModeAtomicGetCursor(drmModeAtomicReqPtr req)
 {
 	if (!req)
 		return -EINVAL;
 	return req->cursor;
 }
 
-void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor)
+drm_public void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor)
 {
 	if (req)
 		req->cursor = cursor;
 }
 
-int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
-			     uint32_t object_id,
-			     uint32_t property_id,
-			     uint64_t value)
+drm_public int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
+                                        uint32_t object_id,
+                                        uint32_t property_id,
+                                        uint64_t value)
 {
 	if (!req)
 		return -EINVAL;
@@ -1331,7 +1341,7 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
 	return req->cursor;
 }
 
-void drmModeAtomicFree(drmModeAtomicReqPtr req)
+drm_public void drmModeAtomicFree(drmModeAtomicReqPtr req)
 {
 	if (!req)
 		return;
@@ -1354,8 +1364,8 @@ static int sort_req_list(const void *misc, const void *other)
 		return second->property_id - first->property_id;
 }
 
-int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags,
-			void *user_data)
+drm_public int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
+                                   uint32_t flags, void *user_data)
 {
 	drmModeAtomicReqPtr sorted;
 	struct drm_mode_atomic atomic;
@@ -1459,8 +1469,9 @@ out:
 	return ret;
 }
 
-int
-drmModeCreatePropertyBlob(int fd, const void *data, size_t length, uint32_t *id)
+drm_public int
+drmModeCreatePropertyBlob(int fd, const void *data, size_t length,
+                                     uint32_t *id)
 {
 	struct drm_mode_create_blob create;
 	int ret;
@@ -1483,7 +1494,7 @@ drmModeCreatePropertyBlob(int fd, const void *data, size_t length, uint32_t *id)
 	return 0;
 }
 
-int
+drm_public int
 drmModeDestroyPropertyBlob(int fd, uint32_t id)
 {
 	struct drm_mode_destroy_blob destroy;
@@ -1493,8 +1504,9 @@ drmModeDestroyPropertyBlob(int fd, uint32_t id)
 	return DRM_IOCTL(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy);
 }
 
-int
-drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags, uint32_t *lessee_id)
+drm_public int
+drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags,
+                   uint32_t *lessee_id)
 {
 	struct drm_mode_create_lease create;
 	int ret;
@@ -1512,7 +1524,7 @@ drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags,
 	return -errno;
 }
 
-drmModeLesseeListPtr
+drm_public drmModeLesseeListPtr
 drmModeListLessees(int fd)
 {
 	struct drm_mode_list_lessees list;
@@ -1539,7 +1551,7 @@ drmModeListLessees(int fd)
 	return ret;
 }
 
-drmModeObjectListPtr
+drm_public drmModeObjectListPtr
 drmModeGetLease(int fd)
 {
 	struct drm_mode_get_lease get;
@@ -1566,7 +1578,7 @@ drmModeGetLease(int fd)
 	return ret;
 }
 
-int
+drm_public int
 drmModeRevokeLease(int fd, uint32_t lessee_id)
 {
 	struct drm_mode_revoke_lease revoke;
diff --git a/xf86drmRandom.c b/xf86drmRandom.c
index 81f03014..51e9676f 100644
--- a/xf86drmRandom.c
+++ b/xf86drmRandom.c
@@ -74,12 +74,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "libdrm_macros.h"
 #include "xf86drm.h"
 #include "xf86drmRandom.h"
 
 #define RANDOM_MAGIC 0xfeedbeef
 
-void *drmRandomCreate(unsigned long seed)
+drm_public void *drmRandomCreate(unsigned long seed)
 {
     RandomState  *state;
 
@@ -109,13 +110,13 @@ void *drmRandomCreate(unsigned long seed)
     return state;
 }
 
-int drmRandomDestroy(void *state)
+drm_public int drmRandomDestroy(void *state)
 {
     drmFree(state);
     return 0;
 }
 
-unsigned long drmRandom(void *state)
+drm_public unsigned long drmRandom(void *state)
 {
     RandomState   *s = (RandomState *)state;
     unsigned long hi;
@@ -129,7 +130,7 @@ unsigned long drmRandom(void *state)
     return s->seed;
 }
 
-double drmRandomDouble(void *state)
+drm_public double drmRandomDouble(void *state)
 {
     RandomState *s = (RandomState *)state;
     
diff --git a/xf86drmSL.c b/xf86drmSL.c
index a12fa1d0..3826df97 100644
--- a/xf86drmSL.c
+++ b/xf86drmSL.c
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "libdrm_macros.h"
 #include "xf86drm.h"
 
 #define SL_LIST_MAGIC  0xfacade00LU
@@ -97,7 +98,7 @@ static int SLRandomLevel(void)
     return level;
 }
 
-void *drmSLCreate(void)
+drm_public void *drmSLCreate(void)
 {
     SkipListPtr  list;
     int          i;
@@ -114,7 +115,7 @@ void *drmSLCreate(void)
     return list;
 }
 
-int drmSLDestroy(void *l)
+drm_public int drmSLDestroy(void *l)
 {
     SkipListPtr   list  = (SkipListPtr)l;
     SLEntryPtr    entry;
@@ -151,7 +152,7 @@ static SLEntryPtr SLLocate(void *l, unsigned long key, SLEntryPtr *update)
     return entry->forward[0];
 }
 
-int drmSLInsert(void *l, unsigned long key, void *value)
+drm_public int drmSLInsert(void *l, unsigned long key, void *value)
 {
     SkipListPtr   list  = (SkipListPtr)l;
     SLEntryPtr    entry;
@@ -184,7 +185,7 @@ int drmSLInsert(void *l, unsigned long key, void *value)
     return 0;			/* Added to table */
 }
 
-int drmSLDelete(void *l, unsigned long key)
+drm_public int drmSLDelete(void *l, unsigned long key)
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    update[SL_MAX_LEVEL + 1];
@@ -211,7 +212,7 @@ int drmSLDelete(void *l, unsigned long key)
     return 0;
 }
 
-int drmSLLookup(void *l, unsigned long key, void **value)
+drm_public int drmSLLookup(void *l, unsigned long key, void **value)
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    update[SL_MAX_LEVEL + 1];
@@ -227,9 +228,9 @@ int drmSLLookup(void *l, unsigned long key, void **value)
     return -1;
 }
 
-int drmSLLookupNeighbors(void *l, unsigned long key,
-			 unsigned long *prev_key, void **prev_value,
-			 unsigned long *next_key, void **next_value)
+drm_public int drmSLLookupNeighbors(void *l, unsigned long key,
+                                    unsigned long *prev_key, void **prev_value,
+                                    unsigned long *next_key, void **next_value)
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    update[SL_MAX_LEVEL + 1] = {0};
@@ -253,7 +254,7 @@ int drmSLLookupNeighbors(void *l, unsigned long key,
     return retcode;
 }
 
-int drmSLNext(void *l, unsigned long *key, void **value)
+drm_public int drmSLNext(void *l, unsigned long *key, void **value)
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    entry;
@@ -272,7 +273,7 @@ int drmSLNext(void *l, unsigned long *key, void **value)
     return 0;
 }
 
-int drmSLFirst(void *l, unsigned long *key, void **value)
+drm_public int drmSLFirst(void *l, unsigned long *key, void **value)
 {
     SkipListPtr   list = (SkipListPtr)l;
     
@@ -283,7 +284,7 @@ int drmSLFirst(void *l, unsigned long *key, void **value)
 }
 
 /* Dump internal data structures for debugging. */
-void drmSLDump(void *l)
+drm_public void drmSLDump(void *l)
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    entry;
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 06/13] etnaviv: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (4 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 05/13] libdrm: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 07/13] freedreno: " Lucas De Marchi
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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
etnaviv-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@intel.com>
---
 etnaviv/etnaviv_bo.c         | 25 +++++++++++++------------
 etnaviv/etnaviv_cmd_stream.c | 21 ++++++++++++---------
 etnaviv/etnaviv_device.c     | 10 +++++-----
 etnaviv/etnaviv_gpu.c        |  6 +++---
 etnaviv/etnaviv_perfmon.c    |  8 ++++----
 etnaviv/etnaviv_pipe.c       |  8 ++++----
 6 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c
index 32f7b348..43ce6b4e 100644
--- a/etnaviv/etnaviv_bo.c
+++ b/etnaviv/etnaviv_bo.c
@@ -104,7 +104,7 @@ static struct etna_bo *bo_from_handle(struct etna_device *dev,
 }
 
 /* allocate a new (un-tiled) buffer object */
-struct etna_bo *etna_bo_new(struct etna_device *dev, uint32_t size,
+drm_public struct etna_bo *etna_bo_new(struct etna_device *dev, uint32_t size,
 		uint32_t flags)
 {
 	struct etna_bo *bo;
@@ -131,7 +131,7 @@ struct etna_bo *etna_bo_new(struct etna_device *dev, uint32_t size,
 	return bo;
 }
 
-struct etna_bo *etna_bo_ref(struct etna_bo *bo)
+drm_public struct etna_bo *etna_bo_ref(struct etna_bo *bo)
 {
 	atomic_inc(&bo->refcnt);
 
@@ -159,7 +159,8 @@ static int get_buffer_info(struct etna_bo *bo)
 }
 
 /* import a buffer object from DRI2 name */
-struct etna_bo *etna_bo_from_name(struct etna_device *dev, uint32_t name)
+drm_public struct etna_bo *etna_bo_from_name(struct etna_device *dev,
+		uint32_t name)
 {
 	struct etna_bo *bo;
 	struct drm_gem_open req = {
@@ -196,7 +197,7 @@ out_unlock:
  * fd so caller should close() the fd when it is otherwise done
  * with it (even if it is still using the 'struct etna_bo *')
  */
-struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd)
+drm_public struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd)
 {
 	struct etna_bo *bo;
 	int ret, size;
@@ -231,7 +232,7 @@ out_unlock:
 }
 
 /* destroy a buffer object */
-void etna_bo_del(struct etna_bo *bo)
+drm_public void etna_bo_del(struct etna_bo *bo)
 {
 	struct etna_device *dev = bo->dev;
 
@@ -253,7 +254,7 @@ out:
 }
 
 /* get the global flink/DRI2 buffer name */
-int etna_bo_get_name(struct etna_bo *bo, uint32_t *name)
+drm_public int etna_bo_get_name(struct etna_bo *bo, uint32_t *name)
 {
 	if (!bo->name) {
 		struct drm_gem_flink req = {
@@ -277,7 +278,7 @@ int etna_bo_get_name(struct etna_bo *bo, uint32_t *name)
 	return 0;
 }
 
-uint32_t etna_bo_handle(struct etna_bo *bo)
+drm_public uint32_t etna_bo_handle(struct etna_bo *bo)
 {
 	return bo->handle;
 }
@@ -285,7 +286,7 @@ uint32_t etna_bo_handle(struct etna_bo *bo)
 /* caller owns the dmabuf fd that is returned and is responsible
  * to close() it when done
  */
-int etna_bo_dmabuf(struct etna_bo *bo)
+drm_public int etna_bo_dmabuf(struct etna_bo *bo)
 {
 	int ret, prime_fd;
 
@@ -301,12 +302,12 @@ int etna_bo_dmabuf(struct etna_bo *bo)
 	return prime_fd;
 }
 
-uint32_t etna_bo_size(struct etna_bo *bo)
+drm_public uint32_t etna_bo_size(struct etna_bo *bo)
 {
 	return bo->size;
 }
 
-void *etna_bo_map(struct etna_bo *bo)
+drm_public void *etna_bo_map(struct etna_bo *bo)
 {
 	if (!bo->map) {
 		if (!bo->offset) {
@@ -324,7 +325,7 @@ void *etna_bo_map(struct etna_bo *bo)
 	return bo->map;
 }
 
-int etna_bo_cpu_prep(struct etna_bo *bo, uint32_t op)
+drm_public int etna_bo_cpu_prep(struct etna_bo *bo, uint32_t op)
 {
 	struct drm_etnaviv_gem_cpu_prep req = {
 		.handle = bo->handle,
@@ -337,7 +338,7 @@ int etna_bo_cpu_prep(struct etna_bo *bo, uint32_t op)
 			&req, sizeof(req));
 }
 
-void etna_bo_cpu_fini(struct etna_bo *bo)
+drm_public void etna_bo_cpu_fini(struct etna_bo *bo)
 {
 	struct drm_etnaviv_gem_cpu_fini req = {
 		.handle = bo->handle,
diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c
index 13730168..7139c324 100644
--- a/etnaviv/etnaviv_cmd_stream.c
+++ b/etnaviv/etnaviv_cmd_stream.c
@@ -55,7 +55,8 @@ etna_cmd_stream_priv(struct etna_cmd_stream *stream)
     return (struct etna_cmd_stream_priv *)stream;
 }
 
-struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe, uint32_t size,
+drm_public struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe,
+        uint32_t size,
 		void (*reset_notify)(struct etna_cmd_stream *stream, void *priv),
 		void *priv)
 {
@@ -95,7 +96,7 @@ fail:
 	return NULL;
 }
 
-void etna_cmd_stream_del(struct etna_cmd_stream *stream)
+drm_public void etna_cmd_stream_del(struct etna_cmd_stream *stream)
 {
 	struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
 
@@ -119,7 +120,7 @@ static void reset_buffer(struct etna_cmd_stream *stream)
 		priv->reset_notify(stream, priv->reset_notify_priv);
 }
 
-uint32_t etna_cmd_stream_timestamp(struct etna_cmd_stream *stream)
+drm_public uint32_t etna_cmd_stream_timestamp(struct etna_cmd_stream *stream)
 {
 	return etna_cmd_stream_priv(stream)->last_timestamp;
 }
@@ -222,20 +223,21 @@ static void flush(struct etna_cmd_stream *stream, int in_fence_fd,
 		*out_fence_fd = req.fence_fd;
 }
 
-void etna_cmd_stream_flush(struct etna_cmd_stream *stream)
+drm_public void etna_cmd_stream_flush(struct etna_cmd_stream *stream)
 {
 	flush(stream, -1, NULL);
 	reset_buffer(stream);
 }
 
-void etna_cmd_stream_flush2(struct etna_cmd_stream *stream, int in_fence_fd,
-			    int *out_fence_fd)
+drm_public void etna_cmd_stream_flush2(struct etna_cmd_stream *stream,
+									   int in_fence_fd,
+									   int *out_fence_fd)
 {
 	flush(stream, in_fence_fd, out_fence_fd);
 	reset_buffer(stream);
 }
 
-void etna_cmd_stream_finish(struct etna_cmd_stream *stream)
+drm_public void etna_cmd_stream_finish(struct etna_cmd_stream *stream)
 {
 	struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
 
@@ -244,7 +246,8 @@ void etna_cmd_stream_finish(struct etna_cmd_stream *stream)
 	reset_buffer(stream);
 }
 
-void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_reloc *r)
+drm_public void etna_cmd_stream_reloc(struct etna_cmd_stream *stream,
+									  const struct etna_reloc *r)
 {
 	struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
 	struct drm_etnaviv_gem_submit_reloc *reloc;
@@ -261,7 +264,7 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_rel
 	etna_cmd_stream_emit(stream, addr);
 }
 
-void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p)
+drm_public void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p)
 {
 	struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
 	struct drm_etnaviv_gem_submit_pmr *pmr;
diff --git a/etnaviv/etnaviv_device.c b/etnaviv/etnaviv_device.c
index d83e8d3e..699df256 100644
--- a/etnaviv/etnaviv_device.c
+++ b/etnaviv/etnaviv_device.c
@@ -41,7 +41,7 @@
 
 static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
 
-struct etna_device *etna_device_new(int fd)
+drm_public struct etna_device *etna_device_new(int fd)
 {
 	struct etna_device *dev = calloc(sizeof(*dev), 1);
 
@@ -59,7 +59,7 @@ struct etna_device *etna_device_new(int fd)
 
 /* like etna_device_new() but creates it's own private dup() of the fd
  * which is close()d when the device is finalized. */
-struct etna_device *etna_device_new_dup(int fd)
+drm_public struct etna_device *etna_device_new_dup(int fd)
 {
 	int dup_fd = dup(fd);
 	struct etna_device *dev = etna_device_new(dup_fd);
@@ -72,7 +72,7 @@ struct etna_device *etna_device_new_dup(int fd)
 	return dev;
 }
 
-struct etna_device *etna_device_ref(struct etna_device *dev)
+drm_public struct etna_device *etna_device_ref(struct etna_device *dev)
 {
 	atomic_inc(&dev->refcnt);
 
@@ -99,7 +99,7 @@ drm_private void etna_device_del_locked(struct etna_device *dev)
 	etna_device_del_impl(dev);
 }
 
-void etna_device_del(struct etna_device *dev)
+drm_public void etna_device_del(struct etna_device *dev)
 {
 	if (!atomic_dec_and_test(&dev->refcnt))
 		return;
@@ -109,7 +109,7 @@ void etna_device_del(struct etna_device *dev)
 	pthread_mutex_unlock(&table_lock);
 }
 
-int etna_device_fd(struct etna_device *dev)
+drm_public int etna_device_fd(struct etna_device *dev)
 {
    return dev->fd;
 }
diff --git a/etnaviv/etnaviv_gpu.c b/etnaviv/etnaviv_gpu.c
index f7efa028..dc4c126d 100644
--- a/etnaviv/etnaviv_gpu.c
+++ b/etnaviv/etnaviv_gpu.c
@@ -44,7 +44,7 @@ static uint64_t get_param(struct etna_device *dev, uint32_t core, uint32_t param
 	return req.value;
 }
 
-struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
+drm_public struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
 {
 	struct etna_gpu *gpu;
 
@@ -73,12 +73,12 @@ fail:
 	return NULL;
 }
 
-void etna_gpu_del(struct etna_gpu *gpu)
+drm_public void etna_gpu_del(struct etna_gpu *gpu)
 {
 	free(gpu);
 }
 
-int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
+drm_public int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
 		uint64_t *value)
 {
 	struct etna_device *dev = gpu->dev;
diff --git a/etnaviv/etnaviv_perfmon.c b/etnaviv/etnaviv_perfmon.c
index 5f408a7b..f6576b8a 100644
--- a/etnaviv/etnaviv_perfmon.c
+++ b/etnaviv/etnaviv_perfmon.c
@@ -121,7 +121,7 @@ static void etna_perfmon_free_domains(struct etna_perfmon *pm)
 	}
 }
 
-struct etna_perfmon *etna_perfmon_create(struct etna_pipe *pipe)
+drm_public struct etna_perfmon *etna_perfmon_create(struct etna_pipe *pipe)
 {
 	struct etna_perfmon *pm;
 	int ret;
@@ -147,7 +147,7 @@ fail:
 	return NULL;
 }
 
-void etna_perfmon_del(struct etna_perfmon *pm)
+drm_public void etna_perfmon_del(struct etna_perfmon *pm)
 {
 	if (!pm)
 		return;
@@ -156,7 +156,7 @@ void etna_perfmon_del(struct etna_perfmon *pm)
 	free(pm);
 }
 
-struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm, const char *name)
+drm_public struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm, const char *name)
 {
 	struct etna_perfmon_domain *dom;
 
@@ -170,7 +170,7 @@ struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm
 	return NULL;
 }
 
-struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct etna_perfmon_domain *dom, const char *name)
+drm_public struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct etna_perfmon_domain *dom, const char *name)
 {
 	struct etna_perfmon_signal *signal;
 
diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c
index 53954aa3..4120a36f 100644
--- a/etnaviv/etnaviv_pipe.c
+++ b/etnaviv/etnaviv_pipe.c
@@ -26,12 +26,12 @@
 
 #include "etnaviv_priv.h"
 
-int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
+drm_public int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
 {
 	return etna_pipe_wait_ns(pipe, timestamp, ms * 1000000);
 }
 
-int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
+drm_public int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
 {
 	struct etna_device *dev = pipe->gpu->dev;
 	int ret;
@@ -55,12 +55,12 @@ int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
 	return 0;
 }
 
-void etna_pipe_del(struct etna_pipe *pipe)
+drm_public void etna_pipe_del(struct etna_pipe *pipe)
 {
 	free(pipe);
 }
 
-struct etna_pipe *etna_pipe_new(struct etna_gpu *gpu, enum etna_pipe_id id)
+drm_public struct etna_pipe *etna_pipe_new(struct etna_gpu *gpu, enum etna_pipe_id id)
 {
 	struct etna_pipe *pipe;
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 07/13] freedreno: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (5 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 06/13] etnaviv: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 08/13] omap: " Lucas De Marchi
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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@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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 08/13] omap: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (6 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 07/13] freedreno: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 09/13] radeon: " Lucas De Marchi
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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
omap-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@intel.com>
---
 omap/omap_drm.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 417d522c..3136e04e 100644
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
@@ -88,7 +88,7 @@ static struct omap_device * omap_device_new_impl(int fd)
 	return dev;
 }
 
-struct omap_device * omap_device_new(int fd)
+drm_public struct omap_device * omap_device_new(int fd)
 {
 	struct omap_device *dev = NULL;
 
@@ -111,13 +111,13 @@ struct omap_device * omap_device_new(int fd)
 	return dev;
 }
 
-struct omap_device * omap_device_ref(struct omap_device *dev)
+drm_public struct omap_device * omap_device_ref(struct omap_device *dev)
 {
 	atomic_inc(&dev->refcnt);
 	return dev;
 }
 
-void omap_device_del(struct omap_device *dev)
+drm_public void omap_device_del(struct omap_device *dev)
 {
 	if (!atomic_dec_and_test(&dev->refcnt))
 		return;
@@ -129,7 +129,7 @@ void omap_device_del(struct omap_device *dev)
 }
 
 int
-omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
+drm_public omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
 {
 	struct drm_omap_param req = {
 			.param = param,
@@ -147,7 +147,7 @@ omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
 }
 
 int
-omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value)
+drm_public omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value)
 {
 	struct drm_omap_param req = {
 			.param = param,
@@ -227,7 +227,7 @@ fail:
 
 /* allocate a new (un-tiled) buffer object */
 struct omap_bo *
-omap_bo_new(struct omap_device *dev, uint32_t size, uint32_t flags)
+drm_public omap_bo_new(struct omap_device *dev, uint32_t size, uint32_t flags)
 {
 	union omap_gem_size gsize = {
 			.bytes = size,
@@ -240,7 +240,7 @@ omap_bo_new(struct omap_device *dev, uint32_t size, uint32_t flags)
 
 /* allocate a new buffer object */
 struct omap_bo *
-omap_bo_new_tiled(struct omap_device *dev, uint32_t width,
+drm_public omap_bo_new_tiled(struct omap_device *dev, uint32_t width,
 		  uint32_t height, uint32_t flags)
 {
 	union omap_gem_size gsize = {
@@ -255,7 +255,7 @@ omap_bo_new_tiled(struct omap_device *dev, uint32_t width,
 	return omap_bo_new_impl(dev, gsize, flags);
 }
 
-struct omap_bo *omap_bo_ref(struct omap_bo *bo)
+drm_public struct omap_bo *omap_bo_ref(struct omap_bo *bo)
 {
 	atomic_inc(&bo->refcnt);
 	return bo;
@@ -282,7 +282,7 @@ static int get_buffer_info(struct omap_bo *bo)
 
 /* import a buffer object from DRI2 name */
 struct omap_bo *
-omap_bo_from_name(struct omap_device *dev, uint32_t name)
+drm_public omap_bo_from_name(struct omap_device *dev, uint32_t name)
 {
 	struct omap_bo *bo = NULL;
 	struct drm_gem_open req = {
@@ -316,7 +316,7 @@ fail:
  * with it (even if it is still using the 'struct omap_bo *')
  */
 struct omap_bo *
-omap_bo_from_dmabuf(struct omap_device *dev, int fd)
+drm_public omap_bo_from_dmabuf(struct omap_device *dev, int fd)
 {
 	struct omap_bo *bo = NULL;
 	struct drm_prime_handle req = {
@@ -347,7 +347,7 @@ fail:
 }
 
 /* destroy a buffer object */
-void omap_bo_del(struct omap_bo *bo)
+drm_public void omap_bo_del(struct omap_bo *bo)
 {
 	if (!bo) {
 		return;
@@ -380,7 +380,7 @@ void omap_bo_del(struct omap_bo *bo)
 }
 
 /* get the global flink/DRI2 buffer name */
-int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
+drm_public int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
 {
 	if (!bo->name) {
 		struct drm_gem_flink req = {
@@ -401,7 +401,7 @@ int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
 	return 0;
 }
 
-uint32_t omap_bo_handle(struct omap_bo *bo)
+drm_public uint32_t omap_bo_handle(struct omap_bo *bo)
 {
 	return bo->handle;
 }
@@ -409,7 +409,7 @@ uint32_t omap_bo_handle(struct omap_bo *bo)
 /* caller owns the dmabuf fd that is returned and is responsible
  * to close() it when done
  */
-int omap_bo_dmabuf(struct omap_bo *bo)
+drm_public int omap_bo_dmabuf(struct omap_bo *bo)
 {
 	if (bo->fd < 0) {
 		struct drm_prime_handle req = {
@@ -428,7 +428,7 @@ int omap_bo_dmabuf(struct omap_bo *bo)
 	return dup(bo->fd);
 }
 
-uint32_t omap_bo_size(struct omap_bo *bo)
+drm_public uint32_t omap_bo_size(struct omap_bo *bo)
 {
 	if (!bo->size) {
 		get_buffer_info(bo);
@@ -436,7 +436,7 @@ uint32_t omap_bo_size(struct omap_bo *bo)
 	return bo->size;
 }
 
-void *omap_bo_map(struct omap_bo *bo)
+drm_public void *omap_bo_map(struct omap_bo *bo)
 {
 	if (!bo->map) {
 		if (!bo->offset) {
@@ -452,7 +452,7 @@ void *omap_bo_map(struct omap_bo *bo)
 	return bo->map;
 }
 
-int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
+drm_public int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
 {
 	struct drm_omap_gem_cpu_prep req = {
 			.handle = bo->handle,
@@ -462,7 +462,7 @@ int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
 			DRM_OMAP_GEM_CPU_PREP, &req, sizeof(req));
 }
 
-int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op)
+drm_public int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op)
 {
 	struct drm_omap_gem_cpu_fini req = {
 			.handle = bo->handle,
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 09/13] radeon: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (7 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 08/13] omap: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 10/13] tegra: " Lucas De Marchi
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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
radeon-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@intel.com>
---
 radeon/radeon_bo.c       | 24 ++++++++++++------------
 radeon/radeon_bo_gem.c   | 16 ++++++++--------
 radeon/radeon_cs.c       | 24 ++++++++++++------------
 radeon/radeon_cs_gem.c   |  4 ++--
 radeon/radeon_cs_space.c |  6 +++---
 radeon/radeon_surface.c  |  8 ++++----
 6 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/radeon/radeon_bo.c b/radeon/radeon_bo.c
index 821807bc..cd06c26e 100644
--- a/radeon/radeon_bo.c
+++ b/radeon/radeon_bo.c
@@ -33,7 +33,7 @@
 #include <radeon_bo.h>
 #include <radeon_bo_int.h>
 
-void radeon_bo_debug(struct radeon_bo *bo, const char *op)
+drm_public void radeon_bo_debug(struct radeon_bo *bo, const char *op)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
 
@@ -41,7 +41,7 @@ void radeon_bo_debug(struct radeon_bo *bo, const char *op)
             op, bo, bo->handle, boi->size, boi->cref);
 }
 
-struct radeon_bo *
+drm_public struct radeon_bo *
 radeon_bo_open(struct radeon_bo_manager *bom, uint32_t handle, uint32_t size,
 	       uint32_t alignment, uint32_t domains, uint32_t flags)
 {
@@ -50,14 +50,14 @@ radeon_bo_open(struct radeon_bo_manager *bom, uint32_t handle, uint32_t size,
     return bo;
 }
 
-void radeon_bo_ref(struct radeon_bo *bo)
+drm_public void radeon_bo_ref(struct radeon_bo *bo)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     boi->cref++;
     boi->bom->funcs->bo_ref(boi);
 }
 
-struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo)
+drm_public struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     if (bo == NULL)
@@ -79,7 +79,7 @@ int radeon_bo_unmap(struct radeon_bo *bo)
     return boi->bom->funcs->bo_unmap(boi);
 }
 
-int radeon_bo_wait(struct radeon_bo *bo)
+drm_public int radeon_bo_wait(struct radeon_bo *bo)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     if (!boi->bom->funcs->bo_wait)
@@ -87,13 +87,13 @@ int radeon_bo_wait(struct radeon_bo *bo)
     return boi->bom->funcs->bo_wait(boi);
 }
 
-int radeon_bo_is_busy(struct radeon_bo *bo, uint32_t *domain)
+drm_public int radeon_bo_is_busy(struct radeon_bo *bo, uint32_t *domain)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     return boi->bom->funcs->bo_is_busy(boi, domain);
 }
 
-int
+drm_public int
 radeon_bo_set_tiling(struct radeon_bo *bo,
                      uint32_t tiling_flags, uint32_t pitch)
 {
@@ -101,7 +101,7 @@ radeon_bo_set_tiling(struct radeon_bo *bo,
     return boi->bom->funcs->bo_set_tiling(boi, tiling_flags, pitch);
 }
 
-int
+drm_public int
 radeon_bo_get_tiling(struct radeon_bo *bo,
                      uint32_t *tiling_flags, uint32_t *pitch)
 {
@@ -109,7 +109,7 @@ radeon_bo_get_tiling(struct radeon_bo *bo,
     return boi->bom->funcs->bo_get_tiling(boi, tiling_flags, pitch);
 }
 
-int radeon_bo_is_static(struct radeon_bo *bo)
+drm_public int radeon_bo_is_static(struct radeon_bo *bo)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     if (boi->bom->funcs->bo_is_static)
@@ -117,19 +117,19 @@ int radeon_bo_is_static(struct radeon_bo *bo)
     return 0;
 }
 
-int
+drm_public int
 radeon_bo_is_referenced_by_cs(struct radeon_bo *bo, struct radeon_cs *cs)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     return boi->cref > 1;
 }
 
-uint32_t radeon_bo_get_handle(struct radeon_bo *bo)
+drm_public uint32_t radeon_bo_get_handle(struct radeon_bo *bo)
 {
     return bo->handle;
 }
 
-uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo)
+drm_public uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
     uint32_t src_domain;
diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
index 774b26e4..86f7c007 100644
--- a/radeon/radeon_bo_gem.c
+++ b/radeon/radeon_bo_gem.c
@@ -281,7 +281,7 @@ static const struct radeon_bo_funcs bo_gem_funcs = {
     .bo_is_referenced_by_cs = NULL,
 };
 
-struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
+drm_public struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
 {
     struct bo_manager_gem *bomg;
 
@@ -294,7 +294,7 @@ struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
     return (struct radeon_bo_manager*)bomg;
 }
 
-void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom)
+drm_public void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom)
 {
     struct bo_manager_gem *bomg = (struct bo_manager_gem*)bom;
 
@@ -304,21 +304,21 @@ void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom)
     free(bomg);
 }
 
-uint32_t
+drm_public uint32_t
 radeon_gem_name_bo(struct radeon_bo *bo)
 {
     struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
     return bo_gem->name;
 }
 
-void *
+drm_public void *
 radeon_gem_get_reloc_in_cs(struct radeon_bo *bo)
 {
     struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
     return &bo_gem->reloc_in_cs;
 }
 
-int
+drm_public int
 radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name)
 {
     struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
@@ -340,7 +340,7 @@ radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name)
     return 0;
 }
 
-int
+drm_public int
 radeon_gem_set_domain(struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain)
 {
     struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
@@ -358,7 +358,7 @@ radeon_gem_set_domain(struct radeon_bo *bo, uint32_t read_domains, uint32_t writ
     return r;
 }
 
-int radeon_gem_prime_share_bo(struct radeon_bo *bo, int *handle)
+drm_public int radeon_gem_prime_share_bo(struct radeon_bo *bo, int *handle)
 {
     struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
     int ret;
@@ -367,7 +367,7 @@ int radeon_gem_prime_share_bo(struct radeon_bo *bo, int *handle)
     return ret;
 }
 
-struct radeon_bo *
+drm_public struct radeon_bo *
 radeon_gem_bo_open_prime(struct radeon_bo_manager *bom, int fd_handle, uint32_t size)
 {
     struct radeon_bo_gem *bo;
diff --git a/radeon/radeon_cs.c b/radeon/radeon_cs.c
index eb7859e5..1132d069 100644
--- a/radeon/radeon_cs.c
+++ b/radeon/radeon_cs.c
@@ -3,14 +3,14 @@
 #include "radeon_cs.h"
 #include "radeon_cs_int.h"
 
-struct radeon_cs *
+drm_public struct radeon_cs *
 radeon_cs_create(struct radeon_cs_manager *csm, uint32_t ndw)
 {
     struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
     return (struct radeon_cs *)csi;
 }
 
-int
+drm_public int
 radeon_cs_write_reloc(struct radeon_cs *cs, struct radeon_bo *bo,
                       uint32_t read_domain, uint32_t write_domain,
                       uint32_t flags)
@@ -24,7 +24,7 @@ radeon_cs_write_reloc(struct radeon_cs *cs, struct radeon_bo *bo,
                                            flags);
 }
 
-int
+drm_public int
 radeon_cs_begin(struct radeon_cs *cs, uint32_t ndw,
                 const char *file, const char *func, int line)
 {
@@ -32,7 +32,7 @@ radeon_cs_begin(struct radeon_cs *cs, uint32_t ndw,
     return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
 }
 
-int
+drm_public int
 radeon_cs_end(struct radeon_cs *cs,
               const char *file, const char *func, int line)
 {
@@ -40,37 +40,37 @@ radeon_cs_end(struct radeon_cs *cs,
     return csi->csm->funcs->cs_end(csi, file, func, line);
 }
 
-int radeon_cs_emit(struct radeon_cs *cs)
+drm_public int radeon_cs_emit(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     return csi->csm->funcs->cs_emit(csi);
 }
 
-int radeon_cs_destroy(struct radeon_cs *cs)
+drm_public int radeon_cs_destroy(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     return csi->csm->funcs->cs_destroy(csi);
 }
 
-int radeon_cs_erase(struct radeon_cs *cs)
+drm_public int radeon_cs_erase(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     return csi->csm->funcs->cs_erase(csi);
 }
 
-int radeon_cs_need_flush(struct radeon_cs *cs)
+drm_public int radeon_cs_need_flush(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     return csi->csm->funcs->cs_need_flush(csi);
 }
 
-void radeon_cs_print(struct radeon_cs *cs, FILE *file)
+drm_public void radeon_cs_print(struct radeon_cs *cs, FILE *file)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     csi->csm->funcs->cs_print(csi, file);
 }
 
-void
+drm_public void
 radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
@@ -80,7 +80,7 @@ radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
         csi->csm->gart_limit = limit;
 }
 
-void radeon_cs_space_set_flush(struct radeon_cs *cs, 
+drm_public void radeon_cs_space_set_flush(struct radeon_cs *cs,
                                           void (*fn)(void *), void *data)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
@@ -88,7 +88,7 @@ void radeon_cs_space_set_flush(struct radeon_cs *cs,
     csi->space_flush_data = data;
 }
 
-uint32_t radeon_cs_get_id(struct radeon_cs *cs)
+drm_public uint32_t radeon_cs_get_id(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     return csi->id;
diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index 4d5fc13a..ef070c60 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -536,7 +536,7 @@ static int radeon_get_device_id(int fd, uint32_t *device_id)
     return r;
 }
 
-struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd)
+drm_public struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd)
 {
     struct radeon_cs_manager_gem *csm;
 
@@ -550,7 +550,7 @@ struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd)
     return &csm->base;
 }
 
-void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm)
+drm_public void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm)
 {
     free(csm);
 }
diff --git a/radeon/radeon_cs_space.c b/radeon/radeon_cs_space.c
index 8531c345..08093300 100644
--- a/radeon/radeon_cs_space.c
+++ b/radeon/radeon_cs_space.c
@@ -162,7 +162,7 @@ static int radeon_cs_do_space_check(struct radeon_cs_int *cs, struct radeon_cs_s
     return RADEON_CS_SPACE_OK;
 }
 
-void
+drm_public void
 radeon_cs_space_add_persistent_bo(struct radeon_cs *cs, struct radeon_bo *bo,
                                   uint32_t read_domains, uint32_t write_domain)
 {
@@ -206,7 +206,7 @@ again:
     return 0;
 }
 
-int
+drm_public int
 radeon_cs_space_check_with_bo(struct radeon_cs *cs, struct radeon_bo *bo,
                               uint32_t read_domains, uint32_t write_domain)
 {
@@ -233,7 +233,7 @@ int radeon_cs_space_check(struct radeon_cs *cs)
     return radeon_cs_check_space_internal(csi, NULL);
 }
 
-void radeon_cs_space_reset_bos(struct radeon_cs *cs)
+drm_public void radeon_cs_space_reset_bos(struct radeon_cs *cs)
 {
     struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
     int i;
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 3cafcfcb..ea0a27a9 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -2408,7 +2408,7 @@ static int cik_surface_best(struct radeon_surface_manager *surf_man,
 /* ===========================================================================
  * public API
  */
-struct radeon_surface_manager *
+drm_public struct radeon_surface_manager *
 radeon_surface_manager_new(int fd)
 {
     struct radeon_surface_manager *surf_man;
@@ -2457,7 +2457,7 @@ out_err:
     return NULL;
 }
 
-void
+drm_public void
 radeon_surface_manager_free(struct radeon_surface_manager *surf_man)
 {
     free(surf_man);
@@ -2531,7 +2531,7 @@ static int radeon_surface_sanity(struct radeon_surface_manager *surf_man,
     return 0;
 }
 
-int
+drm_public int
 radeon_surface_init(struct radeon_surface_manager *surf_man,
                     struct radeon_surface *surf)
 {
@@ -2548,7 +2548,7 @@ radeon_surface_init(struct radeon_surface_manager *surf_man,
     return surf_man->surface_init(surf_man, surf);
 }
 
-int
+drm_public int
 radeon_surface_best(struct radeon_surface_manager *surf_man,
                     struct radeon_surface *surf)
 {
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 10/13] tegra: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (8 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 09/13] radeon: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 11/13] exynos: " Lucas De Marchi
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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
tegra-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@intel.com>
---
 tegra/tegra.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tegra/tegra.c b/tegra/tegra.c
index 1d7268e5..cf00a3ca 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -70,7 +70,7 @@ static int drm_tegra_wrap(struct drm_tegra **drmp, int fd, bool close)
 	return 0;
 }
 
-int drm_tegra_new(struct drm_tegra **drmp, int fd)
+drm_public int drm_tegra_new(struct drm_tegra **drmp, int fd)
 {
 	bool supported = false;
 	drmVersionPtr version;
@@ -90,7 +90,7 @@ int drm_tegra_new(struct drm_tegra **drmp, int fd)
 	return drm_tegra_wrap(drmp, fd, false);
 }
 
-void drm_tegra_close(struct drm_tegra *drm)
+drm_public void drm_tegra_close(struct drm_tegra *drm)
 {
 	if (!drm)
 		return;
@@ -101,7 +101,7 @@ void drm_tegra_close(struct drm_tegra *drm)
 	free(drm);
 }
 
-int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+drm_public int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
 		     uint32_t flags, uint32_t size)
 {
 	struct drm_tegra_gem_create args;
@@ -139,7 +139,7 @@ int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
 	return 0;
 }
 
-int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+drm_public int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
 		      uint32_t handle, uint32_t flags, uint32_t size)
 {
 	struct drm_tegra_bo *bo;
@@ -162,7 +162,7 @@ int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
 	return 0;
 }
 
-struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo)
+drm_public struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo)
 {
 	if (bo)
 		atomic_inc(&bo->ref);
@@ -170,13 +170,13 @@ struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo)
 	return bo;
 }
 
-void drm_tegra_bo_unref(struct drm_tegra_bo *bo)
+drm_public void drm_tegra_bo_unref(struct drm_tegra_bo *bo)
 {
 	if (bo && atomic_dec_and_test(&bo->ref))
 		drm_tegra_bo_free(bo);
 }
 
-int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle)
+drm_public int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle)
 {
 	if (!bo || !handle)
 		return -EINVAL;
@@ -186,7 +186,7 @@ int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle)
 	return 0;
 }
 
-int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
+drm_public int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
 {
 	struct drm_tegra *drm = bo->drm;
 
@@ -218,7 +218,7 @@ int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
 	return 0;
 }
 
-int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
+drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 {
 	if (!bo)
 		return -EINVAL;
@@ -234,7 +234,7 @@ int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 	return 0;
 }
 
-int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
+drm_public int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
 {
 	struct drm_tegra_gem_get_flags args;
 	struct drm_tegra *drm = bo->drm;
@@ -257,7 +257,7 @@ int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
 	return 0;
 }
 
-int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
+drm_public int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
 {
 	struct drm_tegra_gem_get_flags args;
 	struct drm_tegra *drm = bo->drm;
@@ -278,7 +278,7 @@ int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
 	return 0;
 }
 
-int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
+drm_public int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
 			    struct drm_tegra_bo_tiling *tiling)
 {
 	struct drm_tegra_gem_get_tiling args;
@@ -304,7 +304,7 @@ int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
 	return 0;
 }
 
-int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
+drm_public int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
 			    const struct drm_tegra_bo_tiling *tiling)
 {
 	struct drm_tegra_gem_set_tiling args;
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 11/13] exynos: annotate public functions
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (9 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 10/13] tegra: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-13 23:57 ` [PATCH libdrm v2 12/13] meson: make symbols hidden by default Lucas De Marchi
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

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
exynos-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@intel.com>
---
 exynos/exynos_drm.c    | 30 +++++++++++++++---------------
 exynos/exynos_fimg2d.c | 20 ++++++++++----------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index e1afef65..078bf2c5 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -48,7 +48,7 @@
  *
  * if true, return the device object else NULL.
  */
-struct exynos_device * exynos_device_create(int fd)
+drm_public struct exynos_device * exynos_device_create(int fd)
 {
 	struct exynos_device *dev;
 
@@ -69,7 +69,7 @@ struct exynos_device * exynos_device_create(int fd)
  *
  * @dev: exynos drm device object.
  */
-void exynos_device_destroy(struct exynos_device *dev)
+drm_public void exynos_device_destroy(struct exynos_device *dev)
 {
 	free(dev);
 }
@@ -87,8 +87,8 @@ void exynos_device_destroy(struct exynos_device *dev)
  *
  * if true, return a exynos buffer object else NULL.
  */
-struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
-					       size_t size, uint32_t flags)
+drm_public struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
+                                               size_t size, uint32_t flags)
 {
 	struct exynos_bo *bo;
 	struct drm_exynos_gem_create req = {
@@ -141,8 +141,8 @@ fail:
  *
  * if true, return 0 else negative.
  */
-int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
-				  size_t *size, uint32_t *flags)
+drm_public int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
+                                  size_t *size, uint32_t *flags)
 {
 	int ret;
 	struct drm_exynos_gem_info req = {
@@ -167,7 +167,7 @@ int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
  *
  * @bo: a exynos buffer object to be destroyed.
  */
-void exynos_bo_destroy(struct exynos_bo *bo)
+drm_public void exynos_bo_destroy(struct exynos_bo *bo)
 {
 	if (!bo)
 		return;
@@ -199,7 +199,7 @@ void exynos_bo_destroy(struct exynos_bo *bo)
  * if true, return a exynos buffer object else NULL.
  *
  */
-struct exynos_bo *
+drm_public struct exynos_bo *
 exynos_bo_from_name(struct exynos_device *dev, uint32_t name)
 {
 	struct exynos_bo *bo;
@@ -242,7 +242,7 @@ err_free_bo:
  *
  * if true, return 0 else negative.
  */
-int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name)
+drm_public int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name)
 {
 	if (!bo->name) {
 		struct drm_gem_flink req = {
@@ -265,7 +265,7 @@ int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name)
 	return 0;
 }
 
-uint32_t exynos_bo_handle(struct exynos_bo *bo)
+drm_public uint32_t exynos_bo_handle(struct exynos_bo *bo)
 {
 	return bo->handle;
 }
@@ -278,7 +278,7 @@ uint32_t exynos_bo_handle(struct exynos_bo *bo)
  *
  * if true, user pointer mmaped else NULL.
  */
-void *exynos_bo_map(struct exynos_bo *bo)
+drm_public void *exynos_bo_map(struct exynos_bo *bo)
 {
 	if (!bo->vaddr) {
 		struct exynos_device *dev = bo->dev;
@@ -315,7 +315,7 @@ void *exynos_bo_map(struct exynos_bo *bo)
  *
  * @return: 0 on success, -1 on error, and errno will be set
  */
-int
+drm_public int
 exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle, int *fd)
 {
 	return drmPrimeHandleToFD(dev->fd, handle, 0, fd);
@@ -330,7 +330,7 @@ exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle, int *fd)
  *
  * @return: 0 on success, -1 on error, and errno will be set
  */
-int
+drm_public int
 exynos_prime_fd_to_handle(struct exynos_device *dev, int fd, uint32_t *handle)
 {
 	return drmPrimeFDToHandle(dev->fd, fd, handle);
@@ -353,7 +353,7 @@ exynos_prime_fd_to_handle(struct exynos_device *dev, int fd, uint32_t *handle)
  *
  * if true, return 0 else negative.
  */
-int
+drm_public int
 exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
 		       uint32_t ext, void *edid)
 {
@@ -394,7 +394,7 @@ exynos_handle_vendor(int fd, struct drm_event *e, void *ctx)
 	}
 }
 
-int
+drm_public int
 exynos_handle_event(struct exynos_device *dev, struct exynos_event_context *ctx)
 {
 	char buffer[1024];
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index bca884b9..ac6fa687 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -356,7 +356,7 @@ static int g2d_flush(struct g2d_context *ctx)
  *
  * fd: a file descriptor to an opened drm device.
  */
-struct g2d_context *g2d_init(int fd)
+drm_public struct g2d_context *g2d_init(int fd)
 {
 	struct drm_exynos_g2d_get_ver ver;
 	struct g2d_context *ctx;
@@ -384,7 +384,7 @@ struct g2d_context *g2d_init(int fd)
 	return ctx;
 }
 
-void g2d_fini(struct g2d_context *ctx)
+drm_public void g2d_fini(struct g2d_context *ctx)
 {
 	free(ctx);
 }
@@ -400,7 +400,7 @@ void g2d_fini(struct g2d_context *ctx)
  * @ctx: a pointer to g2d_context structure.
  * @userdata: a pointer to the user data
  */
-void g2d_config_event(struct g2d_context *ctx, void *userdata)
+drm_public void g2d_config_event(struct g2d_context *ctx, void *userdata)
 {
 	ctx->event_userdata = userdata;
 }
@@ -410,7 +410,7 @@ void g2d_config_event(struct g2d_context *ctx, void *userdata)
  *
  * @ctx: a pointer to g2d_context structure.
  */
-int g2d_exec(struct g2d_context *ctx)
+drm_public int g2d_exec(struct g2d_context *ctx)
 {
 	struct drm_exynos_g2d_exec exec;
 	int ret;
@@ -442,7 +442,7 @@ int g2d_exec(struct g2d_context *ctx)
  * @w: width value to buffer filled with given color data.
  * @h: height value to buffer filled with given color data.
  */
-int
+drm_public int
 g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
 			unsigned int x, unsigned int y, unsigned int w,
 			unsigned int h)
@@ -495,7 +495,7 @@ g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
  * @w: width value to source and destination buffers.
  * @h: height value to source and destination buffers.
  */
-int
+drm_public int
 g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
 		struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
 		unsigned int dst_x, unsigned dst_y, unsigned int w,
@@ -578,7 +578,7 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
  * @w: width of rectangle to move.
  * @h: height of rectangle to move.
  */
-int
+drm_public int
 g2d_move(struct g2d_context *ctx, struct g2d_image *img,
 		unsigned int src_x, unsigned int src_y,
 		unsigned int dst_x, unsigned dst_y, unsigned int w,
@@ -676,7 +676,7 @@ g2d_move(struct g2d_context *ctx, struct g2d_image *img,
  * @negative: indicate that it uses color negative to source and
  *	destination buffers.
  */
-int
+drm_public int
 g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
 				struct g2d_image *dst, unsigned int src_x,
 				unsigned int src_y, unsigned int src_w,
@@ -785,7 +785,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
  * @h: height value to source and destination buffer.
  * @op: blend operation type.
  */
-int
+drm_public int
 g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
 		struct g2d_image *dst, unsigned int src_x,
 		unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
@@ -902,7 +902,7 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
  * @dst_h: height value to destination buffer.
  * @op: blend operation type.
  */
-int
+drm_public int
 g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
 		struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
 		unsigned int src_w, unsigned int src_h, unsigned int dst_x,
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 12/13] meson: make symbols hidden by default
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (10 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 11/13] exynos: " Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-14 16:21   ` Dylan Baker
  2018-09-13 23:57 ` [PATCH libdrm v2 13/13] autotools: " Lucas De Marchi
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 amdgpu/meson.build          | 2 +-
 etnaviv/meson.build         | 2 +-
 exynos/meson.build          | 2 +-
 freedreno/meson.build       | 2 +-
 intel/meson.build           | 4 ++--
 libkms/meson.build          | 2 +-
 meson.build                 | 5 ++++-
 nouveau/meson.build         | 2 +-
 omap/meson.build            | 2 +-
 radeon/meson.build          | 2 +-
 tegra/meson.build           | 2 +-
 tests/exynos/meson.build    | 6 +++---
 tests/kms/meson.build       | 2 +-
 tests/kmstest/meson.build   | 2 +-
 tests/meson.build           | 8 ++++----
 tests/modeprint/meson.build | 2 +-
 tests/modetest/meson.build  | 2 +-
 tests/nouveau/meson.build   | 2 +-
 tests/proptest/meson.build  | 2 +-
 tests/radeon/meson.build    | 2 +-
 tests/tegra/meson.build     | 2 +-
 tests/vbltest/meson.build   | 2 +-
 22 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/amdgpu/meson.build b/amdgpu/meson.build
index d9d7de2d..7c8ccc7e 100644
--- a/amdgpu/meson.build
+++ b/amdgpu/meson.build
@@ -31,7 +31,7 @@ libdrm_amdgpu = shared_library(
     config_file,
   ],
   c_args : [
-    warn_c_args,
+    libdrm_c_args,
     '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(datadir_amdgpu, 'amdgpu.ids')),
   ],
   include_directories : [inc_root, inc_drm],
diff --git a/etnaviv/meson.build b/etnaviv/meson.build
index ca2aa544..515a4ed0 100644
--- a/etnaviv/meson.build
+++ b/etnaviv/meson.build
@@ -30,7 +30,7 @@ libdrm_etnaviv = shared_library(
   ],
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
   version : '1.0.0',
   install : true,
diff --git a/exynos/meson.build b/exynos/meson.build
index 30d36405..bdfc3fc6 100644
--- a/exynos/meson.build
+++ b/exynos/meson.build
@@ -21,7 +21,7 @@
 libdrm_exynos = shared_library(
   'drm_exynos',
   [files('exynos_drm.c', 'exynos_fimg2d.c'), config_file],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   dependencies : [dep_pthread_stubs],
diff --git a/freedreno/meson.build b/freedreno/meson.build
index 015b7fb1..c9aba060 100644
--- a/freedreno/meson.build
+++ b/freedreno/meson.build
@@ -42,7 +42,7 @@ endif
 libdrm_freedreno = shared_library(
   'drm_freedreno',
   [files_freedreno, config_file],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm],
   dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
   link_with : libdrm,
diff --git a/intel/meson.build b/intel/meson.build
index ff40ab91..3d6bbac6 100644
--- a/intel/meson.build
+++ b/intel/meson.build
@@ -30,7 +30,7 @@ libdrm_intel = shared_library(
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   version : '1.0.0',
   install : true,
 )
@@ -59,7 +59,7 @@ test_decode = executable(
   files('test_decode.c'),
   include_directories : [inc_root, inc_drm],
   link_with : [libdrm, libdrm_intel],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 test(
diff --git a/libkms/meson.build b/libkms/meson.build
index 86d1a4ee..dc931608 100644
--- a/libkms/meson.build
+++ b/libkms/meson.build
@@ -44,7 +44,7 @@ endif
 libkms = shared_library(
   'kms',
   [files_libkms, config_file],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : libkms_include,
   link_with : libdrm,
   version : '1.0.0',
diff --git a/meson.build b/meson.build
index 75c7bdff..80d50188 100644
--- a/meson.build
+++ b/meson.build
@@ -211,6 +211,9 @@ foreach a : ['unused-parameter', 'attributes', 'long-long',
   endif
 endforeach
 
+# all c args:
+libdrm_c_args = warn_c_args + ['-fvisibility=hidden']
+
 
 dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
 dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
@@ -286,7 +289,7 @@ libdrm = shared_library(
    ),
    config_file,
   ],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   dependencies : [dep_valgrind, dep_rt, dep_m],
   include_directories : inc_drm,
   version : '2.4.0',
diff --git a/nouveau/meson.build b/nouveau/meson.build
index 51c9a712..0c1498d7 100644
--- a/nouveau/meson.build
+++ b/nouveau/meson.build
@@ -22,7 +22,7 @@
 libdrm_nouveau = shared_library(
   'drm_nouveau',
   [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   dependencies : [dep_threads, dep_atomic_ops],
diff --git a/omap/meson.build b/omap/meson.build
index e57b8f5d..54698c6a 100644
--- a/omap/meson.build
+++ b/omap/meson.build
@@ -22,7 +22,7 @@ libdrm_omap = shared_library(
   'drm_omap',
   [files('omap_drm.c'), config_file],
   include_directories : [inc_root, inc_drm],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   link_with : libdrm,
   dependencies : [dep_pthread_stubs, dep_atomic_ops],
   version : '1.0.0',
diff --git a/radeon/meson.build b/radeon/meson.build
index b08c7442..1fc5282c 100644
--- a/radeon/meson.build
+++ b/radeon/meson.build
@@ -28,7 +28,7 @@ libdrm_radeon = shared_library(
     ),
     config_file,
   ],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   dependencies : [dep_pthread_stubs, dep_atomic_ops],
diff --git a/tegra/meson.build b/tegra/meson.build
index 1f5c74b3..4bc454b6 100644
--- a/tegra/meson.build
+++ b/tegra/meson.build
@@ -24,7 +24,7 @@ libdrm_tegra = shared_library(
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   dependencies : [dep_pthread_stubs, dep_atomic_ops],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   version : '0.0.0',
   install : true,
 )
diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
index 940c3ce4..3a048e8a 100644
--- a/tests/exynos/meson.build
+++ b/tests/exynos/meson.build
@@ -24,7 +24,7 @@ if with_libkms
   exynos_fimg2d_test = executable(
     'exynos_fimg2d_test',
     files('exynos_fimg2d_test.c'),
-    c_args : warn_c_args,
+    c_args : libdrm_c_args,
     include_directories : [inc_root, inc_drm, inc_exynos,
                            include_directories('../../libkms')],
     link_with : [libdrm, libkms, libdrm_exynos],
@@ -36,7 +36,7 @@ endif
 exynos_fimg2d_perf = executable(
   'exynos_fimg2d_perf',
   files('exynos_fimg2d_perf.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm, inc_exynos],
   link_with : [libdrm, libdrm_exynos],
   dependencies : dep_threads,
@@ -46,7 +46,7 @@ exynos_fimg2d_perf = executable(
 exynos_fimg2d_event = executable(
   'exynos_fimg2d_event',
   files('exynos_fimg2d_event.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_drm, inc_exynos],
   link_with : [libdrm, libdrm_exynos],
   dependencies : dep_threads,
diff --git a/tests/kms/meson.build b/tests/kms/meson.build
index 1f7f724d..91371aa0 100644
--- a/tests/kms/meson.build
+++ b/tests/kms/meson.build
@@ -27,7 +27,7 @@ libkms_test = static_library(
   ),
   include_directories : [inc_root, inc_tests, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 kms_steal_crtc = executable(
diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
index a47d4951..4fb870f9 100644
--- a/tests/kmstest/meson.build
+++ b/tests/kmstest/meson.build
@@ -21,7 +21,7 @@
 kmstest = executable(
   'kmstest',
   files('main.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [
     inc_root, inc_tests, include_directories('../../libkms'), inc_drm,
   ],
diff --git a/tests/meson.build b/tests/meson.build
index fdf950b7..6c8ddd9c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -53,7 +53,7 @@ drmsl = executable(
   files('drmsl.c'),
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 hash = executable(
@@ -61,7 +61,7 @@ hash = executable(
   files('hash.c'),
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 random = executable(
@@ -69,7 +69,7 @@ random = executable(
   files('random.c'),
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 drmdevice = executable(
@@ -77,7 +77,7 @@ drmdevice = executable(
   files('drmdevice.c'),
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 test('random', random, timeout : 240)
diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
index 5f0eb24b..898fd181 100644
--- a/tests/modeprint/meson.build
+++ b/tests/modeprint/meson.build
@@ -21,7 +21,7 @@
 modeprint = executable(
   'modeprint',
   files('modeprint.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_tests, inc_drm],
   link_with : libdrm,
   dependencies : dep_threads,
diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build
index 2a081845..23d84a1d 100644
--- a/tests/modetest/meson.build
+++ b/tests/modetest/meson.build
@@ -21,7 +21,7 @@
 modetest = executable(
   'modetest',
   files('buffers.c', 'cursor.c', 'modetest.c'),
-  c_args : [warn_c_args, '-Wno-pointer-arith'],
+  c_args : [libdrm_c_args, '-Wno-pointer-arith'],
   include_directories : [inc_root, inc_tests, inc_drm],
   dependencies : [dep_threads, dep_cairo],
   link_with : [libdrm, libutil],
diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
index f5d73c1e..ca4d44f0 100644
--- a/tests/nouveau/meson.build
+++ b/tests/nouveau/meson.build
@@ -24,7 +24,7 @@ threaded = executable(
   dependencies : [dep_dl, dep_threads],
   include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
   link_with : [libdrm, libdrm_nouveau],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
 
 test('threaded', threaded)
diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
index 22d7473e..9c87965a 100644
--- a/tests/proptest/meson.build
+++ b/tests/proptest/meson.build
@@ -21,7 +21,7 @@
 proptest = executable(
   'proptest',
   files('proptest.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_tests, inc_drm],
   link_with : [libdrm, libutil],
   install : with_install_tests,
diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
index 9e4f916e..bb345b73 100644
--- a/tests/radeon/meson.build
+++ b/tests/radeon/meson.build
@@ -23,5 +23,5 @@ radeon_ttm = executable(
   files('rbo.c', 'radeon_ttm.c'),
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
 )
diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
index 9c74ac4a..4f8c54f4 100644
--- a/tests/tegra/meson.build
+++ b/tests/tegra/meson.build
@@ -22,6 +22,6 @@ openclose = executable(
   'openclose',
   files('openclose.c'),
   include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   link_with : [libdrm, libdrm_tegra],
 )
diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
index ae52ab88..6339feba 100644
--- a/tests/vbltest/meson.build
+++ b/tests/vbltest/meson.build
@@ -21,7 +21,7 @@
 vbltest = executable(
   'vbltest',
   files('vbltest.c'),
-  c_args : warn_c_args,
+  c_args : libdrm_c_args,
   include_directories : [inc_root, inc_tests, inc_drm],
   link_with : [libdrm, libutil],
   install : with_install_tests,
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH libdrm v2 13/13] autotools: make symbols hidden by default
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (11 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 12/13] meson: make symbols hidden by default Lucas De Marchi
@ 2018-09-13 23:57 ` Lucas De Marchi
  2018-09-14  9:28 ` [PATCH libdrm v2 00/13] hide library symbols " Eric Engestrom
  2018-09-20 12:16 ` Emil Velikov
  14 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-13 23:57 UTC (permalink / raw)
  To: dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi

Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 Makefile.am                 | 1 +
 amdgpu/Makefile.am          | 1 +
 etnaviv/Makefile.am         | 1 +
 exynos/Makefile.am          | 1 +
 freedreno/Makefile.am       | 1 +
 intel/Makefile.am           | 1 +
 libkms/Makefile.am          | 1 +
 nouveau/Makefile.am         | 1 +
 omap/Makefile.am            | 1 +
 radeon/Makefile.am          | 1 +
 tegra/Makefile.am           | 3 ++-
 tests/Makefile.am           | 1 +
 tests/amdgpu/Makefile.am    | 1 +
 tests/etnaviv/Makefile.am   | 1 +
 tests/exynos/Makefile.am    | 1 +
 tests/kms/Makefile.am       | 3 ++-
 tests/kmstest/Makefile.am   | 1 +
 tests/modeprint/Makefile.am | 1 +
 tests/modetest/Makefile.am  | 1 +
 tests/nouveau/Makefile.am   | 1 +
 tests/proptest/Makefile.am  | 1 +
 tests/radeon/Makefile.am    | 1 +
 tests/tegra/Makefile.am     | 4 +++-
 tests/vbltest/Makefile.am   | 1 +
 vc4/Makefile.am             | 1 +
 25 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index faf0f750..730de1f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -121,6 +121,7 @@ libdrm_la_LIBADD = @CLOCK_LIB@ -lm
 libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	$(VALGRIND_CFLAGS)
 
 libdrm_la_SOURCES = $(LIBDRM_FILES)
diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
index a1b0d05c..707082f0 100644
--- a/amdgpu/Makefile.am
+++ b/amdgpu/Makefile.am
@@ -26,6 +26,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm
diff --git a/etnaviv/Makefile.am b/etnaviv/Makefile.am
index be96ba86..9c2a3d7d 100644
--- a/etnaviv/Makefile.am
+++ b/etnaviv/Makefile.am
@@ -2,6 +2,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm
diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index f99f8981..918b8d82 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm
diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
index cbb0d031..4cb542d3 100644
--- a/freedreno/Makefile.am
+++ b/freedreno/Makefile.am
@@ -3,6 +3,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	$(VALGRIND_CFLAGS) \
diff --git a/intel/Makefile.am b/intel/Makefile.am
index c52e8c08..5b1f2f56 100644
--- a/intel/Makefile.am
+++ b/intel/Makefile.am
@@ -26,6 +26,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	$(PCIACCESS_CFLAGS) \
diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 461fc35b..5e08a380 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -2,6 +2,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)
 
diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
index 344a8445..3c4d043b 100644
--- a/nouveau/Makefile.am
+++ b/nouveau/Makefile.am
@@ -2,6 +2,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm \
diff --git a/omap/Makefile.am b/omap/Makefile.am
index 599bb9de..26978ae7 100644
--- a/omap/Makefile.am
+++ b/omap/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm
diff --git a/radeon/Makefile.am b/radeon/Makefile.am
index e2415314..c07b4922 100644
--- a/radeon/Makefile.am
+++ b/radeon/Makefile.am
@@ -26,6 +26,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	-I$(top_srcdir)/include/drm
diff --git a/tegra/Makefile.am b/tegra/Makefile.am
index fb40be55..08b5e7c4 100644
--- a/tegra/Makefile.am
+++ b/tegra/Makefile.am
@@ -4,7 +4,8 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = \
 	@PTHREADSTUBS_CFLAGS@ \
-	$(WARN_CFLAGS)
+	$(WARN_CFLAGS) \
+	-fvisibility=hidden
 
 libdrm_tegra_ladir = $(libdir)
 libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b72c24f9..d274a3e9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@ endif
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
diff --git a/tests/amdgpu/Makefile.am b/tests/amdgpu/Makefile.am
index e79c1bd3..447ff217 100644
--- a/tests/amdgpu/Makefile.am
+++ b/tests/amdgpu/Makefile.am
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	-fvisibility=hidden \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)/amdgpu \
 	-I $(top_srcdir) \
diff --git a/tests/etnaviv/Makefile.am b/tests/etnaviv/Makefile.am
index 226baee2..3e0c6120 100644
--- a/tests/etnaviv/Makefile.am
+++ b/tests/etnaviv/Makefile.am
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	-fvisibility=hidden \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)/etnaviv \
 	-I $(top_srcdir)
diff --git a/tests/exynos/Makefile.am b/tests/exynos/Makefile.am
index b6361727..9658fb42 100644
--- a/tests/exynos/Makefile.am
+++ b/tests/exynos/Makefile.am
@@ -1,6 +1,7 @@
 AM_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)/libkms/ \
 	-I $(top_srcdir)/exynos \
diff --git a/tests/kms/Makefile.am b/tests/kms/Makefile.am
index 6645af7a..42242006 100644
--- a/tests/kms/Makefile.am
+++ b/tests/kms/Makefile.am
@@ -4,7 +4,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)
 
 AM_CFLAGS = \
-	$(WARN_CFLAGS)
+	$(WARN_CFLAGS) \
+	-fvisibility=hidden
 
 noinst_LTLIBRARIES = libkms-test.la
 
diff --git a/tests/kmstest/Makefile.am b/tests/kmstest/Makefile.am
index ced541b7..4c993b04 100644
--- a/tests/kmstest/Makefile.am
+++ b/tests/kmstest/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/libkms/ \
 	-I$(top_srcdir)/tests/ \
diff --git a/tests/modeprint/Makefile.am b/tests/modeprint/Makefile.am
index 601dbc96..84d5990a 100644
--- a/tests/modeprint/Makefile.am
+++ b/tests/modeprint/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
 	-I$(top_srcdir)
diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am
index 4b296c83..5eebd960 100644
--- a/tests/modetest/Makefile.am
+++ b/tests/modetest/Makefile.am
@@ -3,6 +3,7 @@ include Makefile.sources
 AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))
 
 AM_CFLAGS += \
+	-fvisibility=hidden \
 	-pthread \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
diff --git a/tests/nouveau/Makefile.am b/tests/nouveau/Makefile.am
index 3c799a81..554f43ec 100644
--- a/tests/nouveau/Makefile.am
+++ b/tests/nouveau/Makefile.am
@@ -1,6 +1,7 @@
 AM_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/nouveau \
 	-I$(top_srcdir)
diff --git a/tests/proptest/Makefile.am b/tests/proptest/Makefile.am
index 3fde46be..33b8705b 100644
--- a/tests/proptest/Makefile.am
+++ b/tests/proptest/Makefile.am
@@ -2,6 +2,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
 	-I$(top_srcdir)
diff --git a/tests/radeon/Makefile.am b/tests/radeon/Makefile.am
index 9da76259..3d173e31 100644
--- a/tests/radeon/Makefile.am
+++ b/tests/radeon/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
diff --git a/tests/tegra/Makefile.am b/tests/tegra/Makefile.am
index 8e625c8f..b462a30c 100644
--- a/tests/tegra/Makefile.am
+++ b/tests/tegra/Makefile.am
@@ -3,7 +3,9 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/tegra \
 	-I$(top_srcdir)
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = \
+	$(WARN_CFLAGS) \
+	-fvisibility=hidden
 
 LDADD = \
 	../../tegra/libdrm_tegra.la \
diff --git a/tests/vbltest/Makefile.am b/tests/vbltest/Makefile.am
index 276afad5..b6cd7a4d 100644
--- a/tests/vbltest/Makefile.am
+++ b/tests/vbltest/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
 	$(WARN_CFLAGS)\
+	-fvisibility=hidden \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
 	-I$(top_srcdir)
diff --git a/vc4/Makefile.am b/vc4/Makefile.am
index 7e486b4d..5f82d04e 100644
--- a/vc4/Makefile.am
+++ b/vc4/Makefile.am
@@ -23,6 +23,7 @@ include Makefile.sources
 
 AM_CFLAGS = \
 	$(WARN_CFLAGS) \
+	-fvisibility=hidden \
 	-I$(top_srcdir) \
 	$(PTHREADSTUBS_CFLAGS) \
 	$(VALGRIND_CFLAGS) \
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 04/13] libkms: annotate public functions
  2018-09-13 23:57 ` [PATCH libdrm v2 04/13] libkms: " Lucas De Marchi
@ 2018-09-14  8:02   ` Michel Dänzer
  2018-09-20  6:00     ` Lucas De Marchi
  0 siblings, 1 reply; 22+ messages in thread
From: Michel Dänzer @ 2018-09-14  8:02 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Eric Engestrom, Daniel Vetter, dri-devel, Rodrigo Vivi


The shortlog prefix of this patch should be amdgpu: instead of libkms:.
With that fixed, this patch and the radeon patch are

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 00/13] hide library symbols by default
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (12 preceding siblings ...)
  2018-09-13 23:57 ` [PATCH libdrm v2 13/13] autotools: " Lucas De Marchi
@ 2018-09-14  9:28 ` Eric Engestrom
  2018-09-20  0:05   ` Lucas De Marchi
  2018-09-20  6:03   ` Lucas De Marchi
  2018-09-20 12:16 ` Emil Velikov
  14 siblings, 2 replies; 22+ messages in thread
From: Eric Engestrom @ 2018-09-14  9:28 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Daniel Vetter, Rodrigo Vivi, dri-devel

On Thursday, 2018-09-13 16:57:11 -0700, Lucas De Marchi wrote:
> Rely on -fvisibility=hidden to hide the symbols. Previous version of
> this series applying only to drm_intel.so is
> 
> 	Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> 
> but it's not included here since I changed the approach for the build
> system change.

Patches 1 (intel), 5 (libdrm) and 12 (meson) are:
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

The rest of the series is:
Acked-by: Eric Engestrom <eric.engestrom@intel.com>

You can also add the same change to Android:
----8<----
diff --git a/Android.common.mk b/Android.common.mk
index e3de1069dfad4277347c..d0e5d559da1a73cf9fa1 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -2,6 +2,7 @@
 LOCAL_CFLAGS += \
        -DMAJOR_IN_SYSMACROS=1 \
        -DHAVE_VISIBILITY=1 \
+       -fvisibility=hidden \
        -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
 
 LOCAL_CFLAGS += \
---->8----

After that, the `drm_private` macro is ready to be removed :)

> 
> drm_private can also be removed from other symbols but it proved to be
> a lot of manual work to re-align all the fields, so I decided to leave
> it to be done on top as a cleanup.
> 
> There were lots of changes to param alignement that had to be done
> manually, I may have missed some.
> 
> Changes from v1:
> 	- Include changes for all other sub-libraries
> 	- Include changes to autotools
> 	- Make main Makefil.am and meson.build define the required
> 	  flag
> 
> This is build-tested locally and on gitlab:
> https://gitlab.freedesktop.org/demarchi/drm/pipelines/4339
> 
> Lucas De Marchi (13):
>   intel: annotate public functions
>   libkms: annotate public functions
>   nouveau: annotate public functions
>   libkms: annotate public functions
>   libdrm: annotate public functions
>   etnaviv: annotate public functions
>   freedreno: annotate public functions
>   omap: annotate public functions
>   radeon: annotate public functions
>   tegra: annotate public functions
>   exynos: annotate public functions
>   meson: make symbols hidden by default
>   autotools: make symbols hidden by default
> 
>  Makefile.am                      |   1 +
>  amdgpu/Makefile.am               |   1 +
>  amdgpu/amdgpu_bo.c               | 104 ++++++------
>  amdgpu/amdgpu_cs.c               | 137 +++++++--------
>  amdgpu/amdgpu_device.c           |  19 ++-
>  amdgpu/amdgpu_gpu_info.c         |  51 +++---
>  amdgpu/amdgpu_vamgr.c            |  24 +--
>  amdgpu/amdgpu_vm.c               |   5 +-
>  amdgpu/meson.build               |   2 +-
>  etnaviv/Makefile.am              |   1 +
>  etnaviv/etnaviv_bo.c             |  25 +--
>  etnaviv/etnaviv_cmd_stream.c     |  21 ++-
>  etnaviv/etnaviv_device.c         |  10 +-
>  etnaviv/etnaviv_gpu.c            |   6 +-
>  etnaviv/etnaviv_perfmon.c        |   8 +-
>  etnaviv/etnaviv_pipe.c           |   8 +-
>  etnaviv/meson.build              |   2 +-
>  exynos/Makefile.am               |   1 +
>  exynos/exynos_drm.c              |  30 ++--
>  exynos/exynos_fimg2d.c           |  20 +--
>  exynos/meson.build               |   2 +-
>  freedreno/Makefile.am            |   1 +
>  freedreno/freedreno_bo.c         |  32 ++--
>  freedreno/freedreno_device.c     |  12 +-
>  freedreno/freedreno_pipe.c       |  14 +-
>  freedreno/freedreno_ringbuffer.c |  40 ++---
>  freedreno/meson.build            |   2 +-
>  intel/Makefile.am                |   1 +
>  intel/intel_bufmgr.c             |  64 +++----
>  intel/intel_bufmgr_fake.c        |  10 +-
>  intel/intel_bufmgr_gem.c         |  73 ++++----
>  intel/intel_decode.c             |  14 +-
>  intel/meson.build                |   4 +-
>  libdrm_macros.h                  |   2 +
>  libkms/Makefile.am               |   1 +
>  libkms/api.c                     |  16 +-
>  libkms/meson.build               |   2 +-
>  meson.build                      |   5 +-
>  nouveau/Makefile.am              |   1 +
>  nouveau/bufctx.c                 |  10 +-
>  nouveau/meson.build              |   2 +-
>  nouveau/nouveau.c                |  50 +++---
>  nouveau/pushbuf.c                |  18 +-
>  omap/Makefile.am                 |   1 +
>  omap/meson.build                 |   2 +-
>  omap/omap_drm.c                  |  36 ++--
>  radeon/Makefile.am               |   1 +
>  radeon/meson.build               |   2 +-
>  radeon/radeon_bo.c               |  24 +--
>  radeon/radeon_bo_gem.c           |  16 +-
>  radeon/radeon_cs.c               |  24 +--
>  radeon/radeon_cs_gem.c           |   4 +-
>  radeon/radeon_cs_space.c         |   6 +-
>  radeon/radeon_surface.c          |   8 +-
>  tegra/Makefile.am                |   3 +-
>  tegra/meson.build                |   2 +-
>  tegra/tegra.c                    |  26 +--
>  tests/Makefile.am                |   1 +
>  tests/amdgpu/Makefile.am         |   1 +
>  tests/etnaviv/Makefile.am        |   1 +
>  tests/exynos/Makefile.am         |   1 +
>  tests/exynos/meson.build         |   6 +-
>  tests/kms/Makefile.am            |   3 +-
>  tests/kms/meson.build            |   2 +-
>  tests/kmstest/Makefile.am        |   1 +
>  tests/kmstest/meson.build        |   2 +-
>  tests/meson.build                |   8 +-
>  tests/modeprint/Makefile.am      |   1 +
>  tests/modeprint/meson.build      |   2 +-
>  tests/modetest/Makefile.am       |   1 +
>  tests/modetest/meson.build       |   2 +-
>  tests/nouveau/Makefile.am        |   1 +
>  tests/nouveau/meson.build        |   2 +-
>  tests/proptest/Makefile.am       |   1 +
>  tests/proptest/meson.build       |   2 +-
>  tests/radeon/Makefile.am         |   1 +
>  tests/radeon/meson.build         |   2 +-
>  tests/tegra/Makefile.am          |   4 +-
>  tests/tegra/meson.build          |   2 +-
>  tests/vbltest/Makefile.am        |   1 +
>  tests/vbltest/meson.build        |   2 +-
>  vc4/Makefile.am                  |   1 +
>  xf86drm.c                        | 276 ++++++++++++++++---------------
>  xf86drmHash.c                    |  15 +-
>  xf86drmMode.c                    | 158 ++++++++++--------
>  xf86drmRandom.c                  |   9 +-
>  xf86drmSL.c                      |  23 +--
>  87 files changed, 803 insertions(+), 736 deletions(-)
> 
> -- 
> 2.17.1
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 12/13] meson: make symbols hidden by default
  2018-09-13 23:57 ` [PATCH libdrm v2 12/13] meson: make symbols hidden by default Lucas De Marchi
@ 2018-09-14 16:21   ` Dylan Baker
  0 siblings, 0 replies; 22+ messages in thread
From: Dylan Baker @ 2018-09-14 16:21 UTC (permalink / raw)
  To: Lucas De Marchi, dri-devel; +Cc: Eric Engestrom, Daniel Vetter, Rodrigo Vivi


[-- Attachment #1.1: Type: text/plain, Size: 13239 bytes --]

Quoting Lucas De Marchi (2018-09-13 16:57:23)
> Now that symbols that should be exported are annotated accordingly, make
> all the rest hidden by default.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  amdgpu/meson.build          | 2 +-
>  etnaviv/meson.build         | 2 +-
>  exynos/meson.build          | 2 +-
>  freedreno/meson.build       | 2 +-
>  intel/meson.build           | 4 ++--
>  libkms/meson.build          | 2 +-
>  meson.build                 | 5 ++++-
>  nouveau/meson.build         | 2 +-
>  omap/meson.build            | 2 +-
>  radeon/meson.build          | 2 +-
>  tegra/meson.build           | 2 +-
>  tests/exynos/meson.build    | 6 +++---
>  tests/kms/meson.build       | 2 +-
>  tests/kmstest/meson.build   | 2 +-
>  tests/meson.build           | 8 ++++----
>  tests/modeprint/meson.build | 2 +-
>  tests/modetest/meson.build  | 2 +-
>  tests/nouveau/meson.build   | 2 +-
>  tests/proptest/meson.build  | 2 +-
>  tests/radeon/meson.build    | 2 +-
>  tests/tegra/meson.build     | 2 +-
>  tests/vbltest/meson.build   | 2 +-
>  22 files changed, 31 insertions(+), 28 deletions(-)
> 
> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> index d9d7de2d..7c8ccc7e 100644
> --- a/amdgpu/meson.build
> +++ b/amdgpu/meson.build
> @@ -31,7 +31,7 @@ libdrm_amdgpu = shared_library(
>      config_file,
>    ],
>    c_args : [
> -    warn_c_args,
> +    libdrm_c_args,
>      '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(datadir_amdgpu, 'amdgpu.ids')),
>    ],
>    include_directories : [inc_root, inc_drm],
> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> index ca2aa544..515a4ed0 100644
> --- a/etnaviv/meson.build
> +++ b/etnaviv/meson.build
> @@ -30,7 +30,7 @@ libdrm_etnaviv = shared_library(
>    ],
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
>    version : '1.0.0',
>    install : true,
> diff --git a/exynos/meson.build b/exynos/meson.build
> index 30d36405..bdfc3fc6 100644
> --- a/exynos/meson.build
> +++ b/exynos/meson.build
> @@ -21,7 +21,7 @@
>  libdrm_exynos = shared_library(
>    'drm_exynos',
>    [files('exynos_drm.c', 'exynos_fimg2d.c'), config_file],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    dependencies : [dep_pthread_stubs],
> diff --git a/freedreno/meson.build b/freedreno/meson.build
> index 015b7fb1..c9aba060 100644
> --- a/freedreno/meson.build
> +++ b/freedreno/meson.build
> @@ -42,7 +42,7 @@ endif
>  libdrm_freedreno = shared_library(
>    'drm_freedreno',
>    [files_freedreno, config_file],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm],
>    dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
>    link_with : libdrm,
> diff --git a/intel/meson.build b/intel/meson.build
> index ff40ab91..3d6bbac6 100644
> --- a/intel/meson.build
> +++ b/intel/meson.build
> @@ -30,7 +30,7 @@ libdrm_intel = shared_library(
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    version : '1.0.0',
>    install : true,
>  )
> @@ -59,7 +59,7 @@ test_decode = executable(
>    files('test_decode.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : [libdrm, libdrm_intel],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  test(
> diff --git a/libkms/meson.build b/libkms/meson.build
> index 86d1a4ee..dc931608 100644
> --- a/libkms/meson.build
> +++ b/libkms/meson.build
> @@ -44,7 +44,7 @@ endif
>  libkms = shared_library(
>    'kms',
>    [files_libkms, config_file],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : libkms_include,
>    link_with : libdrm,
>    version : '1.0.0',
> diff --git a/meson.build b/meson.build
> index 75c7bdff..80d50188 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -211,6 +211,9 @@ foreach a : ['unused-parameter', 'attributes', 'long-long',
>    endif
>  endforeach
>  
> +# all c args:
> +libdrm_c_args = warn_c_args + ['-fvisibility=hidden']
> +
>  
>  dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
>  dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
> @@ -286,7 +289,7 @@ libdrm = shared_library(
>     ),
>     config_file,
>    ],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    dependencies : [dep_valgrind, dep_rt, dep_m],
>    include_directories : inc_drm,
>    version : '2.4.0',
> diff --git a/nouveau/meson.build b/nouveau/meson.build
> index 51c9a712..0c1498d7 100644
> --- a/nouveau/meson.build
> +++ b/nouveau/meson.build
> @@ -22,7 +22,7 @@
>  libdrm_nouveau = shared_library(
>    'drm_nouveau',
>    [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    dependencies : [dep_threads, dep_atomic_ops],
> diff --git a/omap/meson.build b/omap/meson.build
> index e57b8f5d..54698c6a 100644
> --- a/omap/meson.build
> +++ b/omap/meson.build
> @@ -22,7 +22,7 @@ libdrm_omap = shared_library(
>    'drm_omap',
>    [files('omap_drm.c'), config_file],
>    include_directories : [inc_root, inc_drm],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    link_with : libdrm,
>    dependencies : [dep_pthread_stubs, dep_atomic_ops],
>    version : '1.0.0',
> diff --git a/radeon/meson.build b/radeon/meson.build
> index b08c7442..1fc5282c 100644
> --- a/radeon/meson.build
> +++ b/radeon/meson.build
> @@ -28,7 +28,7 @@ libdrm_radeon = shared_library(
>      ),
>      config_file,
>    ],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    dependencies : [dep_pthread_stubs, dep_atomic_ops],
> diff --git a/tegra/meson.build b/tegra/meson.build
> index 1f5c74b3..4bc454b6 100644
> --- a/tegra/meson.build
> +++ b/tegra/meson.build
> @@ -24,7 +24,7 @@ libdrm_tegra = shared_library(
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    dependencies : [dep_pthread_stubs, dep_atomic_ops],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    version : '0.0.0',
>    install : true,
>  )
> diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
> index 940c3ce4..3a048e8a 100644
> --- a/tests/exynos/meson.build
> +++ b/tests/exynos/meson.build
> @@ -24,7 +24,7 @@ if with_libkms
>    exynos_fimg2d_test = executable(
>      'exynos_fimg2d_test',
>      files('exynos_fimg2d_test.c'),
> -    c_args : warn_c_args,
> +    c_args : libdrm_c_args,
>      include_directories : [inc_root, inc_drm, inc_exynos,
>                             include_directories('../../libkms')],
>      link_with : [libdrm, libkms, libdrm_exynos],
> @@ -36,7 +36,7 @@ endif
>  exynos_fimg2d_perf = executable(
>    'exynos_fimg2d_perf',
>    files('exynos_fimg2d_perf.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm, inc_exynos],
>    link_with : [libdrm, libdrm_exynos],
>    dependencies : dep_threads,
> @@ -46,7 +46,7 @@ exynos_fimg2d_perf = executable(
>  exynos_fimg2d_event = executable(
>    'exynos_fimg2d_event',
>    files('exynos_fimg2d_event.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_drm, inc_exynos],
>    link_with : [libdrm, libdrm_exynos],
>    dependencies : dep_threads,
> diff --git a/tests/kms/meson.build b/tests/kms/meson.build
> index 1f7f724d..91371aa0 100644
> --- a/tests/kms/meson.build
> +++ b/tests/kms/meson.build
> @@ -27,7 +27,7 @@ libkms_test = static_library(
>    ),
>    include_directories : [inc_root, inc_tests, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  kms_steal_crtc = executable(
> diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
> index a47d4951..4fb870f9 100644
> --- a/tests/kmstest/meson.build
> +++ b/tests/kmstest/meson.build
> @@ -21,7 +21,7 @@
>  kmstest = executable(
>    'kmstest',
>    files('main.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [
>      inc_root, inc_tests, include_directories('../../libkms'), inc_drm,
>    ],
> diff --git a/tests/meson.build b/tests/meson.build
> index fdf950b7..6c8ddd9c 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -53,7 +53,7 @@ drmsl = executable(
>    files('drmsl.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  hash = executable(
> @@ -61,7 +61,7 @@ hash = executable(
>    files('hash.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  random = executable(
> @@ -69,7 +69,7 @@ random = executable(
>    files('random.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  drmdevice = executable(
> @@ -77,7 +77,7 @@ drmdevice = executable(
>    files('drmdevice.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  test('random', random, timeout : 240)
> diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
> index 5f0eb24b..898fd181 100644
> --- a/tests/modeprint/meson.build
> +++ b/tests/modeprint/meson.build
> @@ -21,7 +21,7 @@
>  modeprint = executable(
>    'modeprint',
>    files('modeprint.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_tests, inc_drm],
>    link_with : libdrm,
>    dependencies : dep_threads,
> diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build
> index 2a081845..23d84a1d 100644
> --- a/tests/modetest/meson.build
> +++ b/tests/modetest/meson.build
> @@ -21,7 +21,7 @@
>  modetest = executable(
>    'modetest',
>    files('buffers.c', 'cursor.c', 'modetest.c'),
> -  c_args : [warn_c_args, '-Wno-pointer-arith'],
> +  c_args : [libdrm_c_args, '-Wno-pointer-arith'],
>    include_directories : [inc_root, inc_tests, inc_drm],
>    dependencies : [dep_threads, dep_cairo],
>    link_with : [libdrm, libutil],
> diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
> index f5d73c1e..ca4d44f0 100644
> --- a/tests/nouveau/meson.build
> +++ b/tests/nouveau/meson.build
> @@ -24,7 +24,7 @@ threaded = executable(
>    dependencies : [dep_dl, dep_threads],
>    include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
>    link_with : [libdrm, libdrm_nouveau],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
>  
>  test('threaded', threaded)
> diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
> index 22d7473e..9c87965a 100644
> --- a/tests/proptest/meson.build
> +++ b/tests/proptest/meson.build
> @@ -21,7 +21,7 @@
>  proptest = executable(
>    'proptest',
>    files('proptest.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_tests, inc_drm],
>    link_with : [libdrm, libutil],
>    install : with_install_tests,
> diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
> index 9e4f916e..bb345b73 100644
> --- a/tests/radeon/meson.build
> +++ b/tests/radeon/meson.build
> @@ -23,5 +23,5 @@ radeon_ttm = executable(
>    files('rbo.c', 'radeon_ttm.c'),
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>  )
> diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> index 9c74ac4a..4f8c54f4 100644
> --- a/tests/tegra/meson.build
> +++ b/tests/tegra/meson.build
> @@ -22,6 +22,6 @@ openclose = executable(
>    'openclose',
>    files('openclose.c'),
>    include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    link_with : [libdrm, libdrm_tegra],
>  )
> diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
> index ae52ab88..6339feba 100644
> --- a/tests/vbltest/meson.build
> +++ b/tests/vbltest/meson.build
> @@ -21,7 +21,7 @@
>  vbltest = executable(
>    'vbltest',
>    files('vbltest.c'),
> -  c_args : warn_c_args,
> +  c_args : libdrm_c_args,
>    include_directories : [inc_root, inc_tests, inc_drm],
>    link_with : [libdrm, libutil],
>    install : with_install_tests,
> -- 
> 2.17.1
> 

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRxxLdWILx1cItL2yVMlfqrPrBz7AUCW5vgDwAKCRBMlfqrPrBz
7K+gAQCZMg8q7Rs3OszsRwSdto+Rrc0U3v8oOBmB7POqCXpAKQEA8iDAt4jM1dgm
AlTzNDDYBXkNqX6MeQwna9S1nh9hZwU=
=EejK
-----END PGP SIGNATURE-----

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 00/13] hide library symbols by default
  2018-09-14  9:28 ` [PATCH libdrm v2 00/13] hide library symbols " Eric Engestrom
@ 2018-09-20  0:05   ` Lucas De Marchi
  2018-09-20  6:03   ` Lucas De Marchi
  1 sibling, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-20  0:05 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: Daniel Vetter, Rodrigo Vivi, dri-devel

On Fri, Sep 14, 2018 at 10:28:46AM +0100, Eric Engestrom wrote:
> On Thursday, 2018-09-13 16:57:11 -0700, Lucas De Marchi wrote:
> > Rely on -fvisibility=hidden to hide the symbols. Previous version of
> > this series applying only to drm_intel.so is
> > 
> > 	Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> > 
> > but it's not included here since I changed the approach for the build
> > system change.
> 
> Patches 1 (intel), 5 (libdrm) and 12 (meson) are:
> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> 
> The rest of the series is:
> Acked-by: Eric Engestrom <eric.engestrom@intel.com>
> 
> You can also add the same change to Android:
> ----8<----
> diff --git a/Android.common.mk b/Android.common.mk
> index e3de1069dfad4277347c..d0e5d559da1a73cf9fa1 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -2,6 +2,7 @@
>  LOCAL_CFLAGS += \
>         -DMAJOR_IN_SYSMACROS=1 \
>         -DHAVE_VISIBILITY=1 \
> +       -fvisibility=hidden \
>         -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
>  
>  LOCAL_CFLAGS += \
> ---->8----

thanks. I added a commit on top with that. I also collected the 
other ack/rev and pushed to my gitlab repo. I will wait to see
if I will resend for someone to push this through or if I will
get write access soon.

> 
> After that, the `drm_private` macro is ready to be removed :)

yep, but the coding reformat is a nightmare since I have realig
parameters to the opening parenthesis in several (but not all)
cases. I may need to try some other automation for that
(git-clang-format?, clang-tidy?, coccinelle?, ...).

thanks
Lucas De Marchi

> 
> > 
> > drm_private can also be removed from other symbols but it proved to be
> > a lot of manual work to re-align all the fields, so I decided to leave
> > it to be done on top as a cleanup.
> > 
> > There were lots of changes to param alignement that had to be done
> > manually, I may have missed some.
> > 
> > Changes from v1:
> > 	- Include changes for all other sub-libraries
> > 	- Include changes to autotools
> > 	- Make main Makefil.am and meson.build define the required
> > 	  flag
> > 
> > This is build-tested locally and on gitlab:
> > https://gitlab.freedesktop.org/demarchi/drm/pipelines/4339
> > 
> > Lucas De Marchi (13):
> >   intel: annotate public functions
> >   libkms: annotate public functions
> >   nouveau: annotate public functions
> >   libkms: annotate public functions
> >   libdrm: annotate public functions
> >   etnaviv: annotate public functions
> >   freedreno: annotate public functions
> >   omap: annotate public functions
> >   radeon: annotate public functions
> >   tegra: annotate public functions
> >   exynos: annotate public functions
> >   meson: make symbols hidden by default
> >   autotools: make symbols hidden by default
> > 
> >  Makefile.am                      |   1 +
> >  amdgpu/Makefile.am               |   1 +
> >  amdgpu/amdgpu_bo.c               | 104 ++++++------
> >  amdgpu/amdgpu_cs.c               | 137 +++++++--------
> >  amdgpu/amdgpu_device.c           |  19 ++-
> >  amdgpu/amdgpu_gpu_info.c         |  51 +++---
> >  amdgpu/amdgpu_vamgr.c            |  24 +--
> >  amdgpu/amdgpu_vm.c               |   5 +-
> >  amdgpu/meson.build               |   2 +-
> >  etnaviv/Makefile.am              |   1 +
> >  etnaviv/etnaviv_bo.c             |  25 +--
> >  etnaviv/etnaviv_cmd_stream.c     |  21 ++-
> >  etnaviv/etnaviv_device.c         |  10 +-
> >  etnaviv/etnaviv_gpu.c            |   6 +-
> >  etnaviv/etnaviv_perfmon.c        |   8 +-
> >  etnaviv/etnaviv_pipe.c           |   8 +-
> >  etnaviv/meson.build              |   2 +-
> >  exynos/Makefile.am               |   1 +
> >  exynos/exynos_drm.c              |  30 ++--
> >  exynos/exynos_fimg2d.c           |  20 +--
> >  exynos/meson.build               |   2 +-
> >  freedreno/Makefile.am            |   1 +
> >  freedreno/freedreno_bo.c         |  32 ++--
> >  freedreno/freedreno_device.c     |  12 +-
> >  freedreno/freedreno_pipe.c       |  14 +-
> >  freedreno/freedreno_ringbuffer.c |  40 ++---
> >  freedreno/meson.build            |   2 +-
> >  intel/Makefile.am                |   1 +
> >  intel/intel_bufmgr.c             |  64 +++----
> >  intel/intel_bufmgr_fake.c        |  10 +-
> >  intel/intel_bufmgr_gem.c         |  73 ++++----
> >  intel/intel_decode.c             |  14 +-
> >  intel/meson.build                |   4 +-
> >  libdrm_macros.h                  |   2 +
> >  libkms/Makefile.am               |   1 +
> >  libkms/api.c                     |  16 +-
> >  libkms/meson.build               |   2 +-
> >  meson.build                      |   5 +-
> >  nouveau/Makefile.am              |   1 +
> >  nouveau/bufctx.c                 |  10 +-
> >  nouveau/meson.build              |   2 +-
> >  nouveau/nouveau.c                |  50 +++---
> >  nouveau/pushbuf.c                |  18 +-
> >  omap/Makefile.am                 |   1 +
> >  omap/meson.build                 |   2 +-
> >  omap/omap_drm.c                  |  36 ++--
> >  radeon/Makefile.am               |   1 +
> >  radeon/meson.build               |   2 +-
> >  radeon/radeon_bo.c               |  24 +--
> >  radeon/radeon_bo_gem.c           |  16 +-
> >  radeon/radeon_cs.c               |  24 +--
> >  radeon/radeon_cs_gem.c           |   4 +-
> >  radeon/radeon_cs_space.c         |   6 +-
> >  radeon/radeon_surface.c          |   8 +-
> >  tegra/Makefile.am                |   3 +-
> >  tegra/meson.build                |   2 +-
> >  tegra/tegra.c                    |  26 +--
> >  tests/Makefile.am                |   1 +
> >  tests/amdgpu/Makefile.am         |   1 +
> >  tests/etnaviv/Makefile.am        |   1 +
> >  tests/exynos/Makefile.am         |   1 +
> >  tests/exynos/meson.build         |   6 +-
> >  tests/kms/Makefile.am            |   3 +-
> >  tests/kms/meson.build            |   2 +-
> >  tests/kmstest/Makefile.am        |   1 +
> >  tests/kmstest/meson.build        |   2 +-
> >  tests/meson.build                |   8 +-
> >  tests/modeprint/Makefile.am      |   1 +
> >  tests/modeprint/meson.build      |   2 +-
> >  tests/modetest/Makefile.am       |   1 +
> >  tests/modetest/meson.build       |   2 +-
> >  tests/nouveau/Makefile.am        |   1 +
> >  tests/nouveau/meson.build        |   2 +-
> >  tests/proptest/Makefile.am       |   1 +
> >  tests/proptest/meson.build       |   2 +-
> >  tests/radeon/Makefile.am         |   1 +
> >  tests/radeon/meson.build         |   2 +-
> >  tests/tegra/Makefile.am          |   4 +-
> >  tests/tegra/meson.build          |   2 +-
> >  tests/vbltest/Makefile.am        |   1 +
> >  tests/vbltest/meson.build        |   2 +-
> >  vc4/Makefile.am                  |   1 +
> >  xf86drm.c                        | 276 ++++++++++++++++---------------
> >  xf86drmHash.c                    |  15 +-
> >  xf86drmMode.c                    | 158 ++++++++++--------
> >  xf86drmRandom.c                  |   9 +-
> >  xf86drmSL.c                      |  23 +--
> >  87 files changed, 803 insertions(+), 736 deletions(-)
> > 
> > -- 
> > 2.17.1
> > 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 04/13] libkms: annotate public functions
  2018-09-14  8:02   ` Michel Dänzer
@ 2018-09-20  6:00     ` Lucas De Marchi
  0 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-20  6:00 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Eric Engestrom, Daniel Vetter, dri-devel, Rodrigo Vivi

On Fri, Sep 14, 2018 at 10:02:19AM +0200, Michel Dänzer wrote:
> 
> The shortlog prefix of this patch should be amdgpu: instead of libkms:.

thanks, I fixed that.

Lucas De Marchi

> With that fixed, this patch and the radeon patch are
> 
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> 
> -- 
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 00/13] hide library symbols by default
  2018-09-14  9:28 ` [PATCH libdrm v2 00/13] hide library symbols " Eric Engestrom
  2018-09-20  0:05   ` Lucas De Marchi
@ 2018-09-20  6:03   ` Lucas De Marchi
  1 sibling, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-20  6:03 UTC (permalink / raw)
  To: Eric Engestrom
  Cc: Daniel Vetter, Michel Dänzer, dri-devel, Dylan Baker, Rodrigo Vivi

On Fri, Sep 14, 2018 at 10:28:46AM +0100, Eric Engestrom wrote:
> On Thursday, 2018-09-13 16:57:11 -0700, Lucas De Marchi wrote:
> > Rely on -fvisibility=hidden to hide the symbols. Previous version of
> > this series applying only to drm_intel.so is
> > 
> > 	Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> > 
> > but it's not included here since I changed the approach for the build
> > system change.
> 
> Patches 1 (intel), 5 (libdrm) and 12 (meson) are:
> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> 
> The rest of the series is:
> Acked-by: Eric Engestrom <eric.engestrom@intel.com>

Added the r-b/a-b and pushed the series. Thanks.

Lucas De Marchi

> 
> You can also add the same change to Android:
> ----8<----
> diff --git a/Android.common.mk b/Android.common.mk
> index e3de1069dfad4277347c..d0e5d559da1a73cf9fa1 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -2,6 +2,7 @@
>  LOCAL_CFLAGS += \
>         -DMAJOR_IN_SYSMACROS=1 \
>         -DHAVE_VISIBILITY=1 \
> +       -fvisibility=hidden \
>         -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
>  
>  LOCAL_CFLAGS += \
> ---->8----
> 
> After that, the `drm_private` macro is ready to be removed :)
> 
> > 
> > drm_private can also be removed from other symbols but it proved to be
> > a lot of manual work to re-align all the fields, so I decided to leave
> > it to be done on top as a cleanup.
> > 
> > There were lots of changes to param alignement that had to be done
> > manually, I may have missed some.
> > 
> > Changes from v1:
> > 	- Include changes for all other sub-libraries
> > 	- Include changes to autotools
> > 	- Make main Makefil.am and meson.build define the required
> > 	  flag
> > 
> > This is build-tested locally and on gitlab:
> > https://gitlab.freedesktop.org/demarchi/drm/pipelines/4339
> > 
> > Lucas De Marchi (13):
> >   intel: annotate public functions
> >   libkms: annotate public functions
> >   nouveau: annotate public functions
> >   libkms: annotate public functions
> >   libdrm: annotate public functions
> >   etnaviv: annotate public functions
> >   freedreno: annotate public functions
> >   omap: annotate public functions
> >   radeon: annotate public functions
> >   tegra: annotate public functions
> >   exynos: annotate public functions
> >   meson: make symbols hidden by default
> >   autotools: make symbols hidden by default
> > 
> >  Makefile.am                      |   1 +
> >  amdgpu/Makefile.am               |   1 +
> >  amdgpu/amdgpu_bo.c               | 104 ++++++------
> >  amdgpu/amdgpu_cs.c               | 137 +++++++--------
> >  amdgpu/amdgpu_device.c           |  19 ++-
> >  amdgpu/amdgpu_gpu_info.c         |  51 +++---
> >  amdgpu/amdgpu_vamgr.c            |  24 +--
> >  amdgpu/amdgpu_vm.c               |   5 +-
> >  amdgpu/meson.build               |   2 +-
> >  etnaviv/Makefile.am              |   1 +
> >  etnaviv/etnaviv_bo.c             |  25 +--
> >  etnaviv/etnaviv_cmd_stream.c     |  21 ++-
> >  etnaviv/etnaviv_device.c         |  10 +-
> >  etnaviv/etnaviv_gpu.c            |   6 +-
> >  etnaviv/etnaviv_perfmon.c        |   8 +-
> >  etnaviv/etnaviv_pipe.c           |   8 +-
> >  etnaviv/meson.build              |   2 +-
> >  exynos/Makefile.am               |   1 +
> >  exynos/exynos_drm.c              |  30 ++--
> >  exynos/exynos_fimg2d.c           |  20 +--
> >  exynos/meson.build               |   2 +-
> >  freedreno/Makefile.am            |   1 +
> >  freedreno/freedreno_bo.c         |  32 ++--
> >  freedreno/freedreno_device.c     |  12 +-
> >  freedreno/freedreno_pipe.c       |  14 +-
> >  freedreno/freedreno_ringbuffer.c |  40 ++---
> >  freedreno/meson.build            |   2 +-
> >  intel/Makefile.am                |   1 +
> >  intel/intel_bufmgr.c             |  64 +++----
> >  intel/intel_bufmgr_fake.c        |  10 +-
> >  intel/intel_bufmgr_gem.c         |  73 ++++----
> >  intel/intel_decode.c             |  14 +-
> >  intel/meson.build                |   4 +-
> >  libdrm_macros.h                  |   2 +
> >  libkms/Makefile.am               |   1 +
> >  libkms/api.c                     |  16 +-
> >  libkms/meson.build               |   2 +-
> >  meson.build                      |   5 +-
> >  nouveau/Makefile.am              |   1 +
> >  nouveau/bufctx.c                 |  10 +-
> >  nouveau/meson.build              |   2 +-
> >  nouveau/nouveau.c                |  50 +++---
> >  nouveau/pushbuf.c                |  18 +-
> >  omap/Makefile.am                 |   1 +
> >  omap/meson.build                 |   2 +-
> >  omap/omap_drm.c                  |  36 ++--
> >  radeon/Makefile.am               |   1 +
> >  radeon/meson.build               |   2 +-
> >  radeon/radeon_bo.c               |  24 +--
> >  radeon/radeon_bo_gem.c           |  16 +-
> >  radeon/radeon_cs.c               |  24 +--
> >  radeon/radeon_cs_gem.c           |   4 +-
> >  radeon/radeon_cs_space.c         |   6 +-
> >  radeon/radeon_surface.c          |   8 +-
> >  tegra/Makefile.am                |   3 +-
> >  tegra/meson.build                |   2 +-
> >  tegra/tegra.c                    |  26 +--
> >  tests/Makefile.am                |   1 +
> >  tests/amdgpu/Makefile.am         |   1 +
> >  tests/etnaviv/Makefile.am        |   1 +
> >  tests/exynos/Makefile.am         |   1 +
> >  tests/exynos/meson.build         |   6 +-
> >  tests/kms/Makefile.am            |   3 +-
> >  tests/kms/meson.build            |   2 +-
> >  tests/kmstest/Makefile.am        |   1 +
> >  tests/kmstest/meson.build        |   2 +-
> >  tests/meson.build                |   8 +-
> >  tests/modeprint/Makefile.am      |   1 +
> >  tests/modeprint/meson.build      |   2 +-
> >  tests/modetest/Makefile.am       |   1 +
> >  tests/modetest/meson.build       |   2 +-
> >  tests/nouveau/Makefile.am        |   1 +
> >  tests/nouveau/meson.build        |   2 +-
> >  tests/proptest/Makefile.am       |   1 +
> >  tests/proptest/meson.build       |   2 +-
> >  tests/radeon/Makefile.am         |   1 +
> >  tests/radeon/meson.build         |   2 +-
> >  tests/tegra/Makefile.am          |   4 +-
> >  tests/tegra/meson.build          |   2 +-
> >  tests/vbltest/Makefile.am        |   1 +
> >  tests/vbltest/meson.build        |   2 +-
> >  vc4/Makefile.am                  |   1 +
> >  xf86drm.c                        | 276 ++++++++++++++++---------------
> >  xf86drmHash.c                    |  15 +-
> >  xf86drmMode.c                    | 158 ++++++++++--------
> >  xf86drmRandom.c                  |   9 +-
> >  xf86drmSL.c                      |  23 +--
> >  87 files changed, 803 insertions(+), 736 deletions(-)
> > 
> > -- 
> > 2.17.1
> > 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 00/13] hide library symbols by default
  2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
                   ` (13 preceding siblings ...)
  2018-09-14  9:28 ` [PATCH libdrm v2 00/13] hide library symbols " Eric Engestrom
@ 2018-09-20 12:16 ` Emil Velikov
  2018-09-21 21:14   ` Lucas De Marchi
  14 siblings, 1 reply; 22+ messages in thread
From: Emil Velikov @ 2018-09-20 12:16 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Eric Engestrom, Daniel Vetter, ML dri-devel, Rodrigo Vivi

On 14 September 2018 at 00:57, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Rely on -fvisibility=hidden to hide the symbols. Previous version of
> this series applying only to drm_intel.so is
>
>         Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
>
> but it's not included here since I changed the approach for the build
> system change.
>
> drm_private can also be removed from other symbols but it proved to be
> a lot of manual work to re-align all the fields, so I decided to leave
> it to be done on top as a cleanup.
>
Did you read through the reasoning behind
0f8da82500ec542e269092c0718479e25eaff5f6?

Alternatively you do not care too much about compat in said cases,
which is fine.
My only request is - keep it only for the Intel bits.

Thanks
Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH libdrm v2 00/13] hide library symbols by default
  2018-09-20 12:16 ` Emil Velikov
@ 2018-09-21 21:14   ` Lucas De Marchi
  0 siblings, 0 replies; 22+ messages in thread
From: Lucas De Marchi @ 2018-09-21 21:14 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Eric Engestrom, Daniel Vetter, ML dri-devel, Rodrigo Vivi

On Thu, Sep 20, 2018 at 01:16:09PM +0100, Emil Velikov wrote:
> On 14 September 2018 at 00:57, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > Rely on -fvisibility=hidden to hide the symbols. Previous version of
> > this series applying only to drm_intel.so is
> >
> >         Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> >
> > but it's not included here since I changed the approach for the build
> > system change.
> >
> > drm_private can also be removed from other symbols but it proved to be
> > a lot of manual work to re-align all the fields, so I decided to leave
> > it to be done on top as a cleanup.
> >
> Did you read through the reasoning behind
> 0f8da82500ec542e269092c0718479e25eaff5f6?

In v1 (https://lists.freedesktop.org/archives/dri-devel/2018-September/189639.html)
I had this:
    From git log archeology and mention in another thread we used to pass
    -fvisibility=hidden, but reverted to the contrary due to bug in obscure
    toolchain some years ago (see 0f8da82500ec542e269092c0718479e25eaff5f6).
    I think it's time to revisit that decision: we have plenty of other
    projects doing that nowadays without problem.

It looks like for some reason this was not part of the coverletter in v2,
sorry.

> 
> Alternatively you do not care too much about compat in said cases,
> which is fine.
> My only request is - keep it only for the Intel bits.

this is not only for Intel bits, it's improving all the libdrm as a whole.

A decision/commit made 3 year can be revisited, we don't have to carry it
forever. Do we have a problem with it *today*?  If we do, then we may have
another decision like working it around for the sad said compiler rather
than for everybody.  Default visibility hidden is a sane default adopted by
multiple open source libraries as it avoids unwanted results that can't
be taken back (like exporting a symbol that shouldn't have been) and
reduces maintenance (just look at the custom scripts we have to keep
checking the exported symbols).

Lucas De Marchi

> 
> Thanks
> Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-09-21 21:14 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13 23:57 [PATCH libdrm v2 00/13] hide library symbols by default Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 01/13] intel: annotate public functions Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 02/13] libkms: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 03/13] nouveau: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 04/13] libkms: " Lucas De Marchi
2018-09-14  8:02   ` Michel Dänzer
2018-09-20  6:00     ` Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 05/13] libdrm: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 06/13] etnaviv: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 07/13] freedreno: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 08/13] omap: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 09/13] radeon: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 10/13] tegra: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 11/13] exynos: " Lucas De Marchi
2018-09-13 23:57 ` [PATCH libdrm v2 12/13] meson: make symbols hidden by default Lucas De Marchi
2018-09-14 16:21   ` Dylan Baker
2018-09-13 23:57 ` [PATCH libdrm v2 13/13] autotools: " Lucas De Marchi
2018-09-14  9:28 ` [PATCH libdrm v2 00/13] hide library symbols " Eric Engestrom
2018-09-20  0:05   ` Lucas De Marchi
2018-09-20  6:03   ` Lucas De Marchi
2018-09-20 12:16 ` Emil Velikov
2018-09-21 21:14   ` Lucas De Marchi

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.