Subversion Repositories Kolibri OS

Rev

Rev 2326 | Rev 2330 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2326 Rev 2327
1
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
1
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
2
 */
2
 */
3
/*
3
/*
4
 *
4
 *
5
 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
5
 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6
 * All Rights Reserved.
6
 * All Rights Reserved.
7
 *
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 * Permission is hereby granted, free of charge, to any person obtaining a
9
 * copy of this software and associated documentation files (the
9
 * copy of this software and associated documentation files (the
10
 * "Software"), to deal in the Software without restriction, including
10
 * "Software"), to deal in the Software without restriction, including
11
 * without limitation the rights to use, copy, modify, merge, publish,
11
 * without limitation the rights to use, copy, modify, merge, publish,
12
 * distribute, sub license, and/or sell copies of the Software, and to
12
 * distribute, sub license, and/or sell copies of the Software, and to
13
 * permit persons to whom the Software is furnished to do so, subject to
13
 * permit persons to whom the Software is furnished to do so, subject to
14
 * the following conditions:
14
 * the following conditions:
15
 *
15
 *
16
 * The above copyright notice and this permission notice (including the
16
 * The above copyright notice and this permission notice (including the
17
 * next paragraph) shall be included in all copies or substantial portions
17
 * next paragraph) shall be included in all copies or substantial portions
18
 * of the Software.
18
 * of the Software.
19
 *
19
 *
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23
 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23
 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
 *
27
 *
28
 */
28
 */
29
 
29
 
30
#ifndef _I915_DRV_H_
30
#ifndef _I915_DRV_H_
31
#define _I915_DRV_H_
31
#define _I915_DRV_H_
32
 
32
 
33
#include "i915_reg.h"
33
#include "i915_reg.h"
34
//#include "intel_bios.h"
34
#include "intel_bios.h"
35
#include "intel_ringbuffer.h"
35
#include "intel_ringbuffer.h"
36
//#include 
36
//#include 
37
//#include 
37
//#include 
38
//#include 
38
//#include 
39
//#include 
39
//#include 
40
 
40
 
41
#include 
41
#include 
42
 
42
 
43
/* General customization:
43
/* General customization:
44
 */
44
 */
-
 
45
 
-
 
46
#define I915_TILING_NONE    0
-
 
47
 
45
 
48
 
46
#define DRIVER_AUTHOR		"Tungsten Graphics, Inc."
49
#define DRIVER_AUTHOR		"Tungsten Graphics, Inc."
47
 
50
 
48
#define DRIVER_NAME		"i915"
51
#define DRIVER_NAME		"i915"
49
#define DRIVER_DESC		"Intel Graphics"
52
#define DRIVER_DESC		"Intel Graphics"
50
#define DRIVER_DATE		"20080730"
53
#define DRIVER_DATE		"20080730"
51
 
54
 
52
enum pipe {
55
enum pipe {
53
	PIPE_A = 0,
56
	PIPE_A = 0,
54
	PIPE_B,
57
	PIPE_B,
55
	PIPE_C,
58
	PIPE_C,
56
	I915_MAX_PIPES
59
	I915_MAX_PIPES
57
};
60
};
58
#define pipe_name(p) ((p) + 'A')
61
#define pipe_name(p) ((p) + 'A')
59
 
62
 
60
enum plane {
63
enum plane {
61
	PLANE_A = 0,
64
	PLANE_A = 0,
62
	PLANE_B,
65
	PLANE_B,
63
	PLANE_C,
66
	PLANE_C,
64
};
67
};
65
#define plane_name(p) ((p) + 'A')
68
#define plane_name(p) ((p) + 'A')
66
 
69
 
67
#define I915_GEM_GPU_DOMAINS	(~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
70
#define I915_GEM_GPU_DOMAINS	(~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
68
 
71
 
69
#define for_each_pipe(p) for ((p) = 0; (p) < dev_priv->num_pipe; (p)++)
72
#define for_each_pipe(p) for ((p) = 0; (p) < dev_priv->num_pipe; (p)++)
70
 
73
 
71
/* Interface history:
74
/* Interface history:
72
 *
75
 *
73
 * 1.1: Original.
76
 * 1.1: Original.
74
 * 1.2: Add Power Management
77
 * 1.2: Add Power Management
75
 * 1.3: Add vblank support
78
 * 1.3: Add vblank support
76
 * 1.4: Fix cmdbuffer path, add heap destroy
79
 * 1.4: Fix cmdbuffer path, add heap destroy
77
 * 1.5: Add vblank pipe configuration
80
 * 1.5: Add vblank pipe configuration
78
 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
81
 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
79
 *      - Support vertical blank on secondary display pipe
82
 *      - Support vertical blank on secondary display pipe
80
 */
83
 */
81
#define DRIVER_MAJOR		1
84
#define DRIVER_MAJOR		1
82
#define DRIVER_MINOR		6
85
#define DRIVER_MINOR		6
83
#define DRIVER_PATCHLEVEL	0
86
#define DRIVER_PATCHLEVEL	0
84
 
87
 
85
#define WATCH_COHERENCY	0
88
#define WATCH_COHERENCY	0
86
#define WATCH_LISTS	0
89
#define WATCH_LISTS	0
87
 
90
 
88
#define I915_GEM_PHYS_CURSOR_0 1
91
#define I915_GEM_PHYS_CURSOR_0 1
89
#define I915_GEM_PHYS_CURSOR_1 2
92
#define I915_GEM_PHYS_CURSOR_1 2
90
#define I915_GEM_PHYS_OVERLAY_REGS 3
93
#define I915_GEM_PHYS_OVERLAY_REGS 3
91
#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
94
#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
92
 
95
 
93
struct mem_block {
96
struct mem_block {
94
	struct mem_block *next;
97
	struct mem_block *next;
95
	struct mem_block *prev;
98
	struct mem_block *prev;
96
	int start;
99
	int start;
97
	int size;
100
	int size;
98
	struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
101
	struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
99
};
102
};
100
 
103
 
101
struct opregion_header;
104
struct opregion_header;
102
struct opregion_acpi;
105
struct opregion_acpi;
103
struct opregion_swsci;
106
struct opregion_swsci;
104
struct opregion_asle;
107
struct opregion_asle;
105
 
108
 
106
struct intel_opregion {
109
struct intel_opregion {
107
	struct opregion_header *header;
110
	struct opregion_header *header;
108
	struct opregion_acpi *acpi;
111
	struct opregion_acpi *acpi;
109
	struct opregion_swsci *swsci;
112
	struct opregion_swsci *swsci;
110
	struct opregion_asle *asle;
113
	struct opregion_asle *asle;
111
	void *vbt;
114
	void *vbt;
112
	u32 __iomem *lid_state;
115
	u32 __iomem *lid_state;
113
};
116
};
114
#define OPREGION_SIZE            (8*1024)
117
#define OPREGION_SIZE            (8*1024)
115
 
118
 
116
struct intel_overlay;
119
struct intel_overlay;
117
struct intel_overlay_error_state;
120
struct intel_overlay_error_state;
118
 
121
 
119
 
122
 
120
#define I915_FENCE_REG_NONE -1
123
#define I915_FENCE_REG_NONE -1
121
 
124
 
122
struct drm_i915_fence_reg {
125
struct drm_i915_fence_reg {
123
	struct list_head lru_list;
126
	struct list_head lru_list;
124
	struct drm_i915_gem_object *obj;
127
	struct drm_i915_gem_object *obj;
125
	uint32_t setup_seqno;
128
	uint32_t setup_seqno;
126
};
129
};
127
 
130
 
128
struct sdvo_device_mapping {
131
struct sdvo_device_mapping {
129
	u8 initialized;
132
	u8 initialized;
130
	u8 dvo_port;
133
	u8 dvo_port;
131
	u8 slave_addr;
134
	u8 slave_addr;
132
	u8 dvo_wiring;
135
	u8 dvo_wiring;
133
	u8 i2c_pin;
136
	u8 i2c_pin;
134
	u8 i2c_speed;
137
	u8 i2c_speed;
135
	u8 ddc_pin;
138
	u8 ddc_pin;
136
};
139
};
137
 
140
 
138
struct intel_display_error_state;
141
struct intel_display_error_state;
139
 
142
 
140
struct drm_i915_error_state {
143
struct drm_i915_error_state {
141
	u32 eir;
144
	u32 eir;
142
	u32 pgtbl_er;
145
	u32 pgtbl_er;
143
	u32 pipestat[I915_MAX_PIPES];
146
	u32 pipestat[I915_MAX_PIPES];
144
	u32 ipeir;
147
	u32 ipeir;
145
	u32 ipehr;
148
	u32 ipehr;
146
	u32 instdone;
149
	u32 instdone;
147
	u32 acthd;
150
	u32 acthd;
148
	u32 error; /* gen6+ */
151
	u32 error; /* gen6+ */
149
	u32 bcs_acthd; /* gen6+ blt engine */
152
	u32 bcs_acthd; /* gen6+ blt engine */
150
	u32 bcs_ipehr;
153
	u32 bcs_ipehr;
151
	u32 bcs_ipeir;
154
	u32 bcs_ipeir;
152
	u32 bcs_instdone;
155
	u32 bcs_instdone;
153
	u32 bcs_seqno;
156
	u32 bcs_seqno;
154
	u32 vcs_acthd; /* gen6+ bsd engine */
157
	u32 vcs_acthd; /* gen6+ bsd engine */
155
	u32 vcs_ipehr;
158
	u32 vcs_ipehr;
156
	u32 vcs_ipeir;
159
	u32 vcs_ipeir;
157
	u32 vcs_instdone;
160
	u32 vcs_instdone;
158
	u32 vcs_seqno;
161
	u32 vcs_seqno;
159
	u32 instpm;
162
	u32 instpm;
160
	u32 instps;
163
	u32 instps;
161
	u32 instdone1;
164
	u32 instdone1;
162
	u32 seqno;
165
	u32 seqno;
163
	u64 bbaddr;
166
	u64 bbaddr;
164
	u64 fence[16];
167
	u64 fence[16];
165
	struct timeval time;
168
	struct timeval time;
166
	struct drm_i915_error_object {
169
	struct drm_i915_error_object {
167
		int page_count;
170
		int page_count;
168
		u32 gtt_offset;
171
		u32 gtt_offset;
169
		u32 *pages[0];
172
		u32 *pages[0];
170
	} *ringbuffer[I915_NUM_RINGS], *batchbuffer[I915_NUM_RINGS];
173
	} *ringbuffer[I915_NUM_RINGS], *batchbuffer[I915_NUM_RINGS];
171
	struct drm_i915_error_buffer {
174
	struct drm_i915_error_buffer {
172
		u32 size;
175
		u32 size;
173
		u32 name;
176
		u32 name;
174
		u32 seqno;
177
		u32 seqno;
175
		u32 gtt_offset;
178
		u32 gtt_offset;
176
		u32 read_domains;
179
		u32 read_domains;
177
		u32 write_domain;
180
		u32 write_domain;
178
		s32 fence_reg:5;
181
		s32 fence_reg:5;
179
		s32 pinned:2;
182
		s32 pinned:2;
180
		u32 tiling:2;
183
		u32 tiling:2;
181
		u32 dirty:1;
184
		u32 dirty:1;
182
		u32 purgeable:1;
185
		u32 purgeable:1;
183
		u32 ring:4;
186
		u32 ring:4;
184
		u32 cache_level:2;
187
		u32 cache_level:2;
185
	} *active_bo, *pinned_bo;
188
	} *active_bo, *pinned_bo;
186
	u32 active_bo_count, pinned_bo_count;
189
	u32 active_bo_count, pinned_bo_count;
187
	struct intel_overlay_error_state *overlay;
190
	struct intel_overlay_error_state *overlay;
188
	struct intel_display_error_state *display;
191
	struct intel_display_error_state *display;
189
};
192
};
190
 
193
 
191
struct drm_i915_display_funcs {
194
struct drm_i915_display_funcs {
192
	void (*dpms)(struct drm_crtc *crtc, int mode);
195
	void (*dpms)(struct drm_crtc *crtc, int mode);
193
	bool (*fbc_enabled)(struct drm_device *dev);
196
	bool (*fbc_enabled)(struct drm_device *dev);
194
	void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
197
	void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
195
	void (*disable_fbc)(struct drm_device *dev);
198
	void (*disable_fbc)(struct drm_device *dev);
196
	int (*get_display_clock_speed)(struct drm_device *dev);
199
	int (*get_display_clock_speed)(struct drm_device *dev);
197
	int (*get_fifo_size)(struct drm_device *dev, int plane);
200
	int (*get_fifo_size)(struct drm_device *dev, int plane);
198
	void (*update_wm)(struct drm_device *dev);
201
	void (*update_wm)(struct drm_device *dev);
199
	int (*crtc_mode_set)(struct drm_crtc *crtc,
202
	int (*crtc_mode_set)(struct drm_crtc *crtc,
200
			     struct drm_display_mode *mode,
203
			     struct drm_display_mode *mode,
201
			     struct drm_display_mode *adjusted_mode,
204
			     struct drm_display_mode *adjusted_mode,
202
			     int x, int y,
205
			     int x, int y,
203
			     struct drm_framebuffer *old_fb);
206
			     struct drm_framebuffer *old_fb);
204
	void (*fdi_link_train)(struct drm_crtc *crtc);
207
	void (*fdi_link_train)(struct drm_crtc *crtc);
205
	void (*init_clock_gating)(struct drm_device *dev);
208
	void (*init_clock_gating)(struct drm_device *dev);
206
	void (*init_pch_clock_gating)(struct drm_device *dev);
209
	void (*init_pch_clock_gating)(struct drm_device *dev);
207
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
210
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
208
			  struct drm_framebuffer *fb,
211
			  struct drm_framebuffer *fb,
209
			  struct drm_i915_gem_object *obj);
212
			  struct drm_i915_gem_object *obj);
210
	int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
213
	int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
211
			    int x, int y);
214
			    int x, int y);
212
	/* clock updates for mode set */
215
	/* clock updates for mode set */
213
	/* cursor updates */
216
	/* cursor updates */
214
	/* render clock increase/decrease */
217
	/* render clock increase/decrease */
215
	/* display clock increase/decrease */
218
	/* display clock increase/decrease */
216
	/* pll clock increase/decrease */
219
	/* pll clock increase/decrease */
217
};
220
};
218
 
221
 
219
struct intel_device_info {
222
struct intel_device_info {
220
	u8 gen;
223
	u8 gen;
221
	u8 is_mobile : 1;
224
	u8 is_mobile : 1;
222
	u8 is_i85x : 1;
225
	u8 is_i85x : 1;
223
	u8 is_i915g : 1;
226
	u8 is_i915g : 1;
224
	u8 is_i945gm : 1;
227
	u8 is_i945gm : 1;
225
	u8 is_g33 : 1;
228
	u8 is_g33 : 1;
226
	u8 need_gfx_hws : 1;
229
	u8 need_gfx_hws : 1;
227
	u8 is_g4x : 1;
230
	u8 is_g4x : 1;
228
	u8 is_pineview : 1;
231
	u8 is_pineview : 1;
229
	u8 is_broadwater : 1;
232
	u8 is_broadwater : 1;
230
	u8 is_crestline : 1;
233
	u8 is_crestline : 1;
231
	u8 is_ivybridge : 1;
234
	u8 is_ivybridge : 1;
232
	u8 has_fbc : 1;
235
	u8 has_fbc : 1;
233
	u8 has_pipe_cxsr : 1;
236
	u8 has_pipe_cxsr : 1;
234
	u8 has_hotplug : 1;
237
	u8 has_hotplug : 1;
235
	u8 cursor_needs_physical : 1;
238
	u8 cursor_needs_physical : 1;
236
	u8 has_overlay : 1;
239
	u8 has_overlay : 1;
237
	u8 overlay_needs_physical : 1;
240
	u8 overlay_needs_physical : 1;
238
	u8 supports_tv : 1;
241
	u8 supports_tv : 1;
239
	u8 has_bsd_ring : 1;
242
	u8 has_bsd_ring : 1;
240
	u8 has_blt_ring : 1;
243
	u8 has_blt_ring : 1;
241
};
244
};
242
 
245
 
243
enum no_fbc_reason {
246
enum no_fbc_reason {
244
	FBC_NO_OUTPUT, /* no outputs enabled to compress */
247
	FBC_NO_OUTPUT, /* no outputs enabled to compress */
245
	FBC_STOLEN_TOO_SMALL, /* not enough space to hold compressed buffers */
248
	FBC_STOLEN_TOO_SMALL, /* not enough space to hold compressed buffers */
246
	FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
249
	FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
247
	FBC_MODE_TOO_LARGE, /* mode too large for compression */
250
	FBC_MODE_TOO_LARGE, /* mode too large for compression */
248
	FBC_BAD_PLANE, /* fbc not supported on plane */
251
	FBC_BAD_PLANE, /* fbc not supported on plane */
249
	FBC_NOT_TILED, /* buffer not tiled */
252
	FBC_NOT_TILED, /* buffer not tiled */
250
	FBC_MULTIPLE_PIPES, /* more than one pipe active */
253
	FBC_MULTIPLE_PIPES, /* more than one pipe active */
251
	FBC_MODULE_PARAM,
254
	FBC_MODULE_PARAM,
252
};
255
};
253
 
256
 
254
enum intel_pch {
257
enum intel_pch {
255
	PCH_IBX,	/* Ibexpeak PCH */
258
	PCH_IBX,	/* Ibexpeak PCH */
256
	PCH_CPT,	/* Cougarpoint PCH */
259
	PCH_CPT,	/* Cougarpoint PCH */
257
};
260
};
258
 
261
 
259
#define QUIRK_PIPEA_FORCE (1<<0)
262
#define QUIRK_PIPEA_FORCE (1<<0)
260
#define QUIRK_LVDS_SSC_DISABLE (1<<1)
263
#define QUIRK_LVDS_SSC_DISABLE (1<<1)
261
 
264
 
262
struct intel_fbdev;
265
struct intel_fbdev;
263
struct intel_fbc_work;
266
struct intel_fbc_work;
264
 
267
 
265
 
268
 
266
typedef struct drm_i915_private {
269
typedef struct drm_i915_private {
267
	struct drm_device *dev;
270
	struct drm_device *dev;
268
 
271
 
269
	const struct intel_device_info *info;
272
	const struct intel_device_info *info;
270
 
273
 
271
	int has_gem;
274
	int has_gem;
272
	int relative_constants_mode;
275
	int relative_constants_mode;
273
 
276
 
274
	void __iomem *regs;
277
	void __iomem *regs;
275
	u32 gt_fifo_count;
278
	u32 gt_fifo_count;
276
 
279
 
277
    struct intel_gmbus {
280
    struct intel_gmbus {
278
        struct i2c_adapter adapter;
281
        struct i2c_adapter adapter;
279
        struct i2c_adapter *force_bit;
282
        struct i2c_adapter *force_bit;
280
        u32 reg0;
283
        u32 reg0;
281
    } *gmbus;
284
    } *gmbus;
282
 
285
 
283
	struct pci_dev *bridge_dev;
286
	struct pci_dev *bridge_dev;
284
    struct intel_ring_buffer ring[I915_NUM_RINGS];
287
    struct intel_ring_buffer ring[I915_NUM_RINGS];
285
	uint32_t next_seqno;
288
	uint32_t next_seqno;
286
 
289
 
287
    drm_dma_handle_t *status_page_dmah;
290
    drm_dma_handle_t *status_page_dmah;
288
//   uint32_t counter;
291
//   uint32_t counter;
289
//   drm_local_map_t hws_map;
292
//   drm_local_map_t hws_map;
290
//   struct drm_i915_gem_object *pwrctx;
293
//   struct drm_i915_gem_object *pwrctx;
291
//   struct drm_i915_gem_object *renderctx;
294
//   struct drm_i915_gem_object *renderctx;
292
 
295
 
293
//   struct resource mch_res;
296
//   struct resource mch_res;
294
 
297
 
295
	unsigned int cpp;
298
	unsigned int cpp;
296
	int back_offset;
299
	int back_offset;
297
	int front_offset;
300
	int front_offset;
298
	int current_page;
301
	int current_page;
299
	int page_flipping;
302
	int page_flipping;
300
 
303
 
301
	atomic_t irq_received;
304
	atomic_t irq_received;
302
 
305
 
303
	/* protects the irq masks */
306
	/* protects the irq masks */
304
	spinlock_t irq_lock;
307
	spinlock_t irq_lock;
305
	/** Cached value of IMR to avoid reads in updating the bitfield */
308
	/** Cached value of IMR to avoid reads in updating the bitfield */
306
	u32 pipestat[2];
309
	u32 pipestat[2];
307
	u32 irq_mask;
310
	u32 irq_mask;
308
	u32 gt_irq_mask;
311
	u32 gt_irq_mask;
309
	u32 pch_irq_mask;
312
	u32 pch_irq_mask;
310
 
313
 
311
	u32 hotplug_supported_mask;
314
	u32 hotplug_supported_mask;
312
//   struct work_struct hotplug_work;
315
//   struct work_struct hotplug_work;
313
 
316
 
314
	int tex_lru_log_granularity;
317
	int tex_lru_log_granularity;
315
	int allow_batchbuffer;
318
	int allow_batchbuffer;
316
	struct mem_block *agp_heap;
319
	struct mem_block *agp_heap;
317
	unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
320
	unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
318
	int vblank_pipe;
321
	int vblank_pipe;
319
	int num_pipe;
322
	int num_pipe;
320
 
323
 
321
	/* For hangcheck timer */
324
	/* For hangcheck timer */
322
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
325
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
323
//   struct timer_list hangcheck_timer;
326
//   struct timer_list hangcheck_timer;
324
	int hangcheck_count;
327
	int hangcheck_count;
325
	uint32_t last_acthd;
328
	uint32_t last_acthd;
326
	uint32_t last_instdone;
329
	uint32_t last_instdone;
327
	uint32_t last_instdone1;
330
	uint32_t last_instdone1;
328
 
331
 
329
	unsigned long cfb_size;
332
	unsigned long cfb_size;
330
	unsigned int cfb_fb;
333
	unsigned int cfb_fb;
331
	enum plane cfb_plane;
334
	enum plane cfb_plane;
332
	int cfb_y;
335
	int cfb_y;
333
//   struct intel_fbc_work *fbc_work;
336
//   struct intel_fbc_work *fbc_work;
334
 
337
 
335
//   struct intel_opregion opregion;
338
    struct intel_opregion opregion;
336
 
339
 
337
	/* overlay */
340
	/* overlay */
338
//   struct intel_overlay *overlay;
341
//   struct intel_overlay *overlay;
339
 
342
 
340
	/* LVDS info */
343
	/* LVDS info */
341
	int backlight_level;  /* restore backlight to this value */
344
	int backlight_level;  /* restore backlight to this value */
342
	bool backlight_enabled;
345
	bool backlight_enabled;
343
	struct drm_display_mode *panel_fixed_mode;
346
	struct drm_display_mode *panel_fixed_mode;
344
	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
347
	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
345
	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
348
	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
346
 
349
 
347
	/* Feature bits from the VBIOS */
350
	/* Feature bits from the VBIOS */
348
	unsigned int int_tv_support:1;
351
	unsigned int int_tv_support:1;
349
	unsigned int lvds_dither:1;
352
	unsigned int lvds_dither:1;
350
	unsigned int lvds_vbt:1;
353
	unsigned int lvds_vbt:1;
351
	unsigned int int_crt_support:1;
354
	unsigned int int_crt_support:1;
352
	unsigned int lvds_use_ssc:1;
355
	unsigned int lvds_use_ssc:1;
353
	int lvds_ssc_freq;
356
	int lvds_ssc_freq;
354
	struct {
357
	struct {
355
		int rate;
358
		int rate;
356
		int lanes;
359
		int lanes;
357
		int preemphasis;
360
		int preemphasis;
358
		int vswing;
361
		int vswing;
359
 
362
 
360
		bool initialized;
363
		bool initialized;
361
		bool support;
364
		bool support;
362
		int bpp;
365
		int bpp;
363
//       struct edp_power_seq pps;
366
        struct edp_power_seq pps;
364
	} edp;
367
	} edp;
365
	bool no_aux_handshake;
368
	bool no_aux_handshake;
366
 
369
 
367
//   struct notifier_block lid_notifier;
370
//   struct notifier_block lid_notifier;
368
 
371
 
369
	int crt_ddc_pin;
372
	int crt_ddc_pin;
370
    struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
373
    struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
371
	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
374
	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
372
	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
375
	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
373
 
376
 
374
	unsigned int fsb_freq, mem_freq, is_ddr3;
377
	unsigned int fsb_freq, mem_freq, is_ddr3;
375
 
378
 
376
	spinlock_t error_lock;
379
	spinlock_t error_lock;
377
//   struct drm_i915_error_state *first_error;
380
//   struct drm_i915_error_state *first_error;
378
//   struct work_struct error_work;
381
//   struct work_struct error_work;
379
//   struct completion error_completion;
382
//   struct completion error_completion;
380
//   struct workqueue_struct *wq;
383
//   struct workqueue_struct *wq;
381
 
384
 
382
	/* Display functions */
385
	/* Display functions */
383
//   struct drm_i915_display_funcs display;
386
    struct drm_i915_display_funcs display;
384
 
387
 
385
	/* PCH chipset type */
388
	/* PCH chipset type */
386
	enum intel_pch pch_type;
389
	enum intel_pch pch_type;
387
 
390
 
388
	unsigned long quirks;
391
	unsigned long quirks;
389
 
392
 
390
	/* Register state */
393
	/* Register state */
391
	bool modeset_on_lid;
394
	bool modeset_on_lid;
392
	u8 saveLBB;
395
	u8 saveLBB;
393
	u32 saveDSPACNTR;
396
	u32 saveDSPACNTR;
394
	u32 saveDSPBCNTR;
397
	u32 saveDSPBCNTR;
395
	u32 saveDSPARB;
398
	u32 saveDSPARB;
396
	u32 saveHWS;
399
	u32 saveHWS;
397
	u32 savePIPEACONF;
400
	u32 savePIPEACONF;
398
	u32 savePIPEBCONF;
401
	u32 savePIPEBCONF;
399
	u32 savePIPEASRC;
402
	u32 savePIPEASRC;
400
	u32 savePIPEBSRC;
403
	u32 savePIPEBSRC;
401
	u32 saveFPA0;
404
	u32 saveFPA0;
402
	u32 saveFPA1;
405
	u32 saveFPA1;
403
	u32 saveDPLL_A;
406
	u32 saveDPLL_A;
404
	u32 saveDPLL_A_MD;
407
	u32 saveDPLL_A_MD;
405
	u32 saveHTOTAL_A;
408
	u32 saveHTOTAL_A;
406
	u32 saveHBLANK_A;
409
	u32 saveHBLANK_A;
407
	u32 saveHSYNC_A;
410
	u32 saveHSYNC_A;
408
	u32 saveVTOTAL_A;
411
	u32 saveVTOTAL_A;
409
	u32 saveVBLANK_A;
412
	u32 saveVBLANK_A;
410
	u32 saveVSYNC_A;
413
	u32 saveVSYNC_A;
411
	u32 saveBCLRPAT_A;
414
	u32 saveBCLRPAT_A;
412
	u32 saveTRANSACONF;
415
	u32 saveTRANSACONF;
413
	u32 saveTRANS_HTOTAL_A;
416
	u32 saveTRANS_HTOTAL_A;
414
	u32 saveTRANS_HBLANK_A;
417
	u32 saveTRANS_HBLANK_A;
415
	u32 saveTRANS_HSYNC_A;
418
	u32 saveTRANS_HSYNC_A;
416
	u32 saveTRANS_VTOTAL_A;
419
	u32 saveTRANS_VTOTAL_A;
417
	u32 saveTRANS_VBLANK_A;
420
	u32 saveTRANS_VBLANK_A;
418
	u32 saveTRANS_VSYNC_A;
421
	u32 saveTRANS_VSYNC_A;
419
	u32 savePIPEASTAT;
422
	u32 savePIPEASTAT;
420
	u32 saveDSPASTRIDE;
423
	u32 saveDSPASTRIDE;
421
	u32 saveDSPASIZE;
424
	u32 saveDSPASIZE;
422
	u32 saveDSPAPOS;
425
	u32 saveDSPAPOS;
423
	u32 saveDSPAADDR;
426
	u32 saveDSPAADDR;
424
	u32 saveDSPASURF;
427
	u32 saveDSPASURF;
425
	u32 saveDSPATILEOFF;
428
	u32 saveDSPATILEOFF;
426
	u32 savePFIT_PGM_RATIOS;
429
	u32 savePFIT_PGM_RATIOS;
427
	u32 saveBLC_HIST_CTL;
430
	u32 saveBLC_HIST_CTL;
428
	u32 saveBLC_PWM_CTL;
431
	u32 saveBLC_PWM_CTL;
429
	u32 saveBLC_PWM_CTL2;
432
	u32 saveBLC_PWM_CTL2;
430
	u32 saveBLC_CPU_PWM_CTL;
433
	u32 saveBLC_CPU_PWM_CTL;
431
	u32 saveBLC_CPU_PWM_CTL2;
434
	u32 saveBLC_CPU_PWM_CTL2;
432
	u32 saveFPB0;
435
	u32 saveFPB0;
433
	u32 saveFPB1;
436
	u32 saveFPB1;
434
	u32 saveDPLL_B;
437
	u32 saveDPLL_B;
435
	u32 saveDPLL_B_MD;
438
	u32 saveDPLL_B_MD;
436
	u32 saveHTOTAL_B;
439
	u32 saveHTOTAL_B;
437
	u32 saveHBLANK_B;
440
	u32 saveHBLANK_B;
438
	u32 saveHSYNC_B;
441
	u32 saveHSYNC_B;
439
	u32 saveVTOTAL_B;
442
	u32 saveVTOTAL_B;
440
	u32 saveVBLANK_B;
443
	u32 saveVBLANK_B;
441
	u32 saveVSYNC_B;
444
	u32 saveVSYNC_B;
442
	u32 saveBCLRPAT_B;
445
	u32 saveBCLRPAT_B;
443
	u32 saveTRANSBCONF;
446
	u32 saveTRANSBCONF;
444
	u32 saveTRANS_HTOTAL_B;
447
	u32 saveTRANS_HTOTAL_B;
445
	u32 saveTRANS_HBLANK_B;
448
	u32 saveTRANS_HBLANK_B;
446
	u32 saveTRANS_HSYNC_B;
449
	u32 saveTRANS_HSYNC_B;
447
	u32 saveTRANS_VTOTAL_B;
450
	u32 saveTRANS_VTOTAL_B;
448
	u32 saveTRANS_VBLANK_B;
451
	u32 saveTRANS_VBLANK_B;
449
	u32 saveTRANS_VSYNC_B;
452
	u32 saveTRANS_VSYNC_B;
450
	u32 savePIPEBSTAT;
453
	u32 savePIPEBSTAT;
451
	u32 saveDSPBSTRIDE;
454
	u32 saveDSPBSTRIDE;
452
	u32 saveDSPBSIZE;
455
	u32 saveDSPBSIZE;
453
	u32 saveDSPBPOS;
456
	u32 saveDSPBPOS;
454
	u32 saveDSPBADDR;
457
	u32 saveDSPBADDR;
455
	u32 saveDSPBSURF;
458
	u32 saveDSPBSURF;
456
	u32 saveDSPBTILEOFF;
459
	u32 saveDSPBTILEOFF;
457
	u32 saveVGA0;
460
	u32 saveVGA0;
458
	u32 saveVGA1;
461
	u32 saveVGA1;
459
	u32 saveVGA_PD;
462
	u32 saveVGA_PD;
460
	u32 saveVGACNTRL;
463
	u32 saveVGACNTRL;
461
	u32 saveADPA;
464
	u32 saveADPA;
462
	u32 saveLVDS;
465
	u32 saveLVDS;
463
	u32 savePP_ON_DELAYS;
466
	u32 savePP_ON_DELAYS;
464
	u32 savePP_OFF_DELAYS;
467
	u32 savePP_OFF_DELAYS;
465
	u32 saveDVOA;
468
	u32 saveDVOA;
466
	u32 saveDVOB;
469
	u32 saveDVOB;
467
	u32 saveDVOC;
470
	u32 saveDVOC;
468
	u32 savePP_ON;
471
	u32 savePP_ON;
469
	u32 savePP_OFF;
472
	u32 savePP_OFF;
470
	u32 savePP_CONTROL;
473
	u32 savePP_CONTROL;
471
	u32 savePP_DIVISOR;
474
	u32 savePP_DIVISOR;
472
	u32 savePFIT_CONTROL;
475
	u32 savePFIT_CONTROL;
473
	u32 save_palette_a[256];
476
	u32 save_palette_a[256];
474
	u32 save_palette_b[256];
477
	u32 save_palette_b[256];
475
	u32 saveDPFC_CB_BASE;
478
	u32 saveDPFC_CB_BASE;
476
	u32 saveFBC_CFB_BASE;
479
	u32 saveFBC_CFB_BASE;
477
	u32 saveFBC_LL_BASE;
480
	u32 saveFBC_LL_BASE;
478
	u32 saveFBC_CONTROL;
481
	u32 saveFBC_CONTROL;
479
	u32 saveFBC_CONTROL2;
482
	u32 saveFBC_CONTROL2;
480
	u32 saveIER;
483
	u32 saveIER;
481
	u32 saveIIR;
484
	u32 saveIIR;
482
	u32 saveIMR;
485
	u32 saveIMR;
483
	u32 saveDEIER;
486
	u32 saveDEIER;
484
	u32 saveDEIMR;
487
	u32 saveDEIMR;
485
	u32 saveGTIER;
488
	u32 saveGTIER;
486
	u32 saveGTIMR;
489
	u32 saveGTIMR;
487
	u32 saveFDI_RXA_IMR;
490
	u32 saveFDI_RXA_IMR;
488
	u32 saveFDI_RXB_IMR;
491
	u32 saveFDI_RXB_IMR;
489
	u32 saveCACHE_MODE_0;
492
	u32 saveCACHE_MODE_0;
490
	u32 saveMI_ARB_STATE;
493
	u32 saveMI_ARB_STATE;
491
	u32 saveSWF0[16];
494
	u32 saveSWF0[16];
492
	u32 saveSWF1[16];
495
	u32 saveSWF1[16];
493
	u32 saveSWF2[3];
496
	u32 saveSWF2[3];
494
	u8 saveMSR;
497
	u8 saveMSR;
495
	u8 saveSR[8];
498
	u8 saveSR[8];
496
	u8 saveGR[25];
499
	u8 saveGR[25];
497
	u8 saveAR_INDEX;
500
	u8 saveAR_INDEX;
498
	u8 saveAR[21];
501
	u8 saveAR[21];
499
	u8 saveDACMASK;
502
	u8 saveDACMASK;
500
	u8 saveCR[37];
503
	u8 saveCR[37];
501
	uint64_t saveFENCE[16];
504
	uint64_t saveFENCE[16];
502
	u32 saveCURACNTR;
505
	u32 saveCURACNTR;
503
	u32 saveCURAPOS;
506
	u32 saveCURAPOS;
504
	u32 saveCURABASE;
507
	u32 saveCURABASE;
505
	u32 saveCURBCNTR;
508
	u32 saveCURBCNTR;
506
	u32 saveCURBPOS;
509
	u32 saveCURBPOS;
507
	u32 saveCURBBASE;
510
	u32 saveCURBBASE;
508
	u32 saveCURSIZE;
511
	u32 saveCURSIZE;
509
	u32 saveDP_B;
512
	u32 saveDP_B;
510
	u32 saveDP_C;
513
	u32 saveDP_C;
511
	u32 saveDP_D;
514
	u32 saveDP_D;
512
	u32 savePIPEA_GMCH_DATA_M;
515
	u32 savePIPEA_GMCH_DATA_M;
513
	u32 savePIPEB_GMCH_DATA_M;
516
	u32 savePIPEB_GMCH_DATA_M;
514
	u32 savePIPEA_GMCH_DATA_N;
517
	u32 savePIPEA_GMCH_DATA_N;
515
	u32 savePIPEB_GMCH_DATA_N;
518
	u32 savePIPEB_GMCH_DATA_N;
516
	u32 savePIPEA_DP_LINK_M;
519
	u32 savePIPEA_DP_LINK_M;
517
	u32 savePIPEB_DP_LINK_M;
520
	u32 savePIPEB_DP_LINK_M;
518
	u32 savePIPEA_DP_LINK_N;
521
	u32 savePIPEA_DP_LINK_N;
519
	u32 savePIPEB_DP_LINK_N;
522
	u32 savePIPEB_DP_LINK_N;
520
	u32 saveFDI_RXA_CTL;
523
	u32 saveFDI_RXA_CTL;
521
	u32 saveFDI_TXA_CTL;
524
	u32 saveFDI_TXA_CTL;
522
	u32 saveFDI_RXB_CTL;
525
	u32 saveFDI_RXB_CTL;
523
	u32 saveFDI_TXB_CTL;
526
	u32 saveFDI_TXB_CTL;
524
	u32 savePFA_CTL_1;
527
	u32 savePFA_CTL_1;
525
	u32 savePFB_CTL_1;
528
	u32 savePFB_CTL_1;
526
	u32 savePFA_WIN_SZ;
529
	u32 savePFA_WIN_SZ;
527
	u32 savePFB_WIN_SZ;
530
	u32 savePFB_WIN_SZ;
528
	u32 savePFA_WIN_POS;
531
	u32 savePFA_WIN_POS;
529
	u32 savePFB_WIN_POS;
532
	u32 savePFB_WIN_POS;
530
	u32 savePCH_DREF_CONTROL;
533
	u32 savePCH_DREF_CONTROL;
531
	u32 saveDISP_ARB_CTL;
534
	u32 saveDISP_ARB_CTL;
532
	u32 savePIPEA_DATA_M1;
535
	u32 savePIPEA_DATA_M1;
533
	u32 savePIPEA_DATA_N1;
536
	u32 savePIPEA_DATA_N1;
534
	u32 savePIPEA_LINK_M1;
537
	u32 savePIPEA_LINK_M1;
535
	u32 savePIPEA_LINK_N1;
538
	u32 savePIPEA_LINK_N1;
536
	u32 savePIPEB_DATA_M1;
539
	u32 savePIPEB_DATA_M1;
537
	u32 savePIPEB_DATA_N1;
540
	u32 savePIPEB_DATA_N1;
538
	u32 savePIPEB_LINK_M1;
541
	u32 savePIPEB_LINK_M1;
539
	u32 savePIPEB_LINK_N1;
542
	u32 savePIPEB_LINK_N1;
540
	u32 saveMCHBAR_RENDER_STANDBY;
543
	u32 saveMCHBAR_RENDER_STANDBY;
541
	u32 savePCH_PORT_HOTPLUG;
544
	u32 savePCH_PORT_HOTPLUG;
542
 
545
 
543
	struct {
546
	struct {
544
		/** Bridge to intel-gtt-ko */
547
		/** Bridge to intel-gtt-ko */
545
		const struct intel_gtt *gtt;
548
		const struct intel_gtt *gtt;
546
		/** Memory allocator for GTT stolen memory */
549
		/** Memory allocator for GTT stolen memory */
547
//       struct drm_mm stolen;
550
//       struct drm_mm stolen;
548
		/** Memory allocator for GTT */
551
		/** Memory allocator for GTT */
549
//       struct drm_mm gtt_space;
552
//       struct drm_mm gtt_space;
550
		/** List of all objects in gtt_space. Used to restore gtt
553
		/** List of all objects in gtt_space. Used to restore gtt
551
		 * mappings on resume */
554
		 * mappings on resume */
552
		struct list_head gtt_list;
555
		struct list_head gtt_list;
553
 
556
 
554
		/** Usable portion of the GTT for GEM */
557
		/** Usable portion of the GTT for GEM */
555
		unsigned long gtt_start;
558
		unsigned long gtt_start;
556
		unsigned long gtt_mappable_end;
559
		unsigned long gtt_mappable_end;
557
		unsigned long gtt_end;
560
		unsigned long gtt_end;
558
 
561
 
559
//       struct io_mapping *gtt_mapping;
562
//       struct io_mapping *gtt_mapping;
560
		int gtt_mtrr;
563
		int gtt_mtrr;
561
 
564
 
562
//       struct shrinker inactive_shrinker;
565
//       struct shrinker inactive_shrinker;
563
 
566
 
564
		/**
567
		/**
565
		 * List of objects currently involved in rendering.
568
		 * List of objects currently involved in rendering.
566
		 *
569
		 *
567
		 * Includes buffers having the contents of their GPU caches
570
		 * Includes buffers having the contents of their GPU caches
568
		 * flushed, not necessarily primitives.  last_rendering_seqno
571
		 * flushed, not necessarily primitives.  last_rendering_seqno
569
		 * represents when the rendering involved will be completed.
572
		 * represents when the rendering involved will be completed.
570
		 *
573
		 *
571
		 * A reference is held on the buffer while on this list.
574
		 * A reference is held on the buffer while on this list.
572
		 */
575
		 */
573
		struct list_head active_list;
576
		struct list_head active_list;
574
 
577
 
575
		/**
578
		/**
576
		 * List of objects which are not in the ringbuffer but which
579
		 * List of objects which are not in the ringbuffer but which
577
		 * still have a write_domain which needs to be flushed before
580
		 * still have a write_domain which needs to be flushed before
578
		 * unbinding.
581
		 * unbinding.
579
		 *
582
		 *
580
		 * last_rendering_seqno is 0 while an object is in this list.
583
		 * last_rendering_seqno is 0 while an object is in this list.
581
		 *
584
		 *
582
		 * A reference is held on the buffer while on this list.
585
		 * A reference is held on the buffer while on this list.
583
		 */
586
		 */
584
		struct list_head flushing_list;
587
		struct list_head flushing_list;
585
 
588
 
586
		/**
589
		/**
587
		 * LRU list of objects which are not in the ringbuffer and
590
		 * LRU list of objects which are not in the ringbuffer and
588
		 * are ready to unbind, but are still in the GTT.
591
		 * are ready to unbind, but are still in the GTT.
589
		 *
592
		 *
590
		 * last_rendering_seqno is 0 while an object is in this list.
593
		 * last_rendering_seqno is 0 while an object is in this list.
591
		 *
594
		 *
592
		 * A reference is not held on the buffer while on this list,
595
		 * A reference is not held on the buffer while on this list,
593
		 * as merely being GTT-bound shouldn't prevent its being
596
		 * as merely being GTT-bound shouldn't prevent its being
594
		 * freed, and we'll pull it off the list in the free path.
597
		 * freed, and we'll pull it off the list in the free path.
595
		 */
598
		 */
596
		struct list_head inactive_list;
599
		struct list_head inactive_list;
597
 
600
 
598
		/**
601
		/**
599
		 * LRU list of objects which are not in the ringbuffer but
602
		 * LRU list of objects which are not in the ringbuffer but
600
		 * are still pinned in the GTT.
603
		 * are still pinned in the GTT.
601
		 */
604
		 */
602
		struct list_head pinned_list;
605
		struct list_head pinned_list;
603
 
606
 
604
		/** LRU list of objects with fence regs on them. */
607
		/** LRU list of objects with fence regs on them. */
605
		struct list_head fence_list;
608
		struct list_head fence_list;
606
 
609
 
607
		/**
610
		/**
608
		 * List of objects currently pending being freed.
611
		 * List of objects currently pending being freed.
609
		 *
612
		 *
610
		 * These objects are no longer in use, but due to a signal
613
		 * These objects are no longer in use, but due to a signal
611
		 * we were prevented from freeing them at the appointed time.
614
		 * we were prevented from freeing them at the appointed time.
612
		 */
615
		 */
613
		struct list_head deferred_free_list;
616
		struct list_head deferred_free_list;
614
 
617
 
615
		/**
618
		/**
616
		 * We leave the user IRQ off as much as possible,
619
		 * We leave the user IRQ off as much as possible,
617
		 * but this means that requests will finish and never
620
		 * but this means that requests will finish and never
618
		 * be retired once the system goes idle. Set a timer to
621
		 * be retired once the system goes idle. Set a timer to
619
		 * fire periodically while the ring is running. When it
622
		 * fire periodically while the ring is running. When it
620
		 * fires, go retire requests.
623
		 * fires, go retire requests.
621
		 */
624
		 */
622
//       struct delayed_work retire_work;
625
//       struct delayed_work retire_work;
623
 
626
 
624
		/**
627
		/**
625
		 * Are we in a non-interruptible section of code like
628
		 * Are we in a non-interruptible section of code like
626
		 * modesetting?
629
		 * modesetting?
627
		 */
630
		 */
628
		bool interruptible;
631
		bool interruptible;
629
 
632
 
630
		/**
633
		/**
631
		 * Flag if the X Server, and thus DRM, is not currently in
634
		 * Flag if the X Server, and thus DRM, is not currently in
632
		 * control of the device.
635
		 * control of the device.
633
		 *
636
		 *
634
		 * This is set between LeaveVT and EnterVT.  It needs to be
637
		 * This is set between LeaveVT and EnterVT.  It needs to be
635
		 * replaced with a semaphore.  It also needs to be
638
		 * replaced with a semaphore.  It also needs to be
636
		 * transitioned away from for kernel modesetting.
639
		 * transitioned away from for kernel modesetting.
637
		 */
640
		 */
638
		int suspended;
641
		int suspended;
639
 
642
 
640
		/**
643
		/**
641
		 * Flag if the hardware appears to be wedged.
644
		 * Flag if the hardware appears to be wedged.
642
		 *
645
		 *
643
		 * This is set when attempts to idle the device timeout.
646
		 * This is set when attempts to idle the device timeout.
644
		 * It prevents command submission from occurring and makes
647
		 * It prevents command submission from occurring and makes
645
		 * every pending request fail
648
		 * every pending request fail
646
		 */
649
		 */
647
		atomic_t wedged;
650
		atomic_t wedged;
648
 
651
 
649
		/** Bit 6 swizzling required for X tiling */
652
		/** Bit 6 swizzling required for X tiling */
650
		uint32_t bit_6_swizzle_x;
653
		uint32_t bit_6_swizzle_x;
651
		/** Bit 6 swizzling required for Y tiling */
654
		/** Bit 6 swizzling required for Y tiling */
652
		uint32_t bit_6_swizzle_y;
655
		uint32_t bit_6_swizzle_y;
653
 
656
 
654
		/* storage for physical objects */
657
		/* storage for physical objects */
655
//       struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
658
//       struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
656
 
659
 
657
		/* accounting, useful for userland debugging */
660
		/* accounting, useful for userland debugging */
658
		size_t gtt_total;
661
		size_t gtt_total;
659
		size_t mappable_gtt_total;
662
		size_t mappable_gtt_total;
660
		size_t object_memory;
663
		size_t object_memory;
661
		u32 object_count;
664
		u32 object_count;
662
	} mm;
665
	} mm;
663
//   struct sdvo_device_mapping sdvo_mappings[2];
666
    struct sdvo_device_mapping sdvo_mappings[2];
664
	/* indicate whether the LVDS_BORDER should be enabled or not */
667
	/* indicate whether the LVDS_BORDER should be enabled or not */
665
	unsigned int lvds_border_bits;
668
	unsigned int lvds_border_bits;
666
	/* Panel fitter placement and size for Ironlake+ */
669
	/* Panel fitter placement and size for Ironlake+ */
667
	u32 pch_pf_pos, pch_pf_size;
670
	u32 pch_pf_pos, pch_pf_size;
668
	int panel_t3, panel_t12;
671
	int panel_t3, panel_t12;
669
 
672
 
670
    struct drm_crtc *plane_to_crtc_mapping[2];
673
    struct drm_crtc *plane_to_crtc_mapping[2];
671
    struct drm_crtc *pipe_to_crtc_mapping[2];
674
    struct drm_crtc *pipe_to_crtc_mapping[2];
672
//   wait_queue_head_t pending_flip_queue;
675
//   wait_queue_head_t pending_flip_queue;
673
	bool flip_pending_is_done;
676
	bool flip_pending_is_done;
674
 
677
 
675
	/* Reclocking support */
678
	/* Reclocking support */
676
	bool render_reclock_avail;
679
	bool render_reclock_avail;
677
	bool lvds_downclock_avail;
680
	bool lvds_downclock_avail;
678
	/* indicates the reduced downclock for LVDS*/
681
	/* indicates the reduced downclock for LVDS*/
679
	int lvds_downclock;
682
	int lvds_downclock;
680
//   struct work_struct idle_work;
683
//   struct work_struct idle_work;
681
//   struct timer_list idle_timer;
684
//   struct timer_list idle_timer;
682
	bool busy;
685
	bool busy;
683
	u16 orig_clock;
686
	u16 orig_clock;
684
	int child_dev_num;
687
	int child_dev_num;
685
//   struct child_device_config *child_dev;
688
    struct child_device_config *child_dev;
686
//   struct drm_connector *int_lvds_connector;
689
    struct drm_connector *int_lvds_connector;
687
//   struct drm_connector *int_edp_connector;
690
    struct drm_connector *int_edp_connector;
688
 
691
 
689
	bool mchbar_need_disable;
692
	bool mchbar_need_disable;
690
 
693
 
691
//   struct work_struct rps_work;
694
//   struct work_struct rps_work;
692
	spinlock_t rps_lock;
695
	spinlock_t rps_lock;
693
	u32 pm_iir;
696
	u32 pm_iir;
694
 
697
 
695
	u8 cur_delay;
698
	u8 cur_delay;
696
	u8 min_delay;
699
	u8 min_delay;
697
	u8 max_delay;
700
	u8 max_delay;
698
	u8 fmax;
701
	u8 fmax;
699
	u8 fstart;
702
	u8 fstart;
700
 
703
 
701
	u64 last_count1;
704
	u64 last_count1;
702
	unsigned long last_time1;
705
	unsigned long last_time1;
703
	u64 last_count2;
706
	u64 last_count2;
704
//   struct timespec last_time2;
707
//   struct timespec last_time2;
705
	unsigned long gfx_power;
708
	unsigned long gfx_power;
706
	int c_m;
709
	int c_m;
707
	int r_t;
710
	int r_t;
708
	u8 corr;
711
	u8 corr;
709
	spinlock_t *mchdev_lock;
712
	spinlock_t *mchdev_lock;
710
 
713
 
711
//   enum no_fbc_reason no_fbc_reason;
714
//   enum no_fbc_reason no_fbc_reason;
712
 
715
 
713
//   struct drm_mm_node *compressed_fb;
716
//   struct drm_mm_node *compressed_fb;
714
//   struct drm_mm_node *compressed_llb;
717
//   struct drm_mm_node *compressed_llb;
715
 
718
 
716
	unsigned long last_gpu_reset;
719
	unsigned long last_gpu_reset;
717
 
720
 
718
	/* list of fbdev register on this device */
721
	/* list of fbdev register on this device */
719
//   struct intel_fbdev *fbdev;
722
//   struct intel_fbdev *fbdev;
720
 
723
 
721
//   struct backlight_device *backlight;
724
//   struct backlight_device *backlight;
722
 
725
 
723
//   struct drm_property *broadcast_rgb_property;
726
//   struct drm_property *broadcast_rgb_property;
724
//   struct drm_property *force_audio_property;
727
//   struct drm_property *force_audio_property;
725
 
728
 
726
	atomic_t forcewake_count;
729
	atomic_t forcewake_count;
727
} drm_i915_private_t;
730
} drm_i915_private_t;
728
 
731
 
729
enum i915_cache_level {
732
enum i915_cache_level {
730
	I915_CACHE_NONE,
733
	I915_CACHE_NONE,
731
	I915_CACHE_LLC,
734
	I915_CACHE_LLC,
732
	I915_CACHE_LLC_MLC, /* gen6+ */
735
	I915_CACHE_LLC_MLC, /* gen6+ */
733
};
736
};
-
 
737
 
-
 
738
struct drm_i915_gem_object {
-
 
739
    struct drm_gem_object base;
-
 
740
 
-
 
741
    /** Current space allocated to this object in the GTT, if any. */
-
 
742
    struct drm_mm_node *gtt_space;
-
 
743
    struct list_head gtt_list;
-
 
744
 
-
 
745
    /** This object's place on the active/flushing/inactive lists */
-
 
746
    struct list_head ring_list;
-
 
747
    struct list_head mm_list;
-
 
748
    /** This object's place on GPU write list */
-
 
749
    struct list_head gpu_write_list;
-
 
750
    /** This object's place in the batchbuffer or on the eviction list */
-
 
751
    struct list_head exec_list;
-
 
752
 
-
 
753
    /**
-
 
754
     * This is set if the object is on the active or flushing lists
-
 
755
     * (has pending rendering), and is not set if it's on inactive (ready
-
 
756
     * to be unbound).
-
 
757
     */
-
 
758
    unsigned int active : 1;
-
 
759
 
-
 
760
    /**
-
 
761
     * This is set if the object has been written to since last bound
-
 
762
     * to the GTT
-
 
763
     */
-
 
764
    unsigned int dirty : 1;
-
 
765
 
-
 
766
    /**
-
 
767
     * This is set if the object has been written to since the last
-
 
768
     * GPU flush.
-
 
769
     */
-
 
770
    unsigned int pending_gpu_write : 1;
-
 
771
 
-
 
772
    /**
-
 
773
     * Fence register bits (if any) for this object.  Will be set
-
 
774
     * as needed when mapped into the GTT.
-
 
775
     * Protected by dev->struct_mutex.
-
 
776
     *
-
 
777
     * Size: 4 bits for 16 fences + sign (for FENCE_REG_NONE)
-
 
778
     */
-
 
779
    signed int fence_reg : 5;
-
 
780
 
-
 
781
    /**
-
 
782
     * Advice: are the backing pages purgeable?
-
 
783
     */
-
 
784
    unsigned int madv : 2;
-
 
785
 
-
 
786
    /**
-
 
787
     * Current tiling mode for the object.
-
 
788
     */
-
 
789
    unsigned int tiling_mode : 2;
-
 
790
    unsigned int tiling_changed : 1;
-
 
791
 
-
 
792
    /** How many users have pinned this object in GTT space. The following
-
 
793
     * users can each hold at most one reference: pwrite/pread, pin_ioctl
-
 
794
     * (via user_pin_count), execbuffer (objects are not allowed multiple
-
 
795
     * times for the same batchbuffer), and the framebuffer code. When
-
 
796
     * switching/pageflipping, the framebuffer code has at most two buffers
-
 
797
     * pinned per crtc.
-
 
798
     *
-
 
799
     * In the worst case this is 1 + 1 + 1 + 2*2 = 7. That would fit into 3
-
 
800
     * bits with absolutely no headroom. So use 4 bits. */
-
 
801
    unsigned int pin_count : 4;
-
 
802
#define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf
-
 
803
 
-
 
804
    /**
-
 
805
     * Is the object at the current location in the gtt mappable and
-
 
806
     * fenceable? Used to avoid costly recalculations.
-
 
807
     */
-
 
808
    unsigned int map_and_fenceable : 1;
-
 
809
 
-
 
810
    /**
-
 
811
     * Whether the current gtt mapping needs to be mappable (and isn't just
-
 
812
     * mappable by accident). Track pin and fault separate for a more
-
 
813
     * accurate mappable working set.
-
 
814
     */
-
 
815
    unsigned int fault_mappable : 1;
-
 
816
    unsigned int pin_mappable : 1;
-
 
817
 
-
 
818
    /*
-
 
819
     * Is the GPU currently using a fence to access this buffer,
-
 
820
     */
-
 
821
    unsigned int pending_fenced_gpu_access:1;
-
 
822
    unsigned int fenced_gpu_access:1;
-
 
823
 
-
 
824
    unsigned int cache_level:2;
-
 
825
 
-
 
826
    struct page **pages;
-
 
827
 
-
 
828
    /**
-
 
829
     * DMAR support
-
 
830
     */
-
 
831
    struct scatterlist *sg_list;
-
 
832
    int num_sg;
-
 
833
 
-
 
834
    /**
-
 
835
     * Used for performing relocations during execbuffer insertion.
-
 
836
     */
-
 
837
    struct hlist_node exec_node;
-
 
838
    unsigned long exec_handle;
-
 
839
    struct drm_i915_gem_exec_object2 *exec_entry;
-
 
840
 
-
 
841
    /**
-
 
842
     * Current offset of the object in GTT space.
-
 
843
     *
-
 
844
     * This is the same as gtt_space->start
-
 
845
     */
-
 
846
    uint32_t gtt_offset;
-
 
847
 
-
 
848
    /** Breadcrumb of last rendering to the buffer. */
-
 
849
    uint32_t last_rendering_seqno;
-
 
850
    struct intel_ring_buffer *ring;
-
 
851
 
-
 
852
    /** Breadcrumb of last fenced GPU access to the buffer. */
-
 
853
    uint32_t last_fenced_seqno;
-
 
854
    struct intel_ring_buffer *last_fenced_ring;
-
 
855
 
-
 
856
    /** Current tiling stride for the object, if it's tiled. */
-
 
857
    uint32_t stride;
-
 
858
 
-
 
859
    /** Record of address bit 17 of each page at last unbind. */
-
 
860
    unsigned long *bit_17;
-
 
861
 
-
 
862
 
-
 
863
    /**
-
 
864
     * If present, while GEM_DOMAIN_CPU is in the read domain this array
-
 
865
     * flags which individual pages are valid.
-
 
866
     */
-
 
867
    uint8_t *page_cpu_valid;
-
 
868
 
-
 
869
    /** User space pin count and filp owning the pin */
-
 
870
    uint32_t user_pin_count;
-
 
871
    struct drm_file *pin_filp;
-
 
872
 
-
 
873
    /** for phy allocated objects */
-
 
874
    struct drm_i915_gem_phys_object *phys_obj;
-
 
875
 
-
 
876
    /**
-
 
877
     * Number of crtcs where this object is currently the fb, but
-
 
878
     * will be page flipped away on the next vblank.  When it
-
 
879
     * reaches 0, dev_priv->pending_flip_queue will be woken up.
-
 
880
     */
-
 
881
    atomic_t pending_flip;
-
 
882
};
734
 
883
 
735
 
884
 
736
#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
885
#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
737
 
886
 
738
/**
887
/**
739
 * Request queue structure.
888
 * Request queue structure.
740
 *
889
 *
741
 * The request queue allows us to note sequence numbers that have been emitted
890
 * The request queue allows us to note sequence numbers that have been emitted
742
 * and may be associated with active buffers to be retired.
891
 * and may be associated with active buffers to be retired.
743
 *
892
 *
744
 * By keeping this list, we can avoid having to do questionable
893
 * By keeping this list, we can avoid having to do questionable
745
 * sequence-number comparisons on buffer last_rendering_seqnos, and associate
894
 * sequence-number comparisons on buffer last_rendering_seqnos, and associate
746
 * an emission time with seqnos for tracking how far ahead of the GPU we are.
895
 * an emission time with seqnos for tracking how far ahead of the GPU we are.
747
 */
896
 */
748
struct drm_i915_gem_request {
897
struct drm_i915_gem_request {
749
	/** On Which ring this request was generated */
898
	/** On Which ring this request was generated */
750
	struct intel_ring_buffer *ring;
899
	struct intel_ring_buffer *ring;
751
 
900
 
752
	/** GEM sequence number associated with this request. */
901
	/** GEM sequence number associated with this request. */
753
	uint32_t seqno;
902
	uint32_t seqno;
754
 
903
 
755
	/** Time at which this request was emitted, in jiffies. */
904
	/** Time at which this request was emitted, in jiffies. */
756
	unsigned long emitted_jiffies;
905
	unsigned long emitted_jiffies;
757
 
906
 
758
	/** global list entry for this request */
907
	/** global list entry for this request */
759
	struct list_head list;
908
	struct list_head list;
760
 
909
 
761
	struct drm_i915_file_private *file_priv;
910
	struct drm_i915_file_private *file_priv;
762
	/** file_priv list entry for this request */
911
	/** file_priv list entry for this request */
763
	struct list_head client_list;
912
	struct list_head client_list;
764
};
913
};
765
 
914
 
766
struct drm_i915_file_private {
915
struct drm_i915_file_private {
767
	struct {
916
	struct {
768
//       struct spinlock lock;
917
//       struct spinlock lock;
769
		struct list_head request_list;
918
		struct list_head request_list;
770
	} mm;
919
	} mm;
771
};
920
};
772
 
921
 
773
#define INTEL_INFO(dev)	(((struct drm_i915_private *) (dev)->dev_private)->info)
922
#define INTEL_INFO(dev)	(((struct drm_i915_private *) (dev)->dev_private)->info)
774
 
923
 
775
#define IS_I830(dev)		((dev)->pci_device == 0x3577)
924
#define IS_I830(dev)		((dev)->pci_device == 0x3577)
776
#define IS_845G(dev)		((dev)->pci_device == 0x2562)
925
#define IS_845G(dev)		((dev)->pci_device == 0x2562)
777
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
926
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
778
#define IS_I865G(dev)		((dev)->pci_device == 0x2572)
927
#define IS_I865G(dev)		((dev)->pci_device == 0x2572)
779
#define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
928
#define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
780
#define IS_I915GM(dev)		((dev)->pci_device == 0x2592)
929
#define IS_I915GM(dev)		((dev)->pci_device == 0x2592)
781
#define IS_I945G(dev)		((dev)->pci_device == 0x2772)
930
#define IS_I945G(dev)		((dev)->pci_device == 0x2772)
782
#define IS_I945GM(dev)		(INTEL_INFO(dev)->is_i945gm)
931
#define IS_I945GM(dev)		(INTEL_INFO(dev)->is_i945gm)
783
#define IS_BROADWATER(dev)	(INTEL_INFO(dev)->is_broadwater)
932
#define IS_BROADWATER(dev)	(INTEL_INFO(dev)->is_broadwater)
784
#define IS_CRESTLINE(dev)	(INTEL_INFO(dev)->is_crestline)
933
#define IS_CRESTLINE(dev)	(INTEL_INFO(dev)->is_crestline)
785
#define IS_GM45(dev)		((dev)->pci_device == 0x2A42)
934
#define IS_GM45(dev)		((dev)->pci_device == 0x2A42)
786
#define IS_G4X(dev)		(INTEL_INFO(dev)->is_g4x)
935
#define IS_G4X(dev)		(INTEL_INFO(dev)->is_g4x)
787
#define IS_PINEVIEW_G(dev)	((dev)->pci_device == 0xa001)
936
#define IS_PINEVIEW_G(dev)	((dev)->pci_device == 0xa001)
788
#define IS_PINEVIEW_M(dev)	((dev)->pci_device == 0xa011)
937
#define IS_PINEVIEW_M(dev)	((dev)->pci_device == 0xa011)
789
#define IS_PINEVIEW(dev)	(INTEL_INFO(dev)->is_pineview)
938
#define IS_PINEVIEW(dev)	(INTEL_INFO(dev)->is_pineview)
790
#define IS_G33(dev)		(INTEL_INFO(dev)->is_g33)
939
#define IS_G33(dev)		(INTEL_INFO(dev)->is_g33)
791
#define IS_IRONLAKE_D(dev)	((dev)->pci_device == 0x0042)
940
#define IS_IRONLAKE_D(dev)	((dev)->pci_device == 0x0042)
792
#define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
941
#define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
793
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
942
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
794
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
943
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
795
 
944
 
796
/*
945
/*
797
 * The genX designation typically refers to the render engine, so render
946
 * The genX designation typically refers to the render engine, so render
798
 * capability related checks should use IS_GEN, while display and other checks
947
 * capability related checks should use IS_GEN, while display and other checks
799
 * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
948
 * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
800
 * chips, etc.).
949
 * chips, etc.).
801
 */
950
 */
802
#define IS_GEN2(dev)	(INTEL_INFO(dev)->gen == 2)
951
#define IS_GEN2(dev)	(INTEL_INFO(dev)->gen == 2)
803
#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
952
#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
804
#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
953
#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
805
#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
954
#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
806
#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
955
#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
807
#define IS_GEN7(dev)	(INTEL_INFO(dev)->gen == 7)
956
#define IS_GEN7(dev)	(INTEL_INFO(dev)->gen == 7)
808
 
957
 
809
#define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
958
#define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
810
#define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
959
#define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
811
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
960
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
812
 
961
 
813
#define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
962
#define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
814
#define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
963
#define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
815
 
964
 
816
/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
965
/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
817
 * rows, which changed the alignment requirements and fence programming.
966
 * rows, which changed the alignment requirements and fence programming.
818
 */
967
 */
819
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
968
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
820
						      IS_I915GM(dev)))
969
						      IS_I915GM(dev)))
821
#define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
970
#define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
822
#define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
971
#define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
823
#define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
972
#define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
824
#define SUPPORTS_EDP(dev)		(IS_IRONLAKE_M(dev))
973
#define SUPPORTS_EDP(dev)		(IS_IRONLAKE_M(dev))
825
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
974
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
826
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
975
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
827
/* dsparb controlled by hw only */
976
/* dsparb controlled by hw only */
828
#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
977
#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
829
 
978
 
830
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
979
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
831
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
980
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
832
#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
981
#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
833
 
982
 
834
#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
983
#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
835
#define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
984
#define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
836
 
985
 
837
#define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
986
#define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
838
#define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
987
#define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
839
#define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
988
#define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
840
 
989
 
841
//#include "i915_trace.h"
990
//#include "i915_trace.h"
842
 
991
 
843
extern int i915_max_ioctl;
992
extern int i915_max_ioctl;
844
extern unsigned int i915_fbpercrtc;
993
extern unsigned int i915_fbpercrtc;
845
extern int i915_panel_ignore_lid;
994
extern int i915_panel_ignore_lid;
846
extern unsigned int i915_powersave;
995
extern unsigned int i915_powersave;
847
extern unsigned int i915_semaphores;
996
extern unsigned int i915_semaphores;
848
extern unsigned int i915_lvds_downclock;
997
extern unsigned int i915_lvds_downclock;
849
extern unsigned int i915_panel_use_ssc;
998
extern unsigned int i915_panel_use_ssc;
850
extern int i915_vbt_sdvo_panel_type;
999
extern int i915_vbt_sdvo_panel_type;
851
extern unsigned int i915_enable_rc6;
1000
extern unsigned int i915_enable_rc6;
852
extern unsigned int i915_enable_fbc;
1001
extern unsigned int i915_enable_fbc;
853
extern bool i915_enable_hangcheck;
1002
extern bool i915_enable_hangcheck;
854
 
1003
 
855
extern int i915_resume(struct drm_device *dev);
1004
extern int i915_resume(struct drm_device *dev);
856
extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
1005
extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
857
extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
1006
extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
858
 
1007
 
859
				/* i915_dma.c */
1008
				/* i915_dma.c */
860
extern void i915_kernel_lost_context(struct drm_device * dev);
1009
extern void i915_kernel_lost_context(struct drm_device * dev);
861
extern int i915_driver_load(struct drm_device *, unsigned long flags);
1010
extern int i915_driver_load(struct drm_device *, unsigned long flags);
862
extern int i915_driver_unload(struct drm_device *);
1011
extern int i915_driver_unload(struct drm_device *);
863
extern int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv);
1012
extern int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv);
864
extern void i915_driver_lastclose(struct drm_device * dev);
1013
extern void i915_driver_lastclose(struct drm_device * dev);
865
extern void i915_driver_preclose(struct drm_device *dev,
1014
extern void i915_driver_preclose(struct drm_device *dev,
866
				 struct drm_file *file_priv);
1015
				 struct drm_file *file_priv);
867
extern void i915_driver_postclose(struct drm_device *dev,
1016
extern void i915_driver_postclose(struct drm_device *dev,
868
				  struct drm_file *file_priv);
1017
				  struct drm_file *file_priv);
869
extern int i915_driver_device_is_agp(struct drm_device * dev);
1018
extern int i915_driver_device_is_agp(struct drm_device * dev);
870
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
1019
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
871
			      unsigned long arg);
1020
			      unsigned long arg);
872
extern int i915_emit_box(struct drm_device *dev,
1021
extern int i915_emit_box(struct drm_device *dev,
873
			 struct drm_clip_rect *box,
1022
			 struct drm_clip_rect *box,
874
			 int DR1, int DR4);
1023
			 int DR1, int DR4);
875
extern int i915_reset(struct drm_device *dev, u8 flags);
1024
extern int i915_reset(struct drm_device *dev, u8 flags);
876
extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
1025
extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
877
extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
1026
extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
878
extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
1027
extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
879
extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
1028
extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
880
 
1029
 
881
 
1030
 
882
/* i915_irq.c */
1031
/* i915_irq.c */
883
void i915_hangcheck_elapsed(unsigned long data);
1032
void i915_hangcheck_elapsed(unsigned long data);
884
void i915_handle_error(struct drm_device *dev, bool wedged);
1033
void i915_handle_error(struct drm_device *dev, bool wedged);
885
extern int i915_irq_emit(struct drm_device *dev, void *data,
1034
extern int i915_irq_emit(struct drm_device *dev, void *data,
886
			 struct drm_file *file_priv);
1035
			 struct drm_file *file_priv);
887
extern int i915_irq_wait(struct drm_device *dev, void *data,
1036
extern int i915_irq_wait(struct drm_device *dev, void *data,
888
			 struct drm_file *file_priv);
1037
			 struct drm_file *file_priv);
889
 
1038
 
890
extern void intel_irq_init(struct drm_device *dev);
1039
extern void intel_irq_init(struct drm_device *dev);
891
 
1040
 
892
extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
1041
extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
893
				struct drm_file *file_priv);
1042
				struct drm_file *file_priv);
894
extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
1043
extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
895
				struct drm_file *file_priv);
1044
				struct drm_file *file_priv);
896
extern int i915_vblank_swap(struct drm_device *dev, void *data,
1045
extern int i915_vblank_swap(struct drm_device *dev, void *data,
897
			    struct drm_file *file_priv);
1046
			    struct drm_file *file_priv);
898
 
1047
 
899
void
1048
void
900
i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1049
i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
901
 
1050
 
902
void
1051
void
903
i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1052
i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
904
 
1053
 
905
void intel_enable_asle (struct drm_device *dev);
1054
void intel_enable_asle (struct drm_device *dev);
906
 
1055
 
907
#ifdef CONFIG_DEBUG_FS
1056
#ifdef CONFIG_DEBUG_FS
908
extern void i915_destroy_error_state(struct drm_device *dev);
1057
extern void i915_destroy_error_state(struct drm_device *dev);
909
#else
1058
#else
910
#define i915_destroy_error_state(x)
1059
#define i915_destroy_error_state(x)
911
#endif
1060
#endif
912
 
1061
 
913
 
1062
 
914
/* i915_mem.c */
1063
/* i915_mem.c */
915
extern int i915_mem_alloc(struct drm_device *dev, void *data,
1064
extern int i915_mem_alloc(struct drm_device *dev, void *data,
916
			  struct drm_file *file_priv);
1065
			  struct drm_file *file_priv);
917
extern int i915_mem_free(struct drm_device *dev, void *data,
1066
extern int i915_mem_free(struct drm_device *dev, void *data,
918
			 struct drm_file *file_priv);
1067
			 struct drm_file *file_priv);
919
extern int i915_mem_init_heap(struct drm_device *dev, void *data,
1068
extern int i915_mem_init_heap(struct drm_device *dev, void *data,
920
			      struct drm_file *file_priv);
1069
			      struct drm_file *file_priv);
921
extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
1070
extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
922
				 struct drm_file *file_priv);
1071
				 struct drm_file *file_priv);
923
extern void i915_mem_takedown(struct mem_block **heap);
1072
extern void i915_mem_takedown(struct mem_block **heap);
924
extern void i915_mem_release(struct drm_device * dev,
1073
extern void i915_mem_release(struct drm_device * dev,
925
			     struct drm_file *file_priv, struct mem_block *heap);
1074
			     struct drm_file *file_priv, struct mem_block *heap);
926
/* i915_gem.c */
1075
/* i915_gem.c */
927
int i915_gem_init_ioctl(struct drm_device *dev, void *data,
1076
int i915_gem_init_ioctl(struct drm_device *dev, void *data,
928
			struct drm_file *file_priv);
1077
			struct drm_file *file_priv);
929
int i915_gem_create_ioctl(struct drm_device *dev, void *data,
1078
int i915_gem_create_ioctl(struct drm_device *dev, void *data,
930
			  struct drm_file *file_priv);
1079
			  struct drm_file *file_priv);
931
int i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1080
int i915_gem_pread_ioctl(struct drm_device *dev, void *data,
932
			 struct drm_file *file_priv);
1081
			 struct drm_file *file_priv);
933
int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1082
int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
934
			  struct drm_file *file_priv);
1083
			  struct drm_file *file_priv);
935
int i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1084
int i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
936
			struct drm_file *file_priv);
1085
			struct drm_file *file_priv);
937
int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1086
int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
938
			struct drm_file *file_priv);
1087
			struct drm_file *file_priv);
939
int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
1088
int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
940
			      struct drm_file *file_priv);
1089
			      struct drm_file *file_priv);
941
int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
1090
int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
942
			     struct drm_file *file_priv);
1091
			     struct drm_file *file_priv);
943
int i915_gem_execbuffer(struct drm_device *dev, void *data,
1092
int i915_gem_execbuffer(struct drm_device *dev, void *data,
944
			struct drm_file *file_priv);
1093
			struct drm_file *file_priv);
945
int i915_gem_execbuffer2(struct drm_device *dev, void *data,
1094
int i915_gem_execbuffer2(struct drm_device *dev, void *data,
946
			 struct drm_file *file_priv);
1095
			 struct drm_file *file_priv);
947
int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
1096
int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
948
		       struct drm_file *file_priv);
1097
		       struct drm_file *file_priv);
949
int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
1098
int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
950
			 struct drm_file *file_priv);
1099
			 struct drm_file *file_priv);
951
int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
1100
int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
952
			struct drm_file *file_priv);
1101
			struct drm_file *file_priv);
953
int i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
1102
int i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
954
			    struct drm_file *file_priv);
1103
			    struct drm_file *file_priv);
955
int i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
1104
int i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
956
			   struct drm_file *file_priv);
1105
			   struct drm_file *file_priv);
957
int i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
1106
int i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
958
			   struct drm_file *file_priv);
1107
			   struct drm_file *file_priv);
959
int i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
1108
int i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
960
			   struct drm_file *file_priv);
1109
			   struct drm_file *file_priv);
961
int i915_gem_set_tiling(struct drm_device *dev, void *data,
1110
int i915_gem_set_tiling(struct drm_device *dev, void *data,
962
			struct drm_file *file_priv);
1111
			struct drm_file *file_priv);
963
int i915_gem_get_tiling(struct drm_device *dev, void *data,
1112
int i915_gem_get_tiling(struct drm_device *dev, void *data,
964
			struct drm_file *file_priv);
1113
			struct drm_file *file_priv);
965
int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
1114
int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
966
				struct drm_file *file_priv);
1115
				struct drm_file *file_priv);
967
void i915_gem_load(struct drm_device *dev);
1116
void i915_gem_load(struct drm_device *dev);
968
int i915_gem_init_object(struct drm_gem_object *obj);
1117
int i915_gem_init_object(struct drm_gem_object *obj);
969
int __must_check i915_gem_flush_ring(struct intel_ring_buffer *ring,
1118
int __must_check i915_gem_flush_ring(struct intel_ring_buffer *ring,
970
				     uint32_t invalidate_domains,
1119
				     uint32_t invalidate_domains,
971
				     uint32_t flush_domains);
1120
				     uint32_t flush_domains);
972
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
1121
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
973
						  size_t size);
1122
						  size_t size);
974
void i915_gem_free_object(struct drm_gem_object *obj);
1123
void i915_gem_free_object(struct drm_gem_object *obj);
975
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
1124
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
976
				     uint32_t alignment,
1125
				     uint32_t alignment,
977
				     bool map_and_fenceable);
1126
				     bool map_and_fenceable);
978
void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
1127
void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
979
int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj);
1128
int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj);
980
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
1129
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
981
void i915_gem_lastclose(struct drm_device *dev);
1130
void i915_gem_lastclose(struct drm_device *dev);
982
 
1131
 
983
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
1132
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
984
int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj);
1133
int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj);
985
void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
1134
void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
986
				    struct intel_ring_buffer *ring,
1135
				    struct intel_ring_buffer *ring,
987
				    u32 seqno);
1136
				    u32 seqno);
988
 
1137
 
989
int i915_gem_dumb_create(struct drm_file *file_priv,
1138
int i915_gem_dumb_create(struct drm_file *file_priv,
990
			 struct drm_device *dev,
1139
			 struct drm_device *dev,
991
			 struct drm_mode_create_dumb *args);
1140
			 struct drm_mode_create_dumb *args);
992
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
1141
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
993
		      uint32_t handle, uint64_t *offset);
1142
		      uint32_t handle, uint64_t *offset);
994
int i915_gem_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev,
1143
int i915_gem_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev,
995
			  uint32_t handle);
1144
			  uint32_t handle);
996
/**
1145
/**
997
 * Returns true if seq1 is later than seq2.
1146
 * Returns true if seq1 is later than seq2.
998
 */
1147
 */
999
//static inline bool
1148
//static inline bool
1000
//i915_seqno_passed(uint32_t seq1, uint32_t seq2)
1149
//i915_seqno_passed(uint32_t seq1, uint32_t seq2)
1001
//{
1150
//{
1002
//   return (int32_t)(seq1 - seq2) >= 0;
1151
//   return (int32_t)(seq1 - seq2) >= 0;
1003
//}
1152
//}
1004
 
1153
 
1005
//static inline u32
1154
//static inline u32
1006
//i915_gem_next_request_seqno(struct intel_ring_buffer *ring)
1155
//i915_gem_next_request_seqno(struct intel_ring_buffer *ring)
1007
//{
1156
//{
1008
//   drm_i915_private_t *dev_priv = ring->dev->dev_private;
1157
//   drm_i915_private_t *dev_priv = ring->dev->dev_private;
1009
//   return ring->outstanding_lazy_request = dev_priv->next_seqno;
1158
//   return ring->outstanding_lazy_request = dev_priv->next_seqno;
1010
//}
1159
//}
1011
 
1160
 
1012
/*
1161
/*
1013
void i915_gem_retire_requests(struct drm_device *dev);
1162
void i915_gem_retire_requests(struct drm_device *dev);
1014
void i915_gem_reset(struct drm_device *dev);
1163
void i915_gem_reset(struct drm_device *dev);
1015
void i915_gem_clflush_object(struct drm_i915_gem_object *obj);
1164
void i915_gem_clflush_object(struct drm_i915_gem_object *obj);
1016
int __must_check i915_gem_object_set_domain(struct drm_i915_gem_object *obj,
1165
int __must_check i915_gem_object_set_domain(struct drm_i915_gem_object *obj,
1017
					    uint32_t read_domains,
1166
					    uint32_t read_domains,
1018
					    uint32_t write_domain);
1167
					    uint32_t write_domain);
1019
int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
1168
int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
1020
int __must_check i915_gem_init_ringbuffer(struct drm_device *dev);
1169
int __must_check i915_gem_init_ringbuffer(struct drm_device *dev);
1021
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
1170
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
1022
void i915_gem_do_init(struct drm_device *dev,
1171
void i915_gem_do_init(struct drm_device *dev,
1023
		      unsigned long start,
1172
		      unsigned long start,
1024
		      unsigned long mappable_end,
1173
		      unsigned long mappable_end,
1025
		      unsigned long end);
1174
		      unsigned long end);
1026
int __must_check i915_gpu_idle(struct drm_device *dev);
1175
int __must_check i915_gpu_idle(struct drm_device *dev);
1027
int __must_check i915_gem_idle(struct drm_device *dev);
1176
int __must_check i915_gem_idle(struct drm_device *dev);
1028
int __must_check i915_add_request(struct intel_ring_buffer *ring,
1177
int __must_check i915_add_request(struct intel_ring_buffer *ring,
1029
				  struct drm_file *file,
1178
				  struct drm_file *file,
1030
				  struct drm_i915_gem_request *request);
1179
				  struct drm_i915_gem_request *request);
1031
int __must_check i915_wait_request(struct intel_ring_buffer *ring,
1180
int __must_check i915_wait_request(struct intel_ring_buffer *ring,
1032
				   uint32_t seqno);
1181
				   uint32_t seqno);
1033
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
1182
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
1034
int __must_check
1183
int __must_check
1035
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj,
1184
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj,
1036
				  bool write);
1185
				  bool write);
1037
int __must_check
1186
int __must_check
1038
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
1187
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
1039
				     u32 alignment,
1188
				     u32 alignment,
1040
				     struct intel_ring_buffer *pipelined);
1189
				     struct intel_ring_buffer *pipelined);
1041
int i915_gem_attach_phys_object(struct drm_device *dev,
1190
int i915_gem_attach_phys_object(struct drm_device *dev,
1042
				struct drm_i915_gem_object *obj,
1191
				struct drm_i915_gem_object *obj,
1043
				int id,
1192
				int id,
1044
				int align);
1193
				int align);
1045
void i915_gem_detach_phys_object(struct drm_device *dev,
1194
void i915_gem_detach_phys_object(struct drm_device *dev,
1046
				 struct drm_i915_gem_object *obj);
1195
				 struct drm_i915_gem_object *obj);
1047
void i915_gem_free_all_phys_object(struct drm_device *dev);
1196
void i915_gem_free_all_phys_object(struct drm_device *dev);
1048
void i915_gem_release(struct drm_device *dev, struct drm_file *file);
1197
void i915_gem_release(struct drm_device *dev, struct drm_file *file);
1049
 
1198
 
1050
uint32_t
1199
uint32_t
1051
i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev,
1200
i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev,
1052
				    uint32_t size,
1201
				    uint32_t size,
1053
				    int tiling_mode);
1202
				    int tiling_mode);
1054
 
1203
 
1055
int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
1204
int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
1056
				    enum i915_cache_level cache_level);
1205
				    enum i915_cache_level cache_level);
1057
*/
1206
*/
1058
 
1207
 
1059
/* i915_gem_gtt.c */
1208
/* i915_gem_gtt.c */
1060
void i915_gem_restore_gtt_mappings(struct drm_device *dev);
1209
void i915_gem_restore_gtt_mappings(struct drm_device *dev);
1061
int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj);
1210
int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj);
1062
void i915_gem_gtt_rebind_object(struct drm_i915_gem_object *obj,
1211
void i915_gem_gtt_rebind_object(struct drm_i915_gem_object *obj,
1063
				enum i915_cache_level cache_level);
1212
				enum i915_cache_level cache_level);
1064
void i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj);
1213
void i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj);
1065
 
1214
 
1066
/* i915_gem_evict.c */
1215
/* i915_gem_evict.c */
1067
int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
1216
int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
1068
					  unsigned alignment, bool mappable);
1217
					  unsigned alignment, bool mappable);
1069
int __must_check i915_gem_evict_everything(struct drm_device *dev,
1218
int __must_check i915_gem_evict_everything(struct drm_device *dev,
1070
					   bool purgeable_only);
1219
					   bool purgeable_only);
1071
int __must_check i915_gem_evict_inactive(struct drm_device *dev,
1220
int __must_check i915_gem_evict_inactive(struct drm_device *dev,
1072
					 bool purgeable_only);
1221
					 bool purgeable_only);
1073
 
1222
 
1074
/* i915_gem_tiling.c */
1223
/* i915_gem_tiling.c */
1075
void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
1224
void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
1076
void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
1225
void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
1077
void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
1226
void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
1078
 
1227
 
1079
/* i915_gem_debug.c */
1228
/* i915_gem_debug.c */
1080
void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
1229
void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
1081
			  const char *where, uint32_t mark);
1230
			  const char *where, uint32_t mark);
1082
#if WATCH_LISTS
1231
#if WATCH_LISTS
1083
int i915_verify_lists(struct drm_device *dev);
1232
int i915_verify_lists(struct drm_device *dev);
1084
#else
1233
#else
1085
#define i915_verify_lists(dev) 0
1234
#define i915_verify_lists(dev) 0
1086
#endif
1235
#endif
1087
void i915_gem_object_check_coherency(struct drm_i915_gem_object *obj,
1236
void i915_gem_object_check_coherency(struct drm_i915_gem_object *obj,
1088
				     int handle);
1237
				     int handle);
1089
void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
1238
void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
1090
			  const char *where, uint32_t mark);
1239
			  const char *where, uint32_t mark);
1091
 
1240
 
1092
/* i915_debugfs.c */
1241
/* i915_debugfs.c */
1093
int i915_debugfs_init(struct drm_minor *minor);
1242
int i915_debugfs_init(struct drm_minor *minor);
1094
void i915_debugfs_cleanup(struct drm_minor *minor);
1243
void i915_debugfs_cleanup(struct drm_minor *minor);
1095
 
1244
 
1096
/* i915_suspend.c */
1245
/* i915_suspend.c */
1097
extern int i915_save_state(struct drm_device *dev);
1246
extern int i915_save_state(struct drm_device *dev);
1098
extern int i915_restore_state(struct drm_device *dev);
1247
extern int i915_restore_state(struct drm_device *dev);
1099
 
1248
 
1100
/* i915_suspend.c */
1249
/* i915_suspend.c */
1101
extern int i915_save_state(struct drm_device *dev);
1250
extern int i915_save_state(struct drm_device *dev);
1102
extern int i915_restore_state(struct drm_device *dev);
1251
extern int i915_restore_state(struct drm_device *dev);
1103
 
1252
 
1104
/* intel_i2c.c */
1253
/* intel_i2c.c */
1105
extern int intel_setup_gmbus(struct drm_device *dev);
1254
extern int intel_setup_gmbus(struct drm_device *dev);
1106
extern void intel_teardown_gmbus(struct drm_device *dev);
1255
extern void intel_teardown_gmbus(struct drm_device *dev);
1107
extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
1256
extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
1108
extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
1257
extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
1109
 
1258
 
1110
//extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
1259
//extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
1111
//{
1260
//{
1112
//   return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
1261
//   return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
1113
//}
1262
//}
1114
 
1263
 
1115
extern void intel_i2c_reset(struct drm_device *dev);
1264
extern void intel_i2c_reset(struct drm_device *dev);
1116
 
1265
 
1117
/* intel_opregion.c */
1266
/* intel_opregion.c */
1118
extern int intel_opregion_setup(struct drm_device *dev);
1267
extern int intel_opregion_setup(struct drm_device *dev);
1119
#ifdef CONFIG_ACPI
1268
#ifdef CONFIG_ACPI
1120
extern void intel_opregion_init(struct drm_device *dev);
1269
extern void intel_opregion_init(struct drm_device *dev);
1121
extern void intel_opregion_fini(struct drm_device *dev);
1270
extern void intel_opregion_fini(struct drm_device *dev);
1122
extern void intel_opregion_asle_intr(struct drm_device *dev);
1271
extern void intel_opregion_asle_intr(struct drm_device *dev);
1123
extern void intel_opregion_gse_intr(struct drm_device *dev);
1272
extern void intel_opregion_gse_intr(struct drm_device *dev);
1124
extern void intel_opregion_enable_asle(struct drm_device *dev);
1273
extern void intel_opregion_enable_asle(struct drm_device *dev);
1125
#else
1274
#else
1126
static inline void intel_opregion_init(struct drm_device *dev) { return; }
1275
static inline void intel_opregion_init(struct drm_device *dev) { return; }
1127
static inline void intel_opregion_fini(struct drm_device *dev) { return; }
1276
static inline void intel_opregion_fini(struct drm_device *dev) { return; }
1128
static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
1277
static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
1129
static inline void intel_opregion_gse_intr(struct drm_device *dev) { return; }
1278
static inline void intel_opregion_gse_intr(struct drm_device *dev) { return; }
1130
static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
1279
static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
1131
#endif
1280
#endif
1132
 
1281
 
1133
/* intel_acpi.c */
1282
/* intel_acpi.c */
1134
#ifdef CONFIG_ACPI
1283
#ifdef CONFIG_ACPI
1135
extern void intel_register_dsm_handler(void);
1284
extern void intel_register_dsm_handler(void);
1136
extern void intel_unregister_dsm_handler(void);
1285
extern void intel_unregister_dsm_handler(void);
1137
#else
1286
#else
1138
static inline void intel_register_dsm_handler(void) { return; }
1287
static inline void intel_register_dsm_handler(void) { return; }
1139
static inline void intel_unregister_dsm_handler(void) { return; }
1288
static inline void intel_unregister_dsm_handler(void) { return; }
1140
#endif /* CONFIG_ACPI */
1289
#endif /* CONFIG_ACPI */
1141
 
1290
 
1142
/* modesetting */
1291
/* modesetting */
1143
extern void intel_modeset_init(struct drm_device *dev);
1292
extern void intel_modeset_init(struct drm_device *dev);
1144
extern void intel_modeset_gem_init(struct drm_device *dev);
1293
extern void intel_modeset_gem_init(struct drm_device *dev);
1145
extern void intel_modeset_cleanup(struct drm_device *dev);
1294
extern void intel_modeset_cleanup(struct drm_device *dev);
1146
extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
1295
extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
1147
extern bool intel_fbc_enabled(struct drm_device *dev);
1296
extern bool intel_fbc_enabled(struct drm_device *dev);
1148
extern void intel_disable_fbc(struct drm_device *dev);
1297
extern void intel_disable_fbc(struct drm_device *dev);
1149
extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
1298
extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
1150
extern void ironlake_enable_rc6(struct drm_device *dev);
1299
extern void ironlake_enable_rc6(struct drm_device *dev);
1151
extern void gen6_set_rps(struct drm_device *dev, u8 val);
1300
extern void gen6_set_rps(struct drm_device *dev, u8 val);
1152
extern void intel_detect_pch (struct drm_device *dev);
1301
extern void intel_detect_pch (struct drm_device *dev);
1153
extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
1302
extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
1154
 
1303
 
1155
/* overlay */
1304
/* overlay */
1156
#ifdef CONFIG_DEBUG_FS
1305
#ifdef CONFIG_DEBUG_FS
1157
extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
1306
extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
1158
extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_overlay_error_state *error);
1307
extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_overlay_error_state *error);
1159
 
1308
 
1160
extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev);
1309
extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev);
1161
extern void intel_display_print_error_state(struct seq_file *m,
1310
extern void intel_display_print_error_state(struct seq_file *m,
1162
					    struct drm_device *dev,
1311
					    struct drm_device *dev,
1163
					    struct intel_display_error_state *error);
1312
					    struct intel_display_error_state *error);
1164
#endif
1313
#endif
1165
 
1314
 
1166
#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
1315
#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
1167
 
1316
 
1168
#define BEGIN_LP_RING(n) \
1317
#define BEGIN_LP_RING(n) \
1169
	intel_ring_begin(LP_RING(dev_priv), (n))
1318
	intel_ring_begin(LP_RING(dev_priv), (n))
1170
 
1319
 
1171
#define OUT_RING(x) \
1320
#define OUT_RING(x) \
1172
	intel_ring_emit(LP_RING(dev_priv), x)
1321
	intel_ring_emit(LP_RING(dev_priv), x)
1173
 
1322
 
1174
#define ADVANCE_LP_RING() \
1323
#define ADVANCE_LP_RING() \
1175
	intel_ring_advance(LP_RING(dev_priv))
1324
	intel_ring_advance(LP_RING(dev_priv))
1176
 
1325
 
1177
/**
1326
/**
1178
 * Lock test for when it's just for synchronization of ring access.
1327
 * Lock test for when it's just for synchronization of ring access.
1179
 *
1328
 *
1180
 * In that case, we don't need to do it when GEM is initialized as nobody else
1329
 * In that case, we don't need to do it when GEM is initialized as nobody else
1181
 * has access to the ring.
1330
 * has access to the ring.
1182
 */
1331
 */
1183
#define RING_LOCK_TEST_WITH_RETURN(dev, file) do {			\
1332
#define RING_LOCK_TEST_WITH_RETURN(dev, file) do {			\
1184
	if (LP_RING(dev->dev_private)->obj == NULL)			\
1333
	if (LP_RING(dev->dev_private)->obj == NULL)			\
1185
		LOCK_TEST_WITH_RETURN(dev, file);			\
1334
		LOCK_TEST_WITH_RETURN(dev, file);			\
1186
} while (0)
1335
} while (0)
1187
 
1336
 
1188
/* On SNB platform, before reading ring registers forcewake bit
1337
/* On SNB platform, before reading ring registers forcewake bit
1189
 * must be set to prevent GT core from power down and stale values being
1338
 * must be set to prevent GT core from power down and stale values being
1190
 * returned.
1339
 * returned.
1191
 */
1340
 */
1192
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
1341
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
1193
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
1342
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
1194
void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv);
1343
void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv);
1195
 
1344
 
1196
/* We give fast paths for the really cool registers */
1345
/* We give fast paths for the really cool registers */
1197
#define NEEDS_FORCE_WAKE(dev_priv, reg) \
1346
#define NEEDS_FORCE_WAKE(dev_priv, reg) \
1198
	(((dev_priv)->info->gen >= 6) && \
1347
	(((dev_priv)->info->gen >= 6) && \
1199
	((reg) < 0x40000) && \
1348
	((reg) < 0x40000) && \
1200
	((reg) != FORCEWAKE))
1349
	((reg) != FORCEWAKE))
1201
 
1350
 
1202
#define __i915_read(x, y) \
1351
#define __i915_read(x, y) \
1203
static inline u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
1352
static inline u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
1204
	u##x val = 0; \
1353
	u##x val = 0; \
1205
	if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
1354
	if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
1206
		gen6_gt_force_wake_get(dev_priv); \
1355
		gen6_gt_force_wake_get(dev_priv); \
1207
		val = read##y(dev_priv->regs + reg); \
1356
		val = read##y(dev_priv->regs + reg); \
1208
		gen6_gt_force_wake_put(dev_priv); \
1357
		gen6_gt_force_wake_put(dev_priv); \
1209
	} else { \
1358
	} else { \
1210
		val = read##y(dev_priv->regs + reg); \
1359
		val = read##y(dev_priv->regs + reg); \
1211
	} \
1360
	} \
1212
/*   trace_i915_reg_rw(false, reg, val, sizeof(val)); */\
1361
/*   trace_i915_reg_rw(false, reg, val, sizeof(val)); */\
1213
	return val; \
1362
	return val; \
1214
}
1363
}
1215
 
1364
 
1216
__i915_read(8, b)
1365
__i915_read(8, b)
1217
__i915_read(16, w)
1366
__i915_read(16, w)
1218
__i915_read(32, l)
1367
__i915_read(32, l)
1219
__i915_read(64, q)
1368
__i915_read(64, q)
1220
#undef __i915_read
1369
#undef __i915_read
1221
 
1370
 
1222
#define __i915_write(x, y) \
1371
#define __i915_write(x, y) \
1223
static inline void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
1372
static inline void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
1224
/*   trace_i915_reg_rw(true, reg, val, sizeof(val));*/ \
1373
/*   trace_i915_reg_rw(true, reg, val, sizeof(val));*/ \
1225
	if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
1374
	if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
1226
		__gen6_gt_wait_for_fifo(dev_priv); \
1375
		__gen6_gt_wait_for_fifo(dev_priv); \
1227
	} \
1376
	} \
1228
	write##y(val, dev_priv->regs + reg); \
1377
	write##y(val, dev_priv->regs + reg); \
1229
}
1378
}
1230
__i915_write(8, b)
1379
__i915_write(8, b)
1231
__i915_write(16, w)
1380
__i915_write(16, w)
1232
__i915_write(32, l)
1381
__i915_write(32, l)
1233
__i915_write(64, q)
1382
__i915_write(64, q)
1234
#undef __i915_write
1383
#undef __i915_write
1235
 
1384
 
1236
#define I915_READ8(reg)		i915_read8(dev_priv, (reg))
1385
#define I915_READ8(reg)		i915_read8(dev_priv, (reg))
1237
#define I915_WRITE8(reg, val)	i915_write8(dev_priv, (reg), (val))
1386
#define I915_WRITE8(reg, val)	i915_write8(dev_priv, (reg), (val))
1238
 
1387
 
1239
#define I915_READ16(reg)	i915_read16(dev_priv, (reg))
1388
#define I915_READ16(reg)	i915_read16(dev_priv, (reg))
1240
#define I915_WRITE16(reg, val)	i915_write16(dev_priv, (reg), (val))
1389
#define I915_WRITE16(reg, val)	i915_write16(dev_priv, (reg), (val))
1241
#define I915_READ16_NOTRACE(reg)	readw(dev_priv->regs + (reg))
1390
#define I915_READ16_NOTRACE(reg)	readw(dev_priv->regs + (reg))
1242
#define I915_WRITE16_NOTRACE(reg, val)	writew(val, dev_priv->regs + (reg))
1391
#define I915_WRITE16_NOTRACE(reg, val)	writew(val, dev_priv->regs + (reg))
1243
 
1392
 
1244
#define I915_READ(reg)		i915_read32(dev_priv, (reg))
1393
#define I915_READ(reg)		i915_read32(dev_priv, (reg))
1245
#define I915_WRITE(reg, val)	i915_write32(dev_priv, (reg), (val))
1394
#define I915_WRITE(reg, val)	i915_write32(dev_priv, (reg), (val))
1246
#define I915_READ_NOTRACE(reg)		readl(dev_priv->regs + (reg))
1395
#define I915_READ_NOTRACE(reg)		readl(dev_priv->regs + (reg))
1247
#define I915_WRITE_NOTRACE(reg, val)	writel(val, dev_priv->regs + (reg))
1396
#define I915_WRITE_NOTRACE(reg, val)	writel(val, dev_priv->regs + (reg))
1248
 
1397
 
1249
#define I915_WRITE64(reg, val)	i915_write64(dev_priv, (reg), (val))
1398
#define I915_WRITE64(reg, val)	i915_write64(dev_priv, (reg), (val))
1250
#define I915_READ64(reg)	i915_read64(dev_priv, (reg))
1399
#define I915_READ64(reg)	i915_read64(dev_priv, (reg))
1251
 
1400
 
1252
#define POSTING_READ(reg)	(void)I915_READ_NOTRACE(reg)
1401
#define POSTING_READ(reg)	(void)I915_READ_NOTRACE(reg)
1253
#define POSTING_READ16(reg)	(void)I915_READ16_NOTRACE(reg)
1402
#define POSTING_READ16(reg)	(void)I915_READ16_NOTRACE(reg)
1254
 
1403
 
1255
 
1404
 
1256
#endif
1405
#endif
1257
 
1406
 
1258
struct>
1407
struct>
1259
 
1408
 
1260
struct>
1409
struct>
1261
#define>
1410
#define>
1262
#define>
1411
#define>