summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Ross <gordon.w.ross@gmail.com>2016-10-29 16:04:15 -0400
committerGordon Ross <gordon.w.ross@gmail.com>2016-11-22 22:55:22 -0500
commitfaf8165e7b6e7f47d35d15ca30e53c25a8f72de4 (patch)
treefe31153acfb6d8bdf16ffa6e20e3fedffa1c5063
parented20f65b1d42c5bd2d5223ef4d3d2457062eef4b (diff)
downloadillumos-gfx-drm-faf8165e7b6e7f47d35d15ca30e53c25a8f72de4.tar.gz
Import patches for libdrm 2.4.71 from oi-userland,
commit 514a49365da85d55677e83b4ffdc14862307c088
-rw-r--r--usr/src/common/libdrm/patches/etnaviv.patch13
-rw-r--r--usr/src/common/libdrm/patches/exynos.patch33
-rw-r--r--usr/src/common/libdrm/patches/freedreno.patch15
-rw-r--r--usr/src/common/libdrm/patches/intel-drm.patch30
-rw-r--r--usr/src/common/libdrm/patches/omap.patch13
-rw-r--r--usr/src/common/libdrm/patches/rpath-pc.in.patch103
-rw-r--r--usr/src/common/libdrm/patches/solaris-drm-port.patch212
7 files changed, 419 insertions, 0 deletions
diff --git a/usr/src/common/libdrm/patches/etnaviv.patch b/usr/src/common/libdrm/patches/etnaviv.patch
new file mode 100644
index 0000000..397f500
--- /dev/null
+++ b/usr/src/common/libdrm/patches/etnaviv.patch
@@ -0,0 +1,13 @@
+--- libdrm-2.4.71/etnaviv/etnaviv_device.c.old 2016-10-18 23:11:06.163832408 +0300
++++ libdrm-2.4.71/etnaviv/etnaviv_device.c 2016-10-18 23:12:18.805796392 +0300
+@@ -29,8 +29,8 @@
+ #endif
+
+ #include <stdlib.h>
+-#include <linux/stddef.h>
+-#include <linux/types.h>
++#include <stddef.h>
++#include <sys/types.h>
+ #include <errno.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
diff --git a/usr/src/common/libdrm/patches/exynos.patch b/usr/src/common/libdrm/patches/exynos.patch
new file mode 100644
index 0000000..b511dd4
--- /dev/null
+++ b/usr/src/common/libdrm/patches/exynos.patch
@@ -0,0 +1,33 @@
+--- libdrm-2.4.58/exynos/exynos_drm.c.backup 2015-01-08 18:34:51.809200717 +0300
++++ libdrm-2.4.58/exynos/exynos_drm.c 2015-01-08 18:35:10.234657246 +0300
+@@ -34,7 +34,7 @@
+ #include <errno.h>
+
+ #include <sys/mman.h>
+-#include <linux/stddef.h>
++#include <stddef.h>
+
+ #include <xf86drm.h>
+
+--- libdrm-2.4.58/exynos/exynos_fimg2d.c.backup 2015-01-08 19:21:22.648231644 +0300
++++ libdrm-2.4.58/exynos/exynos_fimg2d.c 2015-01-08 19:21:42.357339447 +0300
+@@ -20,7 +20,7 @@
+ #include <errno.h>
+
+ #include <sys/mman.h>
+-#include <linux/stddef.h>
++#include <stddef.h>
+
+ #include <xf86drm.h>
+
+--- libdrm-2.4.58/tests/exynos/exynos_fimg2d_test.c.backup 2015-01-08 19:23:24.788944043 +0300
++++ libdrm-2.4.58/tests/exynos/exynos_fimg2d_test.c 2015-01-08 19:23:44.048826244 +0300
+@@ -20,7 +20,7 @@
+ #include <errno.h>
+
+ #include <sys/mman.h>
+-#include <linux/stddef.h>
++#include <stddef.h>
+
+ #include <xf86drm.h>
+ #include <xf86drmMode.h>
diff --git a/usr/src/common/libdrm/patches/freedreno.patch b/usr/src/common/libdrm/patches/freedreno.patch
new file mode 100644
index 0000000..ebabc4b
--- /dev/null
+++ b/usr/src/common/libdrm/patches/freedreno.patch
@@ -0,0 +1,15 @@
+--- libdrm-2.4.70/freedreno/kgsl/kgsl_bo.c.orig 2016-09-14 01:56:02.447145494 +0200
++++ libdrm-2.4.70/freedreno/kgsl/kgsl_bo.c 2016-09-14 01:57:13.859602672 +0200
+@@ -32,7 +32,12 @@
+
+ #include "kgsl_priv.h"
+
++#if defined(__sun) && defined(__SVR4)
++#include <xorg/xorg-server.h>
++#include <xorg/fb.h>
++#else
+ #include <linux/fb.h>
++#endif
+
+ static int set_memtype(struct fd_device *dev, uint32_t handle, uint32_t flags)
+ {
diff --git a/usr/src/common/libdrm/patches/intel-drm.patch b/usr/src/common/libdrm/patches/intel-drm.patch
new file mode 100644
index 0000000..be07ed1
--- /dev/null
+++ b/usr/src/common/libdrm/patches/intel-drm.patch
@@ -0,0 +1,30 @@
+diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
+index 0a4012b..cb463be 100644
+--- a/intel/intel_bufmgr_gem.c
++++ b/intel/intel_bufmgr_gem.c
+@@ -3268,13 +3268,24 @@ drm_intel_bufmgr_gem_set_aub_annotations(drm_intel_bo *bo,
+ static pthread_mutex_t bufmgr_list_mutex = PTHREAD_MUTEX_INITIALIZER;
+ static drmMMListHead bufmgr_list = { &bufmgr_list, &bufmgr_list };
+
++static int
++compare_file_descriptor(int fd1, int fd2) {
++ struct stat stat1, stat2;
++ if (fstat (fd1, &stat1) < 0)
++ return -1;
++ if (fstat (fd2, &stat2) < 0)
++ return -1;
++ return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino);
++}
++
+ static drm_intel_bufmgr_gem *
+ drm_intel_bufmgr_gem_find(int fd)
+ {
+ drm_intel_bufmgr_gem *bufmgr_gem;
+
+ DRMLISTFOREACHENTRY(bufmgr_gem, &bufmgr_list, managers) {
+- if (bufmgr_gem->fd == fd) {
++ if (bufmgr_gem->fd == fd ||
++ compare_file_descriptor (bufmgr_gem->fd, fd)) {
+ atomic_inc(&bufmgr_gem->refcount);
+ return bufmgr_gem;
+ }
diff --git a/usr/src/common/libdrm/patches/omap.patch b/usr/src/common/libdrm/patches/omap.patch
new file mode 100644
index 0000000..baa4cdd
--- /dev/null
+++ b/usr/src/common/libdrm/patches/omap.patch
@@ -0,0 +1,13 @@
+--- libdrm-2.4.58/omap/omap_drm.c.backup 2015-01-08 18:32:54.476979307 +0300
++++ libdrm-2.4.58/omap/omap_drm.c 2015-01-08 18:34:06.884595926 +0300
+@@ -31,8 +31,8 @@
+ #endif
+
+ #include <stdlib.h>
+-#include <linux/stddef.h>
+-#include <linux/types.h>
++#include <stddef.h>
++#include <sys/types.h>
+ #include <errno.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
diff --git a/usr/src/common/libdrm/patches/rpath-pc.in.patch b/usr/src/common/libdrm/patches/rpath-pc.in.patch
new file mode 100644
index 0000000..8e35deb
--- /dev/null
+++ b/usr/src/common/libdrm/patches/rpath-pc.in.patch
@@ -0,0 +1,103 @@
+diff -ur libdrm-2.4.58-pc/exynos/libdrm_exynos.pc.in libdrm-2.4.58/exynos/libdrm_exynos.pc.in
+--- libdrm-2.4.58-pc/exynos/libdrm_exynos.pc.in 2013-02-14 19:14:08.000000000 +0400
++++ libdrm-2.4.58/exynos/libdrm_exynos.pc.in 2015-01-16 11:06:53.912309735 +0300
+@@ -6,6 +6,6 @@
+ Name: libdrm_exynos
+ Description: Userspace interface to exynos kernel DRM services
+ Version: 0.7
+-Libs: -L${libdir} -ldrm_exynos
++Libs: -L${libdir} -R${libdir} -ldrm_exynos
+ Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/exynos
+ Requires.private: libdrm
+diff -ur libdrm-2.4.58-pc/freedreno/libdrm_freedreno.pc.in libdrm-2.4.58/freedreno/libdrm_freedreno.pc.in
+--- libdrm-2.4.58-pc/freedreno/libdrm_freedreno.pc.in 2013-10-09 20:03:23.000000000 +0400
++++ libdrm-2.4.58/freedreno/libdrm_freedreno.pc.in 2015-01-16 11:06:53.934385038 +0300
+@@ -6,6 +6,6 @@
+ Name: libdrm_freedreno
+ Description: Userspace interface to freedreno kernel DRM services
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm_freedreno
++Libs: -L${libdir} -R${libdir} -ldrm_freedreno
+ Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/freedreno
+ Requires.private: libdrm
+diff -ur libdrm-2.4.58-pc/intel/libdrm_intel.pc.in libdrm-2.4.58/intel/libdrm_intel.pc.in
+--- libdrm-2.4.58-pc/intel/libdrm_intel.pc.in 2013-10-09 20:03:25.000000000 +0400
++++ libdrm-2.4.58/intel/libdrm_intel.pc.in 2015-01-16 11:06:53.922157974 +0300
+@@ -7,5 +7,5 @@
+ Description: Userspace interface to intel kernel DRM services
+ Version: @PACKAGE_VERSION@
+ Requires: libdrm
+-Libs: -L${libdir} -ldrm_intel
++Libs: -L${libdir} -R${libdir} -ldrm_intel
+ Cflags: -I${includedir} -I${includedir}/libdrm
+diff -ur libdrm-2.4.58-pc/libdrm.pc.in libdrm-2.4.58/libdrm.pc.in
+--- libdrm-2.4.58-pc/libdrm.pc.in 2013-02-14 19:14:08.000000000 +0400
++++ libdrm-2.4.58/libdrm.pc.in 2015-01-16 11:06:53.919163639 +0300
+@@ -6,5 +6,5 @@
+ Name: libdrm
+ Description: Userspace interface to kernel DRM services
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm
++Libs: -L${libdir} -R${libdir} -ldrm
+ Cflags: -I${includedir} -I${includedir}/libdrm
+diff -ur libdrm-2.4.58-pc/libkms/libkms.pc.in libdrm-2.4.58/libkms/libkms.pc.in
+--- libdrm-2.4.58-pc/libkms/libkms.pc.in 2013-02-14 19:14:08.000000000 +0400
++++ libdrm-2.4.58/libkms/libkms.pc.in 2015-01-16 11:06:53.916371045 +0300
+@@ -6,5 +6,5 @@
+ Name: libkms
+ Description: Library that abstract aways the different mm interface for kernel drivers
+ Version: 1.0.0
+-Libs: -L${libdir} -lkms
++Libs: -L${libdir} -R${libdir} -lkms
+ Cflags: -I${includedir}/libkms
+diff -ur libdrm-2.4.58-pc/nouveau/libdrm_nouveau.pc.in libdrm-2.4.58/nouveau/libdrm_nouveau.pc.in
+--- libdrm-2.4.58-pc/nouveau/libdrm_nouveau.pc.in 2013-10-09 20:03:25.000000000 +0400
++++ libdrm-2.4.58/nouveau/libdrm_nouveau.pc.in 2015-01-16 11:06:53.928345775 +0300
+@@ -6,6 +6,6 @@
+ Name: libdrm_nouveau
+ Description: Userspace interface to nouveau kernel DRM services
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm_nouveau
++Libs: -L${libdir} -R${libdir} -ldrm_nouveau
+ Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau
+ Requires.private: libdrm
+diff -ur libdrm-2.4.58-pc/omap/libdrm_omap.pc.in libdrm-2.4.58/omap/libdrm_omap.pc.in
+--- libdrm-2.4.58-pc/omap/libdrm_omap.pc.in 2013-02-14 19:14:08.000000000 +0400
++++ libdrm-2.4.58/omap/libdrm_omap.pc.in 2015-01-16 11:06:53.925430710 +0300
+@@ -6,6 +6,6 @@
+ Name: libdrm_omap
+ Description: Userspace interface to omap kernel DRM services
+ Version: 0.6
+-Libs: -L${libdir} -ldrm_omap
++Libs: -L${libdir} -R${libdir} -ldrm_omap
+ Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/omap
+ Requires.private: libdrm
+diff -ur libdrm-2.4.58-pc/radeon/libdrm_radeon.pc.in libdrm-2.4.58/radeon/libdrm_radeon.pc.in
+--- libdrm-2.4.58-pc/radeon/libdrm_radeon.pc.in 2013-02-14 19:14:08.000000000 +0400
++++ libdrm-2.4.58/radeon/libdrm_radeon.pc.in 2015-01-16 11:06:53.931197646 +0300
+@@ -6,5 +6,5 @@
+ Name: libdrm_radeon
+ Description: Userspace interface to kernel DRM services for radeon
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm_radeon
++Libs: -L${libdir} -R${libdir} -ldrm_radeon
+ Cflags: -I${includedir} -I${includedir}/libdrm
+--- libdrm-2.4.64/tegra/libdrm_tegra.pc.in.~1~ 2015-09-14 15:55:25.984198527 +0300
++++ libdrm-2.4.64/tegra/libdrm_tegra.pc.in 2015-09-14 15:55:39.369838244 +0300
+@@ -6,6 +6,6 @@
+ Name: libdrm_tegra
+ Description: Userspace interface to Tegra kernel DRM services
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm_tegra
++Libs: -L${libdir} -R${libdir} -ldrm_tegra
+ Cflags: -I${includedir} -I${includedir}/libdrm
+ Requires.private: libdrm
+--- libdrm-2.4.64/amdgpu/libdrm_amdgpu.pc.in.~1~ 2015-09-14 15:54:50.636837960 +0300
++++ libdrm-2.4.64/amdgpu/libdrm_amdgpu.pc.in 2015-09-14 15:55:02.641516915 +0300
+@@ -6,5 +6,5 @@
+ Name: libdrm_amdgpu
+ Description: Userspace interface to kernel DRM services for amdgpu
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -ldrm_amdgpu
++Libs: -L${libdir} -R${libdir} -ldrm_amdgpu
+ Cflags: -I${includedir} -I${includedir}/libdrm
diff --git a/usr/src/common/libdrm/patches/solaris-drm-port.patch b/usr/src/common/libdrm/patches/solaris-drm-port.patch
new file mode 100644
index 0000000..8a4d8d6
--- /dev/null
+++ b/usr/src/common/libdrm/patches/solaris-drm-port.patch
@@ -0,0 +1,212 @@
+# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+
+diff --git a/include/drm/drm.h b/include/drm/drm.h
+index 8adb9d5..f9bedd0 100644
+--- a/include/drm/drm.h 2016-04-28 03:44:16.000000000 +0300
++++ b/include/drm/drm.h 2016-05-24 10:27:22.341573589 +0300
+@@ -55,10 +55,36 @@
+ typedef int64_t __s64;
+ typedef uint64_t __u64;
+ typedef size_t __kernel_size_t;
++#if defined(__SOLARIS__) || defined(__sun)
++#include <sys/types32.h>
++typedef unsigned long long drm_handle_t;
++#else
+ typedef unsigned long drm_handle_t;
++#endif
+
+ #endif
+
++/* Solaris-specific. */
++#if defined(__SOLARIS__) || defined(__sun)
++
++#define _IOC_NRBITS 8
++#define _IOC_TYPEBITS 8
++#define _IOC_SIZEBITS 14
++#define _IOC_DIRBITS 2
++
++#define _IOC_NRSHIFT 0
++#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
++#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
++#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
++
++#define _IOC(dir, type, nr, size) \
++ (((dir) /* already shifted */) | \
++ ((type) << _IOC_TYPESHIFT) | \
++ ((nr) << _IOC_NRSHIFT) | \
++ ((size) << _IOC_SIZESHIFT))
++
++#endif /* __Solaris__ or __sun */
++
+ #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
+ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
+ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
+@@ -210,12 +236,13 @@
+ * \sa drmAddMap().
+ */
+ struct drm_map {
+- unsigned long offset; /**< Requested physical address (0 for SAREA)*/
++ unsigned long long offset; /**< Requested physical address (0 for SAREA)*/
++ unsigned long long handle;
++ /**< User-space: "Handle" to pass to mmap() */
++ /**< Kernel-space: kernel-virtual address */
+ unsigned long size; /**< Requested physical size (bytes) */
+ enum drm_map_type type; /**< Type of memory to map */
+ enum drm_map_flags flags; /**< Flags */
+- void *handle; /**< User-space: "Handle" to pass to mmap() */
+- /**< Kernel-space: kernel-virtual address */
+ int mtrr; /**< MTRR slot used */
+ /* Private data */
+ };
+@@ -322,18 +349,22 @@
+ *
+ * \sa drmAddBufs().
+ */
++
++typedef enum {
++ _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
++ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
++ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
++ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
++ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
++} drm_buf_flag;
++
++
+ struct drm_buf_desc {
+ int count; /**< Number of buffers of this size */
+ int size; /**< Size in bytes */
+ int low_mark; /**< Low water mark */
+ int high_mark; /**< High water mark */
+- enum {
+- _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
+- _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
+- _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
+- _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
+- _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
+- } flags;
++ drm_buf_flag flags;
+ unsigned long agp_start; /**<
+ * Start address of where the AGP buffers are
+ * in the AGP aperture
+@@ -379,6 +410,7 @@
+ void *virtual; /**< Mmap'd area in user-virtual */
+ #endif
+ struct drm_buf_pub *list; /**< Buffer information */
++ int fd;
+ };
+
+ /**
+--- a/include/drm/i915_drm.h
++++ b/include/drm/i915_drm.h
+@@ -75,6 +75,7 @@ typedef struct _drm_i915_sarea {
+ int pf_current_page; /* which buffer is being displayed? */
+ int perf_boxes; /* performance boxes to be displayed */
+ int width, height; /* screen size in pixels */
++ int pad0;
+
+ drm_handle_t front_handle;
+ int front_offset;
+@@ -114,6 +115,8 @@ typedef struct _drm_i915_sarea {
+ int pipeB_w;
+ int pipeB_h;
+
++ int pad1;
++
+ /* fill out some space for old userspace triple buffer */
+ drm_handle_t unused_handle;
+ __u32 unused1, unused2, unused3;
+diff --git a/libkms/linux.c b/libkms/linux.c
+index fc4f205..5d66fc7 100644
+--- libdrm-2.4.64/libkms/linux.c.~1~ 2015-09-14 10:39:04.176885400 +0300
++++ libdrm-2.4.64/libkms/linux.c 2015-09-14 10:40:12.713465696 +0300
+@@ -40,6 +40,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #ifdef HAVE_SYS_MKDEV_H
+ #include <sys/mkdev.h>
+diff --git a/xf86drm.h b/xf86drm.h
+index 76eb94e..6a14120 100644
+--- a/xf86drm.h
++++ b/xf86drm.h
+@@ -458,6 +458,17 @@ do { register unsigned int __old __asm("o0"); \
+ #endif /* architecture */
+ #endif /* __GNUC__ >= 2 */
+
++#if defined(__SUNPRO_C)
++#include <atomic.h>
++#define atomic_cmpset_int(p, c, n) ((c == atomic_cas_uint(p, c, n)) ? 1 : 0)
++#define DRM_CAS(lock,old,new,__ret) \
++ do { \
++ unsigned int __result, __old = (old);\
++ __result = !atomic_cmpset_int(lock,__old,new);\
++ __ret = __result; \
++ } while(0)
++#endif
++
+ #ifndef DRM_CAS
+ #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
+ #endif
+diff --git a/xf86drmMode.c b/xf86drmMode.c
+index c809c44..715f23a 100644
+--- libdrm-2.4.64/xf86drmMode.c.~1~ 2015-09-14 10:33:51.340507095 +0300
++++ libdrm-2.4.64/xf86drmMode.c 2015-09-14 10:36:09.881744836 +0300
+@@ -834,7 +834,9 @@
+ drmClose(fd);
+ return 0;
+ #endif
+- return -ENOSYS;
++
++/* for now return 0 on solaris */
++ return 0;
+ }
+
+ int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
+--- a/xf86drm.c Fri Mar 20 07:05:48 2015
++++ b/xf86drm.c Fri Mar 20 07:06:10 2015
+@@ -1105,7 +1105,7 @@
+ drm_map_t map;
+
+ memclear(map);
+- map.handle = (void *)(uintptr_t)handle;
++ map.handle = (drm_handle_t)(uintptr_t)handle;
+
+ if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
+ return -errno;
+--- libdrm-2.4.64/amdgpu/amdgpu_cs.c.~1~ 2015-09-14 10:42:37.518409301 +0300
++++ libdrm-2.4.64/amdgpu/amdgpu_cs.c 2015-09-14 10:42:52.951974725 +0300
+@@ -25,6 +25,7 @@
+ #include "config.h"
+ #endif
+
++#include <alloca.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>