Since the guys who ported DRI to the Solaris kernel left the
company before following through on their promise to push bits
upstream, and I'm stuck maintaining the user-land side,
I've taken their patches to libdrm, cleaned them up, merged them
to git head, and created the attached patches - the first two
should be self-explanatory, the last is due to changes they made
in the data passed to the DRM ioctls in Solaris - I suspect at
least part of it is due to supporting both 32-bit & 64-bit apps
(including Xorg servers) on our 64-bit kernel, but I can't find
any notes from them explaining the details (or why the fd member
is needed in the structure passed to the ioctl on that fd).
(Should anyone wish to see the current patches against libdrm 2.3.0
I started porting these from, they're at:
http://src.opensolaris.org/source/xref/fox/fox-gate/XW_NV/open-src/lib/libdrm/solaris-drm-port.patch
The kernel side sources for Solaris are at:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/io/drm/
and:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/intel/io/drm/
and possibly some other directories, since I don't know the kernel
source layout very well.)
--
-Alan Coopersmith- [EMAIL PROTECTED]
Sun Microsystems, Inc. - X Window System Engineering
>From 2babb8b8b68b74185bf16a927095906e75744245 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[EMAIL PROTECTED]>
Date: Thu, 5 Jun 2008 17:31:27 -0700
Subject: [PATCH] Solaris ioctl definitions
---
shared-core/drm.h | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 7f1ccd1..5a04c02 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -79,7 +79,7 @@ #define DRM_IOC_READ _IOC_READ
#define DRM_IOC_WRITE _IOC_WRITE
#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ||
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ||
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) ||
defined(__sun)
#include <sys/ioccom.h>
#define DRM_IOCTL_NR(n) ((n) & 0xff)
#define DRM_IOC_VOID IOC_VOID
@@ -89,6 +89,13 @@ #define DRM_IOC_READWRITE IOC_INOUT
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#endif
+#if defined(__sun) && !defined(_IOC)
+#define _IOC(dir, group, nr, size) \
+ (dir == DRM_IOC_READWRITE ? _IOWRN(group, nr, size) : \
+ (dir == DRM_IOC_WRITE ? _IOWN(group, nr, size) : \
+ /* dir == DRM_IOC_READ */ _IORN(group, nr, size) ))
+#endif
+
#ifdef __OpenBSD__
#define DRM_MAJOR 81
#endif
--
1.4.1
>From 9880fe365548e55d043183bb1a6d819a3c80fe53 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[EMAIL PROTECTED]>
Date: Mon, 9 Jun 2008 17:03:28 -0700
Subject: [PATCH] Use C99 versions of __FUNCTION__ & __volatile__ when not
building with gcc
---
shared-core/drm.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 5a04c02..f4a88c0 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -69,6 +69,12 @@ #ifdef __GNUC__
# define DEPRECATED __attribute__ ((deprecated))
#else
# define DEPRECATED
+# ifndef __FUNCTION__
+# define __FUNCTION__ __func__ /* C99 */
+# endif
+# ifndef __volatile__
+# define __volatile__ volatile
+# endif
#endif
#if defined(__linux__)
--
1.4.1
>From b507bccb9e9ef8d67e3ee7056c57088e66e7ca77 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[EMAIL PROTECTED]>
Date: Tue, 17 Jun 2008 15:47:23 -0700
Subject: [PATCH] Make data passed to ioctl's on Solaris match the Solaris
kernel DRI implementation
---
libdrm/xf86drm.c | 7 +++++++
shared-core/drm.h | 17 +++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 28f481f..57dbe5c 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -894,7 +894,11 @@ int drmRmMap(int fd, drm_handle_t handle
{
drm_map_t map;
+#ifdef __sun
+ map.handle = handle;
+#else
map.handle = (void *)handle;
+#endif
if(ioctl(fd, DRM_IOCTL_RM_MAP, &map))
return -errno;
@@ -1132,6 +1136,9 @@ drmBufMapPtr drmMapBufs(int fd)
bufs.count = 0;
bufs.list = NULL;
bufs.virtual = NULL;
+#ifdef __sun
+ bufs.fd = fd;
+#endif
if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs))
return NULL;
diff --git a/shared-core/drm.h b/shared-core/drm.h
index f4a88c0..4554cdc 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -125,7 +125,11 @@ #if defined(__linux__)
typedef unsigned int drm_handle_t;
#else
#include <sys/types.h>
+# if defined(__sun)
+typedef unsigned long long drm_handle_t;/**< To mapped regions */
+# else
typedef unsigned long drm_handle_t; /**< To mapped regions */
+# endif
#endif
typedef unsigned int drm_context_t; /**< GLXContext handle */
typedef unsigned int drm_drawable_t;
@@ -278,12 +282,22 @@ struct drm_ctx_priv_map {
* \sa drmAddMap().
*/
struct drm_map {
+#ifdef __sun
+ 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 */
+#else
unsigned long offset; /**< Requested physical address (0 for SAREA)*/
+#endif
unsigned long size; /**< Requested physical size (bytes) */
enum drm_map_type type; /**< Type of memory to map */
enum drm_map_flags flags; /**< Flags */
+#ifndef __sun
void *handle; /**< User-space: "Handle" to pass to mmap() */
/**< Kernel-space: kernel-virtual address */
+#endif
int mtrr; /**< MTRR slot used */
/* Private data */
};
@@ -447,6 +461,9 @@ #else
void __user *virtual; /**< Mmap'd area in user-virtual */
#endif
struct drm_buf_pub __user *list; /**< Buffer information */
+#ifdef __sun
+ int fd;
+#endif
};
/**
--
1.4.1
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel