summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Ross <gordon.w.ross@gmail.com>2016-10-29 18:07:54 -0400
committerGordon Ross <gordon.w.ross@gmail.com>2016-11-23 00:26:49 -0500
commite063b977e8a2c1a321bd414044c2cd3f222ec7ba (patch)
tree27bd54f145e7508929751010c7ef6dbd766e3c4e
parente224385b6c2936e1344533c57381048d2f6a74e3 (diff)
downloadillumos-gfx-drm-e063b977e8a2c1a321bd414044c2cd3f222ec7ba.tar.gz
Build libdrm, libkms, libdrm_...
Also build man pages and package things Split up the patches so they're easier to update
-rw-r--r--usr/src/Makefile.master5
-rw-r--r--usr/src/Targetdirs6
-rw-r--r--usr/src/common/libdrm/Check-patches41
-rw-r--r--usr/src/common/libdrm/Makefile2
-rw-r--r--usr/src/common/libdrm/Makefile.drm40
-rw-r--r--usr/src/common/libdrm/patches/incl-drm-drm-h.patch (renamed from usr/src/common/libdrm/patches/solaris-drm-port.patch)161
-rw-r--r--usr/src/common/libdrm/patches/incl-drm-i915-drm-h.patch116
-rw-r--r--usr/src/common/libdrm/patches/libdrm-lists-h.patch28
-rw-r--r--usr/src/common/libdrm/patches/util-double-list-h.patch12
-rw-r--r--usr/src/common/libdrm/patches/util-math-h.patch11
-rw-r--r--usr/src/common/libdrm/patches/xf86drm-c.patch12
-rw-r--r--usr/src/common/libdrm/patches/xf86drm-h.patch49
-rw-r--r--usr/src/common/libdrm/patches/xf86drmMode-c.patch15
-rw-r--r--usr/src/lib/Makefile11
-rw-r--r--usr/src/lib/libdrm/Makefile99
-rw-r--r--usr/src/lib/libdrm/Makefile.com56
-rw-r--r--usr/src/lib/libdrm/Makefile.pc41
-rw-r--r--usr/src/lib/libdrm/amd64/Makefile19
-rw-r--r--usr/src/lib/libdrm/i386/Makefile18
-rw-r--r--usr/src/lib/libdrm_amdgpu/Makefile74
-rw-r--r--usr/src/lib/libdrm_amdgpu/Makefile.com62
-rw-r--r--usr/src/lib/libdrm_amdgpu/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_amdgpu/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_exynos/Makefile83
-rw-r--r--usr/src/lib/libdrm_exynos/Makefile.com60
-rw-r--r--usr/src/lib/libdrm_exynos/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_exynos/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_freedreno/Makefile76
-rw-r--r--usr/src/lib/libdrm_freedreno/Makefile.com81
-rw-r--r--usr/src/lib/libdrm_freedreno/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_freedreno/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_intel/Makefile77
-rw-r--r--usr/src/lib/libdrm_intel/Makefile.com61
-rw-r--r--usr/src/lib/libdrm_intel/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_intel/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_omap/Makefile82
-rw-r--r--usr/src/lib/libdrm_omap/Makefile.com60
-rw-r--r--usr/src/lib/libdrm_omap/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_omap/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_radeon/Makefile82
-rw-r--r--usr/src/lib/libdrm_radeon/Makefile.com61
-rw-r--r--usr/src/lib/libdrm_radeon/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_radeon/i386/Makefile20
-rw-r--r--usr/src/lib/libdrm_tegra/Makefile74
-rw-r--r--usr/src/lib/libdrm_tegra/Makefile.com59
-rw-r--r--usr/src/lib/libdrm_tegra/amd64/Makefile21
-rw-r--r--usr/src/lib/libdrm_tegra/i386/Makefile20
-rw-r--r--usr/src/lib/libkms/Makefile74
-rw-r--r--usr/src/lib/libkms/Makefile.com69
-rw-r--r--usr/src/lib/libkms/amd64/Makefile21
-rw-r--r--usr/src/lib/libkms/i386/Makefile20
-rw-r--r--usr/src/man/Makefile1
-rw-r--r--usr/src/man/Makefile.man16
-rw-r--r--usr/src/man/man3/Makefile37
-rw-r--r--usr/src/man/man7/Makefile28
-rw-r--r--usr/src/pkg/manifests/x11-library-libdrm.mf139
56 files changed, 2243 insertions, 183 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index f298d23..94d9cca 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -179,6 +179,7 @@ TAR= /usr/bin/tar
ASTBINDIR= /usr/ast/bin
MSGCC= $(ASTBINDIR)/msgcc
MSGFMT= /usr/bin/msgfmt -s
+XSLTPROC= /usr/bin/xsltproc
FILEMODE= 644
DIRMODE= 755
@@ -367,7 +368,7 @@ XSTRCONST= -xstrconst
#
# turn warnings into errors (C)
-CERRWARN = -errtags=yes -errwarn=%all
+CERRWARN = -errtags=yes # -errwarn=%all
CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
@@ -392,7 +393,7 @@ CCERRWARN= -xwe
# C99 mode
C99_ENABLE= -xc99=%all
C99_DISABLE= -xc99=%none
-C99MODE= $(C99_DISABLE)
+C99MODE= $(C99_ENABLE)
C99LMODE= $(C99MODE:-xc99%=-Xc99%)
# In most places, assignments to these macros should be appended with +=
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs
index dcc6ed6..3f77cae 100644
--- a/usr/src/Targetdirs
+++ b/usr/src/Targetdirs
@@ -213,6 +213,8 @@ DIRS= \
/usr/lib/mdb/kvm \
/usr/lib/mdb/proc \
/usr/lib/nfs \
+ /usr/lib/pkgconfig \
+ /usr/lib/xorg \
/usr/net \
/usr/net/servers \
/usr/lib/pool \
@@ -332,6 +334,8 @@ DIRS64= \
/usr/ccs/lib/$(MACH64) \
/usr/lib/$(MACH64) \
/usr/lib/$(MACH64)/gss \
+ /usr/lib/$(MACH64)/pkgconfig \
+ /usr/lib/abi/$(MACH64) \
/usr/lib/brand/sn1/$(MACH64) \
/usr/lib/brand/solaris10/$(MACH64) \
/usr/lib/elfedit/$(MACH64) \
@@ -351,7 +355,7 @@ DIRS64= \
/usr/lib/secure/$(MACH64) \
/usr/lib/security/$(MACH64) \
/usr/lib/smbsrv/$(MACH64) \
- /usr/lib/abi/$(MACH64) \
+ /usr/lib/xorg/$(MACH64) \
/usr/sbin/$(MACH64) \
/usr/ucb/$(MACH64) \
/usr/ucblib/$(MACH64) \
diff --git a/usr/src/common/libdrm/Check-patches b/usr/src/common/libdrm/Check-patches
index 56df35f..4bf0a24 100644
--- a/usr/src/common/libdrm/Check-patches
+++ b/usr/src/common/libdrm/Check-patches
@@ -92,19 +92,32 @@ diff_ref omap -name '*.c' > $chk/omap.patch
echo patches/rpath-pc.in.patch
diff_ref . -name '*.pc.in' > $chk/rpath-pc.in.patch
-# Everything else is in...
-echo patches/solaris-drm-port.patch
-( head -27 patches/solaris-drm-port.patch ;
- ( cd $dir && find . -name '*.[ch]' -print) |
- sed -e 's:^./::' | sort |
- egrep -v '^(etnaviv|exynos|freedreno|intel|omap|tests/exynos)' |
- while read f
- do
- cmp -s $ref/$f $dir/$f || {
- echo diff ... $dir/$f
- diff -u $ref/$f $dir/$f
- }
- done
-) > $chk/solaris-drm-port.patch
+echo patches/incl-drm-drm-h.patch
+( head -27 patches/incl-drm-drm-h.patch ;
+ diff_ref include/drm/drm.h ) > $chk/incl-drm-drm-h.patch
+
+echo patches/incl-drm-i915-drm-h.patch
+( head -27 patches/incl-drm-i915-drm-h.patch ;
+ diff_ref include/drm/i915_drm.h ) > $chk/incl-drm-i915-drm-h.patch
+
+echo patches/libdrm-lists-h.patch
+diff_ref libdrm_lists.h > $chk/libdrm-lists-h.patch
+
+echo patches/util-double-list-h.patch
+diff_ref util_double_list.h > $chk/util-double-list-h.patch
+
+echo patches/util-math-h.patch
+diff_ref util_math.h > $chk/util-math-h.patch
+
+echo patches/xf86drm-c.patch
+diff_ref xf86drm.c > $chk/xf86drm-c.patch
+
+echo patches/xf86drm-h.patch
+( head -27 patches/xf86drm-h.patch ;
+ diff_ref xf86drm.h ) > $chk/xf86drm-h.patch
+
+echo patches/xf86drmMode-c.patch
+diff_ref xf86drmMode.c > $chk/xf86drmMode-c.patch
+
diff -r patches $chk \ No newline at end of file
diff --git a/usr/src/common/libdrm/Makefile b/usr/src/common/libdrm/Makefile
index 85f8f9d..6846ecd 100644
--- a/usr/src/common/libdrm/Makefile
+++ b/usr/src/common/libdrm/Makefile
@@ -21,7 +21,9 @@ include $(SRC)/Makefile.master
FETCH= $(SRC)/tools/userland-fetch
+# See also: ./Makefile.drm LIBDRM_VERS
LIBDRM_VERS=2.4.71
+
LIBDRM_DIR=libdrm-$(LIBDRM_VERS)
LIBDRM_ARCHIVE=$(LIBDRM_DIR).tar.bz2
LIBDRM_URL=http://dri.freedesktop.org/libdrm/$(LIBDRM_ARCHIVE)
diff --git a/usr/src/common/libdrm/Makefile.drm b/usr/src/common/libdrm/Makefile.drm
new file mode 100644
index 0000000..95dbaa2
--- /dev/null
+++ b/usr/src/common/libdrm/Makefile.drm
@@ -0,0 +1,40 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2016 Gordon W. Ross
+#
+
+# This make include is used in $SRC/lib/libdrm/*
+#
+# See also: ./Makefile LIBDRM_VERS
+LIBDRM_VERS=2.4.71
+
+LIBDRM_CMN_DIR=$(SRC)/common/libdrm/libdrm-$(LIBDRM_VERS)
+
+ROOTLIBDIR = $(ROOT)/usr/lib/xorg
+ROOTLIBDIR64 = $(ROOT)/usr/lib/xorg/$(MACH64)
+
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+# Defines that would normally come from autoconf. ook through
+# libdrm-$(LIBDRM_VERS)/config.h.in when updating libdrm to
+# check for new ones we might need to define.
+CPPFLAGS += -DHAVE_ALLOCA_H
+CPPFLAGS += -DMAJOR_IN_MKDEV
+
+# Additional CPPFLAG defines in:
+# $SRC/cmd/drm-tests/util HAVE_CAIRO
+# $SRC/lib/libkms HAVE_INTEL (_VMWGFX,_NOUVEAU,_RADEON,_EXYNOS)
+
+CPPFLAGS += -I$(SRC)/uts/common \
+ -I$(SRC)/uts/common/drm \
+ -I$(LIBDRM_CMN_DIR)/include/drm
diff --git a/usr/src/common/libdrm/patches/solaris-drm-port.patch b/usr/src/common/libdrm/patches/incl-drm-drm-h.patch
index 5a0a973..152523a 100644
--- a/usr/src/common/libdrm/patches/solaris-drm-port.patch
+++ b/usr/src/common/libdrm/patches/incl-drm-drm-h.patch
@@ -25,17 +25,6 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
-diff ... libdrm-2.4.64/amdgpu/amdgpu_cs.c
---- 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>
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
@@ -142,153 +131,3 @@ index 8adb9d5..f9bedd0 100644
};
/**
-diff ... b/include/drm/i915_drm.h
---- a/include/drm/i915_drm.h
-+++ b/include/drm/i915_drm.h
-@@ -100,6 +100,7 @@
- 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;
-@@ -139,6 +140,8 @@
- 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;
-@@ -296,6 +299,15 @@
- struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
- } drm_i915_batchbuffer_t;
-
-+typedef struct drm_i915_batchbuffer32 {
-+ int start; /* agp offset */
-+ int used; /* nr bytes in use */
-+ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
-+ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
-+ int num_cliprects; /* mulitpass with multiple cliprects? */
-+ caddr32_t cliprects; /* pointer to userspace cliprects */
-+} drm_i915_batchbuffer32_t;
-+
- /* As above, but pass a pointer to userspace buffer which can be
- * validated by the kernel prior to sending to hardware.
- */
-@@ -308,6 +320,15 @@
- struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
- } drm_i915_cmdbuffer_t;
-
-+typedef struct drm_i915_cmdbuffer32 {
-+ caddr32_t buf; /* pointer to userspace command buffer */
-+ int sz; /* nr bytes in buf */
-+ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
-+ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
-+ int num_cliprects; /* mulitpass with multiple cliprects? */
-+ caddr32_t cliprects; /* pointer to userspace cliprects */
-+} drm_i915_cmdbuffer32_t;
-+
- /* Userspace can request & wait on irq's:
- */
- typedef struct drm_i915_irq_emit {
-@@ -314,6 +335,10 @@
- int *irq_seq;
- } drm_i915_irq_emit_t;
-
-+typedef struct drm_i915_irq_emit32 {
-+ caddr32_t irq_seq;
-+} drm_i915_irq_emit32_t;
-+
- typedef struct drm_i915_irq_wait {
- int irq_seq;
- } drm_i915_irq_wait_t;
-@@ -369,6 +394,11 @@
- int *value;
- } drm_i915_getparam_t;
-
-+typedef struct drm_i915_getparam32 {
-+ int param;
-+ caddr32_t value;
-+} drm_i915_getparam32_t;
-+
- /* Ioctl to set kernel params:
- */
- #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
-@@ -392,6 +422,13 @@
- int *region_offset; /* offset from start of fb or agp */
- } drm_i915_mem_alloc_t;
-
-+typedef struct drm_i915_mem_alloc32 {
-+ int region;
-+ int alignment;
-+ int size;
-+ caddr32_t region_offset; /* offset from start of fb or agp */
-+} drm_i915_mem_alloc32_t;
-+
- typedef struct drm_i915_mem_free {
- int region;
- int region_offset;
-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 MAJOR_IN_MKDEV
- #include <sys/mkdev.h>
-diff ... b/xf86drm.c
---- a/xf86drm.c Fri Mar 20 07:05:48 2015
-+++ b/xf86drm.c Fri Mar 20 07:06:10 2015
-@@ -1108,7 +1108,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;
-diff --git a/xf86drm.h b/xf86drm.h
-index 76eb94e..6a14120 100644
---- a/xf86drm.h
-+++ b/xf86drm.h
-@@ -472,6 +472,17 @@
- #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
-@@ -850,7 +850,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,
diff --git a/usr/src/common/libdrm/patches/incl-drm-i915-drm-h.patch b/usr/src/common/libdrm/patches/incl-drm-i915-drm-h.patch
new file mode 100644
index 0000000..ac49639
--- /dev/null
+++ b/usr/src/common/libdrm/patches/incl-drm-i915-drm-h.patch
@@ -0,0 +1,116 @@
+# 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 ... b/include/drm/i915_drm.h
+--- a/include/drm/i915_drm.h
++++ b/include/drm/i915_drm.h
+@@ -100,6 +100,7 @@
+ 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;
+@@ -139,6 +140,8 @@
+ 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;
+@@ -296,6 +299,15 @@
+ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
+ } drm_i915_batchbuffer_t;
+
++typedef struct drm_i915_batchbuffer32 {
++ int start; /* agp offset */
++ int used; /* nr bytes in use */
++ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
++ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
++ int num_cliprects; /* mulitpass with multiple cliprects? */
++ caddr32_t cliprects; /* pointer to userspace cliprects */
++} drm_i915_batchbuffer32_t;
++
+ /* As above, but pass a pointer to userspace buffer which can be
+ * validated by the kernel prior to sending to hardware.
+ */
+@@ -308,6 +320,15 @@
+ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
+ } drm_i915_cmdbuffer_t;
+
++typedef struct drm_i915_cmdbuffer32 {
++ caddr32_t buf; /* pointer to userspace command buffer */
++ int sz; /* nr bytes in buf */
++ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
++ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
++ int num_cliprects; /* mulitpass with multiple cliprects? */
++ caddr32_t cliprects; /* pointer to userspace cliprects */
++} drm_i915_cmdbuffer32_t;
++
+ /* Userspace can request & wait on irq's:
+ */
+ typedef struct drm_i915_irq_emit {
+@@ -314,6 +335,10 @@
+ int *irq_seq;
+ } drm_i915_irq_emit_t;
+
++typedef struct drm_i915_irq_emit32 {
++ caddr32_t irq_seq;
++} drm_i915_irq_emit32_t;
++
+ typedef struct drm_i915_irq_wait {
+ int irq_seq;
+ } drm_i915_irq_wait_t;
+@@ -369,6 +394,11 @@
+ int *value;
+ } drm_i915_getparam_t;
+
++typedef struct drm_i915_getparam32 {
++ int param;
++ caddr32_t value;
++} drm_i915_getparam32_t;
++
+ /* Ioctl to set kernel params:
+ */
+ #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
+@@ -392,6 +422,13 @@
+ int *region_offset; /* offset from start of fb or agp */
+ } drm_i915_mem_alloc_t;
+
++typedef struct drm_i915_mem_alloc32 {
++ int region;
++ int alignment;
++ int size;
++ caddr32_t region_offset; /* offset from start of fb or agp */
++} drm_i915_mem_alloc32_t;
++
+ typedef struct drm_i915_mem_free {
+ int region;
+ int region_offset;
diff --git a/usr/src/common/libdrm/patches/libdrm-lists-h.patch b/usr/src/common/libdrm/patches/libdrm-lists-h.patch
new file mode 100644
index 0000000..a1d2691
--- /dev/null
+++ b/usr/src/common/libdrm/patches/libdrm-lists-h.patch
@@ -0,0 +1,28 @@
+diff ... libdrm-2.4.67/libdrm_lists.h
+--- libdrm-2.4.67/libdrm_lists.h.~1~ Thu Feb 14 10:14:08 2013
++++ libdrm-2.4.67/libdrm_lists.h Sat Oct 29 18:53:40 2016
+@@ -96,18 +96,18 @@
+ (__item) = (__temp), (__temp) = (__item)->prev)
+
+ #define DRMLISTFOREACHENTRY(__item, __list, __head) \
+- for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head); \
++ for ((__item) = DRMLISTENTRY(__typeof(*__item), (__list)->next, __head); \
+ &(__item)->__head != (__list); \
+- (__item) = DRMLISTENTRY(typeof(*__item), \
++ (__item) = DRMLISTENTRY(__typeof(*__item), \
+ (__item)->__head.next, __head))
+
+ #define DRMLISTFOREACHENTRYSAFE(__item, __temp, __list, __head) \
+- for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head), \
+- (__temp) = DRMLISTENTRY(typeof(*__item), \
++ for ((__item) = DRMLISTENTRY(__typeof(*__item), (__list)->next, __head), \
++ (__temp) = DRMLISTENTRY(__typeof(*__item), \
+ (__item)->__head.next, __head); \
+ &(__item)->__head != (__list); \
+ (__item) = (__temp), \
+- (__temp) = DRMLISTENTRY(typeof(*__item), \
++ (__temp) = DRMLISTENTRY(__typeof(*__item), \
+ (__temp)->__head.next, __head))
+
+ #define DRMLISTJOIN(__list, __join) if (!DRMLISTEMPTY(__list)) { \
+
diff --git a/usr/src/common/libdrm/patches/util-double-list-h.patch b/usr/src/common/libdrm/patches/util-double-list-h.patch
new file mode 100644
index 0000000..91677ad
--- /dev/null
+++ b/usr/src/common/libdrm/patches/util-double-list-h.patch
@@ -0,0 +1,12 @@
+diff ... libdrm-2.4.71/util_double_list.h
+--- libdrm-2.4.71/util_double_list.h.~1~ Tue Aug 2 16:22:45 2016
++++ libdrm-2.4.71/util_double_list.h Sat Nov 19 10:37:40 2016
+@@ -110,7 +110,7 @@
+ #ifndef container_of
+ #define container_of(ptr, sample, member) \
+ (void *)((char *)(ptr) \
+- - ((char *)&((typeof(sample))0)->member))
++ - ((char *)&((__typeof(sample))0)->member))
+ #endif
+
+ #define LIST_FOR_EACH_ENTRY(pos, head, member) \
diff --git a/usr/src/common/libdrm/patches/util-math-h.patch b/usr/src/common/libdrm/patches/util-math-h.patch
new file mode 100644
index 0000000..69f51f2
--- /dev/null
+++ b/usr/src/common/libdrm/patches/util-math-h.patch
@@ -0,0 +1,11 @@
+diff ... libdrm-2.4.67/util_math.h
+--- libdrm-2.4.67/util_math.h.~1~ Fri Oct 23 13:58:02 2015
++++ libdrm-2.4.67/util_math.h Sat Oct 29 20:59:51 2016
+@@ -29,6 +29,6 @@
+ #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+
+ #define __align_mask(value, mask) (((value) + (mask)) & ~(mask))
+-#define ALIGN(value, alignment) __align_mask(value, (typeof(value))((alignment) - 1))
++#define ALIGN(value, alignment) __align_mask(value, (__typeof(value))((alignment) - 1))
+
+ #endif /*_UTIL_MATH_H_*/
diff --git a/usr/src/common/libdrm/patches/xf86drm-c.patch b/usr/src/common/libdrm/patches/xf86drm-c.patch
new file mode 100644
index 0000000..7c6064b
--- /dev/null
+++ b/usr/src/common/libdrm/patches/xf86drm-c.patch
@@ -0,0 +1,12 @@
+diff ... b/xf86drm.c
+--- a/xf86drm.c Fri Mar 20 07:05:48 2015
++++ b/xf86drm.c Fri Mar 20 07:06:10 2015
+@@ -1108,7 +1108,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;
diff --git a/usr/src/common/libdrm/patches/xf86drm-h.patch b/usr/src/common/libdrm/patches/xf86drm-h.patch
new file mode 100644
index 0000000..6b00073
--- /dev/null
+++ b/usr/src/common/libdrm/patches/xf86drm-h.patch
@@ -0,0 +1,49 @@
+# 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/xf86drm.h b/xf86drm.h
+index 76eb94e..6a14120 100644
+--- a/xf86drm.h
++++ b/xf86drm.h
+@@ -472,6 +472,17 @@
+ #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/usr/src/common/libdrm/patches/xf86drmMode-c.patch b/usr/src/common/libdrm/patches/xf86drmMode-c.patch
new file mode 100644
index 0000000..7d34058
--- /dev/null
+++ b/usr/src/common/libdrm/patches/xf86drmMode-c.patch
@@ -0,0 +1,15 @@
+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
+@@ -850,7 +850,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,
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index d961af6..e234330 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -48,7 +48,16 @@ SUBDIRS= \
libfoo \
$($(MACH)_SUBDIRS)
-i386_SUBDIRS=
+i386_SUBDIRS= \
+ libdrm .WAIT \
+ libkms \
+ libdrm_intel \
+ libdrm_amdgpu \
+ libdrm_exynos \
+ libdrm_freedreno \
+ libdrm_omap \
+ libdrm_radeon \
+ libdrm_tegra
sparc_SUBDIRS=
diff --git a/usr/src/lib/libdrm/Makefile b/usr/src/lib/libdrm/Makefile
new file mode 100644
index 0000000..3863fff
--- /dev/null
+++ b/usr/src/lib/libdrm/Makefile
@@ -0,0 +1,99 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+HDRS= \
+ xf86drm.h \
+ xf86drmMode.h
+
+# Note -- these headers come from uts/common/drm:
+# drm.h drm_fourcc.h drm_mode.h drm_sarea.h i915_drm.h
+# See KDRM_HDRS in $src/common/libdrm/Makefile
+
+DRM_HDRS= \
+ amdgpu_drm.h \
+ mach64_drm.h \
+ mga_drm.h \
+ nouveau_drm.h \
+ qxl_drm.h \
+ r128_drm.h \
+ radeon_drm.h \
+ savage_drm.h \
+ sis_drm.h \
+ tegra_drm.h \
+ vc4_drm.h \
+ via_drm.h \
+ vmwgfx_drm.h
+
+ROOT_DRM_HDRS= $(DRM_HDRS:%=$(ROOTHDRDIR)/libdrm/%)
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS) $(ROOT_DRM_HDRS)
+
+# need to mkdir...
+$(ROOT_DRM_HDRS) : $(ROOTHDRDIR)/libdrm
+$(ROOTHDRDIR)/libdrm :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rules for install_h target
+$(ROOTHDRDIR)/libdrm/%: $(LIBDRM_CMN_DIR)/include/drm/%
+ $(INS.file)
+
+# HDRS=...
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm/Makefile.com b/usr/src/lib/libdrm/Makefile.com
new file mode 100644
index 0000000..8dd6a3d
--- /dev/null
+++ b/usr/src/lib/libdrm/Makefile.com
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm.a
+VERS= .2
+
+# See common/libdrm/libdrm-*/Makefile.in am__objects
+OBJECTS= xf86drm.o xf86drmHash.o \
+ xf86drmRandom.o xf86drmSL.o \
+ xf86drmMode.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+# CFLAGS += $(CCVERBOSE)
+LDLIBS += -lm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm/Makefile.pc b/usr/src/lib/libdrm/Makefile.pc
new file mode 100644
index 0000000..28221ac
--- /dev/null
+++ b/usr/src/lib/libdrm/Makefile.pc
@@ -0,0 +1,41 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2016 Gordon W. Ross
+#
+
+ROOTPCDIR= $(ROOT)/usr/lib/pkgconfig
+ROOTPCDIR64= $(ROOT)/usr/lib/$(MACH64)/pkgconfig
+
+ROOTPCS= $(PCS:%=$(ROOTPCDIR)/%)
+ROOTPCS64= $(PCS:%=$(ROOTPCDIR64)/%)
+
+PCLIBDIR=/usr/lib/xorg
+$(BUILD64)PCLIBDIR=/usr/lib/xorg/$(MACH64)
+
+# Need ${prefix} as a literal
+PREFIX=$$\{prefix\}
+
+PC_SED= -e "s:@prefix@:/usr:g" \
+ -e "s:@exec_prefix@:${PREFIX}:g" \
+ -e "s:@libdir@:${PCLIBDIR}:g" \
+ -e "s:@includedir@:${PREFIX}/include:g" \
+ -e "s:@PACKAGE_VERSION@:${LIBDRM_VERS}:g"
+
+%.pc : $(SRCDIR)/%.pc.in
+ $(SED) $(PC_SED) > $@.tmp < $<
+ $(MV) $@.tmp $@
+
+$(ROOTPCDIR)/%: %
+ $(INS.file)
+$(ROOTPCDIR64)/%: %
+ $(INS.file)
diff --git a/usr/src/lib/libdrm/amd64/Makefile b/usr/src/lib/libdrm/amd64/Makefile
new file mode 100644
index 0000000..e29cfd9
--- /dev/null
+++ b/usr/src/lib/libdrm/amd64/Makefile
@@ -0,0 +1,19 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm/i386/Makefile b/usr/src/lib/libdrm/i386/Makefile
new file mode 100644
index 0000000..1b7eeee
--- /dev/null
+++ b/usr/src/lib/libdrm/i386/Makefile
@@ -0,0 +1,18 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_amdgpu/Makefile b/usr/src/lib/libdrm_amdgpu/Makefile
new file mode 100644
index 0000000..010a384
--- /dev/null
+++ b/usr/src/lib/libdrm_amdgpu/Makefile
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/libdrm
+
+HDRS= amdgpu.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/amdgpu/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_amdgpu/Makefile.com b/usr/src/lib/libdrm_amdgpu/Makefile.com
new file mode 100644
index 0000000..5d6ee0e
--- /dev/null
+++ b/usr/src/lib/libdrm_amdgpu/Makefile.com
@@ -0,0 +1,62 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_amdgpu.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/amdgpu/Makefile.in am__objects
+OBJECTS= \
+ amdgpu_bo.o amdgpu_cs.o amdgpu_device.o \
+ amdgpu_gpu_info.o amdgpu_vamgr.o util_hash.o \
+ util_hash_table.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/amdgpu
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/amdgpu
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_amdgpu/amd64/Makefile b/usr/src/lib/libdrm_amdgpu/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_amdgpu/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_amdgpu/i386/Makefile b/usr/src/lib/libdrm_amdgpu/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_amdgpu/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_exynos/Makefile b/usr/src/lib/libdrm_exynos/Makefile
new file mode 100644
index 0000000..4a6002f
--- /dev/null
+++ b/usr/src/lib/libdrm_exynos/Makefile
@@ -0,0 +1,83 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+DRM_HDRS= \
+ exynos_drmif.h \
+
+EXYNOS_HDRS= \
+ exynos_drm.h \
+ exynos_fimg2d.h
+
+ROOT_DRM_HDRS= $(DRM_HDRS:%=$(ROOTHDRDIR)/libdrm/%)
+ROOT_EXYNOS_HDRS= $(EXYNOS_HDRS:%=$(ROOTHDRDIR)/exynos/%)
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOT_DRM_HDRS) $(ROOT_EXYNOS_HDRS)
+
+# need to mkdir...
+$(ROOT_EXYNOS_HDRS) : $(ROOTHDRDIR)/exynos
+$(ROOTHDRDIR)/exynos :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rules for install_h target
+$(ROOTHDRDIR)/libdrm/%: $(LIBDRM_CMN_DIR)/exynos/%
+ $(INS.file)
+
+$(ROOTHDRDIR)/exynos/%: $(LIBDRM_CMN_DIR)/exynos/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_exynos/Makefile.com b/usr/src/lib/libdrm_exynos/Makefile.com
new file mode 100644
index 0000000..ed97601
--- /dev/null
+++ b/usr/src/lib/libdrm_exynos/Makefile.com
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_exynos.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/exynos/Makefile.in am__objects
+OBJECTS= \
+ exynos_drm.o exynos_fimg2d.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/exynos
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/exynos
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_exynos/amd64/Makefile b/usr/src/lib/libdrm_exynos/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_exynos/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_exynos/i386/Makefile b/usr/src/lib/libdrm_exynos/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_exynos/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_freedreno/Makefile b/usr/src/lib/libdrm_freedreno/Makefile
new file mode 100644
index 0000000..e379e4e
--- /dev/null
+++ b/usr/src/lib/libdrm_freedreno/Makefile
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/freedreno
+
+HDRS= \
+ freedreno_drmif.h \
+ freedreno_ringbuffer.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/freedreno/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_freedreno/Makefile.com b/usr/src/lib/libdrm_freedreno/Makefile.com
new file mode 100644
index 0000000..ed4229b
--- /dev/null
+++ b/usr/src/lib/libdrm_freedreno/Makefile.com
@@ -0,0 +1,81 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_freedreno.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/freedreno/Makefile.in am__objects
+OBJS_TOP= \
+ freedreno_device.o freedreno_pipe.o \
+ freedreno_ringbuffer.o freedreno_bo.o freedreno_bo_cache.o
+
+OBJS_MSM= \
+ msm_bo.o \
+ msm_device.o msm_pipe.o msm_ringbuffer.o
+
+OBJS_KGSL= \
+ kgsl_bo.o kgsl_device.o kgsl_pipe.o \
+ kgsl_ringbuffer.o
+
+OBJECTS= $(OBJS_TOP) $(OBJS_MSM) $(OBJS_KGSL)
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/freedreno
+
+CPPFLAGS += -DHAVE_FREEDRENO_KGSL
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/freedreno
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+CPPFLAGS += -I/usr/include/pixman-1
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+objs/%.o pics/%.o: $(SRCDIR)/msm/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+objs/%.o pics/%.o: $(SRCDIR)/kgsl/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_freedreno/amd64/Makefile b/usr/src/lib/libdrm_freedreno/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_freedreno/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_freedreno/i386/Makefile b/usr/src/lib/libdrm_freedreno/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_freedreno/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_intel/Makefile b/usr/src/lib/libdrm_intel/Makefile
new file mode 100644
index 0000000..eef8079
--- /dev/null
+++ b/usr/src/lib/libdrm_intel/Makefile
@@ -0,0 +1,77 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/libdrm
+
+HDRS= \
+ intel_aub.h \
+ intel_bufmgr.h \
+ intel_debug.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/intel/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_intel/Makefile.com b/usr/src/lib/libdrm_intel/Makefile.com
new file mode 100644
index 0000000..e78a23c
--- /dev/null
+++ b/usr/src/lib/libdrm_intel/Makefile.com
@@ -0,0 +1,61 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_intel.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/intel/Makefile.in am_libdrm_intel_la_OBJECTS
+OBJECTS= \
+ intel_bufmgr.o intel_bufmgr_fake.o \
+ intel_bufmgr_gem.o intel_decode.o mm.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/intel
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/intel
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_intel/amd64/Makefile b/usr/src/lib/libdrm_intel/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_intel/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_intel/i386/Makefile b/usr/src/lib/libdrm_intel/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_intel/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_omap/Makefile b/usr/src/lib/libdrm_omap/Makefile
new file mode 100644
index 0000000..658c199
--- /dev/null
+++ b/usr/src/lib/libdrm_omap/Makefile
@@ -0,0 +1,82 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+DRM_HDRS= \
+ omap_drmif.h
+
+OMAP_HDRS= \
+ omap_drm.h
+
+ROOT_DRM_HDRS= $(DRM_HDRS:%=$(ROOTHDRDIR)/libdrm/%)
+ROOT_OMAP_HDRS= $(OMAP_HDRS:%=$(ROOTHDRDIR)/omap/%)
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOT_DRM_HDRS) $(ROOT_OMAP_HDRS)
+
+# need to mkdir...
+$(ROOT_OMAP_HDRS) : $(ROOTHDRDIR)/omap
+$(ROOTHDRDIR)/omap :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rules for install_h target
+$(ROOTHDRDIR)/libdrm/%: $(LIBDRM_CMN_DIR)/omap/%
+ $(INS.file)
+
+$(ROOTHDRDIR)/omap/%: $(LIBDRM_CMN_DIR)/omap/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_omap/Makefile.com b/usr/src/lib/libdrm_omap/Makefile.com
new file mode 100644
index 0000000..46f17e4
--- /dev/null
+++ b/usr/src/lib/libdrm_omap/Makefile.com
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_omap.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/omap/Makefile.in am__objects
+OBJECTS= \
+ omap_drm.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/omap
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/omap
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_omap/amd64/Makefile b/usr/src/lib/libdrm_omap/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_omap/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_omap/i386/Makefile b/usr/src/lib/libdrm_omap/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_omap/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_radeon/Makefile b/usr/src/lib/libdrm_radeon/Makefile
new file mode 100644
index 0000000..c8ee855
--- /dev/null
+++ b/usr/src/lib/libdrm_radeon/Makefile
@@ -0,0 +1,82 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/libdrm
+
+HDRS= \
+ r600_pci_ids.h \
+ radeon_bo.h \
+ radeon_bo_gem.h \
+ radeon_bo_int.h \
+ radeon_cs.h \
+ radeon_cs_gem.h \
+ radeon_cs_int.h \
+ radeon_surface.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/radeon/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_radeon/Makefile.com b/usr/src/lib/libdrm_radeon/Makefile.com
new file mode 100644
index 0000000..fedac9f
--- /dev/null
+++ b/usr/src/lib/libdrm_radeon/Makefile.com
@@ -0,0 +1,61 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_radeon.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/radeon/Makefile.in am__objects
+OBJECTS= \
+ radeon_bo_gem.o radeon_cs_gem.o radeon_cs_space.o \
+ radeon_bo.o radeon_cs.o radeon_surface.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/radeon
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/radeon
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_radeon/amd64/Makefile b/usr/src/lib/libdrm_radeon/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_radeon/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_radeon/i386/Makefile b/usr/src/lib/libdrm_radeon/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_radeon/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libdrm_tegra/Makefile b/usr/src/lib/libdrm_tegra/Makefile
new file mode 100644
index 0000000..e690481
--- /dev/null
+++ b/usr/src/lib/libdrm_tegra/Makefile
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/libdrm
+
+HDRS= tegra.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/tegra/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libdrm_tegra/Makefile.com b/usr/src/lib/libdrm_tegra/Makefile.com
new file mode 100644
index 0000000..4fa3877
--- /dev/null
+++ b/usr/src/lib/libdrm_tegra/Makefile.com
@@ -0,0 +1,59 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libdrm_tegra.a
+VERS= .0
+
+# See common/libdrm/libdrm-*/tegra/Makefile.in am__objects
+OBJECTS= tegra.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/tegra
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/tegra
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -lpciaccess -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libdrm_tegra/amd64/Makefile b/usr/src/lib/libdrm_tegra/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libdrm_tegra/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libdrm_tegra/i386/Makefile b/usr/src/lib/libdrm_tegra/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libdrm_tegra/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/lib/libkms/Makefile b/usr/src/lib/libkms/Makefile
new file mode 100644
index 0000000..543af32
--- /dev/null
+++ b/usr/src/lib/libkms/Makefile
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+# include library definitions
+include ../Makefile.lib
+
+include $(SRC)/common/libdrm/Makefile.drm
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+ROOTHDRDIR= $(ROOT)/usr/include/libkms
+
+HDRS= libkms.h
+
+.KEEP_STATE:
+
+install: all .WAIT $(SUBDIRS)
+
+all clean clobber lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+# need to make ROOTHDRDIR
+$(ROOTHDRS) : $(ROOTHDRDIR)
+$(ROOTHDRDIR) :
+ $(INS.dir) $@
+
+check: $(CHECKHDRS)
+
+_msg: # no msgfiles here
+
+$(POFILE): pofile_MSGFILES
+
+# install rule for install_h target
+$(ROOTHDRDIR)/%: $(LIBDRM_CMN_DIR)/libkms/%
+ $(INS.file)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libkms/Makefile.com b/usr/src/lib/libkms/Makefile.com
new file mode 100644
index 0000000..2646372
--- /dev/null
+++ b/usr/src/lib/libkms/Makefile.com
@@ -0,0 +1,69 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+LIBRARY= libkms.a
+VERS= .1
+
+# See common/libdrm/libdrm-*/libkms/Makefile.in am__objects
+OBJECTS= \
+ linux.o dumb.o api.o \
+ exynos.o intel.o nouveau.o radeon.o vmwgfx.o
+
+include ../../Makefile.lib
+include $(SRC)/common/libdrm/Makefile.drm
+
+LIBS = $(DYNLIB)
+PCS = $(LIBRARY:.a=.pc)
+
+MAPFILES=
+SRCDIR = $(LIBDRM_CMN_DIR)/libkms
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
+
+# See libkms/linux.c
+CPPFLAGS += -DHAVE_INTEL
+CPPFLAGS += -DHAVE_VMWGFX
+CPPFLAGS += -DHAVE_NOUVEAU
+CPPFLAGS += -DHAVE_RADEON
+CPPFLAGS += -DHAVE_EXYNOS
+
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/libkms
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)/exynos
+CPPFLAGS += -I$(LIBDRM_CMN_DIR)
+
+LDLIBS32 += -L$(ROOT)/usr/lib/xorg
+LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64)
+
+LDLIBS += -ldrm -lc
+
+all : $(LIBS) $(PCS)
+
+lint :
+
+include ../../libdrm/Makefile.pc
+include ../../Makefile.targ
+
+.KEEP_STATE:
diff --git a/usr/src/lib/libkms/amd64/Makefile b/usr/src/lib/libkms/amd64/Makefile
new file mode 100644
index 0000000..547a7b3
--- /dev/null
+++ b/usr/src/lib/libkms/amd64/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+DYNFLAGS += -R/usr/lib/xorg/$(MACH64)
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTPCS64)
diff --git a/usr/src/lib/libkms/i386/Makefile b/usr/src/lib/libkms/i386/Makefile
new file mode 100644
index 0000000..248b5e0
--- /dev/null
+++ b/usr/src/lib/libkms/i386/Makefile
@@ -0,0 +1,20 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+DYNFLAGS += -R/usr/lib/xorg
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTPCS)
diff --git a/usr/src/man/Makefile b/usr/src/man/Makefile
index 4274db9..74517d3 100644
--- a/usr/src/man/Makefile
+++ b/usr/src/man/Makefile
@@ -14,6 +14,7 @@
#
SUBDIRS= man1 \
+ man3 \
man3x \
man7 \
man7d \
diff --git a/usr/src/man/Makefile.man b/usr/src/man/Makefile.man
index 1b26bf0..b1661a4 100644
--- a/usr/src/man/Makefile.man
+++ b/usr/src/man/Makefile.man
@@ -19,6 +19,20 @@ ROOTMAN= $(ROOT)/usr/share/man
ROOTHASMAN= $(ROOT)/usr/has/man
FILEMODE= 0444
+# or: http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
+MANPAGES_STYLESHEET = /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl
+
+XSLTPROC_FLAGS = \
+ --stringparam man.authors.section.enabled 0 \
+ --stringparam man.copyright.section.enabled 0 \
+ --stringparam funcsynopsis.style ansi \
+ --stringparam man.output.quietly 1 \
+ --nonet \
+ $(MANPAGES_STYLESHEET)
+
+XSLTPROC_PROCESS_MAN = \
+ $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) "$<"
+
# The manual section being built, client Makefiles must set this to, for e.g.
# "3perl", with case matching that of the section name as installed.
#
@@ -55,7 +69,7 @@ check: $(MANCHECKS)
clean:
clobber:
- $(RM) $(MANLINKS)
+ $(RM) $(MANLINKS) $(CLOBBERFILES)
.PARALLEL:
diff --git a/usr/src/man/man3/Makefile b/usr/src/man/man3/Makefile
new file mode 100644
index 0000000..1575dd6
--- /dev/null
+++ b/usr/src/man/man3/Makefile
@@ -0,0 +1,37 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet
+# at http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011, Richard Lowe
+#
+
+include $(SRC)/Makefile.master
+
+MANSECT= 3
+
+# generated man pages
+GENMAN= \
+ drmAvailable.3 \
+ drmHandleEvent.3 \
+ drmModeGetResources.3
+
+MANFILES= $(GENMAN)
+MANLINKS=
+
+.KEEP_STATE:
+
+include $(SRC)/man/Makefile.man
+include $(SRC)/common/libdrm/Makefile.drm
+
+install: $(ROOTMANFILES) $(ROOTMANLINKS)
+
+$(ROOTMAN)/man3/%.3 : $(LIBDRM_CMN_DIR)/man/%.xml
+ $(XSLTPROC_PROCESS_MAN)
diff --git a/usr/src/man/man7/Makefile b/usr/src/man/man7/Makefile
index 6ba1f78..48ac28e 100644
--- a/usr/src/man/man7/Makefile
+++ b/usr/src/man/man7/Makefile
@@ -17,12 +17,34 @@ include $(SRC)/Makefile.master
MANSECT= 7
-MANFILES= foo.7
-
+# generated man pages
+GENMANS= \
+ drm.7 \
+ drm-kms.7 \
+ drm-memory.7
+
+LINKSRC= drm-memory.7
+GENLINKS= \
+ drm-mm.7 \
+ drm-gem.7 \
+ drm-ttm.7
+
+MANFILES= foo.7 \
+ $(GENMANS)
MANLINKS=
.KEEP_STATE:
include $(SRC)/man/Makefile.man
+include $(SRC)/common/libdrm/Makefile.drm
+
+ROOTGENLINKS= $(GENLINKS:%=$(ROOTMAN)/man$(MANSECT)/%)
+
+install: $(ROOTMANFILES) $(ROOTMANLINKS) $(ROOTGENLINKS)
+
+$(ROOTMAN)/man7/%.7 : $(LIBDRM_CMN_DIR)/man/%.xml
+ $(XSLTPROC_PROCESS_MAN)
+
-install: $(ROOTMANFILES) $(ROOTMANLINKS)
+$(ROOTGENLINKS):
+ $(RM) $@; $(SYMLINK) $(LINKSRC) $@
diff --git a/usr/src/pkg/manifests/x11-library-libdrm.mf b/usr/src/pkg/manifests/x11-library-libdrm.mf
new file mode 100644
index 0000000..d8c1c6e
--- /dev/null
+++ b/usr/src/pkg/manifests/x11-library-libdrm.mf
@@ -0,0 +1,139 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2015 Alexander Pyhalov
+#
+
+set name=pkg.fmri value=pkg:/x11/library/libdrm@$(PKGVERS)
+set name=pkg.description value="Direct Rendering Manager (DRM) Libraries"
+set name=pkg.summary value="DRM Libraries"
+set name=info.classification value=System/X11
+set name=info.source-url \
+ value=http://dri.freedesktop.org/libdrm-2.4.67.tar.bz2
+set name=info.upstream-url value=http://dri.freedesktop.org
+#
+dir path=usr group=sys
+dir path=usr/include
+dir path=usr/include/exynos
+dir path=usr/include/freedreno
+dir path=usr/include/libdrm
+dir path=usr/lib
+dir path=usr/lib/$(ARCH64)
+dir path=usr/lib/$(ARCH64)/pkgconfig group=other
+dir path=usr/lib/pkgconfig group=other
+dir path=usr/lib/xorg
+dir path=usr/lib/xorg/$(ARCH64)
+#
+file path=usr/include/exynos/exynos_drm.h
+file path=usr/include/exynos/exynos_fimg2d.h
+file path=usr/include/freedreno/freedreno_drmif.h
+file path=usr/include/freedreno/freedreno_ringbuffer.h
+file path=usr/include/libdrm/amdgpu.h
+file path=usr/include/libdrm/amdgpu_drm.h
+#file path=usr/include/libdrm/drm.h
+#file path=usr/include/libdrm/drm_fourcc.h
+#file path=usr/include/libdrm/drm_mode.h
+#file path=usr/include/libdrm/drm_sarea.h
+file path=usr/include/libdrm/exynos_drmif.h
+#file path=usr/include/libdrm/i915_drm.h
+file path=usr/include/libdrm/intel_aub.h
+file path=usr/include/libdrm/intel_bufmgr.h
+file path=usr/include/libdrm/intel_debug.h
+file path=usr/include/libdrm/mach64_drm.h
+file path=usr/include/libdrm/mga_drm.h
+file path=usr/include/libdrm/nouveau_drm.h
+file path=usr/include/libdrm/omap_drmif.h
+file path=usr/include/libdrm/qxl_drm.h
+file path=usr/include/libdrm/r128_drm.h
+file path=usr/include/libdrm/r600_pci_ids.h
+file path=usr/include/libdrm/radeon_bo.h
+file path=usr/include/libdrm/radeon_bo_gem.h
+file path=usr/include/libdrm/radeon_bo_int.h
+file path=usr/include/libdrm/radeon_cs.h
+file path=usr/include/libdrm/radeon_cs_gem.h
+file path=usr/include/libdrm/radeon_cs_int.h
+file path=usr/include/libdrm/radeon_drm.h
+file path=usr/include/libdrm/radeon_surface.h
+file path=usr/include/libdrm/savage_drm.h
+file path=usr/include/libdrm/sis_drm.h
+file path=usr/include/libdrm/tegra.h
+file path=usr/include/libdrm/tegra_drm.h
+file path=usr/include/libdrm/vc4_drm.h
+file path=usr/include/libdrm/via_drm.h
+#file path=usr/include/libdrm/virtgpu_drm.h
+file path=usr/include/libdrm/vmwgfx_drm.h
+file path=usr/include/libkms/libkms.h
+file path=usr/include/omap/omap_drm.h
+file path=usr/include/xf86drm.h
+file path=usr/include/xf86drmMode.h
+#
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_amdgpu.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_exynos.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_freedreno.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_intel.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_omap.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_radeon.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libdrm_tegra.pc
+file path=usr/lib/$(ARCH64)/pkgconfig/libkms.pc
+file path=usr/lib/pkgconfig/libdrm.pc
+file path=usr/lib/pkgconfig/libdrm_amdgpu.pc
+file path=usr/lib/pkgconfig/libdrm_exynos.pc
+file path=usr/lib/pkgconfig/libdrm_freedreno.pc
+file path=usr/lib/pkgconfig/libdrm_intel.pc
+file path=usr/lib/pkgconfig/libdrm_omap.pc
+file path=usr/lib/pkgconfig/libdrm_radeon.pc
+file path=usr/lib/pkgconfig/libdrm_tegra.pc
+file path=usr/lib/pkgconfig/libkms.pc
+#
+file path=usr/lib/xorg/$(ARCH64)/libdrm.so.2
+file path=usr/lib/xorg/$(ARCH64)/libdrm_amdgpu.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_exynos.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_freedreno.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_intel.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_omap.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_radeon.so.1
+file path=usr/lib/xorg/$(ARCH64)/libdrm_tegra.so.0
+file path=usr/lib/xorg/$(ARCH64)/libkms.so.1
+file path=usr/lib/xorg/libdrm.so.2
+file path=usr/lib/xorg/libdrm_amdgpu.so.1
+file path=usr/lib/xorg/libdrm_exynos.so.1
+file path=usr/lib/xorg/libdrm_freedreno.so.1
+file path=usr/lib/xorg/libdrm_intel.so.1
+file path=usr/lib/xorg/libdrm_omap.so.1
+file path=usr/lib/xorg/libdrm_radeon.so.1
+file path=usr/lib/xorg/libdrm_tegra.so.0
+file path=usr/lib/xorg/libkms.so.1
+#
+license usr/src/common/libdrm/LICENSE_LIBDRM \
+ license=usr/src/common/libdrm/LICENSE_LIBDRM
+#
+link path=usr/lib/xorg/$(ARCH64)/libdrm.so target=libdrm.so.2
+link path=usr/lib/xorg/$(ARCH64)/libdrm_amdgpu.so target=libdrm_amdgpu.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_exynos.so target=libdrm_exynos.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_freedreno.so \
+ target=libdrm_freedreno.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_intel.so target=libdrm_intel.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_omap.so target=libdrm_omap.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_radeon.so target=libdrm_radeon.so.1
+link path=usr/lib/xorg/$(ARCH64)/libdrm_tegra.so target=libdrm_tegra.so.0
+link path=usr/lib/xorg/$(ARCH64)/libkms.so target=libkms.so.1
+link path=usr/lib/xorg/libdrm.so target=libdrm.so.2
+link path=usr/lib/xorg/libdrm_amdgpu.so target=libdrm_amdgpu.so.1
+link path=usr/lib/xorg/libdrm_exynos.so target=libdrm_exynos.so.1
+link path=usr/lib/xorg/libdrm_freedreno.so target=libdrm_freedreno.so.1
+link path=usr/lib/xorg/libdrm_intel.so target=libdrm_intel.so.1
+link path=usr/lib/xorg/libdrm_omap.so target=libdrm_omap.so.1
+link path=usr/lib/xorg/libdrm_radeon.so target=libdrm_radeon.so.1
+link path=usr/lib/xorg/libdrm_tegra.so target=libdrm_tegra.so.0
+link path=usr/lib/xorg/libkms.so target=libkms.so.1
+depend fmri=pkg:/driver/graphics/drm type=require