4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Common misc module interfaces of DRM under Solaris
32 * I915 DRM Driver for Solaris
34 * This driver provides the hardware 3D acceleration support for Intel
35 * integrated video devices (e.g. i8xx/i915/i945 series chipsets), under the
36 * DRI (Direct Rendering Infrastructure). DRM (Direct Rendering Manager) here
37 * means the kernel device driver in DRI.
39 * I915 driver is a device dependent driver only, it depends on a misc module
40 * named drm for generic DRM operations.
42 * This driver also calls into gfx and agpmaster misc modules respectively for
43 * generic graphics operations and AGP master device support.
46 #ifndef _SYS_DRM_SUNMOD_H_
47 #define _SYS_DRM_SUNMOD_H_
53 #include <sys/types.h>
54 #include <sys/errno.h>
57 #include <sys/visual_io.h>
60 #include <sys/sunddi.h>
64 #include <sys/modctl.h>
65 #include <sys/vgareg.h>
66 #include <sys/vgasubr.h>
69 #include <sys/ddi_impldefs.h>
70 #include <sys/sunldi.h>
71 #include <sys/mkdev.h>
72 #include <sys/gfx_private.h>
73 #include <sys/agpgart.h>
74 #include <sys/agp/agpdefs.h>
75 #include <sys/agp/agpmaster_io.h>
77 #include <sys/modctl.h>
80 * dev_t of this driver looks consists of:
82 * major number with NBITSMAJOR bits
83 * instance node number with NBITSINST bits
84 * minor node number with NBITSMINOR - NBITSINST bits
86 * Each instance has at most 2^(NBITSMINOR - NBITSINST) minor nodes, the first
88 * 0: gfx<instance number>, graphics common node
89 * 1: agpmaster<instance number>, agpmaster node
90 * 2: drm<instance number>, drm node
93 #define AGPMASTER_MINOR 1
95 #define DRM_MIN_CLONEMINOR 3
98 * Number of bits occupied by instance number in dev_t, currently maximum 8
99 * instances are supported.
103 /* Number of bits occupied in dev_t by minor node */
104 #define NBITSMNODE (18 - NBITSINST)
107 * DRM use a "cloning" minor node mechanism to release lock on every close(2),
108 * thus there will be a minor node for every open(2) operation. Here we give
109 * the maximum DRM cloning minor node number.
111 #define MAX_CLONE_MINOR (1 << (NBITSMNODE) - 1)
112 #define DEV2MINOR(dev) (getminor(dev) & ((1 << (NBITSMNODE)) - 1))
113 #define DEV2INST(dev) (getminor(dev) >> NBITSMNODE)
114 #define INST2NODE0(inst) ((inst) << NBITSMNODE)
115 #define INST2NODE1(inst) (((inst) << NBITSMNODE) + AGPMASTER_MINOR)
116 #define INST2NODE2(inst) (((inst) << NBITSMNODE) + DRM_MINOR)
118 /* graphics name for the common graphics minor node */
119 #define GFX_NAME "gfx"
123 * softstate for DRM module
125 typedef struct drm_instance_state
{
127 kmutex_t dis_ctxlock
;
130 drm_device_t
*mis_devp
;
131 ddi_acc_handle_t mis_cfg_hdl
;
132 agp_master_softc_t
*mis_agpm
; /* agpmaster softstate ptr */
133 gfxp_vgatext_softc_ptr_t mis_gfxp
; /* gfx softstate */
137 struct drm_inst_state_list
{
138 drm_inst_state_t disl_state
;
139 struct drm_inst_state_list
*disl_next
;
142 typedef struct drm_inst_state_list drm_inst_list_t
;
145 /* Identifier of this driver */
146 static struct vis_identifier text_ident
= { "SUNWdrm" };
147 static int drm_sun_open(dev_t
*, int, int, cred_t
*);
148 static int drm_sun_close(dev_t
, int, int, cred_t
*);
149 static int drm_sun_ioctl(dev_t
, int, intptr_t, int, cred_t
*, int *);
150 static int drm_sun_devmap(dev_t
, devmap_cookie_t
,
151 offset_t
, size_t, size_t *, uint_t
);
157 #endif /* _SYS_DRM_SUNMOD_H_ */