7042476 Xorg 1.10 & associated module updates [PSARC/2011/214]
PSARC/2011/213 X Synchronization Extension version 3.1
PSARC/2011/214 Xorg server 1.10
# Copyright (c) 2006, 2011, 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 -urp -x '*~' -x '*.orig' include/drm/drm.h include/drm/drm.h
--- include/drm/drm.h 2010-06-06 18:11:46.000000000 -0700
+++ include/drm/drm.h 2011-01-24 19:15:45.548418714 -0800
@@ -54,10 +54,39 @@ typedef int32_t __s32;
typedef uint32_t __u32;
typedef int64_t __s64;
typedef uint64_t __u64;
+#if defined(__SOLARIS__) || defined(__sun)
+#include <sys/types32.h>
+typedef unsigned long long drm_handle_t;
+#else
typedef unsigned long drm_handle_t;
+#endif
#endif
+/* Solaris-specific. */
+#if defined(__SOLARIS__) || defined(__sun)
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
+
+#define _IOC(dir, type, nr, size) \
+ (((dir) /* already shifted */) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+#endif /* __Solaris__ or __sun */
+
+
+
+
#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
@@ -210,12 +239,13 @@ struct drm_ctx_priv_map {
* \sa drmAddMap().
*/
struct drm_map {
- unsigned long offset; /**< Requested physical address (0 for SAREA)*/
+ unsigned long long offset; /**< Requested physical address (0 for SAREA)*/
+ unsigned long long handle;
+ /**< User-space: "Handle" to pass to mmap() */
+ /**< Kernel-space: kernel-virtual address */
unsigned long size; /**< Requested physical size (bytes) */
enum drm_map_type type; /**< Type of memory to map */
enum drm_map_flags flags; /**< Flags */
- void *handle; /**< User-space: "Handle" to pass to mmap() */
- /**< Kernel-space: kernel-virtual address */
int mtrr; /**< MTRR slot used */
/* Private data */
};
@@ -322,18 +352,22 @@ enum drm_dma_flags {
*
* \sa drmAddBufs().
*/
+
+typedef enum {
+ _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
+ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
+ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
+ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
+ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
+} drm_buf_flag;
+
+
struct drm_buf_desc {
int count; /**< Number of buffers of this size */
int size; /**< Size in bytes */
int low_mark; /**< Low water mark */
int high_mark; /**< High water mark */
- enum {
- _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
- _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
- _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
- _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
- _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
- } flags;
+ drm_buf_flag flags;
unsigned long agp_start; /**<
* Start address of where the AGP buffers are
* in the AGP aperture
@@ -375,6 +409,7 @@ struct drm_buf_map {
int count; /**< Length of the buffer list */
void *virtual; /**< Mmap'd area in user-virtual */
struct drm_buf_pub *list; /**< Buffer information */
+ int fd;
};
/**
diff -urp -x '*~' -x '*.orig' include/drm/i915_drm.h include/drm/i915_drm.h
--- include/drm/i915_drm.h 2010-06-07 16:33:16.000000000 -0700
+++ include/drm/i915_drm.h 2011-01-24 19:15:45.548058832 -0800
@@ -75,6 +75,7 @@ typedef struct _drm_i915_sarea {
int pf_current_page; /* which buffer is being displayed? */
int perf_boxes; /* performance boxes to be displayed */
int width, height; /* screen size in pixels */
+ int pad0;
drm_handle_t front_handle;
int front_offset;
@@ -114,6 +115,8 @@ typedef struct _drm_i915_sarea {
int pipeB_w;
int pipeB_h;
+ int pad1;
+
/* fill out some space for old userspace triple buffer */
drm_handle_t unused_handle;
__u32 unused1, unused2, unused3;
diff -urp -x '*~' -x '*.orig' libkms/intel.c libkms/intel.c
--- libkms/intel.c 2010-06-06 18:11:46.000000000 -0700
+++ libkms/intel.c 2011-01-24 19:15:45.549160465 -0800
@@ -37,6 +37,7 @@
#include <sys/mman.h>
#include <sys/ioctl.h>
+#include <unistd.h>
#include "xf86drm.h"
#include "i915_drm.h"
@@ -190,6 +191,30 @@ intel_bo_unmap(struct kms_bo *_bo)
return 0;
}
+int
+drmIoctl(int fd, unsigned long request, void *arg)
+{
+ int ret;
+
+ do {
+ ret = ioctl(fd, request, arg);
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+ return ret;
+}
+
+int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data,
+ unsigned long size)
+{
+ unsigned long request;
+
+ request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE,
+ DRM_COMMAND_BASE + drmCommandIndex, size);
+
+ if (drmIoctl(fd, request, data))
+ return -errno;
+ return 0;
+}
+
static int
intel_bo_destroy(struct kms_bo *_bo)
{
diff -urp -x '*~' -x '*.orig' libkms/linux.c libkms/linux.c
--- libkms/linux.c 2010-06-06 18:11:46.000000000 -0700
+++ libkms/linux.c 2011-01-24 19:15:45.548957995 -0800
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include "internal.h"
diff -urp -x '*~' -x '*.orig' xf86drm.c xf86drm.c
--- xf86drm.c 2010-06-06 18:11:46.000000000 -0700
+++ xf86drm.c 2011-01-24 19:15:45.547448918 -0800
@@ -967,7 +967,7 @@ int drmRmMap(int fd, drm_handle_t handle
{
drm_map_t map;
- map.handle = (void *)handle;
+ map.handle = (drm_handle_t)handle;
if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
return -errno;
diff -urp -x '*~' -x '*.orig' xf86drm.h xf86drm.h
--- xf86drm.h 2010-06-06 18:11:46.000000000 -0700
+++ xf86drm.h 2011-01-24 19:15:45.547758484 -0800
@@ -451,6 +451,17 @@ do { register unsigned int __old __asm("
#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 -urp -x '*~' -x '*.orig' xf86drmMode.c xf86drmMode.c
--- xf86drmMode.c 2010-06-06 18:11:45.000000000 -0700
+++ xf86drmMode.c 2011-01-24 19:15:45.548770835 -0800
@@ -708,7 +708,9 @@ int drmCheckModesettingSupported(const c
if (found)
return 0;
#endif
- return -ENOSYS;
+
+/* for now return 0 on solaris */
+ return 0;
}