diff options
author | Gordon Ross <gordon.w.ross@gmail.com> | 2016-10-09 16:38:00 -0400 |
---|---|---|
committer | Gordon Ross <gordon.w.ross@gmail.com> | 2016-11-19 16:39:28 -0500 |
commit | c9e5ece4570cc1b594bf3b5092f38afea4a4e25d (patch) | |
tree | 0a1dffd013932167150eb26a9a42678eb6c79172 | |
parent | dd7f770820b766892e28a04f42490850e1ed6c50 (diff) | |
download | illumos-gfx-drm-c9e5ece4570cc1b594bf3b5092f38afea4a4e25d.tar.gz |
DRM header updates needed by the kernel code, and related
This change corresponds to portions of the patches in:
oi-userland/components/x11/libdrm/patches/solaris-drm-port.patch
plus changes needed for _MULTI_DATAMODEL ioctls in the drivers,
and other changes needed by the kernel code.
-rw-r--r-- | usr/src/uts/common/drm/drm.h | 55 | ||||
-rw-r--r-- | usr/src/uts/common/drm/drm_linux.h | 2 | ||||
-rw-r--r-- | usr/src/uts/common/drm/i915_drm.h | 37 | ||||
-rw-r--r-- | usr/src/uts/intel/io/i915/i915_dma.c | 8 |
4 files changed, 91 insertions, 11 deletions
diff --git a/usr/src/uts/common/drm/drm.h b/usr/src/uts/common/drm/drm.h index b4ebaa9..a6f50af 100644 --- a/usr/src/uts/common/drm/drm.h +++ b/usr/src/uts/common/drm/drm.h @@ -55,10 +55,36 @@ typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; typedef size_t __kernel_size_t; +#if defined(__SOLARIS__) || defined(__sun) +#include <sys/types32.h> +typedef unsigned long long drm_handle_t; +#else typedef unsigned long drm_handle_t; +#endif #endif +/* Solaris-specific. */ +#if defined(__SOLARIS__) || defined(__sun) + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS) + +#define _IOC(dir, type, nr, size) \ + (((dir) /* already shifted */) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +#endif /* __Solaris__ or __sun */ + #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ @@ -181,7 +207,8 @@ enum drm_map_type { _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ - _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ + _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ + _DRM_GEM = 6 /**< GEM object (XXX: Not libdrm?) */ }; /** @@ -210,12 +237,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 +350,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 @@ -379,6 +411,7 @@ struct drm_buf_map { void *virtual; /**< Mmap'd area in user-virtual */ #endif struct drm_buf_pub *list; /**< Buffer information */ + int fd; }; /** diff --git a/usr/src/uts/common/drm/drm_linux.h b/usr/src/uts/common/drm/drm_linux.h index 02baf92..73a393a 100644 --- a/usr/src/uts/common/drm/drm_linux.h +++ b/usr/src/uts/common/drm/drm_linux.h @@ -129,9 +129,11 @@ #define copy_from_user DRM_COPY_FROM_USER #define unlikely(a) (a) +#if 0 /* See sys/agpgart.h */ #define AGP_USER_TYPES (1 << 16) #define AGP_USER_MEMORY (AGP_USER_TYPES) #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1) +#endif #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) diff --git a/usr/src/uts/common/drm/i915_drm.h b/usr/src/uts/common/drm/i915_drm.h index eb611a7..c452a6c 100644 --- a/usr/src/uts/common/drm/i915_drm.h +++ b/usr/src/uts/common/drm/i915_drm.h @@ -100,6 +100,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; @@ -139,6 +140,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; @@ -296,6 +299,15 @@ typedef struct drm_i915_batchbuffer { 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,12 +320,25 @@ typedef struct _drm_i915_cmdbuffer { 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 { 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 @@ typedef struct drm_i915_getparam { 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 @@ typedef struct drm_i915_mem_alloc { 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/uts/intel/io/i915/i915_dma.c b/usr/src/uts/intel/io/i915/i915_dma.c index b3b3e0c..04dff42 100644 --- a/usr/src/uts/intel/io/i915/i915_dma.c +++ b/usr/src/uts/intel/io/i915/i915_dma.c @@ -1759,6 +1759,14 @@ void i915_driver_postclose(struct drm_device *dev, struct drm_file *file_priv) file_priv->driver_priv = NULL; } +#ifdef _MULTI_DATAMODEL +#define I915_IOCTL_DEF(ioctl, _func, _flags, _copyin32, _copyout32) \ + [DRM_IOCTL_NR(ioctl) - DRM_COMMAND_BASE] = {.cmd = ioctl, .flags = _flags, .func = _func, .copyin32 = _copyin32, .copyout32 = _copyout32} +#else +#define I915_IOCTL_DEF(ioctl, _func, _flags, _copyin32, _copyout32) \ + [DRM_IOCTL_NR(ioctl) - DRM_COMMAND_BASE] = {.cmd = ioctl, .flags = _flags, .func = _func, .copyin32 = NULL, .copyout32 = NULL} +#endif + struct drm_ioctl_desc i915_ioctls[] = { I915_IOCTL_DEF(DRM_IOCTL_I915_INIT, i915_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY, NULL, NULL), I915_IOCTL_DEF(DRM_IOCTL_I915_FLUSH, i915_flush_ioctl, DRM_AUTH, NULL, NULL), |