1265N/A# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
98N/A#
98N/A# Permission is hereby granted, free of charge, to any person obtaining a
1089N/A# copy of this software and associated documentation files (the
1089N/A# "Software"), to deal in the Software without restriction, including
1089N/A# without limitation the rights to use, copy, modify, merge, publish,
1089N/A# distribute, and/or sell copies of the Software, and to permit persons
1089N/A# to whom the Software is furnished to do so, provided that the above
1089N/A# copyright notice(s) and this permission notice appear in all copies of
1089N/A# the Software and that both the above copyright notice(s) and this
1089N/A# permission notice appear in supporting documentation.
1089N/A#
1089N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1089N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1089N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
1089N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1089N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
1089N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
1089N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1089N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1089N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1089N/A#
1089N/A# Except as contained in this notice, the name of a copyright holder
1089N/A# shall not be used in advertising or otherwise to promote the sale, use
1089N/A# or other dealings in this Software without prior written authorization
1089N/A# of the copyright holder.
1089N/A
1296N/Adiff --git a/include/drm/drm.h b/include/drm/drm.h
1296N/Aindex 8adb9d5..f9bedd0 100644
1296N/A--- a/include/drm/drm.h
1296N/A+++ b/include/drm/drm.h
1089N/A@@ -54,10 +54,39 @@ typedef int32_t __s32;
1089N/A typedef uint32_t __u32;
1089N/A typedef int64_t __s64;
1089N/A typedef uint64_t __u64;
1089N/A+#if defined(__SOLARIS__) || defined(__sun)
1089N/A+#include <sys/types32.h>
1089N/A+typedef unsigned long long drm_handle_t;
1089N/A+#else
1089N/A typedef unsigned long drm_handle_t;
1089N/A+#endif
1089N/A
1089N/A #endif
606N/A
1089N/A+/* Solaris-specific. */
1089N/A+#if defined(__SOLARIS__) || defined(__sun)
1089N/A+
1089N/A+#define _IOC_NRBITS 8
1089N/A+#define _IOC_TYPEBITS 8
1089N/A+#define _IOC_SIZEBITS 14
1089N/A+#define _IOC_DIRBITS 2
1089N/A+
1089N/A+#define _IOC_NRSHIFT 0
1089N/A+#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
1089N/A+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
1089N/A+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
1089N/A+
1089N/A+#define _IOC(dir, type, nr, size) \
1089N/A+ (((dir) /* already shifted */) | \
1089N/A+ ((type) << _IOC_TYPESHIFT) | \
1089N/A+ ((nr) << _IOC_NRSHIFT) | \
1089N/A+ ((size) << _IOC_SIZESHIFT))
1089N/A+
1089N/A+#endif /* __Solaris__ or __sun */
1089N/A+
1089N/A+
1089N/A+
1089N/A+
1089N/A #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
1089N/A #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
1089N/A #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
1089N/A@@ -210,12 +239,13 @@ struct drm_ctx_priv_map {
1089N/A * \sa drmAddMap().
1089N/A */
1089N/A struct drm_map {
1089N/A- unsigned long offset; /**< Requested physical address (0 for SAREA)*/
1089N/A+ unsigned long long offset; /**< Requested physical address (0 for SAREA)*/
1089N/A+ unsigned long long handle;
1089N/A+ /**< User-space: "Handle" to pass to mmap() */
1089N/A+ /**< Kernel-space: kernel-virtual address */
1089N/A unsigned long size; /**< Requested physical size (bytes) */
1089N/A enum drm_map_type type; /**< Type of memory to map */
1089N/A enum drm_map_flags flags; /**< Flags */
1089N/A- void *handle; /**< User-space: "Handle" to pass to mmap() */
1089N/A- /**< Kernel-space: kernel-virtual address */
1089N/A int mtrr; /**< MTRR slot used */
1089N/A /* Private data */
1089N/A };
1089N/A@@ -322,18 +352,22 @@ enum drm_dma_flags {
1089N/A *
1089N/A * \sa drmAddBufs().
1089N/A */
1089N/A+
1089N/A+typedef enum {
1089N/A+ _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
1089N/A+ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
1089N/A+ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
1089N/A+ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
1089N/A+ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
1089N/A+} drm_buf_flag;
1089N/A+
1089N/A+
1089N/A struct drm_buf_desc {
1089N/A int count; /**< Number of buffers of this size */
1089N/A int size; /**< Size in bytes */
1089N/A int low_mark; /**< Low water mark */
1089N/A int high_mark; /**< High water mark */
1089N/A- enum {
1089N/A- _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
1089N/A- _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
1089N/A- _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
1089N/A- _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
1089N/A- _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
1089N/A- } flags;
1089N/A+ drm_buf_flag flags;
1089N/A unsigned long agp_start; /**<
1089N/A * Start address of where the AGP buffers are
1089N/A * in the AGP aperture
1296N/A@@ -379,6 +413,7 @@ struct drm_buf_map {
1089N/A void *virtual; /**< Mmap'd area in user-virtual */
1296N/A #endif
1089N/A struct drm_buf_pub *list; /**< Buffer information */
1089N/A+ int fd;
1089N/A };
606N/A
1089N/A /**
1296N/Adiff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
1296N/Aindex af3ce17..96d391d 100644
1296N/A--- a/include/drm/i915_drm.h
1296N/A+++ b/include/drm/i915_drm.h
1089N/A@@ -75,6 +75,7 @@ typedef struct _drm_i915_sarea {
1089N/A int pf_current_page; /* which buffer is being displayed? */
1089N/A int perf_boxes; /* performance boxes to be displayed */
1089N/A int width, height; /* screen size in pixels */
1089N/A+ int pad0;
1089N/A
1089N/A drm_handle_t front_handle;
1089N/A int front_offset;
1089N/A@@ -114,6 +115,8 @@ typedef struct _drm_i915_sarea {
1089N/A int pipeB_w;
1089N/A int pipeB_h;
1089N/A
1089N/A+ int pad1;
1089N/A+
1089N/A /* fill out some space for old userspace triple buffer */
1089N/A drm_handle_t unused_handle;
1089N/A __u32 unused1, unused2, unused3;
1296N/Adiff --git a/libkms/linux.c b/libkms/linux.c
1296N/Aindex fc4f205..5d66fc7 100644
1296N/A--- a/libkms/linux.c
1296N/A+++ b/libkms/linux.c
1089N/A@@ -39,6 +39,7 @@
1089N/A #include <unistd.h>
1089N/A
1089N/A #include <sys/stat.h>
1089N/A+#include <sys/sysmacros.h>
1089N/A
1089N/A #include "internal.h"
1089N/A
1296N/Adiff --git a/xf86drm.c b/xf86drm.c
1296N/Aindex 6ea068f..67e29a0 100644
1296N/A--- a/xf86drm.c
1296N/A+++ b/xf86drm.c
1296N/A@@ -984,7 +984,7 @@ int drmRmMap(int fd, drm_handle_t handle)
1296N/A {
1296N/A drm_map_t map;
1296N/A
1296N/A- map.handle = (void *)(uintptr_t)handle;
1296N/A+ map.handle = (drm_handle_t)(uintptr_t)handle;
1296N/A
1296N/A if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
1296N/A return -errno;
1296N/Adiff --git a/xf86drm.h b/xf86drm.h
1296N/Aindex 76eb94e..6a14120 100644
1296N/A--- a/xf86drm.h
1296N/A+++ b/xf86drm.h
1296N/A@@ -458,6 +458,17 @@ do { register unsigned int __old __asm("o0"); \
98N/A #endif /* architecture */
98N/A #endif /* __GNUC__ >= 2 */
98N/A
98N/A+#if defined(__SUNPRO_C)
606N/A+#include <atomic.h>
606N/A+#define atomic_cmpset_int(p, c, n) ((c == atomic_cas_uint(p, c, n)) ? 1 : 0)
606N/A+#define DRM_CAS(lock,old,new,__ret) \
606N/A+ do { \
606N/A+ unsigned int __result, __old = (old);\
606N/A+ __result = !atomic_cmpset_int(lock,__old,new);\
606N/A+ __ret = __result; \
606N/A+ } while(0)
98N/A+#endif
98N/A+
98N/A #ifndef DRM_CAS
98N/A #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
98N/A #endif
1296N/Adiff --git a/xf86drmMode.c b/xf86drmMode.c
1296N/Aindex c809c44..715f23a 100644
1296N/A--- a/xf86drmMode.c
1296N/A+++ b/xf86drmMode.c
1296N/A@@ -737,7 +737,9 @@ int drmCheckModesettingSupported(const char *busid)
1089N/A if (found)
1089N/A return 0;
98N/A #endif
1089N/A- return -ENOSYS;
606N/A+
1089N/A+/* for now return 0 on solaris */
1089N/A+ return 0;
98N/A
1089N/A }
1265N/A