diff options
52 files changed, 612 insertions, 735 deletions
diff --git a/lib/libdrm/Makefile.am b/lib/libdrm/Makefile.am index faf0f7507..730de1f2d 100644 --- a/lib/libdrm/Makefile.am +++ b/lib/libdrm/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/lib/libdrm/Makefile.bsd-wrapper b/lib/libdrm/Makefile.bsd-wrapper index a17060c5d..c86e74695 100644 --- a/lib/libdrm/Makefile.bsd-wrapper +++ b/lib/libdrm/Makefile.bsd-wrapper @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.16 2018/09/13 12:02:27 jsg Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.17 2018/11/01 08:29:47 jsg Exp $ SHARED_LIBS= drm 7.6 drm_radeon 4.0 drm_intel 5.4 \ - drm_amdgpu 1.6 drm_nouveau 3.0 + drm_amdgpu 1.7 drm_nouveau 3.0 .include <bsd.xorg.mk> diff --git a/lib/libdrm/Makefile.in b/lib/libdrm/Makefile.in index 144394c94..a609a7da4 100644 --- a/lib/libdrm/Makefile.in +++ b/lib/libdrm/Makefile.in @@ -512,6 +512,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/lib/libdrm/amdgpu/Makefile.am b/lib/libdrm/amdgpu/Makefile.am index a1b0d05c1..ef8ab0575 100644 --- a/lib/libdrm/amdgpu/Makefile.am +++ b/lib/libdrm/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 @@ -47,5 +48,6 @@ libdrm_amdgpuinclude_HEADERS = $(LIBDRM_AMDGPU_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_amdgpu.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = amdgpu-symbol-check EXTRA_DIST = $(TESTS) diff --git a/lib/libdrm/amdgpu/Makefile.in b/lib/libdrm/amdgpu/Makefile.in index e927cd92b..5e85392e2 100644 --- a/lib/libdrm/amdgpu/Makefile.in +++ b/lib/libdrm/amdgpu/Makefile.in @@ -353,6 +353,7 @@ LIBDRM_AMDGPU_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm @@ -366,6 +367,7 @@ libdrm_amdgpu_la_SOURCES = $(LIBDRM_AMDGPU_FILES) libdrm_amdgpuincludedir = ${includedir}/libdrm libdrm_amdgpuinclude_HEADERS = $(LIBDRM_AMDGPU_H_FILES) pkgconfig_DATA = libdrm_amdgpu.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = amdgpu-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/amdgpu/amdgpu_bo.c b/lib/libdrm/amdgpu/amdgpu_bo.c index 2f4f90f6e..c0f42e810 100644 --- a/lib/libdrm/amdgpu/amdgpu_bo.c +++ b/lib/libdrm/amdgpu/amdgpu_bo.c @@ -69,24 +69,19 @@ 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; - int r = 0; - - /* It's an error if the heap is not specified */ - if (!(heap & (AMDGPU_GEM_DOMAIN_GTT | AMDGPU_GEM_DOMAIN_VRAM))) - return -EINVAL; + int r; memset(&args, 0, sizeof(args)); args.in.bo_size = alloc_buffer->alloc_size; args.in.alignment = alloc_buffer->phys_alignment; /* Set the placement. */ - args.in.domains = heap; + args.in.domains = alloc_buffer->preferred_heap; args.in.domain_flags = alloc_buffer->flags; /* Allocate the buffer with the preferred heap. */ @@ -112,8 +107,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 +130,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 +227,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 +255,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 +401,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,7 +433,12 @@ int amdgpu_bo_free(amdgpu_bo_handle buf_handle) return 0; } -int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu) +drm_public void amdgpu_bo_inc_ref(amdgpu_bo_handle bo) +{ + atomic_inc(&bo->refcount); +} + +drm_public int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu) { union drm_amdgpu_gem_mmap args; void *ptr; @@ -486,7 +486,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; @@ -512,7 +512,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; @@ -520,8 +520,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; @@ -543,14 +543,15 @@ 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) { - uint32_t i; struct amdgpu_bo *bo; + uint32_t i; + int r = 0; if (cpu == NULL || size == 0) return -EINVAL; @@ -577,16 +578,17 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, } else { *buf_handle = NULL; *offset_in_bo = 0; + r = -ENXIO; } pthread_mutex_unlock(&dev->bo_table_mutex); - return 0; + 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; @@ -616,11 +618,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; @@ -671,7 +673,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; @@ -689,10 +691,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; @@ -730,12 +732,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; @@ -747,13 +749,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/lib/libdrm/configure b/lib/libdrm/configure index 640a36bb5..d647bb8d1 100644 --- a/lib/libdrm/configure +++ b/lib/libdrm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libdrm 2.4.94. +# Generated by GNU Autoconf 2.69 for libdrm 2.4.96. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=DRI>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libdrm' PACKAGE_TARNAME='libdrm' -PACKAGE_VERSION='2.4.94' -PACKAGE_STRING='libdrm 2.4.94' +PACKAGE_VERSION='2.4.96' +PACKAGE_STRING='libdrm 2.4.96' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI' PACKAGE_URL='' @@ -1423,7 +1423,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libdrm 2.4.94 to adapt to many kinds of systems. +\`configure' configures libdrm 2.4.96 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1493,7 +1493,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdrm 2.4.94:";; + short | recursive ) echo "Configuration of libdrm 2.4.96:";; esac cat <<\_ACEOF @@ -1663,7 +1663,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdrm configure 2.4.94 +libdrm configure 2.4.96 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2086,7 +2086,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libdrm $as_me 2.4.94, which was +It was created by libdrm $as_me 2.4.96, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3459,7 +3459,7 @@ fi # Define the identity of the package. PACKAGE='libdrm' - VERSION='2.4.94' + VERSION='2.4.96' cat >>confdefs.h <<_ACEOF @@ -14697,7 +14697,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libdrm $as_me 2.4.94, which was +This file was extended by libdrm $as_me 2.4.96, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14763,7 +14763,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdrm config.status 2.4.94 +libdrm config.status 2.4.96 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/lib/libdrm/configure.ac b/lib/libdrm/configure.ac index 7c8093b24..3e44805d3 100644 --- a/lib/libdrm/configure.ac +++ b/lib/libdrm/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.94], + [2.4.96], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) diff --git a/lib/libdrm/etnaviv/Makefile.in b/lib/libdrm/etnaviv/Makefile.in index 305ff46f0..9d4695682 100644 --- a/lib/libdrm/etnaviv/Makefile.in +++ b/lib/libdrm/etnaviv/Makefile.in @@ -328,6 +328,7 @@ LIBDRM_ETNAVIV_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm @@ -344,6 +345,7 @@ libdrm_etnaviv_la_SOURCES = $(LIBDRM_ETNAVIV_FILES) libdrm_etnavivincludedir = ${includedir}/libdrm libdrm_etnavivinclude_HEADERS = $(LIBDRM_ETNAVIV_H_FILES) pkgconfig_DATA = libdrm_etnaviv.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = etnaviv-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/exynos/Makefile.in b/lib/libdrm/exynos/Makefile.in index 3341481bc..1efb3463e 100644 --- a/lib/libdrm/exynos/Makefile.in +++ b/lib/libdrm/exynos/Makefile.in @@ -314,6 +314,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm @@ -332,6 +333,7 @@ libdrm_exynoscommoninclude_HEADERS = exynos_drm.h exynos_fimg2d.h libdrm_exynosincludedir = ${includedir}/libdrm libdrm_exynosinclude_HEADERS = exynos_drmif.h pkgconfig_DATA = libdrm_exynos.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = exynos-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/freedreno/Makefile.in b/lib/libdrm/freedreno/Makefile.in index 17dbe2335..2d143abfe 100644 --- a/lib/libdrm/freedreno/Makefile.in +++ b/lib/libdrm/freedreno/Makefile.in @@ -355,6 +355,7 @@ LIBDRM_FREEDRENO_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ $(VALGRIND_CFLAGS) \ @@ -373,6 +374,7 @@ libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES) \ libdrm_freedrenocommonincludedir = ${includedir}/freedreno libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_H_FILES) pkgconfig_DATA = libdrm_freedreno.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = freedreno-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/include/drm/drm.h b/lib/libdrm/include/drm/drm.h index f0bd91de0..85c685a20 100644 --- a/lib/libdrm/include/drm/drm.h +++ b/lib/libdrm/include/drm/drm.h @@ -674,6 +674,22 @@ struct drm_get_cap { */ #define DRM_CLIENT_CAP_ATOMIC 3 +/** + * DRM_CLIENT_CAP_ASPECT_RATIO + * + * If set to 1, the DRM core will provide aspect ratio information in modes. + */ +#define DRM_CLIENT_CAP_ASPECT_RATIO 4 + +/** + * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS + * + * If set to 1, the DRM core will expose special connectors to be used for + * writing back to memory the scene setup in the commit. Depends on client + * also supporting DRM_CLIENT_CAP_ATOMIC + */ +#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 + /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; diff --git a/lib/libdrm/include/drm/i915_drm.h b/lib/libdrm/include/drm/i915_drm.h index 16e452aa1..268b585f8 100644 --- a/lib/libdrm/include/drm/i915_drm.h +++ b/lib/libdrm/include/drm/i915_drm.h @@ -529,6 +529,28 @@ typedef struct drm_i915_irq_wait { */ #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 +/* + * Once upon a time we supposed that writes through the GGTT would be + * immediately in physical memory (once flushed out of the CPU path). However, + * on a few different processors and chipsets, this is not necessarily the case + * as the writes appear to be buffered internally. Thus a read of the backing + * storage (physical memory) via a different path (with different physical tags + * to the indirect write via the GGTT) will see stale values from before + * the GGTT write. Inside the kernel, we can for the most part keep track of + * the different read/write domains in use (e.g. set-domain), but the assumption + * of coherency is baked into the ABI, hence reporting its true state in this + * parameter. + * + * Reports true when writes via mmap_gtt are immediately visible following an + * lfence to flush the WCB. + * + * Reports false when writes via mmap_gtt are indeterminately delayed in an in + * internal buffer and are _not_ immediately visible to third parties accessing + * directly via mmap_cpu/mmap_wc. Use of mmap_gtt as part of an IPC + * communications channel when reporting false is strongly disadvised. + */ +#define I915_PARAM_MMAP_GTT_COHERENT 52 + typedef struct drm_i915_getparam { __s32 param; /* diff --git a/lib/libdrm/intel/Makefile.am b/lib/libdrm/intel/Makefile.am index c52e8c086..bad44f5f4 100644 --- a/lib/libdrm/intel/Makefile.am +++ b/lib/libdrm/intel/Makefile.am @@ -26,6 +26,7 @@ include Makefile.sources AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ $(PCIACCESS_CFLAGS) \ @@ -56,6 +57,7 @@ BATCHES = \ tests/gen7-2d-copy.batch \ tests/gen7-3d.batch +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = \ $(BATCHES:.batch=.batch.sh) \ intel-symbol-check diff --git a/lib/libdrm/intel/Makefile.in b/lib/libdrm/intel/Makefile.in index c89c46865..541d3b916 100644 --- a/lib/libdrm/intel/Makefile.in +++ b/lib/libdrm/intel/Makefile.in @@ -127,7 +127,7 @@ am__installdirs = "$(DESTDIR)$(libdrm_intel_ladir)" \ LTLIBRARIES = $(libdrm_intel_la_LTLIBRARIES) libdrm_intel_la_DEPENDENCIES = ../libdrm.la am__objects_1 = intel_bufmgr.lo intel_bufmgr_fake.lo \ - intel_bufmgr_gem.lo intel_decode.lo mm.lo + intel_bufmgr_gem.lo intel_decode.lo intel_chipset.lo mm.lo am_libdrm_intel_la_OBJECTS = $(am__objects_1) libdrm_intel_la_OBJECTS = $(am_libdrm_intel_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -346,12 +346,14 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBDRM_INTEL_FILES := \ + i915_pciids.h \ intel_bufmgr.c \ intel_bufmgr_priv.h \ intel_bufmgr_fake.c \ intel_bufmgr_gem.c \ intel_decode.c \ intel_chipset.h \ + intel_chipset.c \ mm.c \ mm.h \ uthash.h @@ -363,6 +365,7 @@ LIBDRM_INTEL_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ $(PCIACCESS_CFLAGS) \ @@ -388,6 +391,7 @@ BATCHES = \ tests/gen7-2d-copy.batch \ tests/gen7-3d.batch +AM_TESTS_ENVIRONMENT = NM='$(NM)' EXTRA_DIST = \ $(BATCHES) \ $(BATCHES:.batch=.batch.sh) \ @@ -493,6 +497,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_bufmgr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_bufmgr_fake.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_bufmgr_gem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_chipset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_decode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_decode.Po@am__quote@ diff --git a/lib/libdrm/intel/intel_bufmgr.c b/lib/libdrm/intel/intel_bufmgr.c index 192de093c..68d97c0e9 100644 --- a/lib/libdrm/intel/intel_bufmgr.c +++ b/lib/libdrm/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/lib/libdrm/intel/intel_bufmgr_fake.c b/lib/libdrm/intel/intel_bufmgr_fake.c index 3b24b81bb..0cec51f5b 100644 --- a/lib/libdrm/intel/intel_bufmgr_fake.c +++ b/lib/libdrm/intel/intel_bufmgr_fake.c @@ -241,7 +241,7 @@ FENCE_LTE(unsigned a, unsigned b) return 0; } -void +drm_public void drm_intel_bufmgr_fake_set_fence_callback(drm_intel_bufmgr *bufmgr, unsigned int (*emit) (void *priv), void (*wait) (unsigned int fence, @@ -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, @@ -955,7 +955,7 @@ drm_intel_fake_bo_unreference(drm_intel_bo *bo) * Set the buffer as not requiring backing store, and instead get the callback * invoked whenever it would be set dirty. */ -void +drm_public void drm_intel_bo_fake_disable_backing_store(drm_intel_bo *bo, void (*invalidate_cb) (drm_intel_bo *bo, void *ptr), @@ -1409,7 +1409,7 @@ drm_intel_bo_fake_post_submit(drm_intel_bo *bo) bo_fake->write_domain = 0; } -void +drm_public void drm_intel_bufmgr_fake_set_exec_callback(drm_intel_bufmgr *bufmgr, int (*exec) (drm_intel_bo *bo, unsigned int used, @@ -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/lib/libdrm/intel/intel_bufmgr_gem.c b/lib/libdrm/intel/intel_bufmgr_gem.c index 8c3a4b209..fbf48730d 100644 --- a/lib/libdrm/intel/intel_bufmgr_gem.c +++ b/lib/libdrm/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; @@ -3656,13 +3655,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->gen = 7; else if (IS_GEN8(bufmgr_gem->pci_device)) bufmgr_gem->gen = 8; - else if (IS_GEN9(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 9; - else if (IS_GEN10(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 10; - else if (IS_GEN11(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 11; - else { + else if (!intel_get_genx(bufmgr_gem->pci_device, &bufmgr_gem->gen)) { free(bufmgr_gem); bufmgr_gem = NULL; goto exit; diff --git a/lib/libdrm/intel/intel_chipset.h b/lib/libdrm/intel/intel_chipset.h index 4a34b7bed..5db207ccb 100644 --- a/lib/libdrm/intel/intel_chipset.h +++ b/lib/libdrm/intel/intel_chipset.h @@ -165,111 +165,8 @@ #define PCI_CHIP_CHERRYVIEW_2 0x22b2 #define PCI_CHIP_CHERRYVIEW_3 0x22b3 -#define PCI_CHIP_SKYLAKE_DT_GT1 0x1902 -#define PCI_CHIP_SKYLAKE_ULT_GT1 0x1906 -#define PCI_CHIP_SKYLAKE_SRV_GT1 0x190A /* Reserved */ -#define PCI_CHIP_SKYLAKE_H_GT1 0x190B -#define PCI_CHIP_SKYLAKE_ULX_GT1 0x190E /* Reserved */ #define PCI_CHIP_SKYLAKE_DT_GT2 0x1912 -#define PCI_CHIP_SKYLAKE_FUSED0_GT2 0x1913 /* Reserved */ -#define PCI_CHIP_SKYLAKE_FUSED1_GT2 0x1915 /* Reserved */ -#define PCI_CHIP_SKYLAKE_ULT_GT2 0x1916 -#define PCI_CHIP_SKYLAKE_FUSED2_GT2 0x1917 /* Reserved */ -#define PCI_CHIP_SKYLAKE_SRV_GT2 0x191A /* Reserved */ -#define PCI_CHIP_SKYLAKE_HALO_GT2 0x191B -#define PCI_CHIP_SKYLAKE_WKS_GT2 0x191D -#define PCI_CHIP_SKYLAKE_ULX_GT2 0x191E -#define PCI_CHIP_SKYLAKE_MOBILE_GT2 0x1921 /* Reserved */ -#define PCI_CHIP_SKYLAKE_ULT_GT3_0 0x1923 -#define PCI_CHIP_SKYLAKE_ULT_GT3_1 0x1926 -#define PCI_CHIP_SKYLAKE_ULT_GT3_2 0x1927 -#define PCI_CHIP_SKYLAKE_SRV_GT4 0x192A -#define PCI_CHIP_SKYLAKE_HALO_GT3 0x192B /* Reserved */ -#define PCI_CHIP_SKYLAKE_SRV_GT3 0x192D -#define PCI_CHIP_SKYLAKE_DT_GT4 0x1932 -#define PCI_CHIP_SKYLAKE_SRV_GT4X 0x193A -#define PCI_CHIP_SKYLAKE_H_GT4 0x193B -#define PCI_CHIP_SKYLAKE_WKS_GT4 0x193D - -#define PCI_CHIP_KABYLAKE_ULT_GT2 0x5916 -#define PCI_CHIP_KABYLAKE_ULT_GT1_5 0x5913 -#define PCI_CHIP_KABYLAKE_ULT_GT1 0x5906 -#define PCI_CHIP_KABYLAKE_ULT_GT3_0 0x5923 -#define PCI_CHIP_KABYLAKE_ULT_GT3_1 0x5926 -#define PCI_CHIP_KABYLAKE_ULT_GT3_2 0x5927 -#define PCI_CHIP_KABYLAKE_ULT_GT2F 0x5921 -#define PCI_CHIP_KABYLAKE_ULX_GT1_5 0x5915 -#define PCI_CHIP_KABYLAKE_ULX_GT1 0x590E -#define PCI_CHIP_KABYLAKE_ULX_GT2_0 0x591E #define PCI_CHIP_KABYLAKE_DT_GT2 0x5912 -#define PCI_CHIP_KABYLAKE_M_GT2 0x5917 -#define PCI_CHIP_KABYLAKE_DT_GT1 0x5902 -#define PCI_CHIP_KABYLAKE_HALO_GT2 0x591B -#define PCI_CHIP_KABYLAKE_HALO_GT4 0x593B -#define PCI_CHIP_KABYLAKE_HALO_GT1_0 0x5908 -#define PCI_CHIP_KABYLAKE_HALO_GT1_1 0x590B -#define PCI_CHIP_KABYLAKE_SRV_GT2 0x591A -#define PCI_CHIP_KABYLAKE_SRV_GT1 0x590A -#define PCI_CHIP_KABYLAKE_WKS_GT2 0x591D - -#define PCI_CHIP_AMBERLAKE_ULX_GT2_1 0x591C -#define PCI_CHIP_AMBERLAKE_ULX_GT2_2 0x87C0 - -#define PCI_CHIP_BROXTON_0 0x0A84 -#define PCI_CHIP_BROXTON_1 0x1A84 -#define PCI_CHIP_BROXTON_2 0x5A84 -#define PCI_CHIP_BROXTON_3 0x1A85 -#define PCI_CHIP_BROXTON_4 0x5A85 - -#define PCI_CHIP_GLK 0x3184 -#define PCI_CHIP_GLK_2X6 0x3185 - -#define PCI_CHIP_COFFEELAKE_S_GT1_1 0x3E90 -#define PCI_CHIP_COFFEELAKE_S_GT1_2 0x3E93 -#define PCI_CHIP_COFFEELAKE_S_GT1_3 0x3E99 -#define PCI_CHIP_COFFEELAKE_S_GT2_1 0x3E91 -#define PCI_CHIP_COFFEELAKE_S_GT2_2 0x3E92 -#define PCI_CHIP_COFFEELAKE_S_GT2_3 0x3E96 -#define PCI_CHIP_COFFEELAKE_S_GT2_4 0x3E98 -#define PCI_CHIP_COFFEELAKE_S_GT2_5 0x3E9A -#define PCI_CHIP_COFFEELAKE_H_GT2_1 0x3E9B -#define PCI_CHIP_COFFEELAKE_H_GT2_2 0x3E94 -#define PCI_CHIP_COFFEELAKE_U_GT2_1 0x3EA9 -#define PCI_CHIP_COFFEELAKE_U_GT3_1 0x3EA5 -#define PCI_CHIP_COFFEELAKE_U_GT3_2 0x3EA6 -#define PCI_CHIP_COFFEELAKE_U_GT3_3 0x3EA7 -#define PCI_CHIP_COFFEELAKE_U_GT3_4 0x3EA8 - -#define PCI_CHIP_WHISKEYLAKE_U_GT1_1 0x3EA1 -#define PCI_CHIP_WHISKEYLAKE_U_GT2_1 0x3EA0 -#define PCI_CHIP_WHISKEYLAKE_U_GT3_1 0x3EA2 -#define PCI_CHIP_WHISKEYLAKE_U_GT3_2 0x3EA3 -#define PCI_CHIP_WHISKEYLAKE_U_GT3_3 0x3EA4 - -#define PCI_CHIP_CANNONLAKE_0 0x5A51 -#define PCI_CHIP_CANNONLAKE_1 0x5A59 -#define PCI_CHIP_CANNONLAKE_2 0x5A41 -#define PCI_CHIP_CANNONLAKE_3 0x5A49 -#define PCI_CHIP_CANNONLAKE_4 0x5A52 -#define PCI_CHIP_CANNONLAKE_5 0x5A5A -#define PCI_CHIP_CANNONLAKE_6 0x5A42 -#define PCI_CHIP_CANNONLAKE_7 0x5A4A -#define PCI_CHIP_CANNONLAKE_8 0x5A50 -#define PCI_CHIP_CANNONLAKE_9 0x5A40 -#define PCI_CHIP_CANNONLAKE_10 0x5A54 -#define PCI_CHIP_CANNONLAKE_11 0x5A5C -#define PCI_CHIP_CANNONLAKE_12 0x5A44 -#define PCI_CHIP_CANNONLAKE_13 0x5A4C - -#define PCI_CHIP_ICELAKE_11_0 0x8A50 -#define PCI_CHIP_ICELAKE_11_1 0x8A51 -#define PCI_CHIP_ICELAKE_11_2 0x8A5C -#define PCI_CHIP_ICELAKE_11_3 0x8A5D -#define PCI_CHIP_ICELAKE_11_4 0x8A52 -#define PCI_CHIP_ICELAKE_11_5 0x8A5A -#define PCI_CHIP_ICELAKE_11_6 0x8A5B -#define PCI_CHIP_ICELAKE_11_7 0x8A71 -#define PCI_CHIP_ICELAKE_11_8 0x8A70 #define IS_MOBILE(devid) ((devid) == PCI_CHIP_I855_GM || \ (devid) == PCI_CHIP_I915_GM || \ @@ -430,143 +327,16 @@ #define IS_GEN8(devid) (IS_BROADWELL(devid) || \ IS_CHERRYVIEW(devid)) -#define IS_SKL_GT1(devid) ((devid) == PCI_CHIP_SKYLAKE_DT_GT1 || \ - (devid) == PCI_CHIP_SKYLAKE_ULT_GT1 || \ - (devid) == PCI_CHIP_SKYLAKE_SRV_GT1 || \ - (devid) == PCI_CHIP_SKYLAKE_H_GT1 || \ - (devid) == PCI_CHIP_SKYLAKE_ULX_GT1) - -#define IS_SKL_GT2(devid) ((devid) == PCI_CHIP_SKYLAKE_DT_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_FUSED0_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_FUSED1_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_ULT_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_FUSED2_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_SRV_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_HALO_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_WKS_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_ULX_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_MOBILE_GT2) - -#define IS_SKL_GT3(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT3_0 || \ - (devid) == PCI_CHIP_SKYLAKE_ULT_GT3_1 || \ - (devid) == PCI_CHIP_SKYLAKE_ULT_GT3_2 || \ - (devid) == PCI_CHIP_SKYLAKE_HALO_GT3 || \ - (devid) == PCI_CHIP_SKYLAKE_SRV_GT3) - -#define IS_SKL_GT4(devid) ((devid) == PCI_CHIP_SKYLAKE_SRV_GT4 || \ - (devid) == PCI_CHIP_SKYLAKE_DT_GT4 || \ - (devid) == PCI_CHIP_SKYLAKE_SRV_GT4X || \ - (devid) == PCI_CHIP_SKYLAKE_H_GT4 || \ - (devid) == PCI_CHIP_SKYLAKE_WKS_GT4) - -#define IS_KBL_GT1(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT1_5 || \ - (devid) == PCI_CHIP_KABYLAKE_ULX_GT1_5 || \ - (devid) == PCI_CHIP_KABYLAKE_ULT_GT1 || \ - (devid) == PCI_CHIP_KABYLAKE_ULX_GT1 || \ - (devid) == PCI_CHIP_KABYLAKE_DT_GT1 || \ - (devid) == PCI_CHIP_KABYLAKE_HALO_GT1_0 || \ - (devid) == PCI_CHIP_KABYLAKE_HALO_GT1_1 || \ - (devid) == PCI_CHIP_KABYLAKE_SRV_GT1) - -#define IS_KBL_GT2(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT2 || \ - (devid) == PCI_CHIP_KABYLAKE_ULT_GT2F || \ - (devid) == PCI_CHIP_KABYLAKE_ULX_GT2_0 || \ - (devid) == PCI_CHIP_KABYLAKE_DT_GT2 || \ - (devid) == PCI_CHIP_KABYLAKE_M_GT2 || \ - (devid) == PCI_CHIP_KABYLAKE_HALO_GT2 || \ - (devid) == PCI_CHIP_KABYLAKE_SRV_GT2 || \ - (devid) == PCI_CHIP_KABYLAKE_WKS_GT2 || \ - (devid) == PCI_CHIP_AMBERLAKE_ULX_GT2_1 || \ - (devid) == PCI_CHIP_AMBERLAKE_ULX_GT2_2) - -#define IS_KBL_GT3(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT3_0 || \ - (devid) == PCI_CHIP_KABYLAKE_ULT_GT3_1 || \ - (devid) == PCI_CHIP_KABYLAKE_ULT_GT3_2) - -#define IS_KBL_GT4(devid) ((devid) == PCI_CHIP_KABYLAKE_HALO_GT4) - -#define IS_KABYLAKE(devid) (IS_KBL_GT1(devid) || \ - IS_KBL_GT2(devid) || \ - IS_KBL_GT3(devid) || \ - IS_KBL_GT4(devid)) - -#define IS_SKYLAKE(devid) (IS_SKL_GT1(devid) || \ - IS_SKL_GT2(devid) || \ - IS_SKL_GT3(devid) || \ - IS_SKL_GT4(devid)) - -#define IS_BROXTON(devid) ((devid) == PCI_CHIP_BROXTON_0 || \ - (devid) == PCI_CHIP_BROXTON_1 || \ - (devid) == PCI_CHIP_BROXTON_2 || \ - (devid) == PCI_CHIP_BROXTON_3 || \ - (devid) == PCI_CHIP_BROXTON_4) - -#define IS_GEMINILAKE(devid) ((devid) == PCI_CHIP_GLK || \ - (devid) == PCI_CHIP_GLK_2X6) - -#define IS_CFL_S(devid) ((devid) == PCI_CHIP_COFFEELAKE_S_GT1_1 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT1_2 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT1_3 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT2_1 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT2_2 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT2_3 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT2_4 || \ - (devid) == PCI_CHIP_COFFEELAKE_S_GT2_5) - -#define IS_CFL_H(devid) ((devid) == PCI_CHIP_COFFEELAKE_H_GT2_1 || \ - (devid) == PCI_CHIP_COFFEELAKE_H_GT2_2) - -#define IS_CFL_U(devid) ((devid) == PCI_CHIP_COFFEELAKE_U_GT2_1 || \ - (devid) == PCI_CHIP_COFFEELAKE_U_GT3_1 || \ - (devid) == PCI_CHIP_COFFEELAKE_U_GT3_2 || \ - (devid) == PCI_CHIP_COFFEELAKE_U_GT3_3 || \ - (devid) == PCI_CHIP_COFFEELAKE_U_GT3_4 || \ - (devid) == PCI_CHIP_WHISKEYLAKE_U_GT1_1 || \ - (devid) == PCI_CHIP_WHISKEYLAKE_U_GT2_1 || \ - (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_1 || \ - (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_2 || \ - (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_3) - -#define IS_COFFEELAKE(devid) (IS_CFL_S(devid) || \ - IS_CFL_H(devid) || \ - IS_CFL_U(devid)) - -#define IS_GEN9(devid) (IS_SKYLAKE(devid) || \ - IS_BROXTON(devid) || \ - IS_KABYLAKE(devid) || \ - IS_GEMINILAKE(devid) || \ - IS_COFFEELAKE(devid)) - -#define IS_CANNONLAKE(devid) ((devid) == PCI_CHIP_CANNONLAKE_0 || \ - (devid) == PCI_CHIP_CANNONLAKE_1 || \ - (devid) == PCI_CHIP_CANNONLAKE_2 || \ - (devid) == PCI_CHIP_CANNONLAKE_3 || \ - (devid) == PCI_CHIP_CANNONLAKE_4 || \ - (devid) == PCI_CHIP_CANNONLAKE_5 || \ - (devid) == PCI_CHIP_CANNONLAKE_6 || \ - (devid) == PCI_CHIP_CANNONLAKE_7 || \ - (devid) == PCI_CHIP_CANNONLAKE_8 || \ - (devid) == PCI_CHIP_CANNONLAKE_9 || \ - (devid) == PCI_CHIP_CANNONLAKE_10 || \ - (devid) == PCI_CHIP_CANNONLAKE_11 || \ - (devid) == PCI_CHIP_CANNONLAKE_12 || \ - (devid) == PCI_CHIP_CANNONLAKE_13) - -#define IS_GEN10(devid) (IS_CANNONLAKE(devid)) - -#define IS_ICELAKE_11(devid) ((devid) == PCI_CHIP_ICELAKE_11_0 || \ - (devid) == PCI_CHIP_ICELAKE_11_1 || \ - (devid) == PCI_CHIP_ICELAKE_11_2 || \ - (devid) == PCI_CHIP_ICELAKE_11_3 || \ - (devid) == PCI_CHIP_ICELAKE_11_4 || \ - (devid) == PCI_CHIP_ICELAKE_11_5 || \ - (devid) == PCI_CHIP_ICELAKE_11_6 || \ - (devid) == PCI_CHIP_ICELAKE_11_7 || \ - (devid) == PCI_CHIP_ICELAKE_11_8) - -#define IS_ICELAKE(devid) (IS_ICELAKE_11(devid)) - -#define IS_GEN11(devid) (IS_ICELAKE_11(devid)) +/* New platforms use kernel pci ids */ +#include <stdbool.h> +#include <libdrm_macros.h> + +drm_private bool intel_is_genx(unsigned int devid, int gen); +drm_private bool intel_get_genx(unsigned int devid, int *gen); + +#define IS_GEN9(devid) intel_is_genx(devid, 9) +#define IS_GEN10(devid) intel_is_genx(devid, 10) +#define IS_GEN11(devid) intel_is_genx(devid, 11) #define IS_9XX(dev) (IS_GEN3(dev) || \ IS_GEN4(dev) || \ @@ -574,8 +344,6 @@ IS_GEN6(dev) || \ IS_GEN7(dev) || \ IS_GEN8(dev) || \ - IS_GEN9(dev) || \ - IS_GEN10(dev) || \ - IS_GEN11(dev)) + intel_get_genx(dev, NULL)) #endif /* _INTEL_CHIPSET_H */ diff --git a/lib/libdrm/intel/intel_decode.c b/lib/libdrm/intel/intel_decode.c index b24861b16..e0a516644 100644 --- a/lib/libdrm/intel/intel_decode.c +++ b/lib/libdrm/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; @@ -3823,12 +3823,8 @@ drm_intel_decode_context_alloc(uint32_t devid) ctx->devid = devid; ctx->out = stdout; - if (IS_GEN11(devid)) - ctx->gen = 11; - else if (IS_GEN10(devid)) - ctx->gen = 10; - else if (IS_GEN9(devid)) - ctx->gen = 9; + if (intel_get_genx(devid, &ctx->gen)) + ; else if (IS_GEN8(devid)) ctx->gen = 8; else if (IS_GEN7(devid)) @@ -3849,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) { @@ -3871,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) { @@ -3879,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) { @@ -3893,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/lib/libdrm/libdrm_macros.h b/lib/libdrm/libdrm_macros.h index 211fab219..95f0ef559 100644 --- a/lib/libdrm/libdrm_macros.h +++ b/lib/libdrm/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 diff --git a/lib/libdrm/libkms/Makefile.in b/lib/libdrm/libkms/Makefile.in index d66fc4486..f38f538e9 100644 --- a/lib/libdrm/libkms/Makefile.in +++ b/lib/libdrm/libkms/Makefile.in @@ -352,8 +352,8 @@ LIBKMS_EXYNOS_FILES := \ LIBKMS_H_FILES := \ libkms.h -AM_CFLAGS = $(WARN_CFLAGS) -I$(top_srcdir)/include/drm -I$(top_srcdir) \ - $(am__append_6) +AM_CFLAGS = $(WARN_CFLAGS) -fvisibility=hidden \ + -I$(top_srcdir)/include/drm -I$(top_srcdir) $(am__append_6) libkms_la_LTLIBRARIES = libkms.la libkms_ladir = $(libdir) libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined @@ -363,6 +363,7 @@ libkms_la_SOURCES = $(LIBKMS_FILES) $(am__append_1) $(am__append_2) \ libkmsincludedir = ${includedir}/libkms libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfig_DATA = libkms.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = kms-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/libkms/api.c b/lib/libdrm/libkms/api.c index 22dd32d78..caca1a873 100644 --- a/lib/libdrm/libkms/api.c +++ b/lib/libdrm/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; diff --git a/lib/libdrm/nouveau/Makefile.in b/lib/libdrm/nouveau/Makefile.in index bd4a1b9c1..1423f8593 100644 --- a/lib/libdrm/nouveau/Makefile.in +++ b/lib/libdrm/nouveau/Makefile.in @@ -325,6 +325,7 @@ LIBDRM_NOUVEAU_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm \ @@ -347,6 +348,7 @@ libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \ nvif/unpack.h pkgconfig_DATA = libdrm_nouveau.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = nouveau-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/omap/Makefile.in b/lib/libdrm/omap/Makefile.in index 69d296dc0..2d8928c73 100644 --- a/lib/libdrm/omap/Makefile.in +++ b/lib/libdrm/omap/Makefile.in @@ -314,6 +314,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm @@ -328,6 +329,7 @@ libdrm_omapcommoninclude_HEADERS = omap_drm.h libdrm_omapincludedir = ${includedir}/libdrm libdrm_omapinclude_HEADERS = omap_drmif.h pkgconfig_DATA = libdrm_omap.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = omap-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/radeon/Makefile.in b/lib/libdrm/radeon/Makefile.in index ff4dcfad9..48ee0242a 100644 --- a/lib/libdrm/radeon/Makefile.in +++ b/lib/libdrm/radeon/Makefile.in @@ -359,6 +359,7 @@ LIBDRM_RADEON_BOF_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm @@ -371,6 +372,7 @@ libdrm_radeon_la_SOURCES = $(LIBDRM_RADEON_FILES) libdrm_radeonincludedir = ${includedir}/libdrm libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) pkgconfig_DATA = libdrm_radeon.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = radeon-symbol-check EXTRA_DIST = $(LIBDRM_RADEON_BOF_FILES) $(TESTS) all: all-am diff --git a/lib/libdrm/radeon/radeon_bo.c b/lib/libdrm/radeon/radeon_bo.c index 821807bcc..91929532d 100644 --- a/lib/libdrm/radeon/radeon_bo.c +++ b/lib/libdrm/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) @@ -67,19 +67,19 @@ struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo) return boi->bom->funcs->bo_unref(boi); } -int radeon_bo_map(struct radeon_bo *bo, int write) +drm_public int radeon_bo_map(struct radeon_bo *bo, int write) { struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; return boi->bom->funcs->bo_map(boi, write); } -int radeon_bo_unmap(struct radeon_bo *bo) +drm_public int radeon_bo_unmap(struct radeon_bo *bo) { struct radeon_bo_int *boi = (struct radeon_bo_int *)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/lib/libdrm/radeon/radeon_bo_gem.c b/lib/libdrm/radeon/radeon_bo_gem.c index 774b26e41..86f7c0070 100644 --- a/lib/libdrm/radeon/radeon_bo_gem.c +++ b/lib/libdrm/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/lib/libdrm/radeon/radeon_cs.c b/lib/libdrm/radeon/radeon_cs.c index eb7859e50..1132d0690 100644 --- a/lib/libdrm/radeon/radeon_cs.c +++ b/lib/libdrm/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/lib/libdrm/radeon/radeon_cs_gem.c b/lib/libdrm/radeon/radeon_cs_gem.c index 4d5fc13ad..ef070c602 100644 --- a/lib/libdrm/radeon/radeon_cs_gem.c +++ b/lib/libdrm/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/lib/libdrm/radeon/radeon_cs_space.c b/lib/libdrm/radeon/radeon_cs_space.c index 8531c345a..039b0414a 100644 --- a/lib/libdrm/radeon/radeon_cs_space.c +++ b/lib/libdrm/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) { @@ -227,13 +227,13 @@ radeon_cs_space_check_with_bo(struct radeon_cs *cs, struct radeon_bo *bo, return ret; } -int radeon_cs_space_check(struct radeon_cs *cs) +drm_public int radeon_cs_space_check(struct radeon_cs *cs) { struct radeon_cs_int *csi = (struct radeon_cs_int *)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/lib/libdrm/radeon/radeon_surface.c b/lib/libdrm/radeon/radeon_surface.c index 3cafcfcba..ea0a27a94 100644 --- a/lib/libdrm/radeon/radeon_surface.c +++ b/lib/libdrm/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) { diff --git a/lib/libdrm/tegra/Makefile.in b/lib/libdrm/tegra/Makefile.in index 3e5ecc7bf..9d635cc29 100644 --- a/lib/libdrm/tegra/Makefile.in +++ b/lib/libdrm/tegra/Makefile.in @@ -315,7 +315,8 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ @PTHREADSTUBS_CFLAGS@ \ - $(WARN_CFLAGS) + $(WARN_CFLAGS) \ + -fvisibility=hidden libdrm_tegra_ladir = $(libdir) libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la @@ -328,6 +329,7 @@ libdrm_tegra_la_SOURCES = \ libdrm_tegraincludedir = ${includedir}/libdrm libdrm_tegrainclude_HEADERS = tegra.h pkgconfig_DATA = libdrm_tegra.pc +AM_TESTS_ENVIRONMENT = NM='$(NM)' TESTS = tegra-symbol-check EXTRA_DIST = $(TESTS) all: all-am diff --git a/lib/libdrm/tests/Makefile.in b/lib/libdrm/tests/Makefile.in index b33ccfd5a..b6996ca85 100644 --- a/lib/libdrm/tests/Makefile.in +++ b/lib/libdrm/tests/Makefile.in @@ -341,6 +341,7 @@ SUBDIRS = util kms modeprint proptest modetest vbltest $(am__append_1) \ $(am__append_5) $(am__append_6) $(am__append_7) AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir) diff --git a/lib/libdrm/tests/amdgpu/Makefile.in b/lib/libdrm/tests/amdgpu/Makefile.in index a97dae301..a67a2909a 100644 --- a/lib/libdrm/tests/amdgpu/Makefile.in +++ b/lib/libdrm/tests/amdgpu/Makefile.in @@ -280,6 +280,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ + -fvisibility=hidden \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir)/amdgpu \ -I $(top_srcdir) \ diff --git a/lib/libdrm/tests/etnaviv/Makefile.in b/lib/libdrm/tests/etnaviv/Makefile.in index 5dbd85875..aee32918e 100644 --- a/lib/libdrm/tests/etnaviv/Makefile.in +++ b/lib/libdrm/tests/etnaviv/Makefile.in @@ -289,6 +289,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ + -fvisibility=hidden \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir)/etnaviv \ -I $(top_srcdir) diff --git a/lib/libdrm/tests/exynos/Makefile.in b/lib/libdrm/tests/exynos/Makefile.in index 5ffd96f8e..befb65503 100644 --- a/lib/libdrm/tests/exynos/Makefile.in +++ b/lib/libdrm/tests/exynos/Makefile.in @@ -304,6 +304,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -pthread \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir)/libkms/ \ -I $(top_srcdir)/exynos \ diff --git a/lib/libdrm/tests/kms/Makefile.in b/lib/libdrm/tests/kms/Makefile.in index 6c683b223..a86ce5a73 100644 --- a/lib/libdrm/tests/kms/Makefile.in +++ b/lib/libdrm/tests/kms/Makefile.in @@ -292,7 +292,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir) AM_CFLAGS = \ - $(WARN_CFLAGS) + $(WARN_CFLAGS) \ + -fvisibility=hidden noinst_LTLIBRARIES = libkms-test.la libkms_test_la_SOURCES = \ diff --git a/lib/libdrm/tests/kmstest/Makefile.in b/lib/libdrm/tests/kmstest/Makefile.in index 95b88e81a..6c4f0836a 100644 --- a/lib/libdrm/tests/kmstest/Makefile.in +++ b/lib/libdrm/tests/kmstest/Makefile.in @@ -272,6 +272,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/libkms/ \ -I$(top_srcdir)/tests/ \ diff --git a/lib/libdrm/tests/modeprint/Makefile.in b/lib/libdrm/tests/modeprint/Makefile.in index ae83d5c37..bf988cd4d 100644 --- a/lib/libdrm/tests/modeprint/Makefile.in +++ b/lib/libdrm/tests/modeprint/Makefile.in @@ -70,7 +70,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_modeprint_OBJECTS = modeprint.$(OBJEXT) modeprint_OBJECTS = $(am_modeprint_OBJECTS) -modeprint_DEPENDENCIES = $(top_builddir)/libdrm.la +modeprint_DEPENDENCIES = $(top_builddir)/tests/util/libutil.la \ + $(top_builddir)/libdrm.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -271,6 +272,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/tests \ -I$(top_srcdir) @@ -279,6 +281,7 @@ modeprint_SOURCES = \ modeprint.c modeprint_LDADD = \ + $(top_builddir)/tests/util/libutil.la \ $(top_builddir)/libdrm.la all: all-am diff --git a/lib/libdrm/tests/modetest/Makefile.in b/lib/libdrm/tests/modetest/Makefile.in index 3c3973f16..585dcdf7a 100644 --- a/lib/libdrm/tests/modetest/Makefile.in +++ b/lib/libdrm/tests/modetest/Makefile.in @@ -279,9 +279,9 @@ MODETEST_FILES := \ cursor.h \ modetest.c -AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) -pthread \ - -I$(top_srcdir)/include/drm -I$(top_srcdir)/tests \ - -I$(top_srcdir) +AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) \ + -fvisibility=hidden -pthread -I$(top_srcdir)/include/drm \ + -I$(top_srcdir)/tests -I$(top_srcdir) modetest_SOURCES = $(MODETEST_FILES) modetest_LDADD = \ $(top_builddir)/libdrm.la \ diff --git a/lib/libdrm/tests/nouveau/Makefile.in b/lib/libdrm/tests/nouveau/Makefile.in index f9052a01d..c8b283faf 100644 --- a/lib/libdrm/tests/nouveau/Makefile.in +++ b/lib/libdrm/tests/nouveau/Makefile.in @@ -276,6 +276,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -pthread \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/nouveau \ -I$(top_srcdir) diff --git a/lib/libdrm/tests/proptest/Makefile.in b/lib/libdrm/tests/proptest/Makefile.in index 22c96709b..e4949af59 100644 --- a/lib/libdrm/tests/proptest/Makefile.in +++ b/lib/libdrm/tests/proptest/Makefile.in @@ -276,6 +276,7 @@ PROPTEST_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/tests \ -I$(top_srcdir) diff --git a/lib/libdrm/tests/radeon/Makefile.in b/lib/libdrm/tests/radeon/Makefile.in index 03b54836a..ebcdea6c4 100644 --- a/lib/libdrm/tests/radeon/Makefile.in +++ b/lib/libdrm/tests/radeon/Makefile.in @@ -270,6 +270,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir) diff --git a/lib/libdrm/tests/tegra/Makefile.in b/lib/libdrm/tests/tegra/Makefile.in index d30f798be..4c473ca88 100644 --- a/lib/libdrm/tests/tegra/Makefile.in +++ b/lib/libdrm/tests/tegra/Makefile.in @@ -273,7 +273,10 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/tegra \ -I$(top_srcdir) -AM_CFLAGS = $(WARN_CFLAGS) +AM_CFLAGS = \ + $(WARN_CFLAGS) \ + -fvisibility=hidden + LDADD = \ ../../tegra/libdrm_tegra.la \ ../../libdrm.la diff --git a/lib/libdrm/tests/vbltest/Makefile.in b/lib/libdrm/tests/vbltest/Makefile.in index 7b48abd42..96e33d176 100644 --- a/lib/libdrm/tests/vbltest/Makefile.in +++ b/lib/libdrm/tests/vbltest/Makefile.in @@ -272,6 +272,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ + -fvisibility=hidden \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/tests \ -I$(top_srcdir) diff --git a/lib/libdrm/vc4/Makefile.in b/lib/libdrm/vc4/Makefile.in index fc3d0895d..0ecd3eb95 100644 --- a/lib/libdrm/vc4/Makefile.in +++ b/lib/libdrm/vc4/Makefile.in @@ -296,6 +296,7 @@ LIBDRM_VC4_H_FILES := \ AM_CFLAGS = \ $(WARN_CFLAGS) \ + -fvisibility=hidden \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ $(VALGRIND_CFLAGS) \ diff --git a/lib/libdrm/xf86drm.c b/lib/libdrm/xf86drm.c index a7f0d3ea5..f2c6fbf74 100644 --- a/lib/libdrm/xf86drm.c +++ b/lib/libdrm/xf86drm.c @@ -123,7 +123,7 @@ struct drm_pciinfo { static drmServerInfoPtr drm_server_info; -void drmSetServerInfo(drmServerInfoPtr info) +drm_public void drmSetServerInfo(drmServerInfoPtr info) { drm_server_info = info; } @@ -143,7 +143,7 @@ drmDebugPrint(const char *format, va_list ap) return vfprintf(stderr, format, ap); } -void +drm_public void drmMsg(const char *format, ...) { va_list ap; @@ -163,17 +163,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); } @@ -181,7 +181,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; @@ -201,7 +201,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; @@ -318,7 +318,7 @@ _priv_open_device(const char *path) return open(path, O_RDWR, 0); } -int priv_open_device(const char *) +drm_public int priv_open_device(const char *) __attribute__((weak, alias ("_priv_open_device"))); #endif @@ -515,7 +515,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; @@ -750,7 +750,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); } @@ -771,7 +771,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) { @@ -794,12 +794,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); } @@ -813,7 +813,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; @@ -883,7 +883,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)); @@ -931,7 +931,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)); @@ -952,7 +952,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; @@ -968,7 +968,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; @@ -987,7 +987,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); } @@ -1005,7 +1005,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; @@ -1036,7 +1036,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; @@ -1050,7 +1050,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; @@ -1063,7 +1063,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; @@ -1124,8 +1124,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; @@ -1141,7 +1141,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; @@ -1169,8 +1169,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; @@ -1185,7 +1185,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; @@ -1236,7 +1236,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; @@ -1257,7 +1257,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); @@ -1288,7 +1288,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; @@ -1318,12 +1319,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; @@ -1373,7 +1374,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; @@ -1418,7 +1419,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; @@ -1446,7 +1447,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; @@ -1489,7 +1490,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; @@ -1520,7 +1521,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; @@ -1529,7 +1530,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; @@ -1566,7 +1567,7 @@ err_free_context: return NULL; } -void drmFreeReservedContextList(drm_context_t *pt) +drm_public void drmFreeReservedContextList(drm_context_t *pt) { drmFree(pt); } @@ -1589,7 +1590,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; @@ -1600,7 +1601,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; @@ -1611,7 +1612,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; @@ -1632,8 +1634,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; @@ -1666,7 +1668,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; @@ -1677,7 +1679,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; @@ -1688,7 +1690,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; @@ -1699,9 +1701,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; @@ -1717,7 +1719,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; @@ -1735,8 +1738,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; @@ -1766,7 +1771,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; @@ -1784,7 +1789,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; @@ -1804,7 +1809,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; @@ -1832,8 +1837,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; @@ -1862,7 +1867,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; @@ -1887,7 +1892,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; @@ -1912,7 +1917,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; @@ -1935,7 +1940,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; @@ -1958,7 +1963,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; @@ -1981,7 +1986,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; @@ -2004,7 +2009,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; @@ -2027,7 +2032,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; @@ -2050,7 +2055,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; @@ -2073,7 +2078,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; @@ -2096,7 +2101,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; @@ -2119,7 +2124,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; @@ -2130,7 +2135,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; @@ -2144,7 +2150,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; @@ -2166,7 +2172,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; @@ -2198,7 +2204,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: @@ -2235,7 +2241,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; @@ -2259,7 +2265,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; @@ -2271,7 +2277,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; @@ -2302,7 +2308,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; @@ -2315,7 +2322,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); @@ -2326,14 +2333,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; @@ -2344,8 +2351,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; @@ -2358,8 +2365,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; @@ -2374,9 +2381,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; @@ -2393,8 +2400,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; @@ -2410,7 +2417,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; @@ -2548,7 +2555,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; @@ -2583,7 +2590,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; @@ -2610,8 +2617,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; @@ -2639,8 +2646,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; @@ -2668,8 +2675,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; @@ -2691,14 +2698,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; @@ -2731,7 +2737,7 @@ int drmOpenOnceWithType(const char *BusID, int *newlyopened, int type) return fd; } -void drmCloseOnce(int fd) +drm_public void drmCloseOnce(int fd) { int i; @@ -2750,17 +2756,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; @@ -2786,7 +2792,21 @@ char *drmGetDeviceNameFromFd(int fd) return strdup(name); } -int drmGetNodeTypeFromFd(int fd) +static bool drmNodeIsDRM(int maj, int min) +{ +#ifdef __linux__ + char path[64]; + struct stat sbuf; + + snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm", + maj, min); + return stat(path, &sbuf) == 0; +#else + return maj == DRM_MAJOR; +#endif +} + +drm_public int drmGetNodeTypeFromFd(int fd) { struct stat sbuf; int maj, min, type; @@ -2797,7 +2817,7 @@ int drmGetNodeTypeFromFd(int fd) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) { + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) { errno = EINVAL; return -1; } @@ -2808,7 +2828,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; @@ -2825,7 +2846,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; @@ -2862,7 +2883,7 @@ static char *drmGetMinorNameForFD(int fd, int type) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return NULL; snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/device/drm", maj, min); @@ -2896,7 +2917,7 @@ static char *drmGetMinorNameForFD(int fd, int type) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return NULL; switch (type) { @@ -2925,12 +2946,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); } @@ -3023,33 +3044,32 @@ static int drmParseSubsystemType(int maj, int min) #endif } -static char * -get_real_pci_path(int maj, int min, char *real_path) +static void +get_pci_path(int maj, int min, char *pci_path) { char path[PATH_MAX + 1], *term; snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); - if (!realpath(path, real_path)) - return NULL; + if (!realpath(path, pci_path)) { + strcpy(pci_path, path); + return; + } - term = strrchr(real_path, '/'); + term = strrchr(pci_path, '/'); if (term && strncmp(term, "/virtio", 7) == 0) *term = 0; - - return real_path; } static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info) { #ifdef __linux__ unsigned int domain, bus, dev, func; - char real_path[PATH_MAX + 1], *value; + char pci_path[PATH_MAX + 1], *value; int num; - if (get_real_pci_path(maj, min, real_path) == NULL) - return -ENOENT; + get_pci_path(maj, min, pci_path); - value = sysfs_uevent_get(real_path, "PCI_SLOT_NAME"); + value = sysfs_uevent_get(pci_path, "PCI_SLOT_NAME"); if (!value) return -ENOENT; @@ -3095,7 +3115,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; @@ -3162,16 +3182,15 @@ static int parse_separate_sysfs_files(int maj, int min, "subsystem_vendor", "subsystem_device", }; - char path[PATH_MAX + 1], real_path[PATH_MAX + 1]; + char path[PATH_MAX + 1], pci_path[PATH_MAX + 1]; unsigned int data[ARRAY_SIZE(attrs)]; FILE *fp; int ret; - if (get_real_pci_path(maj, min, real_path) == NULL) - return -ENOENT; + get_pci_path(maj, min, pci_path); for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) { - snprintf(path, PATH_MAX, "%s/%s", real_path, attrs[i]); + snprintf(path, PATH_MAX, "%s/%s", pci_path, attrs[i]); fp = fopen(path, "r"); if (!fp) return -errno; @@ -3195,14 +3214,13 @@ static int parse_separate_sysfs_files(int maj, int min, static int parse_config_sysfs_file(int maj, int min, drmPciDeviceInfoPtr device) { - char path[PATH_MAX + 1], real_path[PATH_MAX + 1]; + char path[PATH_MAX + 1], pci_path[PATH_MAX + 1]; unsigned char config[64]; int fd, ret; - if (get_real_pci_path(maj, min, real_path) == NULL) - return -ENOENT; + get_pci_path(maj, min, pci_path); - snprintf(path, PATH_MAX, "%s/config", real_path); + snprintf(path, PATH_MAX, "%s/config", pci_path); fd = open(path, O_RDONLY); if (fd < 0) return -errno; @@ -3297,7 +3315,7 @@ static void drmFreeHost1xDevice(drmDevicePtr device) } } -void drmFreeDevice(drmDevicePtr *device) +drm_public void drmFreeDevice(drmDevicePtr *device) { if (device == NULL) return; @@ -3318,7 +3336,7 @@ void drmFreeDevice(drmDevicePtr *device) *device = NULL; } -void drmFreeDevices(drmDevicePtr devices[], int count) +drm_public void drmFreeDevices(drmDevicePtr devices[], int count) { int i; @@ -3750,7 +3768,7 @@ process_device(drmDevicePtr *device, const char *d_name, maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return -1; subsystem_type = drmParseSubsystemType(maj, min); @@ -3840,7 +3858,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__ /* @@ -3864,7 +3882,7 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return -EINVAL; node_type = drmGetMinorType(min); @@ -3930,7 +3948,7 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return -EINVAL; subsystem_type = drmParseSubsystemType(maj, min); @@ -3988,7 +4006,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); } @@ -4009,7 +4027,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; @@ -4072,12 +4091,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; @@ -4090,7 +4109,7 @@ char *drmGetDeviceNameFromFd2(int fd) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return NULL; snprintf(path, sizeof(path), "/sys/dev/char/%d:%d", maj, min); @@ -4116,7 +4135,7 @@ char *drmGetDeviceNameFromFd2(int fd) maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) return NULL; node_type = drmGetMinorType(min); @@ -4149,7 +4168,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; @@ -4164,7 +4183,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; @@ -4173,7 +4192,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; @@ -4188,7 +4207,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; @@ -4203,7 +4222,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; @@ -4214,7 +4234,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; @@ -4230,9 +4251,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; @@ -4252,7 +4273,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; @@ -4265,7 +4287,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/lib/libdrm/xf86drmHash.c b/lib/libdrm/xf86drmHash.c index b2fa414e5..891b73263 100644 --- a/lib/libdrm/xf86drmHash.c +++ b/lib/libdrm/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; @@ -109,16 +110,11 @@ void *drmHashCreate(void) table = drmMalloc(sizeof(*table)); if (!table) return NULL; table->magic = HASH_MAGIC; - table->entries = 0; - table->hits = 0; - table->partials = 0; - table->misses = 0; - for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL; return table; } -int drmHashDestroy(void *t) +drm_public int drmHashDestroy(void *t) { HashTablePtr table = (HashTablePtr)t; HashBucketPtr bucket; @@ -169,7 +165,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 +178,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 +197,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 +214,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 +231,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/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c index 9a15b5e78..8f8633ed3 100644 --- a/lib/libdrm/xf86drmMode.c +++ b/lib/libdrm/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/lib/libdrm/xf86drmRandom.c b/lib/libdrm/xf86drmRandom.c index 81f03014f..51e9676f4 100644 --- a/lib/libdrm/xf86drmRandom.c +++ b/lib/libdrm/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/lib/libdrm/xf86drmSL.c b/lib/libdrm/xf86drmSL.c index a12fa1d00..3826df97f 100644 --- a/lib/libdrm/xf86drmSL.c +++ b/lib/libdrm/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; |