aboutsummaryrefslogtreecommitdiffstats
path: root/libkms
diff options
context:
space:
mode:
authorRichard Yoo2017-05-09 00:32:30 -0500
committerRichard Yoo2017-05-09 01:08:15 -0500
commitd8ed3020112ded2e210e652f5a8f367d5f847157 (patch)
treea56c761e21902ba6b24df5c5b8168372ab995162 /libkms
parent0da99b8ab0f691ad7ec7f4c5c8a09c5df92486a1 (diff)
parentd4b8344363b4e0f0e831e5722b6df5cc0bb08df8 (diff)
downloadexternal-libdrm-d8ed3020112ded2e210e652f5a8f367d5f847157.tar.gz
external-libdrm-d8ed3020112ded2e210e652f5a8f367d5f847157.tar.xz
external-libdrm-d8ed3020112ded2e210e652f5a8f367d5f847157.zip
Merge tag libdrm-2.4.75 into aosp/masterandroid-n-iot-preview-4
Below is a brief summary of patches pulled in: 0da99b8a (m/master, aosp/master) Move libdrm.so to vendor partition d4b83443 (tag: libdrm-2.4.75) Bump version for 2.4.75 release dae413e4 (tag: libdrm-2.4.74) Bump version for release 317bdff1 (tag: libdrm-2.4.73) Bump version for release 8cf43127 (tag: libdrm-2.4.72) Bump version for release a44c9c31 (tag: libdrm-2.4.71) Bump version for release 20208455 (tag: android-o-preview-1, tag: android-n-mr2-preview-2, tag: android-n-mr2-preview-1, aosp/sdk-release, aosp/o-preview) add a flag control that private libdrm can be chosen Bug: 35871718 Test: aosp_arm-eng compiles Change-Id: I81985fd41d5c0d8a732705dc2a4bee8eb5d459bb
Diffstat (limited to 'libkms')
-rw-r--r--libkms/Android.mk6
-rw-r--r--libkms/Makefile.am6
-rw-r--r--libkms/exynos.c3
-rw-r--r--libkms/libkms.pc.in1
-rw-r--r--libkms/linux.c99
5 files changed, 11 insertions, 104 deletions
diff --git a/libkms/Android.mk b/libkms/Android.mk
index aafebb64..9f81d8e3 100644
--- a/libkms/Android.mk
+++ b/libkms/Android.mk
@@ -4,6 +4,7 @@ intel_drivers := i915 i965 i915g ilo
4radeon_drivers := r300g r600g radeonsi 4radeon_drivers := r300g r600g radeonsi
5rockchip_drivers := rockchip 5rockchip_drivers := rockchip
6nouveau_drivers := nouveau 6nouveau_drivers := nouveau
7virgl_drivers := virgl
7vmwgfx_drivers := vmwgfx 8vmwgfx_drivers := vmwgfx
8tegra_drivers := tegra 9tegra_drivers := tegra
9 10
@@ -12,6 +13,7 @@ valid_drivers := \
12 $(radeon_drivers) \ 13 $(radeon_drivers) \
13 $(rockchip_drivers) \ 14 $(rockchip_drivers) \
14 $(nouveau_drivers) \ 15 $(nouveau_drivers) \
16 $(virgl_drivers) \
15 $(vmwgfx_drivers) \ 17 $(vmwgfx_drivers) \
16 $(tegra_drivers) 18 $(tegra_drivers)
17 19
@@ -46,10 +48,8 @@ ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
46LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) 48LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
47endif 49endif
48 50
49LOCAL_SRC_FILES := $(filter-out %.h,$(LOCAL_SRC_FILES))
50
51LOCAL_MODULE := libkms 51LOCAL_MODULE := libkms
52LOCAL_MODULE_TAGS := optional
53LOCAL_SHARED_LIBRARIES := libdrm 52LOCAL_SHARED_LIBRARIES := libdrm
54 53
54include $(LIBDRM_COMMON_MK)
55include $(BUILD_SHARED_LIBRARY) 55include $(BUILD_SHARED_LIBRARY)
diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 6c0ab7a2..461fc35b 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -10,10 +10,6 @@ libkms_ladir = $(libdir)
10libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined 10libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined
11libkms_la_LIBADD = ../libdrm.la 11libkms_la_LIBADD = ../libdrm.la
12 12
13#if HAVE_LIBUDEV
14#libkms_la_LIBADD += $(LIBUDEV_LIBS)
15#endif
16
17libkms_la_SOURCES = $(LIBKMS_FILES) 13libkms_la_SOURCES = $(LIBKMS_FILES)
18 14
19if HAVE_VMWGFX 15if HAVE_VMWGFX
@@ -44,4 +40,4 @@ pkgconfigdir = @pkgconfigdir@
44pkgconfig_DATA = libkms.pc 40pkgconfig_DATA = libkms.pc
45 41
46TESTS = kms-symbol-check 42TESTS = kms-symbol-check
47EXTRA_DIST = Android.mk $(TESTS) 43EXTRA_DIST = $(TESTS)
diff --git a/libkms/exynos.c b/libkms/exynos.c
index 5de2e5a9..0e97fb51 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -88,7 +88,8 @@ exynos_bo_create(struct kms_driver *kms,
88 pitch = (pitch + 512 - 1) & ~(512 - 1); 88 pitch = (pitch + 512 - 1) & ~(512 - 1);
89 size = pitch * ((height + 4 - 1) & ~(4 - 1)); 89 size = pitch * ((height + 4 - 1) & ~(4 - 1));
90 } else { 90 } else {
91 return -EINVAL; 91 ret = -EINVAL;
92 goto err_free;
92 } 93 }
93 94
94 memset(&arg, 0, sizeof(arg)); 95 memset(&arg, 0, sizeof(arg));
diff --git a/libkms/libkms.pc.in b/libkms/libkms.pc.in
index 511535ad..1421b3ea 100644
--- a/libkms/libkms.pc.in
+++ b/libkms/libkms.pc.in
@@ -8,3 +8,4 @@ Description: Library that abstract aways the different mm interface for kernel d
8Version: 1.0.0 8Version: 1.0.0
9Libs: -L${libdir} -lkms 9Libs: -L${libdir} -lkms
10Cflags: -I${includedir}/libkms 10Cflags: -I${includedir}/libkms
11Requires.private: libdrm
diff --git a/libkms/linux.c b/libkms/linux.c
index 6e0da830..0b50777e 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -41,9 +41,12 @@
41#include <unistd.h> 41#include <unistd.h>
42#include <sys/stat.h> 42#include <sys/stat.h>
43#include <sys/types.h> 43#include <sys/types.h>
44#ifdef HAVE_SYS_MKDEV_H 44#ifdef MAJOR_IN_MKDEV
45#include <sys/mkdev.h> 45#include <sys/mkdev.h>
46#endif 46#endif
47#ifdef MAJOR_IN_SYSMACROS
48#include <sys/sysmacros.h>
49#endif
47 50
48#include "libdrm_macros.h" 51#include "libdrm_macros.h"
49#include "internal.h" 52#include "internal.h"
@@ -138,105 +141,11 @@ linux_from_sysfs(int fd, struct kms_driver **out)
138 return ret; 141 return ret;
139} 142}
140 143
141#if 0
142#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
143#include <libudev.h>
144
145struct create_record
146{
147 unsigned vendor;
148 unsigned chip;
149 int (*func)(int fd, struct kms_driver **out);
150};
151
152static const struct create_record table[] = {
153 { 0x8086, 0x2a42, intel_create }, /* i965 */
154#ifdef HAVE_VMWGFX
155 { 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */
156#endif
157 { 0, 0, NULL },
158};
159
160static int
161linux_get_pciid_from_fd(int fd, unsigned *vendor_id, unsigned *chip_id)
162{
163 struct udev *udev;
164 struct udev_device *device;
165 struct udev_device *parent;
166 const char *pci_id;
167 struct stat buffer;
168 int ret;
169
170 ret = fstat(fd, &buffer);
171 if (ret)
172 return -EINVAL;
173
174 if (!S_ISCHR(buffer.st_mode))
175 return -EINVAL;
176
177 udev = udev_new();
178 if (!udev)
179 return -ENOMEM;
180
181 device = udev_device_new_from_devnum(udev, 'c', buffer.st_rdev);
182 if (!device)
183 goto err_free_udev;
184
185 parent = udev_device_get_parent(device);
186 if (!parent)
187 goto err_free_device;
188
189 pci_id = udev_device_get_property_value(parent, "PCI_ID");
190 if (!pci_id)
191 goto err_free_device;
192
193 if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2)
194 goto err_free_device;
195
196 udev_device_unref(device);
197 udev_unref(udev);
198
199 return 0;
200
201err_free_device:
202 udev_device_unref(device);
203err_free_udev:
204 udev_unref(udev);
205 return -EINVAL;
206}
207
208static int
209linux_from_udev(int fd, struct kms_driver **out)
210{
211 unsigned vendor_id, chip_id;
212 int ret, i;
213
214 ret = linux_get_pciid_from_fd(fd, &vendor_id, &chip_id);
215 if (ret)
216 return ret;
217
218 for (i = 0; table[i].func; i++)
219 if (table[i].vendor == vendor_id && table[i].chip == chip_id)
220 return table[i].func(fd, out);
221
222 return -ENOSYS;
223}
224#else
225static int
226linux_from_udev(int fd, struct kms_driver **out)
227{
228 return -ENOSYS;
229}
230#endif
231
232drm_private int 144drm_private int
233linux_create(int fd, struct kms_driver **out) 145linux_create(int fd, struct kms_driver **out)
234{ 146{
235 if (!dumb_create(fd, out)) 147 if (!dumb_create(fd, out))
236 return 0; 148 return 0;
237 149
238 if (!linux_from_udev(fd, out))
239 return 0;
240
241 return linux_from_sysfs(fd, out); 150 return linux_from_sysfs(fd, out);
242} 151}