aboutsummaryrefslogtreecommitdiffstats
path: root/libkms
diff options
context:
space:
mode:
authorSean Paul2016-02-03 09:52:15 -0600
committerSean Paul2016-02-03 09:52:15 -0600
commit870942e56aac024da5e0a621275f6561a4ddab1b (patch)
treef50e065f5088a40e2a34ae83e2e3ff6ab2e6f625 /libkms
parentbd4d0d244019a72be9ca51ac3e8f35201b271f1b (diff)
parentb38a4b2326c1be5702f5cb73a53c0ed74c12d510 (diff)
downloadexternal-libdrm-870942e56aac024da5e0a621275f6561a4ddab1b.tar.gz
external-libdrm-870942e56aac024da5e0a621275f6561a4ddab1b.tar.xz
external-libdrm-870942e56aac024da5e0a621275f6561a4ddab1b.zip
Merge tag 'tags/libdrm-2.4.66' into master
Tag libdrm-2.4.66 from git://anongit.freedesktop.org/mesa/drm Signed-off-by: Sean Paul <seanpaul@chromium.org> Conflicts: Android.mk Makefile.am configure.ac freedreno/Android.mk include/drm/drm_mode.h intel/Android.mk libkms/Android.mk nouveau/Android.mk radeon/Android.mk tegra/tegra.c tests/Makefile.am xf86drmMode.c xf86drmMode.h Change-Id: I3186bde7f196d2f3438c4334591ee2a0c1371c96
Diffstat (limited to 'libkms')
-rw-r--r--libkms/Android.mk1
-rw-r--r--libkms/Makefile.am3
-rw-r--r--libkms/api.c3
-rw-r--r--libkms/dumb.c4
-rw-r--r--libkms/exynos.c9
-rw-r--r--libkms/intel.c4
-rw-r--r--libkms/internal.h19
-rwxr-xr-xlibkms/kms-symbol-check25
-rw-r--r--libkms/libkms.h4
-rw-r--r--libkms/linux.c10
-rw-r--r--libkms/nouveau.c4
-rw-r--r--libkms/radeon.c4
-rw-r--r--libkms/vmwgfx.c4
13 files changed, 67 insertions, 27 deletions
diff --git a/libkms/Android.mk b/libkms/Android.mk
index 34c10f56..aafebb64 100644
--- a/libkms/Android.mk
+++ b/libkms/Android.mk
@@ -49,6 +49,7 @@ endif
49LOCAL_SRC_FILES := $(filter-out %.h,$(LOCAL_SRC_FILES)) 49LOCAL_SRC_FILES := $(filter-out %.h,$(LOCAL_SRC_FILES))
50 50
51LOCAL_MODULE := libkms 51LOCAL_MODULE := libkms
52LOCAL_MODULE_TAGS := optional
52LOCAL_SHARED_LIBRARIES := libdrm 53LOCAL_SHARED_LIBRARIES := libdrm
53 54
54include $(BUILD_SHARED_LIBRARY) 55include $(BUILD_SHARED_LIBRARY)
diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 4baf4fc9..6c0ab7a2 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -43,4 +43,5 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES)
43pkgconfigdir = @pkgconfigdir@ 43pkgconfigdir = @pkgconfigdir@
44pkgconfig_DATA = libkms.pc 44pkgconfig_DATA = libkms.pc
45 45
46EXTRA_DIST = Android.mk 46TESTS = kms-symbol-check
47EXTRA_DIST = Android.mk $(TESTS)
diff --git a/libkms/api.c b/libkms/api.c
index b512c42d..354d8a2e 100644
--- a/libkms/api.c
+++ b/libkms/api.c
@@ -29,9 +29,12 @@
29#ifdef HAVE_CONFIG_H 29#ifdef HAVE_CONFIG_H
30#include "config.h" 30#include "config.h"
31#endif 31#endif
32
32#include <errno.h> 33#include <errno.h>
33#include <stdlib.h> 34#include <stdlib.h>
34#include <string.h> 35#include <string.h>
36
37#include "libdrm_macros.h"
35#include "internal.h" 38#include "internal.h"
36 39
37int kms_create(int fd, struct kms_driver **out) 40int kms_create(int fd, struct kms_driver **out)
diff --git a/libkms/dumb.c b/libkms/dumb.c
index f9c16e11..b95a072c 100644
--- a/libkms/dumb.c
+++ b/libkms/dumb.c
@@ -38,7 +38,7 @@
38 38
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "xf86drm.h" 40#include "xf86drm.h"
41#include "libdrm.h" 41#include "libdrm_macros.h"
42 42
43struct dumb_bo 43struct dumb_bo
44{ 44{
@@ -190,7 +190,7 @@ dumb_bo_destroy(struct kms_bo *_bo)
190 return 0; 190 return 0;
191} 191}
192 192
193int 193drm_private int
194dumb_create(int fd, struct kms_driver **out) 194dumb_create(int fd, struct kms_driver **out)
195{ 195{
196 struct kms_driver *kms; 196 struct kms_driver *kms;
diff --git a/libkms/exynos.c b/libkms/exynos.c
index 92e329cd..5de2e5a9 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -25,6 +25,7 @@
25#include <sys/ioctl.h> 25#include <sys/ioctl.h>
26#include "xf86drm.h" 26#include "xf86drm.h"
27 27
28#include "libdrm_macros.h"
28#include "exynos_drm.h" 29#include "exynos_drm.h"
29 30
30struct exynos_bo 31struct exynos_bo
@@ -124,7 +125,7 @@ static int
124exynos_bo_map(struct kms_bo *_bo, void **out) 125exynos_bo_map(struct kms_bo *_bo, void **out)
125{ 126{
126 struct exynos_bo *bo = (struct exynos_bo *)_bo; 127 struct exynos_bo *bo = (struct exynos_bo *)_bo;
127 struct drm_exynos_gem_map_off arg; 128 struct drm_mode_map_dumb arg;
128 void *map = NULL; 129 void *map = NULL;
129 int ret; 130 int ret;
130 131
@@ -137,11 +138,11 @@ exynos_bo_map(struct kms_bo *_bo, void **out)
137 memset(&arg, 0, sizeof(arg)); 138 memset(&arg, 0, sizeof(arg));
138 arg.handle = bo->base.handle; 139 arg.handle = bo->base.handle;
139 140
140 ret = drmCommandWriteRead(bo->base.kms->fd, DRM_EXYNOS_GEM_MAP_OFFSET, &arg, sizeof(arg)); 141 ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
141 if (ret) 142 if (ret)
142 return ret; 143 return ret;
143 144
144 map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); 145 map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
145 if (map == MAP_FAILED) 146 if (map == MAP_FAILED)
146 return -errno; 147 return -errno;
147 148
@@ -184,7 +185,7 @@ exynos_bo_destroy(struct kms_bo *_bo)
184 return 0; 185 return 0;
185} 186}
186 187
187int 188drm_private int
188exynos_create(int fd, struct kms_driver **out) 189exynos_create(int fd, struct kms_driver **out)
189{ 190{
190 struct kms_driver *kms; 191 struct kms_driver *kms;
diff --git a/libkms/intel.c b/libkms/intel.c
index 51a7fd2e..3d8ca055 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -38,7 +38,7 @@
38 38
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "xf86drm.h" 40#include "xf86drm.h"
41#include "libdrm.h" 41#include "libdrm_macros.h"
42 42
43#include "i915_drm.h" 43#include "i915_drm.h"
44 44
@@ -216,7 +216,7 @@ intel_bo_destroy(struct kms_bo *_bo)
216 return 0; 216 return 0;
217} 217}
218 218
219int 219drm_private int
220intel_create(int fd, struct kms_driver **out) 220intel_create(int fd, struct kms_driver **out)
221{ 221{
222 struct kms_driver *kms; 222 struct kms_driver *kms;
diff --git a/libkms/internal.h b/libkms/internal.h
index f831b57d..905f5b17 100644
--- a/libkms/internal.h
+++ b/libkms/internal.h
@@ -29,6 +29,11 @@
29#ifndef INTERNAL_H_ 29#ifndef INTERNAL_H_
30#define INTERNAL_H_ 30#define INTERNAL_H_
31 31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include "libdrm_macros.h"
32#include "libkms.h" 37#include "libkms.h"
33 38
34struct kms_driver 39struct kms_driver
@@ -62,18 +67,18 @@ struct kms_bo
62 unsigned handle; 67 unsigned handle;
63}; 68};
64 69
65int linux_create(int fd, struct kms_driver **out); 70drm_private int linux_create(int fd, struct kms_driver **out);
66 71
67int vmwgfx_create(int fd, struct kms_driver **out); 72drm_private int vmwgfx_create(int fd, struct kms_driver **out);
68 73
69int intel_create(int fd, struct kms_driver **out); 74drm_private int intel_create(int fd, struct kms_driver **out);
70 75
71int dumb_create(int fd, struct kms_driver **out); 76drm_private int dumb_create(int fd, struct kms_driver **out);
72 77
73int nouveau_create(int fd, struct kms_driver **out); 78drm_private int nouveau_create(int fd, struct kms_driver **out);
74 79
75int radeon_create(int fd, struct kms_driver **out); 80drm_private int radeon_create(int fd, struct kms_driver **out);
76 81
77int exynos_create(int fd, struct kms_driver **out); 82drm_private int exynos_create(int fd, struct kms_driver **out);
78 83
79#endif 84#endif
diff --git a/libkms/kms-symbol-check b/libkms/kms-symbol-check
new file mode 100755
index 00000000..658b2692
--- /dev/null
+++ b/libkms/kms-symbol-check
@@ -0,0 +1,25 @@
1#!/bin/bash
2
3# The following symbols (past the first five) are taken from the public headers.
4# A list of the latter should be available Makefile.sources/LIBKMS_H_FILES
5
6FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libkms.so} | awk '{print $3}'| while read func; do
7( grep -q "^$func$" || echo $func ) <<EOF
8__bss_start
9_edata
10_end
11_fini
12_init
13kms_bo_create
14kms_bo_destroy
15kms_bo_get_prop
16kms_bo_map
17kms_bo_unmap
18kms_create
19kms_destroy
20kms_get_prop
21EOF
22done)
23
24test ! -n "$FUNCS" || echo $FUNCS
25test ! -n "$FUNCS"
diff --git a/libkms/libkms.h b/libkms/libkms.h
index c00b1597..930a2bfc 100644
--- a/libkms/libkms.h
+++ b/libkms/libkms.h
@@ -29,7 +29,7 @@
29#ifndef _LIBKMS_H_ 29#ifndef _LIBKMS_H_
30#define _LIBKMS_H_ 30#define _LIBKMS_H_
31 31
32#if defined(__cplusplus) || defined(c_plusplus) 32#if defined(__cplusplus)
33extern "C" { 33extern "C" {
34#endif 34#endif
35 35
@@ -75,7 +75,7 @@ int kms_bo_map(struct kms_bo *bo, void **out);
75int kms_bo_unmap(struct kms_bo *bo); 75int kms_bo_unmap(struct kms_bo *bo);
76int kms_bo_destroy(struct kms_bo **bo); 76int kms_bo_destroy(struct kms_bo **bo);
77 77
78#if defined(__cplusplus) || defined(c_plusplus) 78#if defined(__cplusplus)
79}; 79};
80#endif 80#endif
81 81
diff --git a/libkms/linux.c b/libkms/linux.c
index 77a0bbe9..6e0da830 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -39,9 +39,13 @@
39#include <xf86drm.h> 39#include <xf86drm.h>
40#include <string.h> 40#include <string.h>
41#include <unistd.h> 41#include <unistd.h>
42
43#include <sys/stat.h> 42#include <sys/stat.h>
43#include <sys/types.h>
44#ifdef HAVE_SYS_MKDEV_H
45#include <sys/mkdev.h>
46#endif
44 47
48#include "libdrm_macros.h"
45#include "internal.h" 49#include "internal.h"
46 50
47#define PATH_SIZE 512 51#define PATH_SIZE 512
@@ -145,7 +149,7 @@ struct create_record
145 int (*func)(int fd, struct kms_driver **out); 149 int (*func)(int fd, struct kms_driver **out);
146}; 150};
147 151
148static struct create_record table[] = { 152static const struct create_record table[] = {
149 { 0x8086, 0x2a42, intel_create }, /* i965 */ 153 { 0x8086, 0x2a42, intel_create }, /* i965 */
150#ifdef HAVE_VMWGFX 154#ifdef HAVE_VMWGFX
151 { 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */ 155 { 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */
@@ -225,7 +229,7 @@ linux_from_udev(int fd, struct kms_driver **out)
225} 229}
226#endif 230#endif
227 231
228int 232drm_private int
229linux_create(int fd, struct kms_driver **out) 233linux_create(int fd, struct kms_driver **out)
230{ 234{
231 if (!dumb_create(fd, out)) 235 if (!dumb_create(fd, out))
diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index 228903ff..d10e0fdb 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -38,7 +38,7 @@
38 38
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "xf86drm.h" 40#include "xf86drm.h"
41#include "libdrm.h" 41#include "libdrm_macros.h"
42 42
43#include "nouveau_drm.h" 43#include "nouveau_drm.h"
44 44
@@ -198,7 +198,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)
198 return 0; 198 return 0;
199} 199}
200 200
201int 201drm_private int
202nouveau_create(int fd, struct kms_driver **out) 202nouveau_create(int fd, struct kms_driver **out)
203{ 203{
204 struct kms_driver *kms; 204 struct kms_driver *kms;
diff --git a/libkms/radeon.c b/libkms/radeon.c
index 9383a0ae..aaeeaf31 100644
--- a/libkms/radeon.c
+++ b/libkms/radeon.c
@@ -38,7 +38,7 @@
38 38
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include "xf86drm.h" 40#include "xf86drm.h"
41#include "libdrm.h" 41#include "libdrm_macros.h"
42 42
43#include "radeon_drm.h" 43#include "radeon_drm.h"
44 44
@@ -219,7 +219,7 @@ radeon_bo_destroy(struct kms_bo *_bo)
219 return 0; 219 return 0;
220} 220}
221 221
222int 222drm_private int
223radeon_create(int fd, struct kms_driver **out) 223radeon_create(int fd, struct kms_driver **out)
224{ 224{
225 struct kms_driver *kms; 225 struct kms_driver *kms;
diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c
index bc04133f..6a24fd4d 100644
--- a/libkms/vmwgfx.c
+++ b/libkms/vmwgfx.c
@@ -36,7 +36,7 @@
36#include "internal.h" 36#include "internal.h"
37 37
38#include "xf86drm.h" 38#include "xf86drm.h"
39#include "libdrm.h" 39#include "libdrm_macros.h"
40#include "vmwgfx_drm.h" 40#include "vmwgfx_drm.h"
41 41
42struct vmwgfx_bo 42struct vmwgfx_bo
@@ -185,7 +185,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo)
185 return 0; 185 return 0;
186} 186}
187 187
188int 188drm_private int
189vmwgfx_create(int fd, struct kms_driver **out) 189vmwgfx_create(int fd, struct kms_driver **out)
190{ 190{
191 struct kms_driver *kms; 191 struct kms_driver *kms;