Subversion Repositories Kolibri OS

Rev

Rev 5354 | Rev 6088 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5354 Rev 6084
Line 29... Line 29...
29
 
29
 
30
#ifndef _I915_DRV_H_
30
#ifndef _I915_DRV_H_
Line 31... Line 31...
31
#define _I915_DRV_H_
31
#define _I915_DRV_H_
-
 
32
 
Line 32... Line 33...
32
 
33
#include 
33
#include 
34
#include 
34
 
35
 
35
#include "i915_reg.h"
36
#include "i915_reg.h"
36
#include "intel_bios.h"
37
#include "intel_bios.h"
37
#include "intel_ringbuffer.h"
38
#include "intel_ringbuffer.h"
38
#include "intel_lrc.h"
39
#include "intel_lrc.h"
39
#include "i915_gem_gtt.h"
40
#include "i915_gem_gtt.h"
40
#include "i915_gem_render_state.h"
41
#include "i915_gem_render_state.h"
41
//#include 
42
#include 
42
#include 
43
#include 
43
#include 
44
#include 
44
#include 
45
#include 
45
#include  /* for struct drm_dma_handle */
46
#include  /* for struct drm_dma_handle */
-
 
47
#include 
-
 
48
//#include 
Line 46... Line 49...
46
#include 
49
#include 
47
//#include 
50
#include 
Line -... Line 51...
-
 
51
#include "intel_guc.h"
-
 
52
 
-
 
53
#include 
-
 
54
#include 
-
 
55
 
-
 
56
extern int i915_fbsize;
-
 
57
extern struct drm_i915_gem_object *main_fb_obj;
-
 
58
extern struct drm_framebuffer     *main_framebuffer;
-
 
59
 
-
 
60
static struct drm_i915_gem_object *get_fb_obj()
-
 
61
{
-
 
62
    return main_fb_obj;
-
 
63
};
-
 
64
 
-
 
65
#define ioread32(addr)          readl(addr)
-
 
66
static inline u8 inb(u16 port)
-
 
67
{
-
 
68
        u8 v;
-
 
69
        asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
-
 
70
        return v;
-
 
71
}
-
 
72
 
Line 48... Line 73...
48
#include 
73
static inline void outb(u8 v, u16 port)
49
 
74
{
Line 50... Line 75...
50
#include 
75
        asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
51
#include 
76
}
52
 
77
 
Line 53... Line 78...
53
 
78
 
-
 
79
/* General customization:
-
 
80
 */
-
 
81
 
-
 
82
#define DRIVER_NAME		"i915"
-
 
83
#define DRIVER_DESC		"Intel Graphics"
-
 
84
#define DRIVER_DATE		"20151010"
-
 
85
 
-
 
86
#undef WARN_ON
54
/* General customization:
87
/* Many gcc seem to no see through this and fall over :( */
-
 
88
#if 0
-
 
89
#define WARN_ON(x) ({ \
-
 
90
	bool __i915_warn_cond = (x); \
-
 
91
	if (__builtin_constant_p(__i915_warn_cond)) \
-
 
92
		BUILD_BUG_ON(__i915_warn_cond); \
-
 
93
	WARN(__i915_warn_cond, "WARN_ON(" #x ")"); })
-
 
94
#else
-
 
95
#define WARN_ON(x) WARN((x), "WARN_ON(%s)", #x )
-
 
96
#endif
-
 
97
 
-
 
98
#undef WARN_ON_ONCE
-
 
99
#define WARN_ON_ONCE(x) WARN_ONCE((x), "WARN_ON_ONCE(%s)", #x )
-
 
100
 
-
 
101
#define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
-
 
102
			     (long) (x), __func__);
-
 
103
 
-
 
104
/* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
-
 
105
 * WARN_ON()) for hw state sanity checks to check for unexpected conditions
-
 
106
 * which may not necessarily be a user visible problem.  This will either
-
 
107
 * WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to
-
 
108
 * enable distros and users to tailor their preferred amount of i915 abrt
-
 
109
 * spam.
-
 
110
 */
-
 
111
#define I915_STATE_WARN(condition, format...) ({			\
-
 
112
	int __ret_warn_on = !!(condition);				\
-
 
113
	if (unlikely(__ret_warn_on)) {					\
-
 
114
		if (i915.verbose_state_checks)				\
-
 
115
			WARN(1, format);				\
-
 
116
		else 							\
-
 
117
			DRM_ERROR(format);				\
-
 
118
	}								\
-
 
119
	unlikely(__ret_warn_on);					\
-
 
120
})
-
 
121
 
-
 
122
#define I915_STATE_WARN_ON(condition) ({				\
-
 
123
	int __ret_warn_on = !!(condition);				\
-
 
124
	if (unlikely(__ret_warn_on)) {					\
-
 
125
		if (i915.verbose_state_checks)				\
-
 
126
			WARN(1, "WARN_ON(" #condition ")\n");		\
-
 
127
		else 							\
-
 
128
			DRM_ERROR("WARN_ON(" #condition ")\n");		\
Line 55... Line 129...
55
 */
129
	}								\
56
 
130
	unlikely(__ret_warn_on);					\
57
#define DRIVER_NAME		"i915"
131
})
58
#define DRIVER_DESC		"Intel Graphics"
132
 
Line 79... Line 153...
79
	I915_MAX_TRANSCODERS
153
	I915_MAX_TRANSCODERS
80
};
154
};
81
#define transcoder_name(t) ((t) + 'A')
155
#define transcoder_name(t) ((t) + 'A')
Line 82... Line 156...
82
 
156
 
-
 
157
/*
83
/*
158
 * I915_MAX_PLANES in the enum below is the maximum (across all platforms)
84
 * This is the maximum (across all platforms) number of planes (primary +
159
 * number of planes per CRTC.  Not all platforms really have this many planes,
85
 * sprites) that can be active at the same time on one pipe.
-
 
86
 *
160
 * which means some arrays of size I915_MAX_PLANES may have unused entries
87
 * This value doesn't count the cursor plane.
161
 * between the topmost sprite plane and the cursor plane.
88
 */
-
 
89
#define I915_MAX_PLANES	3
-
 
90
 
162
 */
91
enum plane {
163
enum plane {
92
	PLANE_A = 0,
164
	PLANE_A = 0,
93
	PLANE_B,
165
	PLANE_B,
-
 
166
	PLANE_C,
-
 
167
	PLANE_CURSOR,
94
	PLANE_C,
168
	I915_MAX_PLANES,
95
};
169
};
Line 96... Line 170...
96
#define plane_name(p) ((p) + 'A')
170
#define plane_name(p) ((p) + 'A')
Line 136... Line 210...
136
	POWER_DOMAIN_PORT_DDI_B_4_LANES,
210
	POWER_DOMAIN_PORT_DDI_B_4_LANES,
137
	POWER_DOMAIN_PORT_DDI_C_2_LANES,
211
	POWER_DOMAIN_PORT_DDI_C_2_LANES,
138
	POWER_DOMAIN_PORT_DDI_C_4_LANES,
212
	POWER_DOMAIN_PORT_DDI_C_4_LANES,
139
	POWER_DOMAIN_PORT_DDI_D_2_LANES,
213
	POWER_DOMAIN_PORT_DDI_D_2_LANES,
140
	POWER_DOMAIN_PORT_DDI_D_4_LANES,
214
	POWER_DOMAIN_PORT_DDI_D_4_LANES,
-
 
215
	POWER_DOMAIN_PORT_DDI_E_2_LANES,
141
	POWER_DOMAIN_PORT_DSI,
216
	POWER_DOMAIN_PORT_DSI,
142
	POWER_DOMAIN_PORT_CRT,
217
	POWER_DOMAIN_PORT_CRT,
143
	POWER_DOMAIN_PORT_OTHER,
218
	POWER_DOMAIN_PORT_OTHER,
144
	POWER_DOMAIN_VGA,
219
	POWER_DOMAIN_VGA,
145
	POWER_DOMAIN_AUDIO,
220
	POWER_DOMAIN_AUDIO,
146
	POWER_DOMAIN_PLLS,
221
	POWER_DOMAIN_PLLS,
-
 
222
	POWER_DOMAIN_AUX_A,
-
 
223
	POWER_DOMAIN_AUX_B,
-
 
224
	POWER_DOMAIN_AUX_C,
-
 
225
	POWER_DOMAIN_AUX_D,
-
 
226
	POWER_DOMAIN_GMBUS,
147
	POWER_DOMAIN_INIT,
227
	POWER_DOMAIN_INIT,
Line 148... Line 228...
148
 
228
 
149
	POWER_DOMAIN_NUM,
229
	POWER_DOMAIN_NUM,
Line 156... Line 236...
156
	((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \
236
	((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \
157
	 (tran) + POWER_DOMAIN_TRANSCODER_A)
237
	 (tran) + POWER_DOMAIN_TRANSCODER_A)
Line 158... Line 238...
158
 
238
 
159
enum hpd_pin {
239
enum hpd_pin {
160
	HPD_NONE = 0,
-
 
161
	HPD_PORT_A = HPD_NONE, /* PORT_A is internal */
240
	HPD_NONE = 0,
162
	HPD_TV = HPD_NONE,     /* TV is known to be unreliable */
241
	HPD_TV = HPD_NONE,     /* TV is known to be unreliable */
163
	HPD_CRT,
242
	HPD_CRT,
164
	HPD_SDVO_B,
243
	HPD_SDVO_B,
-
 
244
	HPD_SDVO_C,
165
	HPD_SDVO_C,
245
	HPD_PORT_A,
166
	HPD_PORT_B,
246
	HPD_PORT_B,
167
	HPD_PORT_C,
247
	HPD_PORT_C,
-
 
248
	HPD_PORT_D,
168
	HPD_PORT_D,
249
	HPD_PORT_E,
169
	HPD_NUM_PINS
250
	HPD_NUM_PINS
Line -... Line 251...
-
 
251
};
-
 
252
 
-
 
253
#define for_each_hpd_pin(__pin) \
-
 
254
	for ((__pin) = (HPD_NONE + 1); (__pin) < HPD_NUM_PINS; (__pin)++)
-
 
255
 
-
 
256
struct i915_hotplug {
-
 
257
	struct work_struct hotplug_work;
-
 
258
 
-
 
259
	struct {
-
 
260
		unsigned long last_jiffies;
-
 
261
		int count;
-
 
262
		enum {
-
 
263
			HPD_ENABLED = 0,
-
 
264
			HPD_DISABLED = 1,
-
 
265
			HPD_MARK_DISABLED = 2
-
 
266
		} state;
-
 
267
	} stats[HPD_NUM_PINS];
-
 
268
	u32 event_bits;
-
 
269
	struct delayed_work reenable_work;
-
 
270
 
-
 
271
	struct intel_digital_port *irq_port[I915_MAX_PORTS];
-
 
272
	u32 long_port_mask;
-
 
273
	u32 short_port_mask;
-
 
274
	struct work_struct dig_port_work;
-
 
275
 
-
 
276
	/*
-
 
277
	 * if we get a HPD irq from DP and a HPD irq from non-DP
-
 
278
	 * the non-DP HPD could block the workqueue on a mode config
-
 
279
	 * mutex getting, that userspace may have taken. However
-
 
280
	 * userspace is waiting on the DP workqueue to run which is
-
 
281
	 * blocked behind the non-DP one.
-
 
282
	 */
-
 
283
	struct workqueue_struct *dp_wq;
170
};
284
};
171
 
285
 
172
#define I915_GEM_GPU_DOMAINS \
286
#define I915_GEM_GPU_DOMAINS \
173
	(I915_GEM_DOMAIN_RENDER | \
287
	(I915_GEM_DOMAIN_RENDER | \
174
	 I915_GEM_DOMAIN_SAMPLER | \
288
	 I915_GEM_DOMAIN_SAMPLER | \
175
	 I915_GEM_DOMAIN_COMMAND | \
289
	 I915_GEM_DOMAIN_COMMAND | \
Line 176... Line 290...
176
	 I915_GEM_DOMAIN_INSTRUCTION | \
290
	 I915_GEM_DOMAIN_INSTRUCTION | \
177
	 I915_GEM_DOMAIN_VERTEX)
291
	 I915_GEM_DOMAIN_VERTEX)
178
 
292
 
-
 
293
#define for_each_pipe(__dev_priv, __p) \
179
#define for_each_pipe(__dev_priv, __p) \
294
	for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++)
-
 
295
#define for_each_plane(__dev_priv, __pipe, __p)				\
-
 
296
	for ((__p) = 0;							\
-
 
297
	     (__p) < INTEL_INFO(__dev_priv)->num_sprites[(__pipe)] + 1;	\
180
	for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++)
298
	     (__p)++)
-
 
299
#define for_each_sprite(__dev_priv, __p, __s)				\
Line 181... Line 300...
181
#define for_each_plane(pipe, p) \
300
	for ((__s) = 0;							\
182
	for ((p) = 0; (p) < INTEL_INFO(dev)->num_sprites[(pipe)] + 1; (p)++)
301
	     (__s) < INTEL_INFO(__dev_priv)->num_sprites[(__p)];	\
Line -... Line 302...
-
 
302
	     (__s)++)
-
 
303
 
-
 
304
#define for_each_crtc(dev, crtc) \
-
 
305
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
-
 
306
 
-
 
307
#define for_each_intel_plane(dev, intel_plane) \
-
 
308
	list_for_each_entry(intel_plane,			\
-
 
309
			    &dev->mode_config.plane_list,	\
-
 
310
			    base.head)
-
 
311
 
-
 
312
#define for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane)	\
183
#define for_each_sprite(p, s) for ((s) = 0; (s) < INTEL_INFO(dev)->num_sprites[(p)]; (s)++)
313
	list_for_each_entry(intel_plane,				\
184
 
314
			    &(dev)->mode_config.plane_list,		\
Line 185... Line 315...
185
#define for_each_crtc(dev, crtc) \
315
			    base.head)					\
186
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
316
		if ((intel_plane)->pipe == (intel_crtc)->pipe)
187
 
317
 
188
#define for_each_intel_crtc(dev, intel_crtc) \
318
#define for_each_intel_crtc(dev, intel_crtc) \
Line -... Line 319...
-
 
319
	list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
-
 
320
 
-
 
321
#define for_each_intel_encoder(dev, intel_encoder)		\
-
 
322
	list_for_each_entry(intel_encoder,			\
-
 
323
			    &(dev)->mode_config.encoder_list,	\
189
	list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
324
			    base.head)
190
 
325
 
191
#define for_each_intel_encoder(dev, intel_encoder)		\
326
#define for_each_intel_connector(dev, intel_connector)		\
Line 192... Line 327...
192
	list_for_each_entry(intel_encoder,			\
327
	list_for_each_entry(intel_connector,			\
Line 207... Line 342...
207
 
342
 
208
struct drm_i915_private;
343
struct drm_i915_private;
209
struct i915_mm_struct;
344
struct i915_mm_struct;
Line -... Line 345...
-
 
345
struct i915_mmu_object;
-
 
346
 
-
 
347
struct drm_i915_file_private {
-
 
348
	struct drm_i915_private *dev_priv;
-
 
349
	struct drm_file *file;
-
 
350
 
-
 
351
	struct {
-
 
352
		spinlock_t lock;
-
 
353
		struct list_head request_list;
-
 
354
/* 20ms is a fairly arbitrary limit (greater than the average frame time)
-
 
355
 * chosen to prevent the CPU getting more than a frame ahead of the GPU
-
 
356
 * (when using lax throttling for the frontbuffer). We also use it to
-
 
357
 * offer free GPU waitboosts for severely congested workloads.
-
 
358
 */
-
 
359
#define DRM_I915_THROTTLE_JIFFIES msecs_to_jiffies(20)
-
 
360
	} mm;
-
 
361
	struct idr context_idr;
-
 
362
 
-
 
363
	struct intel_rps_client {
-
 
364
		struct list_head link;
-
 
365
		unsigned boosts;
-
 
366
	} rps;
-
 
367
 
-
 
368
	struct intel_engine_cs *bsd_ring;
210
struct i915_mmu_object;
369
};
211
 
370
 
212
enum intel_dpll_id {
371
enum intel_dpll_id {
213
	DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */
372
	DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */
214
	/* real shared dpll ids must be >= 0 */
373
	/* real shared dpll ids must be >= 0 */
215
	DPLL_ID_PCH_PLL_A = 0,
374
	DPLL_ID_PCH_PLL_A = 0,
216
	DPLL_ID_PCH_PLL_B = 1,
375
	DPLL_ID_PCH_PLL_B = 1,
217
	/* hsw/bdw */
376
	/* hsw/bdw */
-
 
377
	DPLL_ID_WRPLL1 = 0,
-
 
378
	DPLL_ID_WRPLL2 = 1,
218
	DPLL_ID_WRPLL1 = 0,
379
	DPLL_ID_SPLL = 2,
219
	DPLL_ID_WRPLL2 = 1,
380
 
220
	/* skl */
381
	/* skl */
221
	DPLL_ID_SKL_DPLL1 = 0,
382
	DPLL_ID_SKL_DPLL1 = 0,
222
	DPLL_ID_SKL_DPLL2 = 1,
383
	DPLL_ID_SKL_DPLL2 = 1,
Line 231... Line 392...
231
	uint32_t fp0;
392
	uint32_t fp0;
232
	uint32_t fp1;
393
	uint32_t fp1;
Line 233... Line 394...
233
 
394
 
234
	/* hsw, bdw */
395
	/* hsw, bdw */
-
 
396
	uint32_t wrpll;
Line 235... Line 397...
235
	uint32_t wrpll;
397
	uint32_t spll;
236
 
398
 
237
	/* skl */
399
	/* skl */
238
	/*
400
	/*
239
	 * DPLL_CTRL1 has 6 bits for each each this DPLL. We store those in
401
	 * DPLL_CTRL1 has 6 bits for each each this DPLL. We store those in
240
	 * lower part of crtl1 and they get shifted into position when writing
402
	 * lower part of ctrl1 and they get shifted into position when writing
241
	 * the register.  This allows us to easily compare the state to share
403
	 * the register.  This allows us to easily compare the state to share
242
	 * the DPLL.
404
	 * the DPLL.
243
	 */
405
	 */
244
	uint32_t ctrl1;
406
	uint32_t ctrl1;
-
 
407
	/* HDMI only, 0 when used for DP */
-
 
408
	uint32_t cfgcr1, cfgcr2;
-
 
409
 
-
 
410
	/* bxt */
245
	/* HDMI only, 0 when used for DP */
411
	uint32_t ebb0, ebb4, pll0, pll1, pll2, pll3, pll6, pll8, pll9, pll10,
Line 246... Line 412...
246
	uint32_t cfgcr1, cfgcr2;
412
		 pcsdw12;
247
};
413
};
248
 
414
 
249
struct intel_shared_dpll_config {
415
struct intel_shared_dpll_config {
Line 250... Line 416...
250
	unsigned crtc_mask; /* mask of CRTCs sharing this PLL */
416
	unsigned crtc_mask; /* mask of CRTCs sharing this PLL */
251
	struct intel_dpll_hw_state hw_state;
417
	struct intel_dpll_hw_state hw_state;
252
};
-
 
Line 253... Line 418...
253
 
418
};
254
struct intel_shared_dpll {
419
 
255
	struct intel_shared_dpll_config config;
420
struct intel_shared_dpll {
256
	struct intel_shared_dpll_config *new_config;
421
	struct intel_shared_dpll_config config;
Line 311... Line 476...
311
struct opregion_acpi;
476
struct opregion_acpi;
312
struct opregion_swsci;
477
struct opregion_swsci;
313
struct opregion_asle;
478
struct opregion_asle;
Line 314... Line 479...
314
 
479
 
315
struct intel_opregion {
480
struct intel_opregion {
316
	struct opregion_header __iomem *header;
481
	struct opregion_header *header;
317
	struct opregion_acpi __iomem *acpi;
482
	struct opregion_acpi *acpi;
318
	struct opregion_swsci __iomem *swsci;
483
	struct opregion_swsci *swsci;
319
	u32 swsci_gbda_sub_functions;
484
	u32 swsci_gbda_sub_functions;
320
	u32 swsci_sbcb_sub_functions;
485
	u32 swsci_sbcb_sub_functions;
321
	struct opregion_asle __iomem *asle;
486
	struct opregion_asle *asle;
322
	void __iomem *vbt;
487
	void *vbt;
323
	u32 __iomem *lid_state;
488
	u32 *lid_state;
324
	struct work_struct asle_work;
489
	struct work_struct asle_work;
325
};
490
};
Line 326... Line 491...
326
#define OPREGION_SIZE            (8*1024)
491
#define OPREGION_SIZE            (8*1024)
Line 353... Line 518...
353
struct drm_i915_error_state {
518
struct drm_i915_error_state {
354
	struct kref ref;
519
	struct kref ref;
355
	struct timeval time;
520
	struct timeval time;
Line 356... Line 521...
356
 
521
 
-
 
522
	char error_msg[128];
357
	char error_msg[128];
523
	int iommu;
358
	u32 reset_count;
524
	u32 reset_count;
Line 359... Line 525...
359
	u32 suspend_count;
525
	u32 suspend_count;
360
 
526
 
Line 366... Line 532...
366
	u32 ccid;
532
	u32 ccid;
367
	u32 derrmr;
533
	u32 derrmr;
368
	u32 forcewake;
534
	u32 forcewake;
369
	u32 error; /* gen6+ */
535
	u32 error; /* gen6+ */
370
	u32 err_int; /* gen7 */
536
	u32 err_int; /* gen7 */
-
 
537
	u32 fault_data0; /* gen8, gen9 */
-
 
538
	u32 fault_data1; /* gen8, gen9 */
371
	u32 done_reg;
539
	u32 done_reg;
372
	u32 gac_eco;
540
	u32 gac_eco;
373
	u32 gam_ecochk;
541
	u32 gam_ecochk;
374
	u32 gab_ctl;
542
	u32 gab_ctl;
375
	u32 gfx_mode;
543
	u32 gfx_mode;
376
	u32 extra_instdone[I915_NUM_INSTDONE_REG];
544
	u32 extra_instdone[I915_NUM_INSTDONE_REG];
377
	u64 fence[I915_MAX_NUM_FENCES];
545
	u64 fence[I915_MAX_NUM_FENCES];
378
	struct intel_overlay_error_state *overlay;
546
	struct intel_overlay_error_state *overlay;
379
	struct intel_display_error_state *display;
547
	struct intel_display_error_state *display;
-
 
548
	struct drm_i915_error_object *semaphore_obj;
Line 380... Line 549...
380
 
549
 
381
	struct drm_i915_error_ring {
550
	struct drm_i915_error_ring {
382
		bool valid;
551
		bool valid;
383
		/* Software tracked state */
552
		/* Software tracked state */
Line 391... Line 560...
391
		u32 cpu_ring_tail;
560
		u32 cpu_ring_tail;
Line 392... Line 561...
392
 
561
 
Line 393... Line 562...
393
		u32 semaphore_seqno[I915_NUM_RINGS - 1];
562
		u32 semaphore_seqno[I915_NUM_RINGS - 1];
-
 
563
 
394
 
564
		/* Register state */
395
		/* Register state */
565
		u32 start;
396
		u32 tail;
566
		u32 tail;
397
		u32 head;
567
		u32 head;
398
		u32 ctl;
568
		u32 ctl;
Line 411... Line 581...
411
		u32 rc_psmi; /* sleep state */
581
		u32 rc_psmi; /* sleep state */
412
		u32 semaphore_mboxes[I915_NUM_RINGS - 1];
582
		u32 semaphore_mboxes[I915_NUM_RINGS - 1];
Line 413... Line 583...
413
 
583
 
414
	struct drm_i915_error_object {
584
		struct drm_i915_error_object {
415
		int page_count;
585
			int page_count;
416
		u32 gtt_offset;
586
			u64 gtt_offset;
417
		u32 *pages[0];
587
			u32 *pages[0];
Line 418... Line 588...
418
		} *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page;
588
		} *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page;
419
 
589
 
Line 436... Line 606...
436
	} ring[I915_NUM_RINGS];
606
	} ring[I915_NUM_RINGS];
Line 437... Line 607...
437
 
607
 
438
	struct drm_i915_error_buffer {
608
	struct drm_i915_error_buffer {
439
		u32 size;
609
		u32 size;
440
		u32 name;
610
		u32 name;
441
		u32 rseqno, wseqno;
611
		u32 rseqno[I915_NUM_RINGS], wseqno;
442
		u32 gtt_offset;
612
		u64 gtt_offset;
443
		u32 read_domains;
613
		u32 read_domains;
444
		u32 write_domain;
614
		u32 write_domain;
445
		s32 fence_reg:I915_MAX_NUM_FENCE_BITS;
615
		s32 fence_reg:I915_MAX_NUM_FENCE_BITS;
446
		s32 pinned:2;
616
		s32 pinned:2;
Line 456... Line 626...
456
	u32 vm_count;
626
	u32 vm_count;
457
};
627
};
Line 458... Line 628...
458
 
628
 
459
struct intel_connector;
629
struct intel_connector;
460
struct intel_encoder;
630
struct intel_encoder;
461
struct intel_crtc_config;
631
struct intel_crtc_state;
462
struct intel_plane_config;
632
struct intel_initial_plane_config;
463
struct intel_crtc;
633
struct intel_crtc;
464
struct intel_limit;
634
struct intel_limit;
Line 465... Line 635...
465
struct dpll;
635
struct dpll;
466
 
-
 
467
struct drm_i915_display_funcs {
-
 
468
	bool (*fbc_enabled)(struct drm_device *dev);
-
 
469
	void (*enable_fbc)(struct drm_crtc *crtc);
636
 
470
	void (*disable_fbc)(struct drm_device *dev);
637
struct drm_i915_display_funcs {
471
	int (*get_display_clock_speed)(struct drm_device *dev);
638
	int (*get_display_clock_speed)(struct drm_device *dev);
472
	int (*get_fifo_size)(struct drm_device *dev, int plane);
639
	int (*get_fifo_size)(struct drm_device *dev, int plane);
473
	/**
640
	/**
Line 482... Line 649...
482
	 * @best_clock: best PLL values found
649
	 * @best_clock: best PLL values found
483
	 *
650
	 *
484
	 * Returns true on success, false on failure.
651
	 * Returns true on success, false on failure.
485
	 */
652
	 */
486
	bool (*find_dpll)(const struct intel_limit *limit,
653
	bool (*find_dpll)(const struct intel_limit *limit,
487
			  struct intel_crtc *crtc,
654
			  struct intel_crtc_state *crtc_state,
488
			  int target, int refclk,
655
			  int target, int refclk,
489
			  struct dpll *match_clock,
656
			  struct dpll *match_clock,
490
			  struct dpll *best_clock);
657
			  struct dpll *best_clock);
491
	void (*update_wm)(struct drm_crtc *crtc);
658
	void (*update_wm)(struct drm_crtc *crtc);
492
	void (*update_sprite_wm)(struct drm_plane *plane,
659
	void (*update_sprite_wm)(struct drm_plane *plane,
493
				 struct drm_crtc *crtc,
660
				 struct drm_crtc *crtc,
494
				 uint32_t sprite_width, uint32_t sprite_height,
661
				 uint32_t sprite_width, uint32_t sprite_height,
495
				 int pixel_size, bool enable, bool scaled);
662
				 int pixel_size, bool enable, bool scaled);
-
 
663
	int (*modeset_calc_cdclk)(struct drm_atomic_state *state);
496
	void (*modeset_global_resources)(struct drm_device *dev);
664
	void (*modeset_commit_cdclk)(struct drm_atomic_state *state);
497
	/* Returns the active state of the crtc, and if the crtc is active,
665
	/* Returns the active state of the crtc, and if the crtc is active,
498
	 * fills out the pipe-config with the hw state. */
666
	 * fills out the pipe-config with the hw state. */
499
	bool (*get_pipe_config)(struct intel_crtc *,
667
	bool (*get_pipe_config)(struct intel_crtc *,
500
				struct intel_crtc_config *);
668
				struct intel_crtc_state *);
501
	void (*get_plane_config)(struct intel_crtc *,
669
	void (*get_initial_plane_config)(struct intel_crtc *,
502
				 struct intel_plane_config *);
670
					 struct intel_initial_plane_config *);
503
	int (*crtc_compute_clock)(struct intel_crtc *crtc);
671
	int (*crtc_compute_clock)(struct intel_crtc *crtc,
-
 
672
				  struct intel_crtc_state *crtc_state);
504
	void (*crtc_enable)(struct drm_crtc *crtc);
673
	void (*crtc_enable)(struct drm_crtc *crtc);
505
	void (*crtc_disable)(struct drm_crtc *crtc);
674
	void (*crtc_disable)(struct drm_crtc *crtc);
506
	void (*off)(struct drm_crtc *crtc);
-
 
507
	void (*audio_codec_enable)(struct drm_connector *connector,
675
	void (*audio_codec_enable)(struct drm_connector *connector,
508
				   struct intel_encoder *encoder,
676
				   struct intel_encoder *encoder,
509
			  struct drm_display_mode *mode);
677
				   const struct drm_display_mode *adjusted_mode);
510
	void (*audio_codec_disable)(struct intel_encoder *encoder);
678
	void (*audio_codec_disable)(struct intel_encoder *encoder);
511
	void (*fdi_link_train)(struct drm_crtc *crtc);
679
	void (*fdi_link_train)(struct drm_crtc *crtc);
512
	void (*init_clock_gating)(struct drm_device *dev);
680
	void (*init_clock_gating)(struct drm_device *dev);
513
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
681
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
514
			  struct drm_framebuffer *fb,
682
			  struct drm_framebuffer *fb,
515
			  struct drm_i915_gem_object *obj,
683
			  struct drm_i915_gem_object *obj,
516
			  struct intel_engine_cs *ring,
684
			  struct drm_i915_gem_request *req,
517
			  uint32_t flags);
685
			  uint32_t flags);
518
	void (*update_primary_plane)(struct drm_crtc *crtc,
686
	void (*update_primary_plane)(struct drm_crtc *crtc,
519
				    struct drm_framebuffer *fb,
687
				     struct drm_framebuffer *fb,
520
			    int x, int y);
688
				     int x, int y);
521
	void (*hpd_irq_setup)(struct drm_device *dev);
689
	void (*hpd_irq_setup)(struct drm_device *dev);
522
	/* clock updates for mode set */
690
	/* clock updates for mode set */
523
	/* cursor updates */
691
	/* cursor updates */
524
	/* render clock increase/decrease */
692
	/* render clock increase/decrease */
525
	/* display clock increase/decrease */
693
	/* display clock increase/decrease */
526
	/* pll clock increase/decrease */
694
	/* pll clock increase/decrease */
-
 
695
};
Line 527... Line 696...
527
 
696
 
-
 
697
enum forcewake_domain_id {
-
 
698
	FW_DOMAIN_ID_RENDER = 0,
-
 
699
	FW_DOMAIN_ID_BLITTER,
-
 
700
	FW_DOMAIN_ID_MEDIA,
-
 
701
 
-
 
702
	FW_DOMAIN_ID_COUNT
-
 
703
};
528
	int (*setup_backlight)(struct intel_connector *connector, enum pipe pipe);
704
 
529
	uint32_t (*get_backlight)(struct intel_connector *connector);
705
enum forcewake_domains {
530
	void (*set_backlight)(struct intel_connector *connector,
706
	FORCEWAKE_RENDER = (1 << FW_DOMAIN_ID_RENDER),
531
			      uint32_t level);
707
	FORCEWAKE_BLITTER = (1 << FW_DOMAIN_ID_BLITTER),
532
	void (*disable_backlight)(struct intel_connector *connector);
708
	FORCEWAKE_MEDIA	= (1 << FW_DOMAIN_ID_MEDIA),
-
 
709
	FORCEWAKE_ALL = (FORCEWAKE_RENDER |
-
 
710
			 FORCEWAKE_BLITTER |
533
	void (*enable_backlight)(struct intel_connector *connector);
711
			 FORCEWAKE_MEDIA)
Line 534... Line 712...
534
};
712
};
535
 
713
 
536
struct intel_uncore_funcs {
714
struct intel_uncore_funcs {
537
	void (*force_wake_get)(struct drm_i915_private *dev_priv,
715
	void (*force_wake_get)(struct drm_i915_private *dev_priv,
538
							int fw_engine);
716
							enum forcewake_domains domains);
Line 539... Line 717...
539
	void (*force_wake_put)(struct drm_i915_private *dev_priv,
717
	void (*force_wake_put)(struct drm_i915_private *dev_priv,
540
							int fw_engine);
718
							enum forcewake_domains domains);
541
 
719
 
542
	uint8_t  (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
720
	uint8_t  (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
Line 558... Line 736...
558
	spinlock_t lock; /** lock is also taken in irq contexts. */
736
	spinlock_t lock; /** lock is also taken in irq contexts. */
Line 559... Line 737...
559
 
737
 
Line 560... Line 738...
560
	struct intel_uncore_funcs funcs;
738
	struct intel_uncore_funcs funcs;
561
 
739
 
562
	unsigned fifo_count;
-
 
563
	unsigned forcewake_count;
-
 
564
 
-
 
565
	unsigned fw_rendercount;
-
 
Line -... Line 740...
-
 
740
	unsigned fifo_count;
-
 
741
	enum forcewake_domains fw_domains;
-
 
742
 
-
 
743
	struct intel_uncore_forcewake_domain {
566
	unsigned fw_mediacount;
744
		struct drm_i915_private *i915;
-
 
745
		enum forcewake_domain_id id;
-
 
746
		unsigned wake_count;
-
 
747
		struct timer_list timer;
-
 
748
		u32 reg_set;
-
 
749
		u32 val_set;
-
 
750
		u32 val_clear;
-
 
751
		u32 reg_ack;
-
 
752
		u32 reg_post;
-
 
753
		u32 val_reset;
-
 
754
	} fw_domain[FW_DOMAIN_ID_COUNT];
-
 
755
};
-
 
756
 
-
 
757
/* Iterate over initialised fw domains */
-
 
758
#define for_each_fw_domain_mask(domain__, mask__, dev_priv__, i__) \
-
 
759
	for ((i__) = 0, (domain__) = &(dev_priv__)->uncore.fw_domain[0]; \
-
 
760
	     (i__) < FW_DOMAIN_ID_COUNT; \
-
 
761
	     (i__)++, (domain__) = &(dev_priv__)->uncore.fw_domain[i__]) \
-
 
762
		if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__)))
-
 
763
 
-
 
764
#define for_each_fw_domain(domain__, dev_priv__, i__) \
-
 
765
	for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__)
-
 
766
 
-
 
767
enum csr_state {
-
 
768
	FW_UNINITIALIZED = 0,
-
 
769
	FW_LOADED,
-
 
770
	FW_FAILED
-
 
771
};
-
 
772
 
-
 
773
struct intel_csr {
-
 
774
	const char *fw_path;
-
 
775
	uint32_t *dmc_payload;
-
 
776
	uint32_t dmc_fw_size;
-
 
777
	uint32_t mmio_count;
567
	unsigned fw_blittercount;
778
	uint32_t mmioaddr[8];
Line 568... Line 779...
568
 
779
	uint32_t mmiodata[8];
569
	struct timer_list force_wake_timer;
780
	enum csr_state state;
570
};
781
};
Line 610... Line 821...
610
	/* Register offsets for the various display pipes and transcoders */
821
	/* Register offsets for the various display pipes and transcoders */
611
	int pipe_offsets[I915_MAX_TRANSCODERS];
822
	int pipe_offsets[I915_MAX_TRANSCODERS];
612
	int trans_offsets[I915_MAX_TRANSCODERS];
823
	int trans_offsets[I915_MAX_TRANSCODERS];
613
	int palette_offsets[I915_MAX_PIPES];
824
	int palette_offsets[I915_MAX_PIPES];
614
	int cursor_offsets[I915_MAX_PIPES];
825
	int cursor_offsets[I915_MAX_PIPES];
-
 
826
 
-
 
827
	/* Slice/subslice/EU info */
-
 
828
	u8 slice_total;
-
 
829
	u8 subslice_total;
-
 
830
	u8 subslice_per_slice;
-
 
831
	u8 eu_total;
-
 
832
	u8 eu_per_subslice;
-
 
833
	/* For each slice, which subslice(s) has(have) 7 EUs (bitfield)? */
-
 
834
	u8 subslice_7eu[3];
-
 
835
	u8 has_slice_pg:1;
-
 
836
	u8 has_subslice_pg:1;
-
 
837
	u8 has_eu_pg:1;
615
};
838
};
Line 616... Line 839...
616
 
839
 
617
#undef DEFINE_FLAG
840
#undef DEFINE_FLAG
Line 635... Line 858...
635
	unsigned batch_active;
858
	unsigned batch_active;
Line 636... Line 859...
636
 
859
 
637
	/* Time when this context was last blamed for a GPU reset */
860
	/* Time when this context was last blamed for a GPU reset */
Line -... Line 861...
-
 
861
	unsigned long guilty_ts;
-
 
862
 
-
 
863
	/* If the contexts causes a second GPU hang within this time,
-
 
864
	 * it is permanently banned from submitting any more work.
-
 
865
	 */
638
	unsigned long guilty_ts;
866
	unsigned long ban_period_seconds;
639
 
867
 
640
	/* This context is banned to submit more work */
868
	/* This context is banned to submit more work */
Line 641... Line 869...
641
	bool banned;
869
	bool banned;
642
};
870
};
-
 
871
 
-
 
872
/* This must match up with the value previously used for execbuf2.rsvd1. */
643
 
873
#define DEFAULT_CONTEXT_HANDLE 0
644
/* This must match up with the value previously used for execbuf2.rsvd1. */
874
 
645
#define DEFAULT_CONTEXT_HANDLE 0
875
#define CONTEXT_NO_ZEROMAP (1<<0)
646
/**
876
/**
647
 * struct intel_context - as the name implies, represents a context.
877
 * struct intel_context - as the name implies, represents a context.
-
 
878
 * @ref: reference count.
-
 
879
 * @user_handle: userspace tracking identity for this context.
648
 * @ref: reference count.
880
 * @remap_slice: l3 row remapping information.
649
 * @user_handle: userspace tracking identity for this context.
881
 * @flags: context specific flags:
650
 * @remap_slice: l3 row remapping information.
882
 *         CONTEXT_NO_ZEROMAP: do not allow mapping things to page 0.
651
 * @file_priv: filp associated with this context (NULL for global default
883
 * @file_priv: filp associated with this context (NULL for global default
652
 *	       context).
884
 *	       context).
653
 * @hang_stats: information about the role of this context in possible GPU
885
 * @hang_stats: information about the role of this context in possible GPU
654
 *		hangs.
886
 *		hangs.
655
 * @vm: virtual memory space used by this context.
887
 * @ppgtt: virtual memory space used by this context.
656
 * @legacy_hw_ctx: render context backing object and whether it is correctly
888
 * @legacy_hw_ctx: render context backing object and whether it is correctly
657
 *                initialized (legacy ring submission mechanism only).
889
 *                initialized (legacy ring submission mechanism only).
Line 662... Line 894...
662
 */
894
 */
663
struct intel_context {
895
struct intel_context {
664
	struct kref ref;
896
	struct kref ref;
665
	int user_handle;
897
	int user_handle;
666
	uint8_t remap_slice;
898
	uint8_t remap_slice;
-
 
899
	struct drm_i915_private *i915;
-
 
900
	int flags;
667
	struct drm_i915_file_private *file_priv;
901
	struct drm_i915_file_private *file_priv;
668
	struct i915_ctx_hang_stats hang_stats;
902
	struct i915_ctx_hang_stats hang_stats;
669
	struct i915_hw_ppgtt *ppgtt;
903
	struct i915_hw_ppgtt *ppgtt;
Line 670... Line 904...
670
 
904
 
Line 673... Line 907...
673
		struct drm_i915_gem_object *rcs_state;
907
		struct drm_i915_gem_object *rcs_state;
674
		bool initialized;
908
		bool initialized;
675
	} legacy_hw_ctx;
909
	} legacy_hw_ctx;
Line 676... Line 910...
676
 
910
 
677
	/* Execlists */
-
 
678
	bool rcs_initialized;
911
	/* Execlists */
679
	struct {
912
	struct {
680
		struct drm_i915_gem_object *state;
913
		struct drm_i915_gem_object *state;
681
		struct intel_ringbuffer *ringbuf;
914
		struct intel_ringbuffer *ringbuf;
682
		int unpin_count;
915
		int pin_count;
Line 683... Line 916...
683
	} engine[I915_NUM_RINGS];
916
	} engine[I915_NUM_RINGS];
684
 
917
 
Line -... Line 918...
-
 
918
	struct list_head link;
-
 
919
};
-
 
920
 
-
 
921
enum fb_op_origin {
-
 
922
	ORIGIN_GTT,
-
 
923
	ORIGIN_CPU,
-
 
924
	ORIGIN_CS,
-
 
925
	ORIGIN_FLIP,
685
	struct list_head link;
926
	ORIGIN_DIRTYFB,
-
 
927
};
-
 
928
 
-
 
929
struct i915_fbc {
686
};
930
	/* This is always the inner lock when overlapping with struct_mutex and
687
 
931
	 * it's the outer lock when overlapping with stolen_lock. */
688
struct i915_fbc {
932
	struct mutex lock;
-
 
933
	unsigned long uncompressed_size;
-
 
934
	unsigned threshold;
689
	unsigned long size;
935
	unsigned int fb_id;
690
	unsigned threshold;
936
	unsigned int possible_framebuffer_bits;
Line 691... Line 937...
691
	unsigned int fb_id;
937
	unsigned int busy_bits;
692
	enum plane plane;
938
	struct intel_crtc *crtc;
Line 699... Line 945...
699
 
945
 
700
	/* Tracks whether the HW is actually enabled, not whether the feature is
946
	/* Tracks whether the HW is actually enabled, not whether the feature is
701
	 * possible. */
947
	 * possible. */
Line 702... Line -...
702
	bool enabled;
-
 
703
 
-
 
704
	/* On gen8 some rings cannont perform fbc clean operation so for now
-
 
705
	 * we are doing this on SW with mmio.
-
 
706
	 * This variable works in the opposite information direction
-
 
707
	 * of ring->fbc_dirty telling software on frontbuffer tracking
-
 
708
	 * to perform the cache clean on sw side.
-
 
709
	 */
-
 
710
	bool need_sw_cache_clean;
948
	bool enabled;
711
 
949
 
712
	struct intel_fbc_work {
950
	struct intel_fbc_work {
713
		struct delayed_work work;
951
		struct delayed_work work;
714
		struct drm_crtc *crtc;
952
		struct intel_crtc *crtc;
Line 715... Line 953...
715
		struct drm_framebuffer *fb;
953
		struct drm_framebuffer *fb;
716
	} *fbc_work;
954
	} *fbc_work;
Line 725... Line 963...
725
	FBC_BAD_PLANE, /* fbc not supported on plane */
963
		FBC_BAD_PLANE, /* fbc not supported on plane */
726
	FBC_NOT_TILED, /* buffer not tiled */
964
		FBC_NOT_TILED, /* buffer not tiled */
727
	FBC_MULTIPLE_PIPES, /* more than one pipe active */
965
		FBC_MULTIPLE_PIPES, /* more than one pipe active */
728
	FBC_MODULE_PARAM,
966
		FBC_MODULE_PARAM,
729
		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
967
		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
-
 
968
		FBC_ROTATION, /* rotation is not supported */
-
 
969
		FBC_IN_DBG_MASTER, /* kernel debugger is active */
-
 
970
		FBC_BAD_STRIDE, /* stride is not supported */
-
 
971
		FBC_PIXEL_RATE, /* pixel rate is too big */
-
 
972
		FBC_PIXEL_FORMAT /* pixel format is invalid */
730
	} no_fbc_reason;
973
	} no_fbc_reason;
-
 
974
 
-
 
975
	bool (*fbc_enabled)(struct drm_i915_private *dev_priv);
-
 
976
	void (*enable_fbc)(struct intel_crtc *crtc);
-
 
977
	void (*disable_fbc)(struct drm_i915_private *dev_priv);
731
};
978
};
Line -... Line 979...
-
 
979
 
-
 
980
/**
-
 
981
 * HIGH_RR is the highest eDP panel refresh rate read from EDID
-
 
982
 * LOW_RR is the lowest eDP panel refresh rate found from EDID
-
 
983
 * parsing for same resolution.
732
 
984
 */
-
 
985
enum drrs_refresh_rate_type {
-
 
986
	DRRS_HIGH_RR,
733
struct i915_drrs {
987
	DRRS_LOW_RR,
-
 
988
	DRRS_MAX_RR, /* RR count */
-
 
989
};
-
 
990
 
-
 
991
enum drrs_support_type {
-
 
992
	DRRS_NOT_SUPPORTED = 0,
-
 
993
	STATIC_DRRS_SUPPORT = 1,
734
	struct intel_connector *connector;
994
	SEAMLESS_DRRS_SUPPORT = 2
Line 735... Line 995...
735
};
995
};
-
 
996
 
-
 
997
struct intel_dp;
-
 
998
struct i915_drrs {
-
 
999
	struct mutex mutex;
-
 
1000
	struct delayed_work work;
-
 
1001
	struct intel_dp *dp;
-
 
1002
	unsigned busy_frontbuffer_bits;
-
 
1003
	enum drrs_refresh_rate_type refresh_rate_type;
-
 
1004
	enum drrs_support_type type;
736
 
1005
};
737
struct intel_dp;
1006
 
738
struct i915_psr {
1007
struct i915_psr {
739
	struct mutex lock;
1008
	struct mutex lock;
740
	bool sink_support;
1009
	bool sink_support;
741
	bool source_ok;
1010
	bool source_ok;
742
	struct intel_dp *enabled;
1011
	struct intel_dp *enabled;
743
	bool active;
1012
	bool active;
-
 
1013
	struct delayed_work work;
-
 
1014
	unsigned busy_frontbuffer_bits;
744
	struct delayed_work work;
1015
	bool psr2_support;
Line 745... Line 1016...
745
	unsigned busy_frontbuffer_bits;
1016
	bool aux_frame_sync;
746
};
1017
};
747
 
1018
 
Line 777... Line 1048...
777
	struct i2c_algo_bit_data bit_algo;
1048
	struct i2c_algo_bit_data bit_algo;
778
	struct drm_i915_private *dev_priv;
1049
	struct drm_i915_private *dev_priv;
779
};
1050
};
Line 780... Line 1051...
780
 
1051
 
781
struct i915_suspend_saved_registers {
-
 
782
	u8 saveLBB;
-
 
783
	u32 saveDSPACNTR;
-
 
784
	u32 saveDSPBCNTR;
1052
struct i915_suspend_saved_registers {
785
	u32 saveDSPARB;
-
 
786
	u32 savePIPEACONF;
-
 
787
	u32 savePIPEBCONF;
-
 
788
	u32 savePIPEASRC;
-
 
789
	u32 savePIPEBSRC;
-
 
790
	u32 saveFPA0;
-
 
791
	u32 saveFPA1;
-
 
792
	u32 saveDPLL_A;
-
 
793
	u32 saveDPLL_A_MD;
-
 
794
	u32 saveHTOTAL_A;
-
 
795
	u32 saveHBLANK_A;
-
 
796
	u32 saveHSYNC_A;
-
 
797
	u32 saveVTOTAL_A;
-
 
798
	u32 saveVBLANK_A;
-
 
799
	u32 saveVSYNC_A;
-
 
800
	u32 saveBCLRPAT_A;
-
 
801
	u32 saveTRANSACONF;
-
 
802
	u32 saveTRANS_HTOTAL_A;
-
 
803
	u32 saveTRANS_HBLANK_A;
-
 
804
	u32 saveTRANS_HSYNC_A;
-
 
805
	u32 saveTRANS_VTOTAL_A;
-
 
806
	u32 saveTRANS_VBLANK_A;
-
 
807
	u32 saveTRANS_VSYNC_A;
-
 
808
	u32 savePIPEASTAT;
-
 
809
	u32 saveDSPASTRIDE;
-
 
810
	u32 saveDSPASIZE;
-
 
811
	u32 saveDSPAPOS;
-
 
812
	u32 saveDSPAADDR;
-
 
813
	u32 saveDSPASURF;
-
 
814
	u32 saveDSPATILEOFF;
-
 
815
	u32 savePFIT_PGM_RATIOS;
-
 
816
	u32 saveBLC_HIST_CTL;
-
 
817
	u32 saveBLC_PWM_CTL;
-
 
818
	u32 saveBLC_PWM_CTL2;
-
 
819
	u32 saveBLC_CPU_PWM_CTL;
-
 
820
	u32 saveBLC_CPU_PWM_CTL2;
-
 
821
	u32 saveFPB0;
-
 
822
	u32 saveFPB1;
-
 
823
	u32 saveDPLL_B;
-
 
824
	u32 saveDPLL_B_MD;
-
 
825
	u32 saveHTOTAL_B;
-
 
826
	u32 saveHBLANK_B;
-
 
827
	u32 saveHSYNC_B;
-
 
828
	u32 saveVTOTAL_B;
-
 
829
	u32 saveVBLANK_B;
-
 
830
	u32 saveVSYNC_B;
-
 
831
	u32 saveBCLRPAT_B;
-
 
832
	u32 saveTRANSBCONF;
-
 
833
	u32 saveTRANS_HTOTAL_B;
-
 
834
	u32 saveTRANS_HBLANK_B;
-
 
835
	u32 saveTRANS_HSYNC_B;
-
 
836
	u32 saveTRANS_VTOTAL_B;
-
 
837
	u32 saveTRANS_VBLANK_B;
-
 
838
	u32 saveTRANS_VSYNC_B;
-
 
839
	u32 savePIPEBSTAT;
-
 
840
	u32 saveDSPBSTRIDE;
-
 
841
	u32 saveDSPBSIZE;
-
 
842
	u32 saveDSPBPOS;
-
 
843
	u32 saveDSPBADDR;
-
 
844
	u32 saveDSPBSURF;
-
 
845
	u32 saveDSPBTILEOFF;
-
 
846
	u32 saveVGA0;
-
 
847
	u32 saveVGA1;
-
 
848
	u32 saveVGA_PD;
-
 
849
	u32 saveVGACNTRL;
-
 
850
	u32 saveADPA;
1053
	u32 saveDSPARB;
851
	u32 saveLVDS;
1054
	u32 saveLVDS;
852
	u32 savePP_ON_DELAYS;
1055
	u32 savePP_ON_DELAYS;
853
	u32 savePP_OFF_DELAYS;
-
 
854
	u32 saveDVOA;
-
 
855
	u32 saveDVOB;
-
 
856
	u32 saveDVOC;
1056
	u32 savePP_OFF_DELAYS;
857
	u32 savePP_ON;
1057
	u32 savePP_ON;
858
	u32 savePP_OFF;
1058
	u32 savePP_OFF;
859
	u32 savePP_CONTROL;
1059
	u32 savePP_CONTROL;
860
	u32 savePP_DIVISOR;
-
 
861
	u32 savePFIT_CONTROL;
-
 
862
	u32 save_palette_a[256];
-
 
863
	u32 save_palette_b[256];
1060
	u32 savePP_DIVISOR;
864
	u32 saveFBC_CONTROL;
-
 
865
	u32 saveIER;
-
 
866
	u32 saveIIR;
-
 
867
	u32 saveIMR;
-
 
868
	u32 saveDEIER;
-
 
869
	u32 saveDEIMR;
-
 
870
	u32 saveGTIER;
-
 
871
	u32 saveGTIMR;
-
 
872
	u32 saveFDI_RXA_IMR;
-
 
873
	u32 saveFDI_RXB_IMR;
1061
	u32 saveFBC_CONTROL;
874
	u32 saveCACHE_MODE_0;
1062
	u32 saveCACHE_MODE_0;
875
	u32 saveMI_ARB_STATE;
1063
	u32 saveMI_ARB_STATE;
876
	u32 saveSWF0[16];
1064
	u32 saveSWF0[16];
877
	u32 saveSWF1[16];
1065
	u32 saveSWF1[16];
878
	u32 saveSWF2[3];
-
 
879
	u8 saveMSR;
-
 
880
	u8 saveSR[8];
-
 
881
	u8 saveGR[25];
-
 
882
	u8 saveAR_INDEX;
-
 
883
	u8 saveAR[21];
-
 
884
	u8 saveDACMASK;
-
 
885
	u8 saveCR[37];
1066
	u32 saveSWF3[3];
886
	uint64_t saveFENCE[I915_MAX_NUM_FENCES];
-
 
887
	u32 saveCURACNTR;
-
 
888
	u32 saveCURAPOS;
-
 
889
	u32 saveCURABASE;
-
 
890
	u32 saveCURBCNTR;
-
 
891
	u32 saveCURBPOS;
-
 
892
	u32 saveCURBBASE;
-
 
893
	u32 saveCURSIZE;
-
 
894
	u32 saveDP_B;
-
 
895
	u32 saveDP_C;
-
 
896
	u32 saveDP_D;
-
 
897
	u32 savePIPEA_GMCH_DATA_M;
-
 
898
	u32 savePIPEB_GMCH_DATA_M;
-
 
899
	u32 savePIPEA_GMCH_DATA_N;
-
 
900
	u32 savePIPEB_GMCH_DATA_N;
-
 
901
	u32 savePIPEA_DP_LINK_M;
-
 
902
	u32 savePIPEB_DP_LINK_M;
-
 
903
	u32 savePIPEA_DP_LINK_N;
-
 
904
	u32 savePIPEB_DP_LINK_N;
-
 
905
	u32 saveFDI_RXA_CTL;
-
 
906
	u32 saveFDI_TXA_CTL;
-
 
907
	u32 saveFDI_RXB_CTL;
-
 
908
	u32 saveFDI_TXB_CTL;
-
 
909
	u32 savePFA_CTL_1;
-
 
910
	u32 savePFB_CTL_1;
-
 
911
	u32 savePFA_WIN_SZ;
-
 
912
	u32 savePFB_WIN_SZ;
-
 
913
	u32 savePFA_WIN_POS;
-
 
914
	u32 savePFB_WIN_POS;
-
 
915
	u32 savePCH_DREF_CONTROL;
-
 
916
	u32 saveDISP_ARB_CTL;
-
 
917
	u32 savePIPEA_DATA_M1;
-
 
918
	u32 savePIPEA_DATA_N1;
-
 
919
	u32 savePIPEA_LINK_M1;
-
 
920
	u32 savePIPEA_LINK_N1;
-
 
921
	u32 savePIPEB_DATA_M1;
-
 
922
	u32 savePIPEB_DATA_N1;
-
 
923
	u32 savePIPEB_LINK_M1;
-
 
924
	u32 savePIPEB_LINK_N1;
-
 
925
	u32 saveMCHBAR_RENDER_STANDBY;
1067
	uint64_t saveFENCE[I915_MAX_NUM_FENCES];
926
	u32 savePCH_PORT_HOTPLUG;
1068
	u32 savePCH_PORT_HOTPLUG;
927
	u16 saveGCDGMBUS;
1069
	u16 saveGCDGMBUS;
Line 928... Line 1070...
928
};
1070
};
Line 983... Line 1125...
983
	u32 pmwgicz;
1125
	u32 pmwgicz;
Line 984... Line 1126...
984
 
1126
 
985
	/* Display 2 CZ domain */
1127
	/* Display 2 CZ domain */
986
	u32 gu_ctl0;
1128
	u32 gu_ctl0;
-
 
1129
	u32 gu_ctl1;
987
	u32 gu_ctl1;
1130
	u32 pcbr;
988
	u32 clock_gate_dis2;
1131
	u32 clock_gate_dis2;
Line 989... Line 1132...
989
};
1132
};
990
 
1133
 
Line 1016... Line 1159...
1016
	u8 cur_freq;		/* Current frequency (cached, may not == HW) */
1159
	u8 cur_freq;		/* Current frequency (cached, may not == HW) */
1017
	u8 min_freq_softlimit;	/* Minimum frequency permitted by the driver */
1160
	u8 min_freq_softlimit;	/* Minimum frequency permitted by the driver */
1018
	u8 max_freq_softlimit;	/* Max frequency permitted by the driver */
1161
	u8 max_freq_softlimit;	/* Max frequency permitted by the driver */
1019
	u8 max_freq;		/* Maximum frequency, RP0 if not overclocking */
1162
	u8 max_freq;		/* Maximum frequency, RP0 if not overclocking */
1020
	u8 min_freq;		/* AKA RPn. Minimum frequency */
1163
	u8 min_freq;		/* AKA RPn. Minimum frequency */
-
 
1164
	u8 idle_freq;		/* Frequency to request when we are idle */
1021
	u8 efficient_freq;	/* AKA RPe. Pre-determined balanced frequency */
1165
	u8 efficient_freq;	/* AKA RPe. Pre-determined balanced frequency */
1022
	u8 rp1_freq;		/* "less than" RP0 power/freqency */
1166
	u8 rp1_freq;		/* "less than" RP0 power/freqency */
1023
	u8 rp0_freq;		/* Non-overclocked max frequency. */
1167
	u8 rp0_freq;		/* Non-overclocked max frequency. */
1024
	u32 cz_freq;
-
 
Line 1025... Line 1168...
1025
 
1168
 
-
 
1169
	u8 up_threshold; /* Current %busy required to uplock */
Line 1026... Line 1170...
1026
	u32 ei_interrupt_count;
1170
	u8 down_threshold; /* Current %busy required to downclock */
1027
 
1171
 
Line -... Line 1172...
-
 
1172
	int last_adj;
-
 
1173
	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
-
 
1174
 
-
 
1175
	spinlock_t client_lock;
1028
	int last_adj;
1176
	struct list_head clients;
1029
	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
1177
	bool client_boost;
-
 
1178
 
-
 
1179
	bool enabled;
-
 
1180
	struct delayed_work delayed_resume_work;
Line 1030... Line 1181...
1030
 
1181
	unsigned boosts;
1031
	bool enabled;
1182
 
Line 1032... Line 1183...
1032
	struct delayed_work delayed_resume_work;
1183
	struct intel_rps_client semaphores, mmioflips;
1033
 
1184
 
1034
	/* manual wa residency calculations */
1185
	/* manual wa residency calculations */
-
 
1186
	struct intel_rps_ei up_ei, down_ei;
-
 
1187
 
1035
	struct intel_rps_ei up_ei, down_ei;
1188
	/*
1036
 
1189
	 * Protects RPS/RC6 register access and PCU communication.
1037
	/*
1190
	 * Must be taken after struct_mutex if nested. Note that
Line 1038... Line 1191...
1038
	 * Protects RPS/RC6 register access and PCU communication.
1191
	 * this lock may be held for long periods of time when
Line 1059... Line 1212...
1059
	unsigned long gfx_power;
1212
	unsigned long gfx_power;
1060
	u8 corr;
1213
	u8 corr;
Line 1061... Line 1214...
1061
 
1214
 
1062
	int c_m;
1215
	int c_m;
1063
	int r_t;
-
 
1064
 
-
 
1065
	struct drm_i915_gem_object *pwrctx;
-
 
1066
	struct drm_i915_gem_object *renderctx;
1216
	int r_t;
Line 1067... Line 1217...
1067
};
1217
};
1068
 
1218
 
Line 1131... Line 1281...
1131
};
1281
};
Line 1132... Line 1282...
1132
 
1282
 
1133
struct i915_gem_mm {
1283
struct i915_gem_mm {
1134
	/** Memory allocator for GTT stolen memory */
1284
	/** Memory allocator for GTT stolen memory */
-
 
1285
	struct drm_mm stolen;
-
 
1286
	/** Protects the usage of the GTT stolen memory allocator. This is
-
 
1287
	 * always the inner lock when overlapping with struct_mutex. */
-
 
1288
	struct mutex stolen_lock;
1135
	struct drm_mm stolen;
1289
 
1136
	/** List of all objects in gtt_space. Used to restore gtt
1290
	/** List of all objects in gtt_space. Used to restore gtt
1137
	 * mappings on resume */
1291
	 * mappings on resume */
1138
	struct list_head bound_list;
1292
	struct list_head bound_list;
1139
	/**
1293
	/**
Line 1218... Line 1372...
1218
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
1372
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
1219
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
1373
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
1220
	/* Hang gpu twice in this window and your context gets banned */
1374
	/* Hang gpu twice in this window and your context gets banned */
1221
#define DRM_I915_CTX_BAN_PERIOD DIV_ROUND_UP(8*DRM_I915_HANGCHECK_PERIOD, 1000)
1375
#define DRM_I915_CTX_BAN_PERIOD DIV_ROUND_UP(8*DRM_I915_HANGCHECK_PERIOD, 1000)
Line -... Line 1376...
-
 
1376
 
1222
 
1377
	struct workqueue_struct *hangcheck_wq;
Line 1223... Line 1378...
1223
	struct timer_list hangcheck_timer;
1378
	struct delayed_work hangcheck_work;
1224
 
1379
 
1225
	/* For reset and error_state handling. */
1380
	/* For reset and error_state handling. */
1226
	spinlock_t lock;
1381
	spinlock_t lock;
1227
	/* Protected by the above dev->gpu_error.lock. */
-
 
1228
	struct drm_i915_error_state *first_error;
-
 
Line 1229... Line 1382...
1229
	struct work_struct work;
1382
	/* Protected by the above dev->gpu_error.lock. */
Line 1230... Line 1383...
1230
 
1383
	struct drm_i915_error_state *first_error;
1231
 
1384
 
Line 1281... Line 1434...
1281
	MODESET_ON_LID_OPEN,
1434
	MODESET_ON_LID_OPEN,
1282
	MODESET_DONE,
1435
	MODESET_DONE,
1283
	MODESET_SUSPENDED,
1436
	MODESET_SUSPENDED,
1284
};
1437
};
Line -... Line 1438...
-
 
1438
 
-
 
1439
#define DP_AUX_A 0x40
-
 
1440
#define DP_AUX_B 0x10
-
 
1441
#define DP_AUX_C 0x20
-
 
1442
#define DP_AUX_D 0x30
-
 
1443
 
-
 
1444
#define DDC_PIN_B  0x05
-
 
1445
#define DDC_PIN_C  0x04
-
 
1446
#define DDC_PIN_D  0x06
1285
 
1447
 
1286
struct ddi_vbt_port_info {
1448
struct ddi_vbt_port_info {
1287
	/*
1449
	/*
1288
	 * This is an index in the HDMI/DVI DDI buffer translation table.
1450
	 * This is an index in the HDMI/DVI DDI buffer translation table.
1289
	 * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't
1451
	 * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't
Line 1293... Line 1455...
1293
	uint8_t hdmi_level_shift;
1455
	uint8_t hdmi_level_shift;
Line 1294... Line 1456...
1294
 
1456
 
1295
	uint8_t supports_dvi:1;
1457
	uint8_t supports_dvi:1;
1296
	uint8_t supports_hdmi:1;
1458
	uint8_t supports_hdmi:1;
-
 
1459
	uint8_t supports_dp:1;
-
 
1460
 
-
 
1461
	uint8_t alternate_aux_channel;
-
 
1462
	uint8_t alternate_ddc_pin;
-
 
1463
 
-
 
1464
	uint8_t dp_boost_level;
1297
	uint8_t supports_dp:1;
1465
	uint8_t hdmi_boost_level;
Line 1298... Line 1466...
1298
};
1466
};
1299
 
1467
 
1300
enum drrs_support_type {
1468
enum psr_lines_to_wait {
1301
	DRRS_NOT_SUPPORTED = 0,
1469
	PSR_0_LINES_TO_WAIT = 0,
-
 
1470
	PSR_1_LINE_TO_WAIT,
1302
	STATIC_DRRS_SUPPORT = 1,
1471
	PSR_4_LINES_TO_WAIT,
Line 1303... Line 1472...
1303
	SEAMLESS_DRRS_SUPPORT = 2
1472
	PSR_8_LINES_TO_WAIT
1304
};
1473
};
1305
 
1474
 
Line 1330... Line 1499...
1330
	bool edp_support;
1499
	bool edp_support;
1331
	int edp_bpp;
1500
	int edp_bpp;
1332
	struct edp_power_seq edp_pps;
1501
	struct edp_power_seq edp_pps;
Line 1333... Line 1502...
1333
 
1502
 
-
 
1503
	struct {
-
 
1504
		bool full_link;
-
 
1505
		bool require_aux_wakeup;
-
 
1506
		int idle_frames;
-
 
1507
		enum psr_lines_to_wait lines_to_wait;
-
 
1508
		int tp1_wakeup_time;
-
 
1509
		int tp2_tp3_wakeup_time;
-
 
1510
	} psr;
-
 
1511
 
1334
	struct {
1512
	struct {
1335
		u16 pwm_freq_hz;
1513
		u16 pwm_freq_hz;
1336
		bool present;
1514
		bool present;
1337
		bool active_low_pwm;
1515
		bool active_low_pwm;
1338
		u8 min_brightness;	/* min_brightness/255 of max */
1516
		u8 min_brightness;	/* min_brightness/255 of max */
Line 1378... Line 1556...
1378
	uint32_t wm_linetime[3];
1556
	uint32_t wm_linetime[3];
1379
	bool enable_fbc_wm;
1557
	bool enable_fbc_wm;
1380
	enum intel_ddb_partitioning partitioning;
1558
	enum intel_ddb_partitioning partitioning;
1381
};
1559
};
Line -... Line 1560...
-
 
1560
 
-
 
1561
struct vlv_pipe_wm {
-
 
1562
	uint16_t primary;
-
 
1563
	uint16_t sprite[2];
-
 
1564
	uint8_t cursor;
-
 
1565
};
-
 
1566
 
-
 
1567
struct vlv_sr_wm {
-
 
1568
	uint16_t plane;
-
 
1569
	uint8_t cursor;
-
 
1570
};
-
 
1571
 
-
 
1572
struct vlv_wm_values {
-
 
1573
	struct vlv_pipe_wm pipe[3];
-
 
1574
	struct vlv_sr_wm sr;
-
 
1575
	struct {
-
 
1576
		uint8_t cursor;
-
 
1577
		uint8_t sprite[2];
-
 
1578
		uint8_t primary;
-
 
1579
	} ddl[3];
-
 
1580
	uint8_t level;
-
 
1581
	bool cxsr;
-
 
1582
};
1382
 
1583
 
1383
struct skl_ddb_entry {
1584
struct skl_ddb_entry {
1384
	uint16_t start, end;	/* in number of blocks, 'end' is exclusive */
1585
	uint16_t start, end;	/* in number of blocks, 'end' is exclusive */
Line 1385... Line 1586...
1385
};
1586
};
Line 1398... Line 1599...
1398
	return false;
1599
	return false;
1399
}
1600
}
Line 1400... Line 1601...
1400
 
1601
 
1401
struct skl_ddb_allocation {
1602
struct skl_ddb_allocation {
1402
	struct skl_ddb_entry pipe[I915_MAX_PIPES];
1603
	struct skl_ddb_entry pipe[I915_MAX_PIPES];
1403
	struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES];
1604
	struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; /* packed/uv */
1404
	struct skl_ddb_entry cursor[I915_MAX_PIPES];
1605
	struct skl_ddb_entry y_plane[I915_MAX_PIPES][I915_MAX_PLANES];
Line 1405... Line 1606...
1405
};
1606
};
1406
 
1607
 
1407
struct skl_wm_values {
1608
struct skl_wm_values {
1408
	bool dirty[I915_MAX_PIPES];
1609
	bool dirty[I915_MAX_PIPES];
1409
	struct skl_ddb_allocation ddb;
1610
	struct skl_ddb_allocation ddb;
1410
	uint32_t wm_linetime[I915_MAX_PIPES];
-
 
1411
	uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8];
1611
	uint32_t wm_linetime[I915_MAX_PIPES];
1412
	uint32_t cursor[I915_MAX_PIPES][8];
-
 
1413
	uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES];
1612
	uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8];
Line 1414... Line 1613...
1414
	uint32_t cursor_trans[I915_MAX_PIPES];
1613
	uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES];
1415
};
1614
};
1416
 
-
 
1417
struct skl_wm_level {
1615
 
1418
	bool plane_en[I915_MAX_PLANES];
1616
struct skl_wm_level {
1419
	bool cursor_en;
-
 
1420
	uint16_t plane_res_b[I915_MAX_PLANES];
-
 
1421
	uint8_t plane_res_l[I915_MAX_PLANES];
1617
	bool plane_en[I915_MAX_PLANES];
Line 1422... Line 1618...
1422
	uint16_t cursor_res_b;
1618
	uint16_t plane_res_b[I915_MAX_PLANES];
1423
	uint8_t cursor_res_l;
1619
	uint8_t plane_res_l[I915_MAX_PLANES];
1424
};
1620
};
Line 1504... Line 1700...
1504
struct i915_workarounds {
1700
struct i915_workarounds {
1505
	struct i915_wa_reg reg[I915_MAX_WA_REGS];
1701
	struct i915_wa_reg reg[I915_MAX_WA_REGS];
1506
	u32 count;
1702
	u32 count;
1507
};
1703
};
Line -... Line 1704...
-
 
1704
 
-
 
1705
struct i915_virtual_gpu {
-
 
1706
	bool active;
-
 
1707
};
-
 
1708
 
-
 
1709
struct i915_execbuffer_params {
-
 
1710
	struct drm_device               *dev;
-
 
1711
	struct drm_file                 *file;
-
 
1712
	uint32_t                        dispatch_flags;
-
 
1713
	uint32_t                        args_batch_start_offset;
-
 
1714
	uint64_t                        batch_obj_vm_offset;
-
 
1715
	struct intel_engine_cs          *ring;
-
 
1716
	struct drm_i915_gem_object      *batch_obj;
-
 
1717
	struct intel_context            *ctx;
-
 
1718
	struct drm_i915_gem_request     *request;
-
 
1719
};
1508
 
1720
 
1509
struct drm_i915_private {
1721
struct drm_i915_private {
-
 
1722
	struct drm_device *dev;
-
 
1723
	struct kmem_cache *objects;
-
 
1724
	struct kmem_cache *vmas;
Line 1510... Line 1725...
1510
	struct drm_device *dev;
1725
	struct kmem_cache *requests;
Line 1511... Line 1726...
1511
 
1726
 
Line 1512... Line 1727...
1512
	const struct intel_device_info info;
1727
	const struct intel_device_info info;
Line 1513... Line 1728...
1513
 
1728
 
Line 1514... Line 1729...
1514
	int relative_constants_mode;
1729
	int relative_constants_mode;
Line -... Line 1730...
-
 
1730
 
-
 
1731
	void __iomem *regs;
-
 
1732
 
-
 
1733
	struct intel_uncore uncore;
-
 
1734
 
-
 
1735
	struct i915_virtual_gpu vgpu;
-
 
1736
 
-
 
1737
	struct intel_guc guc;
Line 1515... Line 1738...
1515
 
1738
 
1516
	void __iomem *regs;
1739
	struct intel_csr csr;
1517
 
1740
 
Line 1548... Line 1771...
1548
	/* protects the mmio flip data */
1771
	/* protects the mmio flip data */
1549
	spinlock_t mmio_flip_lock;
1772
	spinlock_t mmio_flip_lock;
Line 1550... Line 1773...
1550
 
1773
 
Line 1551... Line -...
1551
	bool display_irqs_enabled;
-
 
1552
 
-
 
Line 1553... Line 1774...
1553
	/* To control wakeup latency, e.g. for irq-driven dp aux transfers. */
1774
	bool display_irqs_enabled;
1554
//	struct pm_qos_request pm_qos;
1775
 
Line 1555... Line 1776...
1555
 
1776
 
1556
	/* DPIO indirect register protection */
1777
	/* Sideband mailbox protection */
1557
	struct mutex dpio_lock;
1778
	struct mutex sb_lock;
1558
 
1779
 
Line 1564... Line 1785...
1564
	u32 gt_irq_mask;
1785
	u32 gt_irq_mask;
1565
	u32 pm_irq_mask;
1786
	u32 pm_irq_mask;
1566
	u32 pm_rps_events;
1787
	u32 pm_rps_events;
1567
	u32 pipestat_irq_mask[I915_MAX_PIPES];
1788
	u32 pipestat_irq_mask[I915_MAX_PIPES];
Line 1568... Line 1789...
1568
 
1789
 
1569
	struct work_struct hotplug_work;
-
 
1570
	struct {
-
 
1571
		unsigned long hpd_last_jiffies;
-
 
1572
		int hpd_cnt;
-
 
1573
		enum {
-
 
1574
			HPD_ENABLED = 0,
-
 
1575
			HPD_DISABLED = 1,
-
 
1576
			HPD_MARK_DISABLED = 2
-
 
1577
		} hpd_mark;
-
 
1578
	} hpd_stats[HPD_NUM_PINS];
-
 
1579
	u32 hpd_event_bits;
-
 
1580
	struct delayed_work hotplug_reenable_work;
-
 
1581
 
1790
	struct i915_hotplug hotplug;
1582
	struct i915_fbc fbc;
1791
	struct i915_fbc fbc;
1583
	struct i915_drrs drrs;
1792
	struct i915_drrs drrs;
1584
	struct intel_opregion opregion;
1793
	struct intel_opregion opregion;
Line 1597... Line 1806...
1597
 
1806
 
1598
	/* protects panel power sequencer state */
1807
	/* protects panel power sequencer state */
Line 1599... Line 1808...
1599
	struct mutex pps_mutex;
1808
	struct mutex pps_mutex;
1600
 
-
 
1601
	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
1809
 
Line 1602... Line 1810...
1602
	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
1810
	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
-
 
1811
	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
-
 
1812
 
1603
	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
1813
	unsigned int fsb_freq, mem_freq, is_ddr3;
1604
 
1814
	unsigned int skl_boot_cdclk;
-
 
1815
	unsigned int cdclk_freq, max_cdclk_freq;
Line 1605... Line 1816...
1605
	unsigned int fsb_freq, mem_freq, is_ddr3;
1816
	unsigned int max_dotclk_freq;
1606
	unsigned int vlv_cdclk_freq;
1817
	unsigned int hpll_freq;
1607
	unsigned int hpll_freq;
1818
	unsigned int czclk_freq;
1608
 
1819
 
Line 1652... Line 1863...
1652
 
1863
 
Line 1653... Line 1864...
1653
	struct i915_workarounds workarounds;
1864
	struct i915_workarounds workarounds;
1654
 
1865
 
1655
	/* Reclocking support */
-
 
1656
	bool render_reclock_avail;
-
 
1657
	bool lvds_downclock_avail;
-
 
Line 1658... Line 1866...
1658
	/* indicates the reduced downclock for LVDS*/
1866
	/* Reclocking support */
Line 1659... Line 1867...
1659
	int lvds_downclock;
1867
	bool render_reclock_avail;
Line 1682... Line 1890...
1682
 
1890
 
Line 1683... Line 1891...
1683
	struct i915_gpu_error gpu_error;
1891
	struct i915_gpu_error gpu_error;
Line 1684... Line 1892...
1684
 
1892
 
1685
	struct drm_i915_gem_object *vlv_pctx;
1893
	struct drm_i915_gem_object *vlv_pctx;
1686
 
1894
 
1687
#ifdef CONFIG_DRM_I915_FBDEV
1895
#ifdef CONFIG_DRM_FBDEV_EMULATION
1688
	/* list of fbdev register on this device */
1896
	/* list of fbdev register on this device */
Line 1689... Line 1897...
1689
    struct intel_fbdev *fbdev;
1897
	struct intel_fbdev *fbdev;
1690
	struct work_struct fbdev_suspend_work;
1898
	struct work_struct fbdev_suspend_work;
Line -... Line 1899...
-
 
1899
#endif
-
 
1900
 
-
 
1901
	struct drm_property *broadcast_rgb_property;
-
 
1902
	struct drm_property *force_audio_property;
-
 
1903
 
-
 
1904
	/* hda/i915 audio component */
-
 
1905
	struct i915_audio_component *audio_component;
-
 
1906
	bool audio_component_registered;
-
 
1907
	/**
1691
#endif
1908
	 * av_mutex - mutex for audio/video sync
1692
 
1909
	 *
Line 1693... Line 1910...
1693
	struct drm_property *broadcast_rgb_property;
1910
	 */
Line -... Line 1911...
-
 
1911
	struct mutex av_mutex;
-
 
1912
 
1694
	struct drm_property *force_audio_property;
1913
	uint32_t hw_context_size;
1695
 
1914
	struct list_head context_list;
1696
	uint32_t hw_context_size;
1915
 
Line 1697... Line 1916...
1697
	struct list_head context_list;
1916
	u32 fdi_rx_config;
Line 1730... Line 1949...
1730
 
1949
 
1731
		/* current hardware state */
1950
		/* current hardware state */
1732
		union {
1951
		union {
1733
		struct ilk_wm_values hw;
1952
			struct ilk_wm_values hw;
-
 
1953
			struct skl_wm_values skl_hw;
1734
			struct skl_wm_values skl_hw;
1954
			struct vlv_wm_values vlv;
-
 
1955
		};
-
 
1956
 
1735
		};
1957
		uint8_t max_level;
Line 1736... Line 1958...
1736
	} wm;
1958
	} wm;
Line 1737... Line -...
1737
 
-
 
1738
	struct i915_runtime_pm pm;
-
 
1739
 
-
 
1740
	struct intel_digital_port *hpd_irq_port[I915_MAX_PORTS];
-
 
1741
	u32 long_hpd_port_mask;
-
 
1742
	u32 short_hpd_port_mask;
-
 
1743
	struct work_struct dig_port_work;
-
 
1744
 
-
 
1745
	/*
-
 
1746
	 * if we get a HPD irq from DP and a HPD irq from non-DP
-
 
1747
	 * the non-DP HPD could block the workqueue on a mode config
-
 
1748
	 * mutex getting, that userspace may have taken. However
-
 
1749
	 * userspace is waiting on the DP workqueue to run which is
-
 
1750
	 * blocked behind the non-DP one.
-
 
1751
	 */
-
 
1752
	struct workqueue_struct *dp_wq;
-
 
1753
 
1959
 
1754
	uint32_t bios_vgacntr;
1960
	struct i915_runtime_pm pm;
1755
 
1961
 
1756
	/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
-
 
1757
	struct {
-
 
1758
		int (*do_execbuf)(struct drm_device *dev, struct drm_file *file,
1962
	/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
1759
				  struct intel_engine_cs *ring,
1963
	struct {
1760
				  struct intel_context *ctx,
-
 
1761
				  struct drm_i915_gem_execbuffer2 *args,
-
 
1762
				  struct list_head *vmas,
1964
		int (*execbuf_submit)(struct i915_execbuffer_params *params,
1763
				  struct drm_i915_gem_object *batch_obj,
1965
				      struct drm_i915_gem_execbuffer2 *args,
1764
				  u64 exec_start, u32 flags);
1966
				      struct list_head *vmas);
1765
		int (*init_rings)(struct drm_device *dev);
1967
		int (*init_rings)(struct drm_device *dev);
Line -... Line 1968...
-
 
1968
		void (*cleanup_ring)(struct intel_engine_cs *ring);
-
 
1969
		void (*stop_ring)(struct intel_engine_cs *ring);
-
 
1970
	} gt;
-
 
1971
 
-
 
1972
	bool edp_low_vswing;
1766
		void (*cleanup_ring)(struct intel_engine_cs *ring);
1973
 
1767
		void (*stop_ring)(struct intel_engine_cs *ring);
1974
	/* perform PHY state sanity checks? */
1768
	} gt;
1975
	bool chv_phy_assert[2];
1769
 
1976
 
1770
	/*
1977
	/*
Line 1776... Line 1983...
1776
static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
1983
static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
1777
{
1984
{
1778
	return dev->dev_private;
1985
	return dev->dev_private;
1779
}
1986
}
Line -... Line 1987...
-
 
1987
 
-
 
1988
static inline struct drm_i915_private *dev_to_i915(struct device *dev)
-
 
1989
{
-
 
1990
	return to_i915(dev_get_drvdata(dev));
-
 
1991
}
-
 
1992
 
-
 
1993
static inline struct drm_i915_private *guc_to_i915(struct intel_guc *guc)
-
 
1994
{
-
 
1995
	return container_of(guc, struct drm_i915_private, guc);
-
 
1996
}
1780
 
1997
 
1781
/* Iterate over initialised rings */
1998
/* Iterate over initialised rings */
1782
#define for_each_ring(ring__, dev_priv__, i__) \
1999
#define for_each_ring(ring__, dev_priv__, i__) \
1783
	for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \
2000
	for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \
Line 1812... Line 2029...
1812
	void (*release)(struct drm_i915_gem_object *);
2029
	void (*release)(struct drm_i915_gem_object *);
1813
};
2030
};
Line 1814... Line 2031...
1814
 
2031
 
1815
/*
2032
/*
1816
 * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
2033
 * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
1817
 * considered to be the frontbuffer for the given plane interface-vise. This
2034
 * considered to be the frontbuffer for the given plane interface-wise. This
1818
 * doesn't mean that the hw necessarily already scans it out, but that any
2035
 * doesn't mean that the hw necessarily already scans it out, but that any
1819
 * rendering (by the cpu or gpu) will land in the frontbuffer eventually.
2036
 * rendering (by the cpu or gpu) will land in the frontbuffer eventually.
1820
 *
2037
 *
1821
 * We have one bit per pipe and per scanout plane type.
2038
 * We have one bit per pipe and per scanout plane type.
-
 
2039
 */
1822
 */
2040
#define INTEL_MAX_SPRITE_BITS_PER_PIPE 5
1823
#define INTEL_FRONTBUFFER_BITS_PER_PIPE 4
2041
#define INTEL_FRONTBUFFER_BITS_PER_PIPE 8
1824
#define INTEL_FRONTBUFFER_BITS \
2042
#define INTEL_FRONTBUFFER_BITS \
1825
	(INTEL_FRONTBUFFER_BITS_PER_PIPE * I915_MAX_PIPES)
2043
	(INTEL_FRONTBUFFER_BITS_PER_PIPE * I915_MAX_PIPES)
1826
#define INTEL_FRONTBUFFER_PRIMARY(pipe) \
2044
#define INTEL_FRONTBUFFER_PRIMARY(pipe) \
1827
	(1 << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
2045
	(1 << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
1828
#define INTEL_FRONTBUFFER_CURSOR(pipe) \
2046
#define INTEL_FRONTBUFFER_CURSOR(pipe) \
1829
	(1 << (1 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
2047
	(1 << (1 + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
1830
#define INTEL_FRONTBUFFER_SPRITE(pipe) \
2048
#define INTEL_FRONTBUFFER_SPRITE(pipe, plane) \
1831
	(1 << (2 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
2049
	(1 << (2 + plane + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
1832
#define INTEL_FRONTBUFFER_OVERLAY(pipe) \
2050
#define INTEL_FRONTBUFFER_OVERLAY(pipe) \
1833
	(1 << (3 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
2051
	(1 << (2 + INTEL_MAX_SPRITE_BITS_PER_PIPE + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
1834
#define INTEL_FRONTBUFFER_ALL_MASK(pipe) \
2052
#define INTEL_FRONTBUFFER_ALL_MASK(pipe) \
Line 1835... Line 2053...
1835
	(0xf << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
2053
	(0xff << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
1836
 
2054
 
Line 1837... Line 2055...
1837
struct drm_i915_gem_object {
2055
struct drm_i915_gem_object {
Line 1844... Line 2062...
1844
 
2062
 
1845
	/** Stolen memory for this object, instead of being backed by shmem. */
2063
	/** Stolen memory for this object, instead of being backed by shmem. */
1846
	struct drm_mm_node *stolen;
2064
	struct drm_mm_node *stolen;
Line 1847... Line 2065...
1847
	struct list_head global_list;
2065
	struct list_head global_list;
1848
 
2066
 
1849
    struct list_head ring_list;
2067
	struct list_head ring_list[I915_NUM_RINGS];
Line -... Line 2068...
-
 
2068
	/** Used in execbuf to temporarily hold a ref */
-
 
2069
	struct list_head obj_exec_link;
1850
	/** Used in execbuf to temporarily hold a ref */
2070
 
1851
	struct list_head obj_exec_link;
2071
	struct list_head batch_pool_link;
1852
 
2072
 
1853
    /**
2073
	/**
1854
	 * This is set if the object is on the active lists (has pending
2074
	 * This is set if the object is on the active lists (has pending
1855
	 * rendering and so a non-zero seqno), and is not set if it i s on
2075
	 * rendering and so a non-zero seqno), and is not set if it i s on
Line 1856... Line 2076...
1856
	 * inactive (ready to be unbound) list.
2076
	 * inactive (ready to be unbound) list.
1857
     */
2077
	 */
1858
	unsigned int active:1;
2078
	unsigned int active:I915_NUM_RINGS;
1859
 
2079
 
Line 1898... Line 2118...
1898
     * Whether the current gtt mapping needs to be mappable (and isn't just
2118
	 * Whether the current gtt mapping needs to be mappable (and isn't just
1899
     * mappable by accident). Track pin and fault separate for a more
2119
	 * mappable by accident). Track pin and fault separate for a more
1900
     * accurate mappable working set.
2120
	 * accurate mappable working set.
1901
     */
2121
	 */
1902
	unsigned int fault_mappable:1;
2122
	unsigned int fault_mappable:1;
1903
	unsigned int pin_mappable:1;
-
 
1904
	unsigned int pin_display:1;
-
 
Line 1905... Line 2123...
1905
 
2123
 
1906
    /*
2124
	/*
1907
	 * Is the object to be mapped as read-only to the GPU
2125
	 * Is the object to be mapped as read-only to the GPU
1908
	 * Only honoured if hardware has relevant pte bit
2126
	 * Only honoured if hardware has relevant pte bit
1909
	 */
2127
	 */
1910
	unsigned long gt_ro:1;
2128
	unsigned long gt_ro:1;
1911
	unsigned int cache_level:3;
-
 
1912
 
2129
	unsigned int cache_level:3;
Line 1913... Line 2130...
1913
	unsigned int has_dma_mapping:1;
2130
	unsigned int cache_dirty:1;
Line -... Line 2131...
-
 
2131
 
-
 
2132
	unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS;
1914
 
2133
 
1915
	unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS;
2134
	unsigned int pin_display;
-
 
2135
 
-
 
2136
	struct sg_table *pages;
-
 
2137
	int pages_pin_count;
-
 
2138
	struct get_page {
Line 1916... Line 2139...
1916
 
2139
		struct scatterlist *sg;
1917
	struct sg_table *pages;
2140
		int last;
1918
	int pages_pin_count;
2141
	} get_page;
Line 1919... Line 2142...
1919
 
2142
 
1920
	/* prime dma-buf support */
-
 
-
 
2143
	/* prime dma-buf support */
-
 
2144
	void *dma_buf_vmapping;
-
 
2145
	int vmapping_count;
1921
	void *dma_buf_vmapping;
2146
 
-
 
2147
	/** Breadcrumb of last rendering to the buffer.
-
 
2148
	 * There can only be one writer, but we allow for multiple readers.
-
 
2149
	 * If there is a writer that necessarily implies that all other
-
 
2150
	 * read requests are complete - but we may only be lazily clearing
-
 
2151
	 * the read requests. A read request is naturally the most recent
1922
	int vmapping_count;
2152
	 * request on a ring, so we may have two different write and read
1923
 
2153
	 * requests on one ring where the write request is older than the
1924
	struct intel_engine_cs *ring;
2154
	 * read request. This allows for the CPU to read from an active
1925
 
2155
	 * buffer by only waiting for the write to complete.
Line 1926... Line 2156...
1926
    /** Breadcrumb of last rendering to the buffer. */
2156
	 * */
1927
	uint32_t last_read_seqno;
2157
	struct drm_i915_gem_request *last_read_req[I915_NUM_RINGS];
Line 1928... Line 2158...
1928
	uint32_t last_write_seqno;
2158
	struct drm_i915_gem_request *last_write_req;
1929
    /** Breadcrumb of last fenced GPU access to the buffer. */
2159
	/** Breadcrumb of last fenced GPU access to the buffer. */
Line 1930... Line 2160...
1930
    uint32_t last_fenced_seqno;
2160
	struct drm_i915_gem_request *last_fenced_req;
1931
 
2161
 
Line 1932... Line -...
1932
    /** Current tiling stride for the object, if it's tiled. */
-
 
1933
    uint32_t stride;
-
 
1934
 
-
 
1935
	/** References from framebuffers, locks out tiling changes. */
-
 
1936
	unsigned long framebuffer_references;
2162
	/** Current tiling stride for the object, if it's tiled. */
1937
 
2163
	uint32_t stride;
1938
    /** Record of address bit 17 of each page at last unbind. */
2164
 
Line 1939... Line 2165...
1939
    unsigned long *bit_17;
2165
	/** References from framebuffers, locks out tiling changes. */
Line 1968... Line 2194...
1968
 * Request queue structure.
2194
 * Request queue structure.
1969
 *
2195
 *
1970
 * The request queue allows us to note sequence numbers that have been emitted
2196
 * The request queue allows us to note sequence numbers that have been emitted
1971
 * and may be associated with active buffers to be retired.
2197
 * and may be associated with active buffers to be retired.
1972
 *
2198
 *
1973
 * By keeping this list, we can avoid having to do questionable
2199
 * By keeping this list, we can avoid having to do questionable sequence
1974
 * sequence-number comparisons on buffer last_rendering_seqnos, and associate
2200
 * number comparisons on buffer last_read|write_seqno. It also allows an
1975
 * an emission time with seqnos for tracking how far ahead of the GPU we are.
2201
 * emission time to be associated with the request for tracking how far ahead
-
 
2202
 * of the GPU the submission is.
-
 
2203
 *
-
 
2204
 * The requests are reference counted, so upon creation they should have an
-
 
2205
 * initial reference taken using kref_init
1976
 */
2206
 */
1977
struct drm_i915_gem_request {
2207
struct drm_i915_gem_request {
-
 
2208
	struct kref ref;
-
 
2209
 
1978
	/** On Which ring this request was generated */
2210
	/** On Which ring this request was generated */
-
 
2211
	struct drm_i915_private *i915;
1979
	struct intel_engine_cs *ring;
2212
	struct intel_engine_cs *ring;
Line -... Line 2213...
-
 
2213
 
-
 
2214
	 /** GEM sequence number associated with the previous request,
-
 
2215
	  * when the HWS breadcrumb is equal to this the GPU is processing
-
 
2216
	  * this request.
-
 
2217
	  */
-
 
2218
	u32 previous_seqno;
1980
 
2219
 
-
 
2220
	 /** GEM sequence number associated with this request,
-
 
2221
	  * when the HWS breadcrumb is equal or greater than this the GPU
-
 
2222
	  * has finished processing this request.
1981
	/** GEM sequence number associated with this request. */
2223
	  */
Line 1982... Line 2224...
1982
	uint32_t seqno;
2224
	u32 seqno;
1983
 
2225
 
Line -... Line 2226...
-
 
2226
	/** Position in the ringbuffer of the start of the request */
-
 
2227
	u32 head;
-
 
2228
 
-
 
2229
	/**
-
 
2230
	 * Position in the ringbuffer of the start of the postfix.
-
 
2231
	 * This is required to calculate the maximum available ringbuffer
-
 
2232
	 * space without overwriting the postfix.
1984
	/** Position in the ringbuffer of the start of the request */
2233
	 */
1985
	u32 head;
2234
	 u32 postfix;
Line -... Line 2235...
-
 
2235
 
1986
 
2236
	/** Position in the ringbuffer of the end of the whole request */
-
 
2237
	u32 tail;
-
 
2238
 
-
 
2239
	/**
-
 
2240
	 * Context and ring buffer related to this request
-
 
2241
	 * Contexts are refcounted, so when this request is associated with a
-
 
2242
	 * context, we must increment the context's refcount, to guarantee that
-
 
2243
	 * it persists while any request is linked to it. Requests themselves
-
 
2244
	 * are also refcounted, so the request will only be freed when the last
1987
	/** Position in the ringbuffer of the end of the request */
2245
	 * reference to it is dismissed, and the code in
-
 
2246
	 * i915_gem_request_free() will then decrement the refcount on the
Line 1988... Line 2247...
1988
	u32 tail;
2247
	 * context.
-
 
2248
	 */
1989
 
2249
	struct intel_context *ctx;
Line 1990... Line 2250...
1990
	/** Context related to this request */
2250
	struct intel_ringbuffer *ringbuf;
1991
	struct intel_context *ctx;
2251
 
Line 2000... Line 2260...
2000
	struct list_head list;
2260
	struct list_head list;
Line 2001... Line 2261...
2001
 
2261
 
2002
	struct drm_i915_file_private *file_priv;
2262
	struct drm_i915_file_private *file_priv;
2003
	/** file_priv list entry for this request */
2263
	/** file_priv list entry for this request */
2004
	struct list_head client_list;
-
 
Line 2005... Line -...
2005
};
-
 
2006
 
2264
	struct list_head client_list;
2007
struct drm_i915_file_private {
2265
 
Line -... Line 2266...
-
 
2266
	/** process identifier submitting this request */
-
 
2267
	struct pid *pid;
-
 
2268
 
-
 
2269
	/**
-
 
2270
	 * The ELSP only accepts two elements at a time, so we queue
-
 
2271
	 * context/tail pairs on a given queue (ring->execlist_queue) until the
-
 
2272
	 * hardware is available. The queue serves a double purpose: we also use
-
 
2273
	 * it to keep track of the up to 2 contexts currently in the hardware
2008
	struct drm_i915_private *dev_priv;
2274
	 * (usually one in execution and the other queued up by the GPU): We
-
 
2275
	 * only remove elements from the head of the queue when the hardware
2009
	struct drm_file *file;
2276
	 * informs us that an element has been completed.
-
 
2277
	 *
-
 
2278
	 * All accesses to the queue are mediated by a spinlock
2010
 
2279
	 * (ring->execlist_lock).
2011
	struct {
2280
	 */
2012
		spinlock_t lock;
2281
 
-
 
2282
	/** Execlist link in the submission queue.*/
2013
		struct list_head request_list;
2283
	struct list_head execlist_link;
Line 2014... Line -...
2014
		struct delayed_work idle_work;
-
 
2015
	} mm;
-
 
2016
	struct idr context_idr;
2284
 
Line -... Line 2285...
-
 
2285
	/** Execlists no. of times this request has been sent to the ELSP */
-
 
2286
	int elsp_submitted;
-
 
2287
 
-
 
2288
};
-
 
2289
 
-
 
2290
int i915_gem_request_alloc(struct intel_engine_cs *ring,
-
 
2291
			   struct intel_context *ctx,
-
 
2292
			   struct drm_i915_gem_request **req_out);
-
 
2293
void i915_gem_request_cancel(struct drm_i915_gem_request *req);
-
 
2294
void i915_gem_request_free(struct kref *req_ref);
-
 
2295
int i915_gem_request_add_to_client(struct drm_i915_gem_request *req,
-
 
2296
				   struct drm_file *file);
-
 
2297
 
-
 
2298
static inline uint32_t
-
 
2299
i915_gem_request_get_seqno(struct drm_i915_gem_request *req)
-
 
2300
{
-
 
2301
	return req ? req->seqno : 0;
-
 
2302
}
-
 
2303
 
-
 
2304
static inline struct intel_engine_cs *
-
 
2305
i915_gem_request_get_ring(struct drm_i915_gem_request *req)
-
 
2306
{
-
 
2307
	return req ? req->ring : NULL;
-
 
2308
}
-
 
2309
 
-
 
2310
static inline struct drm_i915_gem_request *
-
 
2311
i915_gem_request_reference(struct drm_i915_gem_request *req)
-
 
2312
{
-
 
2313
	if (req)
-
 
2314
		kref_get(&req->ref);
-
 
2315
	return req;
-
 
2316
}
-
 
2317
 
-
 
2318
static inline void
-
 
2319
i915_gem_request_unreference(struct drm_i915_gem_request *req)
-
 
2320
{
-
 
2321
	WARN_ON(!mutex_is_locked(&req->ring->dev->struct_mutex));
-
 
2322
	kref_put(&req->ref, i915_gem_request_free);
-
 
2323
}
-
 
2324
 
-
 
2325
static inline void
-
 
2326
i915_gem_request_unreference__unlocked(struct drm_i915_gem_request *req)
-
 
2327
{
-
 
2328
	struct drm_device *dev;
-
 
2329
 
-
 
2330
	if (!req)
-
 
2331
		return;
-
 
2332
 
-
 
2333
	dev = req->ring->dev;
-
 
2334
	if (kref_put_mutex(&req->ref, i915_gem_request_free, &dev->struct_mutex))
-
 
2335
		mutex_unlock(&dev->struct_mutex);
-
 
2336
}
-
 
2337
 
-
 
2338
static inline void i915_gem_request_assign(struct drm_i915_gem_request **pdst,
-
 
2339
					   struct drm_i915_gem_request *src)
-
 
2340
{
-
 
2341
	if (src)
-
 
2342
		i915_gem_request_reference(src);
-
 
2343
 
-
 
2344
	if (*pdst)
-
 
2345
		i915_gem_request_unreference(*pdst);
-
 
2346
 
-
 
2347
	*pdst = src;
-
 
2348
}
-
 
2349
 
-
 
2350
/*
2017
 
2351
 * XXX: i915_gem_request_completed should be here but currently needs the
2018
	atomic_t rps_wait_boost;
2352
 * definition of i915_seqno_passed() which is below. It will be moved in
2019
	struct  intel_engine_cs *bsd_ring;
2353
 * a later patch when the call to i915_seqno_passed() is obsoleted...
2020
};
2354
 */
2021
 
2355
 
Line 2069... Line 2403...
2069
 
2403
 
2070
	/*
2404
	/*
2071
	 * Describes where to find a register address in the command to check
2405
	 * Describes where to find a register address in the command to check
2072
	 * against the ring's register whitelist. Only valid if flags has the
2406
	 * against the ring's register whitelist. Only valid if flags has the
-
 
2407
	 * CMD_DESC_REGISTER bit set.
-
 
2408
	 *
-
 
2409
	 * A non-zero step value implies that the command may access multiple
-
 
2410
	 * registers in sequence (e.g. LRI), in that case step gives the
2073
	 * CMD_DESC_REGISTER bit set.
2411
	 * distance in dwords between individual offset fields.
2074
	 */
2412
	 */
2075
	struct {
2413
	struct {
2076
		u32 offset;
2414
		u32 offset;
-
 
2415
		u32 mask;
2077
		u32 mask;
2416
		u32 step;
Line 2078... Line 2417...
2078
	} reg;
2417
	} reg;
2079
 
2418
 
2080
#define MAX_CMD_DESC_BITMASKS 3
2419
#define MAX_CMD_DESC_BITMASKS 3
Line 2120... Line 2459...
2120
		BUILD_BUG(); \
2459
		BUILD_BUG(); \
2121
	__p; \
2460
	__p; \
2122
})
2461
})
2123
#define INTEL_INFO(p) 	(&__I915__(p)->info)
2462
#define INTEL_INFO(p) 	(&__I915__(p)->info)
2124
#define INTEL_DEVID(p)	(INTEL_INFO(p)->device_id)
2463
#define INTEL_DEVID(p)	(INTEL_INFO(p)->device_id)
-
 
2464
#define INTEL_REVID(p)	(__I915__(p)->dev->pdev->revision)
Line 2125... Line 2465...
2125
 
2465
 
2126
#define IS_I830(dev)		(INTEL_DEVID(dev) == 0x3577)
2466
#define IS_I830(dev)		(INTEL_DEVID(dev) == 0x3577)
2127
#define IS_845G(dev)		(INTEL_DEVID(dev) == 0x2562)
2467
#define IS_845G(dev)		(INTEL_DEVID(dev) == 0x2562)
2128
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
2468
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
Line 2142... Line 2482...
2142
#define IS_IRONLAKE_M(dev)	(INTEL_DEVID(dev) == 0x0046)
2482
#define IS_IRONLAKE_M(dev)	(INTEL_DEVID(dev) == 0x0046)
2143
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
2483
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
2144
#define IS_IVB_GT1(dev)		(INTEL_DEVID(dev) == 0x0156 || \
2484
#define IS_IVB_GT1(dev)		(INTEL_DEVID(dev) == 0x0156 || \
2145
				 INTEL_DEVID(dev) == 0x0152 || \
2485
				 INTEL_DEVID(dev) == 0x0152 || \
2146
				 INTEL_DEVID(dev) == 0x015a)
2486
				 INTEL_DEVID(dev) == 0x015a)
2147
#define IS_SNB_GT1(dev)		(INTEL_DEVID(dev) == 0x0102 || \
-
 
2148
				 INTEL_DEVID(dev) == 0x0106 || \
-
 
2149
				 INTEL_DEVID(dev) == 0x010A)
-
 
2150
#define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
2487
#define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
2151
#define IS_CHERRYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
2488
#define IS_CHERRYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
2152
#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
2489
#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
2153
#define IS_BROADWELL(dev)	(!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
2490
#define IS_BROADWELL(dev)	(!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
2154
#define IS_SKYLAKE(dev)	(INTEL_INFO(dev)->is_skylake)
2491
#define IS_SKYLAKE(dev)	(INTEL_INFO(dev)->is_skylake)
-
 
2492
#define IS_BROXTON(dev)	(!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev))
2155
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
2493
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
2156
#define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
2494
#define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
2157
				 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
2495
				 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
2158
#define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
2496
#define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
2159
				 ((INTEL_DEVID(dev) & 0xf) == 0x2  || \
2497
				 ((INTEL_DEVID(dev) & 0xf) == 0x6 ||	\
2160
				 (INTEL_DEVID(dev) & 0xf) == 0x6 || \
2498
				 (INTEL_DEVID(dev) & 0xf) == 0xb ||	\
2161
				 (INTEL_DEVID(dev) & 0xf) == 0xe))
2499
				 (INTEL_DEVID(dev) & 0xf) == 0xe))
-
 
2500
/* ULX machines are also considered ULT. */
-
 
2501
#define IS_BDW_ULX(dev)		(IS_BROADWELL(dev) && \
-
 
2502
				 (INTEL_DEVID(dev) & 0xf) == 0xe)
2162
#define IS_BDW_GT3(dev)		(IS_BROADWELL(dev) && \
2503
#define IS_BDW_GT3(dev)		(IS_BROADWELL(dev) && \
2163
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
2504
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
2164
#define IS_HSW_ULT(dev)		(IS_HASWELL(dev) && \
2505
#define IS_HSW_ULT(dev)		(IS_HASWELL(dev) && \
2165
				 (INTEL_DEVID(dev) & 0xFF00) == 0x0A00)
2506
				 (INTEL_DEVID(dev) & 0xFF00) == 0x0A00)
2166
#define IS_HSW_GT3(dev)		(IS_HASWELL(dev) && \
2507
#define IS_HSW_GT3(dev)		(IS_HASWELL(dev) && \
2167
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
2508
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
2168
/* ULX machines are also considered ULT. */
2509
/* ULX machines are also considered ULT. */
2169
#define IS_HSW_ULX(dev)		(INTEL_DEVID(dev) == 0x0A0E || \
2510
#define IS_HSW_ULX(dev)		(INTEL_DEVID(dev) == 0x0A0E || \
2170
				 INTEL_DEVID(dev) == 0x0A1E)
2511
				 INTEL_DEVID(dev) == 0x0A1E)
-
 
2512
#define IS_SKL_ULT(dev)		(INTEL_DEVID(dev) == 0x1906 || \
-
 
2513
				 INTEL_DEVID(dev) == 0x1913 || \
-
 
2514
				 INTEL_DEVID(dev) == 0x1916 || \
-
 
2515
				 INTEL_DEVID(dev) == 0x1921 || \
-
 
2516
				 INTEL_DEVID(dev) == 0x1926)
-
 
2517
#define IS_SKL_ULX(dev)		(INTEL_DEVID(dev) == 0x190E || \
-
 
2518
				 INTEL_DEVID(dev) == 0x1915 || \
-
 
2519
				 INTEL_DEVID(dev) == 0x191E)
-
 
2520
#define IS_SKL_GT3(dev)		(IS_SKYLAKE(dev) && \
-
 
2521
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
-
 
2522
#define IS_SKL_GT4(dev)		(IS_SKYLAKE(dev) && \
-
 
2523
				 (INTEL_DEVID(dev) & 0x00F0) == 0x0030)
-
 
2524
 
2171
#define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
2525
#define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
Line -... Line 2526...
-
 
2526
 
-
 
2527
#define SKL_REVID_A0		(0x0)
-
 
2528
#define SKL_REVID_B0		(0x1)
-
 
2529
#define SKL_REVID_C0		(0x2)
-
 
2530
#define SKL_REVID_D0		(0x3)
-
 
2531
#define SKL_REVID_E0		(0x4)
-
 
2532
#define SKL_REVID_F0		(0x5)
-
 
2533
 
-
 
2534
#define BXT_REVID_A0		(0x0)
-
 
2535
#define BXT_REVID_B0		(0x3)
-
 
2536
#define BXT_REVID_C0		(0x9)
2172
 
2537
 
2173
/*
2538
/*
2174
 * The genX designation typically refers to the render engine, so render
2539
 * The genX designation typically refers to the render engine, so render
2175
 * capability related checks should use IS_GEN, while display and other checks
2540
 * capability related checks should use IS_GEN, while display and other checks
2176
 * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
2541
 * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
Line 2200... Line 2565...
2200
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
2565
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
Line 2201... Line 2566...
2201
 
2566
 
2202
#define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
2567
#define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
2203
#define HAS_LOGICAL_RING_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 8)
2568
#define HAS_LOGICAL_RING_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 8)
2204
#define USES_PPGTT(dev)		(i915.enable_ppgtt)
2569
#define USES_PPGTT(dev)		(i915.enable_ppgtt)
-
 
2570
#define USES_FULL_PPGTT(dev)	(i915.enable_ppgtt >= 2)
Line 2205... Line 2571...
2205
#define USES_FULL_PPGTT(dev)	(i915.enable_ppgtt == 2)
2571
#define USES_FULL_48BIT_PPGTT(dev)	(i915.enable_ppgtt == 3)
2206
 
2572
 
Line 2207... Line 2573...
2207
#define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
2573
#define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
Line 2221... Line 2587...
2221
/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
2587
/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
2222
 * rows, which changed the alignment requirements and fence programming.
2588
 * rows, which changed the alignment requirements and fence programming.
2223
 */
2589
 */
2224
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
2590
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
2225
						      IS_I915GM(dev)))
2591
						      IS_I915GM(dev)))
2226
#define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
-
 
2227
#define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
-
 
2228
#define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
-
 
2229
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
2592
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
2230
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
2593
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
Line 2231... Line 2594...
2231
 
2594
 
2232
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
2595
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
2233
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
2596
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
Line 2234... Line 2597...
2234
#define HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
2597
#define HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
Line -... Line 2598...
-
 
2598
 
-
 
2599
#define HAS_IPS(dev)		(IS_HSW_ULT(dev) || IS_BROADWELL(dev))
-
 
2600
 
2235
 
2601
#define HAS_DP_MST(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev) || \
2236
#define HAS_IPS(dev)		(IS_HSW_ULT(dev) || IS_BROADWELL(dev))
2602
				 INTEL_INFO(dev)->gen >= 9)
2237
 
2603
 
-
 
2604
#define HAS_DDI(dev)		(INTEL_INFO(dev)->has_ddi)
-
 
2605
#define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
2238
#define HAS_DDI(dev)		(INTEL_INFO(dev)->has_ddi)
2606
#define HAS_PSR(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev) || \
2239
#define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
2607
				 IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev) || \
-
 
2608
				 IS_SKYLAKE(dev))
2240
#define HAS_PSR(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev))
2609
#define HAS_RUNTIME_PM(dev)	(IS_GEN6(dev) || IS_HASWELL(dev) || \
2241
#define HAS_RUNTIME_PM(dev)	(IS_GEN6(dev) || IS_HASWELL(dev) || \
2610
				 IS_BROADWELL(dev) || IS_VALLEYVIEW(dev) || \
Line -... Line 2611...
-
 
2611
				 IS_SKYLAKE(dev))
-
 
2612
#define HAS_RC6(dev)		(INTEL_INFO(dev)->gen >= 6)
-
 
2613
#define HAS_RC6p(dev)		(INTEL_INFO(dev)->gen == 6 || IS_IVYBRIDGE(dev))
-
 
2614
 
-
 
2615
#define HAS_CSR(dev)	(IS_GEN9(dev))
-
 
2616
 
-
 
2617
#define HAS_GUC_UCODE(dev)	(IS_GEN9(dev))
-
 
2618
#define HAS_GUC_SCHED(dev)	(IS_GEN9(dev))
-
 
2619
 
-
 
2620
#define HAS_RESOURCE_STREAMER(dev) (IS_HASWELL(dev) || \
-
 
2621
				    INTEL_INFO(dev)->gen >= 8)
2242
				 IS_BROADWELL(dev) || IS_VALLEYVIEW(dev))
2622
 
2243
#define HAS_RC6(dev)		(INTEL_INFO(dev)->gen >= 6)
2623
#define HAS_CORE_RING_FREQ(dev)	(INTEL_INFO(dev)->gen >= 6 && \
2244
#define HAS_RC6p(dev)		(INTEL_INFO(dev)->gen == 6 || IS_IVYBRIDGE(dev))
2624
				 !IS_VALLEYVIEW(dev) && !IS_BROXTON(dev))
2245
 
2625
 
2246
#define INTEL_PCH_DEVICE_ID_MASK		0xff00
2626
#define INTEL_PCH_DEVICE_ID_MASK		0xff00
2247
#define INTEL_PCH_IBX_DEVICE_ID_TYPE		0x3b00
2627
#define INTEL_PCH_IBX_DEVICE_ID_TYPE		0x3b00
2248
#define INTEL_PCH_CPT_DEVICE_ID_TYPE		0x1c00
2628
#define INTEL_PCH_CPT_DEVICE_ID_TYPE		0x1c00
2249
#define INTEL_PCH_PPT_DEVICE_ID_TYPE		0x1e00
2629
#define INTEL_PCH_PPT_DEVICE_ID_TYPE		0x1e00
-
 
2630
#define INTEL_PCH_LPT_DEVICE_ID_TYPE		0x8c00
Line 2250... Line 2631...
2250
#define INTEL_PCH_LPT_DEVICE_ID_TYPE		0x8c00
2631
#define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
2251
#define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE		0x9c00
2632
#define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
2252
#define INTEL_PCH_SPT_DEVICE_ID_TYPE		0xA100
2633
#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
-
 
2634
#define INTEL_PCH_P2X_DEVICE_ID_TYPE		0x7100
2253
#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE		0x9D00
2635
 
2254
 
2636
#define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
2255
#define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
2637
#define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
2256
#define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
2638
#define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
Line 2265... Line 2647...
2265
/* DPF == dynamic parity feature */
2647
/* DPF == dynamic parity feature */
2266
#define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
2648
#define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
2267
#define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
2649
#define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
Line 2268... Line 2650...
2268
 
2650
 
-
 
2651
#define GT_FREQUENCY_MULTIPLIER 50
Line 2269... Line 2652...
2269
#define GT_FREQUENCY_MULTIPLIER 50
2652
#define GEN9_FREQ_SCALER 3
Line -... Line 2653...
-
 
2653
 
-
 
2654
#include "i915_trace.h"
Line 2270... Line 2655...
2270
 
2655
 
2271
#include "i915_trace.h"
-
 
Line 2272... Line 2656...
2272
 
2656
extern const struct drm_ioctl_desc i915_ioctls[];
2273
 
2657
extern int i915_max_ioctl;
2274
extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
2658
 
2275
extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
2659
extern int i915_resume_switcheroo(struct drm_device *dev);
2276
 
-
 
2277
/* i915_params.c */
2660
 
2278
struct i915_params {
-
 
2279
	int modeset;
2661
/* i915_params.c */
2280
	int panel_ignore_lid;
2662
struct i915_params {
2281
	unsigned int powersave;
2663
	int modeset;
2282
	int semaphores;
2664
	int panel_ignore_lid;
2283
	unsigned int lvds_downclock;
2665
	int semaphores;
Line 2296... Line 2678...
2296
	int enable_cmd_parser;
2678
	int enable_cmd_parser;
2297
	/* leave bools at the end to not create holes */
2679
	/* leave bools at the end to not create holes */
2298
	bool enable_hangcheck;
2680
	bool enable_hangcheck;
2299
	bool fastboot;
2681
	bool fastboot;
2300
	bool prefault_disable;
2682
	bool prefault_disable;
-
 
2683
	bool load_detect_test;
2301
	bool reset;
2684
	bool reset;
2302
	bool disable_display;
2685
	bool disable_display;
2303
	bool disable_vtd_wa;
2686
	bool disable_vtd_wa;
-
 
2687
	bool enable_guc_submission;
-
 
2688
	int guc_log_level;
2304
	int use_mmio_flip;
2689
	int use_mmio_flip;
2305
	bool mmio_debug;
2690
	int mmio_debug;
-
 
2691
	bool verbose_state_checks;
-
 
2692
	bool nuclear_pageflip;
-
 
2693
	int edp_vswing;
2306
};
2694
};
2307
extern struct i915_params i915 __read_mostly;
2695
extern struct i915_params i915 __read_mostly;
Line 2308... Line 2696...
2308
 
2696
 
2309
				/* i915_dma.c */
2697
				/* i915_dma.c */
Line 2313... Line 2701...
2313
extern void i915_driver_lastclose(struct drm_device * dev);
2701
extern void i915_driver_lastclose(struct drm_device * dev);
2314
extern void i915_driver_preclose(struct drm_device *dev,
2702
extern void i915_driver_preclose(struct drm_device *dev,
2315
				 struct drm_file *file);
2703
				 struct drm_file *file);
2316
extern void i915_driver_postclose(struct drm_device *dev,
2704
extern void i915_driver_postclose(struct drm_device *dev,
2317
				  struct drm_file *file);
2705
				  struct drm_file *file);
2318
extern int i915_driver_device_is_agp(struct drm_device * dev);
-
 
2319
#ifdef CONFIG_COMPAT
2706
#ifdef CONFIG_COMPAT
2320
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
2707
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
2321
			      unsigned long arg);
2708
			      unsigned long arg);
2322
#endif
2709
#endif
2323
extern int intel_gpu_reset(struct drm_device *dev);
2710
extern int intel_gpu_reset(struct drm_device *dev);
-
 
2711
extern bool intel_has_gpu_reset(struct drm_device *dev);
2324
extern int i915_reset(struct drm_device *dev);
2712
extern int i915_reset(struct drm_device *dev);
2325
extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
2713
extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
2326
extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
2714
extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
2327
extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
2715
extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
2328
extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
2716
extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
2329
int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on);
2717
int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on);
-
 
2718
void i915_firmware_load_error_print(const char *fw_path, int err);
-
 
2719
 
-
 
2720
/* intel_hotplug.c */
-
 
2721
void intel_hpd_irq_handler(struct drm_device *dev, u32 pin_mask, u32 long_mask);
-
 
2722
void intel_hpd_init(struct drm_i915_private *dev_priv);
-
 
2723
void intel_hpd_init_work(struct drm_i915_private *dev_priv);
2330
void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
2724
void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
-
 
2725
bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port);
Line 2331... Line 2726...
2331
 
2726
 
2332
/* i915_irq.c */
2727
/* i915_irq.c */
2333
void i915_queue_hangcheck(struct drm_device *dev);
2728
void i915_queue_hangcheck(struct drm_device *dev);
2334
__printf(3, 4)
2729
__printf(3, 4)
2335
void i915_handle_error(struct drm_device *dev, bool wedged,
2730
void i915_handle_error(struct drm_device *dev, bool wedged,
Line 2336... Line 2731...
2336
		       const char *fmt, ...);
2731
		       const char *fmt, ...);
2337
 
-
 
2338
extern void intel_irq_init(struct drm_i915_private *dev_priv);
2732
 
2339
extern void intel_hpd_init(struct drm_i915_private *dev_priv);
2733
extern void intel_irq_init(struct drm_i915_private *dev_priv);
Line 2340... Line 2734...
2340
int intel_irq_install(struct drm_i915_private *dev_priv);
2734
int intel_irq_install(struct drm_i915_private *dev_priv);
2341
void intel_irq_uninstall(struct drm_i915_private *dev_priv);
2735
void intel_irq_uninstall(struct drm_i915_private *dev_priv);
2342
 
2736
 
2343
extern void intel_uncore_sanitize(struct drm_device *dev);
2737
extern void intel_uncore_sanitize(struct drm_device *dev);
2344
extern void intel_uncore_early_sanitize(struct drm_device *dev,
2738
extern void intel_uncore_early_sanitize(struct drm_device *dev,
2345
					bool restore_forcewake);
2739
					bool restore_forcewake);
2346
extern void intel_uncore_init(struct drm_device *dev);
2740
extern void intel_uncore_init(struct drm_device *dev);
-
 
2741
extern void intel_uncore_check_errors(struct drm_device *dev);
-
 
2742
extern void intel_uncore_fini(struct drm_device *dev);
-
 
2743
extern void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore);
-
 
2744
const char *intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id);
-
 
2745
void intel_uncore_forcewake_get(struct drm_i915_private *dev_priv,
-
 
2746
				enum forcewake_domains domains);
-
 
2747
void intel_uncore_forcewake_put(struct drm_i915_private *dev_priv,
-
 
2748
				enum forcewake_domains domains);
-
 
2749
/* Like above but the caller must manage the uncore.lock itself.
-
 
2750
 * Must be used with I915_READ_FW and friends.
-
 
2751
 */
-
 
2752
void intel_uncore_forcewake_get__locked(struct drm_i915_private *dev_priv,
-
 
2753
					enum forcewake_domains domains);
-
 
2754
void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv,
-
 
2755
					enum forcewake_domains domains);
-
 
2756
void assert_forcewakes_inactive(struct drm_i915_private *dev_priv);
-
 
2757
static inline bool intel_vgpu_active(struct drm_device *dev)
Line 2347... Line 2758...
2347
extern void intel_uncore_check_errors(struct drm_device *dev);
2758
{
2348
extern void intel_uncore_fini(struct drm_device *dev);
2759
	return to_i915(dev)->vgpu.active;
2349
extern void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore);
2760
}
Line 2356... Line 2767...
2356
i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
2767
i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
2357
		      u32 status_mask);
2768
		      u32 status_mask);
Line 2358... Line 2769...
2358
 
2769
 
2359
void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv);
2770
void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv);
-
 
2771
void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv);
-
 
2772
void i915_hotplug_interrupt_update(struct drm_i915_private *dev_priv,
-
 
2773
				   uint32_t mask,
2360
void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv);
2774
				   uint32_t bits);
2361
void
2775
void
2362
ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask);
2776
ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask);
2363
void
2777
void
2364
ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask);
2778
ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask);
Line 2384... Line 2798...
2384
int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
2798
int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
2385
			      struct drm_file *file_priv);
2799
			      struct drm_file *file_priv);
2386
int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
2800
int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
2387
			     struct drm_file *file_priv);
2801
			     struct drm_file *file_priv);
2388
void i915_gem_execbuffer_move_to_active(struct list_head *vmas,
2802
void i915_gem_execbuffer_move_to_active(struct list_head *vmas,
2389
					struct intel_engine_cs *ring);
2803
					struct drm_i915_gem_request *req);
2390
void i915_gem_execbuffer_retire_commands(struct drm_device *dev,
2804
void i915_gem_execbuffer_retire_commands(struct i915_execbuffer_params *params);
2391
					 struct drm_file *file,
-
 
2392
					 struct intel_engine_cs *ring,
-
 
2393
					 struct drm_i915_gem_object *obj);
-
 
2394
int i915_gem_ringbuffer_submission(struct drm_device *dev,
2805
int i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,
2395
				   struct drm_file *file,
-
 
2396
				   struct intel_engine_cs *ring,
-
 
2397
				   struct intel_context *ctx,
-
 
2398
				   struct drm_i915_gem_execbuffer2 *args,
2806
				   struct drm_i915_gem_execbuffer2 *args,
2399
				   struct list_head *vmas,
2807
				   struct list_head *vmas);
2400
				   struct drm_i915_gem_object *batch_obj,
-
 
2401
				   u64 exec_start, u32 flags);
-
 
2402
int i915_gem_execbuffer(struct drm_device *dev, void *data,
2808
int i915_gem_execbuffer(struct drm_device *dev, void *data,
2403
			struct drm_file *file_priv);
2809
			struct drm_file *file_priv);
2404
int i915_gem_execbuffer2(struct drm_device *dev, void *data,
2810
int i915_gem_execbuffer2(struct drm_device *dev, void *data,
2405
			 struct drm_file *file_priv);
2811
			 struct drm_file *file_priv);
2406
int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
-
 
2407
		       struct drm_file *file_priv);
-
 
2408
int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
-
 
2409
			 struct drm_file *file_priv);
-
 
2410
int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
2812
int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
2411
			struct drm_file *file_priv);
2813
			struct drm_file *file_priv);
2412
int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data,
2814
int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data,
2413
			       struct drm_file *file);
2815
			       struct drm_file *file);
2414
int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
2816
int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
Line 2427... Line 2829...
2427
int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
2829
int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
2428
				struct drm_file *file_priv);
2830
				struct drm_file *file_priv);
2429
int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
2831
int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
2430
			struct drm_file *file_priv);
2832
			struct drm_file *file_priv);
2431
void i915_gem_load(struct drm_device *dev);
2833
void i915_gem_load(struct drm_device *dev);
2432
unsigned long i915_gem_shrink(struct drm_i915_private *dev_priv,
-
 
2433
			      long target,
-
 
2434
			      unsigned flags);
-
 
2435
#define I915_SHRINK_PURGEABLE 0x1
-
 
2436
#define I915_SHRINK_UNBOUND 0x2
-
 
2437
#define I915_SHRINK_BOUND 0x4
-
 
2438
void *i915_gem_object_alloc(struct drm_device *dev);
2834
void *i915_gem_object_alloc(struct drm_device *dev);
2439
void i915_gem_object_free(struct drm_i915_gem_object *obj);
2835
void i915_gem_object_free(struct drm_i915_gem_object *obj);
2440
void i915_gem_object_init(struct drm_i915_gem_object *obj,
2836
void i915_gem_object_init(struct drm_i915_gem_object *obj,
2441
			 const struct drm_i915_gem_object_ops *ops);
2837
			 const struct drm_i915_gem_object_ops *ops);
2442
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
2838
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
2443
						  size_t size);
2839
						  size_t size);
2444
void i915_init_vm(struct drm_i915_private *dev_priv,
2840
struct drm_i915_gem_object *i915_gem_object_create_from_data(
2445
		  struct i915_address_space *vm);
2841
		struct drm_device *dev, const void *data, size_t size);
2446
void i915_gem_free_object(struct drm_gem_object *obj);
2842
void i915_gem_free_object(struct drm_gem_object *obj);
2447
void i915_gem_vma_destroy(struct i915_vma *vma);
2843
void i915_gem_vma_destroy(struct i915_vma *vma);
Line -... Line 2844...
-
 
2844
 
2448
 
2845
/* Flags used by pin/bind&friends. */
2449
#define PIN_MAPPABLE 0x1
2846
#define PIN_MAPPABLE	(1<<0)
2450
#define PIN_NONBLOCK 0x2
2847
#define PIN_NONBLOCK	(1<<1)
2451
#define PIN_GLOBAL 0x4
2848
#define PIN_GLOBAL	(1<<2)
-
 
2849
#define PIN_OFFSET_BIAS	(1<<3)
-
 
2850
#define PIN_USER	(1<<4)
-
 
2851
#define PIN_UPDATE	(1<<5)
-
 
2852
#define PIN_ZONE_4G	(1<<6)
2452
#define PIN_OFFSET_BIAS 0x8
2853
#define PIN_HIGH	(1<<7)
-
 
2854
#define PIN_OFFSET_MASK (~4095)
2453
#define PIN_OFFSET_MASK (~4095)
2855
int __must_check
2454
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
2856
i915_gem_object_pin(struct drm_i915_gem_object *obj,
2455
				     struct i915_address_space *vm,
2857
		    struct i915_address_space *vm,
2456
				     uint32_t alignment,
2858
		    uint32_t alignment,
-
 
2859
		    uint64_t flags);
-
 
2860
int __must_check
-
 
2861
i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
-
 
2862
			 const struct i915_ggtt_view *view,
-
 
2863
			 uint32_t alignment,
-
 
2864
			 uint64_t flags);
-
 
2865
 
-
 
2866
int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
-
 
2867
		  u32 flags);
2457
				     uint64_t flags);
2868
void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);
-
 
2869
int __must_check i915_vma_unbind(struct i915_vma *vma);
-
 
2870
/*
-
 
2871
 * BEWARE: Do not use the function below unless you can _absolutely_
-
 
2872
 * _guarantee_ VMA in question is _not in use_ anywhere.
-
 
2873
 */
2458
int __must_check i915_vma_unbind(struct i915_vma *vma);
2874
int __must_check __i915_vma_unbind_no_wait(struct i915_vma *vma);
2459
int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
2875
int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
2460
void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
2876
void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
Line 2461... Line 2877...
2461
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
2877
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
2462
 
2878
 
Line 2463... Line 2879...
2463
int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
2879
int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
2464
				    int *needs_clflush);
-
 
2465
 
-
 
2466
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
-
 
Line 2467... Line 2880...
2467
static inline struct page *i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n)
2880
				    int *needs_clflush);
-
 
2881
 
2468
{
2882
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
-
 
2883
 
Line -... Line 2884...
-
 
2884
static inline int __sg_page_count(struct scatterlist *sg)
-
 
2885
{
-
 
2886
	return sg->length >> PAGE_SHIFT;
-
 
2887
}
2469
	struct sg_page_iter sg_iter;
2888
 
-
 
2889
static inline struct page *
-
 
2890
i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n)
-
 
2891
{
-
 
2892
	if (WARN_ON(n >= obj->base.size >> PAGE_SHIFT))
-
 
2893
		return NULL;
-
 
2894
 
-
 
2895
	if (n < obj->get_page.last) {
-
 
2896
		obj->get_page.sg = obj->pages->sgl;
-
 
2897
		obj->get_page.last = 0;
-
 
2898
	}
2470
 
2899
 
-
 
2900
	while (obj->get_page.last + __sg_page_count(obj->get_page.sg) <= n) {
-
 
2901
		obj->get_page.last += __sg_page_count(obj->get_page.sg++);
-
 
2902
		if (unlikely(sg_is_chain(obj->get_page.sg)))
-
 
2903
			obj->get_page.sg = sg_chain_ptr(obj->get_page.sg);
2471
	for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, n)
2904
	}
2472
		return sg_page_iter_page(&sg_iter);
2905
 
2473
 
2906
	return nth_page(sg_page(obj->get_page.sg), n - obj->get_page.last);
2474
	return NULL;
2907
}
2475
}
2908
 
Line 2484... Line 2917...
2484
	obj->pages_pin_count--;
2917
	obj->pages_pin_count--;
2485
}
2918
}
Line 2486... Line 2919...
2486
 
2919
 
2487
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
2920
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
2488
int i915_gem_object_sync(struct drm_i915_gem_object *obj,
2921
int i915_gem_object_sync(struct drm_i915_gem_object *obj,
-
 
2922
			 struct intel_engine_cs *to,
2489
			 struct intel_engine_cs *to);
2923
			 struct drm_i915_gem_request **to_req);
2490
void i915_vma_move_to_active(struct i915_vma *vma,
2924
void i915_vma_move_to_active(struct i915_vma *vma,
2491
			     struct intel_engine_cs *ring);
2925
			     struct drm_i915_gem_request *req);
2492
int i915_gem_dumb_create(struct drm_file *file_priv,
2926
int i915_gem_dumb_create(struct drm_file *file_priv,
2493
			 struct drm_device *dev,
2927
			 struct drm_device *dev,
2494
			 struct drm_mode_create_dumb *args);
2928
			 struct drm_mode_create_dumb *args);
2495
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
2929
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
Line 2501... Line 2935...
2501
i915_seqno_passed(uint32_t seq1, uint32_t seq2)
2935
i915_seqno_passed(uint32_t seq1, uint32_t seq2)
2502
{
2936
{
2503
	return (int32_t)(seq1 - seq2) >= 0;
2937
	return (int32_t)(seq1 - seq2) >= 0;
2504
}
2938
}
Line -... Line 2939...
-
 
2939
 
-
 
2940
static inline bool i915_gem_request_started(struct drm_i915_gem_request *req,
-
 
2941
					   bool lazy_coherency)
-
 
2942
{
-
 
2943
	u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);
-
 
2944
	return i915_seqno_passed(seqno, req->previous_seqno);
-
 
2945
}
-
 
2946
 
-
 
2947
static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req,
-
 
2948
					      bool lazy_coherency)
-
 
2949
{
-
 
2950
	u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);
-
 
2951
	return i915_seqno_passed(seqno, req->seqno);
-
 
2952
}
2505
 
2953
 
2506
int __must_check i915_gem_get_seqno(struct drm_device *dev, u32 *seqno);
2954
int __must_check i915_gem_get_seqno(struct drm_device *dev, u32 *seqno);
2507
int __must_check i915_gem_set_seqno(struct drm_device *dev, u32 seqno);
-
 
2508
int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj);
-
 
2509
int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj);
-
 
2510
 
-
 
2511
bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj);
-
 
Line 2512... Line 2955...
2512
void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj);
2955
int __must_check i915_gem_set_seqno(struct drm_device *dev, u32 seqno);
2513
 
2956
 
Line 2514... Line 2957...
2514
struct drm_i915_gem_request *
2957
struct drm_i915_gem_request *
2515
i915_gem_find_active_request(struct intel_engine_cs *ring);
2958
i915_gem_find_active_request(struct intel_engine_cs *ring);
2516
 
2959
 
2517
bool i915_gem_retire_requests(struct drm_device *dev);
2960
bool i915_gem_retire_requests(struct drm_device *dev);
2518
void i915_gem_retire_requests_ring(struct intel_engine_cs *ring);
-
 
Line 2519... Line 2961...
2519
int __must_check i915_gem_check_wedge(struct i915_gpu_error *error,
2961
void i915_gem_retire_requests_ring(struct intel_engine_cs *ring);
2520
				      bool interruptible);
2962
int __must_check i915_gem_check_wedge(struct i915_gpu_error *error,
2521
int __must_check i915_gem_check_olr(struct intel_engine_cs *ring, u32 seqno);
2963
				      bool interruptible);
2522
 
2964
 
Line 2548... Line 2990...
2548
		dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_WARN;
2990
		dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_WARN;
2549
}
2991
}
Line 2550... Line 2992...
2550
 
2992
 
2551
void i915_gem_reset(struct drm_device *dev);
2993
void i915_gem_reset(struct drm_device *dev);
2552
bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
-
 
2553
int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
2994
bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
2554
int __must_check i915_gem_init(struct drm_device *dev);
2995
int __must_check i915_gem_init(struct drm_device *dev);
2555
int i915_gem_init_rings(struct drm_device *dev);
2996
int i915_gem_init_rings(struct drm_device *dev);
2556
int __must_check i915_gem_init_hw(struct drm_device *dev);
2997
int __must_check i915_gem_init_hw(struct drm_device *dev);
2557
int i915_gem_l3_remap(struct intel_engine_cs *ring, int slice);
2998
int i915_gem_l3_remap(struct drm_i915_gem_request *req, int slice);
2558
void i915_gem_init_swizzling(struct drm_device *dev);
2999
void i915_gem_init_swizzling(struct drm_device *dev);
2559
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
3000
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
2560
int __must_check i915_gpu_idle(struct drm_device *dev);
3001
int __must_check i915_gpu_idle(struct drm_device *dev);
2561
int __must_check i915_gem_suspend(struct drm_device *dev);
3002
int __must_check i915_gem_suspend(struct drm_device *dev);
2562
int __i915_add_request(struct intel_engine_cs *ring,
-
 
2563
				  struct drm_file *file,
3003
void __i915_add_request(struct drm_i915_gem_request *req,
2564
		       struct drm_i915_gem_object *batch_obj,
3004
			struct drm_i915_gem_object *batch_obj,
2565
		     u32 *seqno);
3005
			bool flush_caches);
-
 
3006
#define i915_add_request(req) \
-
 
3007
	__i915_add_request(req, NULL, true)
2566
#define i915_add_request(ring, seqno) \
3008
#define i915_add_request_no_flush(req) \
2567
	__i915_add_request(ring, NULL, NULL, seqno)
3009
	__i915_add_request(req, NULL, false)
2568
int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno,
3010
int __i915_wait_request(struct drm_i915_gem_request *req,
2569
			unsigned reset_counter,
3011
			unsigned reset_counter,
2570
			bool interruptible,
3012
			bool interruptible,
2571
			s64 *timeout,
3013
			s64 *timeout,
2572
			struct drm_i915_file_private *file_priv);
3014
			struct intel_rps_client *rps);
2573
int __must_check i915_wait_seqno(struct intel_engine_cs *ring,
-
 
2574
				   uint32_t seqno);
3015
int __must_check i915_wait_request(struct drm_i915_gem_request *req);
2575
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
3016
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
-
 
3017
int __must_check
-
 
3018
i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj,
-
 
3019
			       bool readonly);
2576
int __must_check
3020
int __must_check
2577
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj,
3021
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj,
2578
				  bool write);
3022
				  bool write);
2579
int __must_check
3023
int __must_check
2580
i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write);
3024
i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write);
2581
int __must_check
3025
int __must_check
2582
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
3026
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
2583
				     u32 alignment,
3027
				     u32 alignment,
-
 
3028
				     struct intel_engine_cs *pipelined,
-
 
3029
				     struct drm_i915_gem_request **pipelined_request,
2584
				     struct intel_engine_cs *pipelined);
3030
				     const struct i915_ggtt_view *view);
-
 
3031
void i915_gem_object_unpin_from_display_plane(struct drm_i915_gem_object *obj,
2585
void i915_gem_object_unpin_from_display_plane(struct drm_i915_gem_object *obj);
3032
					      const struct i915_ggtt_view *view);
2586
int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj,
3033
int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj,
2587
				int align);
3034
				int align);
2588
int i915_gem_open(struct drm_device *dev, struct drm_file *file);
3035
int i915_gem_open(struct drm_device *dev, struct drm_file *file);
Line 2601... Line 3048...
2601
				struct dma_buf *dma_buf);
3048
				struct dma_buf *dma_buf);
Line 2602... Line 3049...
2602
 
3049
 
2603
struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
3050
struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
Line 2604... Line 3051...
2604
				struct drm_gem_object *gem_obj, int flags);
3051
				struct drm_gem_object *gem_obj, int flags);
2605
 
-
 
-
 
3052
 
2606
void i915_gem_restore_fences(struct drm_device *dev);
3053
u64 i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o,
2607
 
3054
				  const struct i915_ggtt_view *view);
-
 
3055
u64 i915_gem_obj_offset(struct drm_i915_gem_object *o,
-
 
3056
			struct i915_address_space *vm);
-
 
3057
static inline u64
-
 
3058
i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *o)
-
 
3059
{
-
 
3060
	return i915_gem_obj_ggtt_offset_view(o, &i915_ggtt_view_normal);
2608
unsigned long i915_gem_obj_offset(struct drm_i915_gem_object *o,
3061
}
-
 
3062
 
-
 
3063
bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o);
2609
				  struct i915_address_space *vm);
3064
bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o,
2610
bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o);
3065
				  const struct i915_ggtt_view *view);
-
 
3066
bool i915_gem_obj_bound(struct drm_i915_gem_object *o,
2611
bool i915_gem_obj_bound(struct drm_i915_gem_object *o,
3067
			struct i915_address_space *vm);
2612
			struct i915_address_space *vm);
3068
 
-
 
3069
unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,
2613
unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,
3070
				struct i915_address_space *vm);
2614
				struct i915_address_space *vm);
3071
struct i915_vma *
2615
struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
3072
i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
-
 
3073
		    struct i915_address_space *vm);
-
 
3074
struct i915_vma *
-
 
3075
i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj,
-
 
3076
			  const struct i915_ggtt_view *view);
2616
				     struct i915_address_space *vm);
3077
 
2617
struct i915_vma *
3078
struct i915_vma *
-
 
3079
i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
-
 
3080
				  struct i915_address_space *vm);
-
 
3081
struct i915_vma *
Line 2618... Line 3082...
2618
i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
3082
i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,
2619
				  struct i915_address_space *vm);
3083
				       const struct i915_ggtt_view *view);
2620
 
-
 
-
 
3084
 
2621
struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj);
3085
static inline struct i915_vma *
2622
static inline bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj) {
-
 
2623
	struct i915_vma *vma;
-
 
2624
	list_for_each_entry(vma, &obj->vma_list, vma_link)
-
 
2625
		if (vma->pin_count > 0)
3086
i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj)
-
 
3087
{
Line 2626... Line 3088...
2626
			return true;
3088
	return i915_gem_obj_to_ggtt_view(obj, &i915_ggtt_view_normal);
2627
	return false;
3089
}
2628
}
3090
bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj);
2629
 
3091
 
Line 2646... Line 3108...
2646
}
3108
}
Line 2647... Line 3109...
2647
 
3109
 
2648
 
3110
 
2649
static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj)
3111
static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj)
2650
{
-
 
2651
	return i915_gem_obj_bound(obj, i915_obj_to_ggtt(obj));
-
 
2652
}
-
 
2653
 
-
 
2654
static inline unsigned long
-
 
2655
i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *obj)
-
 
2656
{
3112
{
Line 2657... Line 3113...
2657
	return i915_gem_obj_offset(obj, i915_obj_to_ggtt(obj));
3113
	return i915_gem_obj_ggtt_bound_view(obj, &i915_ggtt_view_normal);
2658
}
3114
}
2659
 
3115
 
Line 2676... Line 3132...
2676
i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj)
3132
i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj)
2677
{
3133
{
2678
	return i915_vma_unbind(i915_gem_obj_to_ggtt(obj));
3134
	return i915_vma_unbind(i915_gem_obj_to_ggtt(obj));
2679
}
3135
}
Line -... Line 3136...
-
 
3136
 
-
 
3137
void i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj,
-
 
3138
				     const struct i915_ggtt_view *view);
2680
 
3139
static inline void
-
 
3140
i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj)
-
 
3141
{
-
 
3142
	i915_gem_object_ggtt_unpin_view(obj, &i915_ggtt_view_normal);
-
 
3143
}
-
 
3144
 
-
 
3145
/* i915_gem_fence.c */
-
 
3146
int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj);
-
 
3147
int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj);
-
 
3148
 
-
 
3149
bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj);
-
 
3150
void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj);
-
 
3151
 
-
 
3152
void i915_gem_restore_fences(struct drm_device *dev);
-
 
3153
 
-
 
3154
void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
-
 
3155
void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
Line 2681... Line 3156...
2681
void i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj);
3156
void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
2682
 
3157
 
2683
/* i915_gem_context.c */
3158
/* i915_gem_context.c */
2684
int __must_check i915_gem_context_init(struct drm_device *dev);
3159
int __must_check i915_gem_context_init(struct drm_device *dev);
2685
void i915_gem_context_fini(struct drm_device *dev);
3160
void i915_gem_context_fini(struct drm_device *dev);
2686
void i915_gem_context_reset(struct drm_device *dev);
3161
void i915_gem_context_reset(struct drm_device *dev);
2687
int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
3162
int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
2688
int i915_gem_context_enable(struct drm_i915_private *dev_priv);
3163
int i915_gem_context_enable(struct drm_i915_gem_request *req);
2689
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
-
 
2690
int i915_switch_context(struct intel_engine_cs *ring,
3164
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
2691
			struct intel_context *to);
3165
int i915_switch_context(struct drm_i915_gem_request *req);
2692
struct intel_context *
3166
struct intel_context *
2693
i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id);
3167
i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id);
2694
void i915_gem_context_free(struct kref *ctx_ref);
3168
void i915_gem_context_free(struct kref *ctx_ref);
Line 2711... Line 3185...
2711
 
3185
 
2712
int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
3186
int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
2713
				  struct drm_file *file);
3187
				  struct drm_file *file);
2714
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
3188
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
-
 
3189
				   struct drm_file *file);
-
 
3190
int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
-
 
3191
				    struct drm_file *file_priv);
-
 
3192
int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
Line 2715... Line 3193...
2715
				   struct drm_file *file);
3193
				    struct drm_file *file_priv);
2716
 
3194
 
2717
/* i915_gem_evict.c */
3195
/* i915_gem_evict.c */
2718
int __must_check i915_gem_evict_something(struct drm_device *dev,
3196
int __must_check i915_gem_evict_something(struct drm_device *dev,
Line 2722... Line 3200...
2722
					  unsigned cache_level,
3200
					  unsigned cache_level,
2723
					  unsigned long start,
3201
					  unsigned long start,
2724
					  unsigned long end,
3202
					  unsigned long end,
2725
					  unsigned flags);
3203
					  unsigned flags);
2726
int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle);
3204
int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle);
2727
int i915_gem_evict_everything(struct drm_device *dev);
-
 
Line 2728... Line 3205...
2728
 
3205
 
2729
/* belongs in i915_gem_gtt.h */
3206
/* belongs in i915_gem_gtt.h */
2730
static inline void i915_gem_chipset_flush(struct drm_device *dev)
3207
static inline void i915_gem_chipset_flush(struct drm_device *dev)
2731
{
3208
{
2732
	if (INTEL_INFO(dev)->gen < 6)
3209
	if (INTEL_INFO(dev)->gen < 6)
2733
		intel_gtt_chipset_flush();
3210
		intel_gtt_chipset_flush();
Line 2734... Line 3211...
2734
}
3211
}
-
 
3212
 
-
 
3213
/* i915_gem_stolen.c */
-
 
3214
int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv,
-
 
3215
				struct drm_mm_node *node, u64 size,
-
 
3216
				unsigned alignment);
-
 
3217
int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv,
-
 
3218
					 struct drm_mm_node *node, u64 size,
-
 
3219
					 unsigned alignment, u64 start,
-
 
3220
					 u64 end);
2735
 
3221
void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
2736
/* i915_gem_stolen.c */
-
 
2737
int i915_gem_init_stolen(struct drm_device *dev);
-
 
2738
int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_cpp);
3222
				 struct drm_mm_node *node);
2739
void i915_gem_stolen_cleanup_compression(struct drm_device *dev);
3223
int i915_gem_init_stolen(struct drm_device *dev);
2740
void i915_gem_cleanup_stolen(struct drm_device *dev);
3224
void i915_gem_cleanup_stolen(struct drm_device *dev);
2741
struct drm_i915_gem_object *
3225
struct drm_i915_gem_object *
2742
i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
3226
i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
2743
struct drm_i915_gem_object *
3227
struct drm_i915_gem_object *
2744
i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
3228
i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
2745
					       u32 stolen_offset,
3229
					       u32 stolen_offset,
Line -... Line 3230...
-
 
3230
					       u32 gtt_offset,
-
 
3231
					       u32 size);
-
 
3232
 
-
 
3233
/* i915_gem_shrinker.c */
-
 
3234
unsigned long i915_gem_shrink(struct drm_i915_private *dev_priv,
-
 
3235
			      unsigned long target,
-
 
3236
			      unsigned flags);
-
 
3237
#define I915_SHRINK_PURGEABLE 0x1
-
 
3238
#define I915_SHRINK_UNBOUND 0x2
-
 
3239
#define I915_SHRINK_BOUND 0x4
-
 
3240
#define I915_SHRINK_ACTIVE 0x8
-
 
3241
unsigned long i915_gem_shrink_all(struct drm_i915_private *dev_priv);
2746
					       u32 gtt_offset,
3242
void i915_gem_shrinker_init(struct drm_i915_private *dev_priv);
2747
					       u32 size);
3243
 
2748
 
3244
 
2749
/* i915_gem_tiling.c */
3245
/* i915_gem_tiling.c */
Line 2750... Line 3246...
2750
static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)
3246
static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)
2751
{
3247
{
2752
	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
3248
	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
Line 2753... Line -...
2753
 
-
 
2754
	return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
-
 
2755
		obj->tiling_mode != I915_TILING_NONE;
-
 
2756
}
-
 
2757
 
3249
 
2758
void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
3250
	return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
2759
void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
3251
		obj->tiling_mode != I915_TILING_NONE;
2760
void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
3252
}
2761
 
3253
 
Line 2768... Line 3260...
2768
 
3260
 
2769
/* i915_debugfs.c */
3261
/* i915_debugfs.c */
2770
int i915_debugfs_init(struct drm_minor *minor);
3262
int i915_debugfs_init(struct drm_minor *minor);
2771
void i915_debugfs_cleanup(struct drm_minor *minor);
3263
void i915_debugfs_cleanup(struct drm_minor *minor);
-
 
3264
#ifdef CONFIG_DEBUG_FS
2772
#ifdef CONFIG_DEBUG_FS
3265
int i915_debugfs_connector_add(struct drm_connector *connector);
2773
void intel_display_crc_init(struct drm_device *dev);
3266
void intel_display_crc_init(struct drm_device *dev);
-
 
3267
#else
-
 
3268
static inline int i915_debugfs_connector_add(struct drm_connector *connector)
2774
#else
3269
{ return 0; }
2775
static inline void intel_display_crc_init(struct drm_device *dev) {}
3270
static inline void intel_display_crc_init(struct drm_device *dev) {}
Line 2776... Line 3271...
2776
#endif
3271
#endif
2777
 
3272
 
Line 2803... Line 3298...
2803
int i915_cmd_parser_init_ring(struct intel_engine_cs *ring);
3298
int i915_cmd_parser_init_ring(struct intel_engine_cs *ring);
2804
void i915_cmd_parser_fini_ring(struct intel_engine_cs *ring);
3299
void i915_cmd_parser_fini_ring(struct intel_engine_cs *ring);
2805
bool i915_needs_cmd_parser(struct intel_engine_cs *ring);
3300
bool i915_needs_cmd_parser(struct intel_engine_cs *ring);
2806
int i915_parse_cmds(struct intel_engine_cs *ring,
3301
int i915_parse_cmds(struct intel_engine_cs *ring,
2807
		    struct drm_i915_gem_object *batch_obj,
3302
		    struct drm_i915_gem_object *batch_obj,
-
 
3303
		    struct drm_i915_gem_object *shadow_batch_obj,
2808
		    u32 batch_start_offset,
3304
		    u32 batch_start_offset,
-
 
3305
		    u32 batch_len,
2809
		    bool is_master);
3306
		    bool is_master);
Line 2810... Line 3307...
2810
 
3307
 
2811
/* i915_suspend.c */
3308
/* i915_suspend.c */
2812
extern int i915_save_state(struct drm_device *dev);
3309
extern int i915_save_state(struct drm_device *dev);
Line 2813... Line -...
2813
extern int i915_restore_state(struct drm_device *dev);
-
 
2814
 
-
 
2815
/* i915_ums.c */
-
 
2816
void i915_save_display_reg(struct drm_device *dev);
-
 
2817
void i915_restore_display_reg(struct drm_device *dev);
3310
extern int i915_restore_state(struct drm_device *dev);
2818
 
3311
 
2819
/* i915_sysfs.c */
3312
/* i915_sysfs.c */
Line 2820... Line 3313...
2820
void i915_setup_sysfs(struct drm_device *dev_priv);
3313
void i915_setup_sysfs(struct drm_device *dev_priv);
2821
void i915_teardown_sysfs(struct drm_device *dev_priv);
3314
void i915_teardown_sysfs(struct drm_device *dev_priv);
2822
 
3315
 
2823
/* intel_i2c.c */
3316
/* intel_i2c.c */
2824
extern int intel_setup_gmbus(struct drm_device *dev);
-
 
2825
extern void intel_teardown_gmbus(struct drm_device *dev);
3317
extern int intel_setup_gmbus(struct drm_device *dev);
2826
static inline bool intel_gmbus_is_port_valid(unsigned port)
-
 
Line 2827... Line 3318...
2827
{
3318
extern void intel_teardown_gmbus(struct drm_device *dev);
2828
	return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD);
3319
extern bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv,
2829
}
3320
				     unsigned int pin);
2830
 
3321
 
2831
extern struct i2c_adapter *intel_gmbus_get_adapter(
3322
extern struct i2c_adapter *
2832
		struct drm_i915_private *dev_priv, unsigned port);
3323
intel_gmbus_get_adapter(struct drm_i915_private *dev_priv, unsigned int pin);
2833
extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
3324
extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
Line 2879... Line 3370...
2879
extern void intel_modeset_init(struct drm_device *dev);
3370
extern void intel_modeset_init(struct drm_device *dev);
2880
extern void intel_modeset_gem_init(struct drm_device *dev);
3371
extern void intel_modeset_gem_init(struct drm_device *dev);
2881
extern void intel_modeset_cleanup(struct drm_device *dev);
3372
extern void intel_modeset_cleanup(struct drm_device *dev);
2882
extern void intel_connector_unregister(struct intel_connector *);
3373
extern void intel_connector_unregister(struct intel_connector *);
2883
extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
3374
extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
2884
extern void intel_modeset_setup_hw_state(struct drm_device *dev,
3375
extern void intel_display_resume(struct drm_device *dev);
2885
					 bool force_restore);
-
 
2886
extern void i915_redisable_vga(struct drm_device *dev);
3376
extern void i915_redisable_vga(struct drm_device *dev);
2887
extern void i915_redisable_vga_power_on(struct drm_device *dev);
3377
extern void i915_redisable_vga_power_on(struct drm_device *dev);
2888
extern bool intel_fbc_enabled(struct drm_device *dev);
-
 
2889
extern void bdw_fbc_sw_flush(struct drm_device *dev, u32 value);
-
 
2890
extern void intel_disable_fbc(struct drm_device *dev);
-
 
2891
extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
3378
extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
2892
extern void intel_init_pch_refclk(struct drm_device *dev);
3379
extern void intel_init_pch_refclk(struct drm_device *dev);
2893
extern void gen6_set_rps(struct drm_device *dev, u8 val);
3380
extern void intel_set_rps(struct drm_device *dev, u8 val);
2894
extern void valleyview_set_rps(struct drm_device *dev, u8 val);
-
 
2895
extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
3381
extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
2896
				  bool enable);
3382
				  bool enable);
2897
extern void intel_detect_pch(struct drm_device *dev);
3383
extern void intel_detect_pch(struct drm_device *dev);
2898
extern int intel_trans_dp_port_sel(struct drm_crtc *crtc);
3384
extern int intel_trans_dp_port_sel(struct drm_crtc *crtc);
2899
extern int intel_enable_rc6(const struct drm_device *dev);
3385
extern int intel_enable_rc6(const struct drm_device *dev);
Line 2902... Line 3388...
2902
int i915_reg_read_ioctl(struct drm_device *dev, void *data,
3388
int i915_reg_read_ioctl(struct drm_device *dev, void *data,
2903
			struct drm_file *file);
3389
			struct drm_file *file);
2904
int i915_get_reset_stats_ioctl(struct drm_device *dev, void *data,
3390
int i915_get_reset_stats_ioctl(struct drm_device *dev, void *data,
2905
			       struct drm_file *file);
3391
			       struct drm_file *file);
Line 2906... Line -...
2906
 
-
 
2907
void intel_notify_mmio_flip(struct intel_engine_cs *ring);
-
 
2908
 
3392
 
2909
/* overlay */
-
 
2910
#ifdef CONFIG_DEBUG_FS
3393
/* overlay */
2911
extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
3394
extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
2912
extern void intel_overlay_print_error_state(struct drm_i915_error_state_buf *e,
3395
extern void intel_overlay_print_error_state(struct drm_i915_error_state_buf *e,
Line 2913... Line 3396...
2913
					    struct intel_overlay_error_state *error);
3396
					    struct intel_overlay_error_state *error);
2914
 
3397
 
2915
extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev);
3398
extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev);
2916
extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
3399
extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
2917
					    struct drm_device *dev,
-
 
2918
					    struct intel_display_error_state *error);
-
 
2919
#endif
-
 
2920
 
-
 
2921
/* On SNB platform, before reading ring registers forcewake bit
-
 
2922
 * must be set to prevent GT core from power down and stale values being
-
 
2923
 * returned.
-
 
2924
 */
-
 
2925
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine);
-
 
Line 2926... Line 3400...
2926
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
3400
					    struct drm_device *dev,
2927
void assert_force_wake_inactive(struct drm_i915_private *dev_priv);
3401
					    struct intel_display_error_state *error);
Line 2928... Line 3402...
2928
 
3402
 
2929
int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val);
3403
int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val);
2930
int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val);
3404
int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val);
2931
 
3405
 
2932
/* intel_sideband.c */
3406
/* intel_sideband.c */
2933
u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr);
3407
u32 vlv_punit_read(struct drm_i915_private *dev_priv, u32 addr);
2934
void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val);
3408
void vlv_punit_write(struct drm_i915_private *dev_priv, u32 addr, u32 val);
2935
u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr);
3409
u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr);
Line 2950... Line 3424...
2950
void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
3424
void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
2951
		     enum intel_sbi_destination destination);
3425
		     enum intel_sbi_destination destination);
2952
u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg);
3426
u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg);
2953
void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
3427
void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
Line 2954... Line 3428...
2954
 
3428
 
2955
int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val);
3429
int intel_gpu_freq(struct drm_i915_private *dev_priv, int val);
2956
int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);
-
 
2957
 
-
 
2958
#define FORCEWAKE_RENDER	(1 << 0)
-
 
2959
#define FORCEWAKE_MEDIA		(1 << 1)
-
 
2960
#define FORCEWAKE_BLITTER	(1 << 2)
-
 
2961
#define FORCEWAKE_ALL		(FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \
-
 
2962
					FORCEWAKE_BLITTER)
-
 
Line 2963... Line 3430...
2963
 
3430
int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
2964
 
3431
 
Line 2965... Line 3432...
2965
#define I915_READ8(reg)		dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
3432
#define I915_READ8(reg)		dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
Line 2983... Line 3450...
2983
 */
3450
 */
2984
#define I915_WRITE64(reg, val)	dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true)
3451
#define I915_WRITE64(reg, val)	dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true)
2985
#define I915_READ64(reg)	dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true)
3452
#define I915_READ64(reg)	dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true)
Line 2986... Line 3453...
2986
 
3453
 
2987
#define I915_READ64_2x32(lower_reg, upper_reg) ({			\
3454
#define I915_READ64_2x32(lower_reg, upper_reg) ({			\
2988
		u32 upper = I915_READ(upper_reg);			\
-
 
2989
		u32 lower = I915_READ(lower_reg);			\
3455
	u32 upper, lower, old_upper, loop = 0;				\
2990
		u32 tmp = I915_READ(upper_reg);				\
3456
	upper = I915_READ(upper_reg);					\
2991
		if (upper != tmp) {					\
3457
	do {								\
2992
			upper = tmp;					\
3458
		old_upper = upper;					\
2993
			lower = I915_READ(lower_reg);			\
3459
		lower = I915_READ(lower_reg);				\
2994
			WARN_ON(I915_READ(upper_reg) != upper);		\
3460
		upper = I915_READ(upper_reg);				\
2995
		}							\
3461
	} while (upper != old_upper && loop++ < 2);			\
Line 2996... Line 3462...
2996
		(u64)upper << 32 | lower; })
3462
	(u64)upper << 32 | lower; })
2997
 
3463
 
Line -... Line 3464...
-
 
3464
#define POSTING_READ(reg)	(void)I915_READ_NOTRACE(reg)
-
 
3465
#define POSTING_READ16(reg)	(void)I915_READ16_NOTRACE(reg)
-
 
3466
 
-
 
3467
/* These are untraced mmio-accessors that are only valid to be used inside
-
 
3468
 * criticial sections inside IRQ handlers where forcewake is explicitly
-
 
3469
 * controlled.
-
 
3470
 * Think twice, and think again, before using these.
-
 
3471
 * Note: Should only be used between intel_uncore_forcewake_irqlock() and
-
 
3472
 * intel_uncore_forcewake_irqunlock().
-
 
3473
 */
-
 
3474
#define I915_READ_FW(reg__) readl(dev_priv->regs + (reg__))
2998
#define POSTING_READ(reg)	(void)I915_READ_NOTRACE(reg)
3475
#define I915_WRITE_FW(reg__, val__) writel(val__, dev_priv->regs + (reg__))
2999
#define POSTING_READ16(reg)	(void)I915_READ16_NOTRACE(reg)
3476
#define POSTING_READ_FW(reg__) (void)I915_READ_FW(reg__)
3000
 
3477
 
3001
/* "Broadcast RGB" property */
3478
/* "Broadcast RGB" property */
Line 3057... Line 3534...
3057
	target_jiffies = timestamp_jiffies +
3534
	target_jiffies = timestamp_jiffies +
3058
			 msecs_to_jiffies_timeout(to_wait_ms);
3535
			 msecs_to_jiffies_timeout(to_wait_ms);
Line 3059... Line 3536...
3059
 
3536
 
3060
	if (time_after(target_jiffies, tmp_jiffies)) {
3537
	if (time_after(target_jiffies, tmp_jiffies)) {
3061
		remaining_jiffies = target_jiffies - tmp_jiffies;
-
 
3062
		while ((int)remaining_jiffies > 0) {
3538
		remaining_jiffies = target_jiffies - tmp_jiffies;
3063
			delay(remaining_jiffies);
-
 
3064
			remaining_jiffies = target_jiffies - jiffies;
-
 
3065
		}
3539
        delay(remaining_jiffies);
3066
	}
3540
	}
Line -... Line 3541...
-
 
3541
}
3067
}
3542
 
3068
 
3543
static inline void i915_trace_irq_get(struct intel_engine_cs *ring,
3069
typedef struct
-
 
3070
{
-
 
3071
  int width;
-
 
3072
  int height;
-
 
3073
  int bpp;
-
 
3074
  int freq;
-
 
3075
}videomode_t;
-
 
3076
 
-
 
3077
struct cmdtable
-
 
3078
{
-
 
3079
    char *key;
-
 
3080
    int   size;
-
 
3081
    int  *val;
-
 
3082
};
-
 
3083
 
-
 
3084
#define CMDENTRY(key, val) {(key), (sizeof(key)-1), &val}
-
 
3085
 
-
 
3086
void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode);
-
 
3087
struct drm_i915_gem_object
-
 
3088
*kos_gem_fb_object_create(struct drm_device *dev, u32 gtt_offset, u32 size);
-
 
3089
 
-
 
3090
extern struct drm_i915_gem_object *main_fb_obj;
3544
				      struct drm_i915_gem_request *req)
3091
 
-
 
3092
static struct drm_i915_gem_object *get_fb_obj()
-
 
3093
{
-
 
3094
    return main_fb_obj;
-
 
3095
};
-
 
3096
 
-
 
3097
#define ioread32(addr)          readl(addr)
-
 
3098
 
3545
{
3099
 
-
 
3100
static inline int pm_runtime_get_sync(struct device *dev)
-
 
3101
{
-
 
3102
    return 0;
-
 
3103
}
-
 
3104
 
-
 
3105
static inline int pm_runtime_set_active(struct device *dev)
-
 
3106
{
-
 
3107
    return 0;
-
 
3108
}
-
 
3109
 
-
 
3110
static inline void pm_runtime_disable(struct device *dev)
-
 
3111
{
-
 
3112
 
-
 
3113
}
-
 
3114
 
-
 
3115
static inline int pm_runtime_put_autosuspend(struct device *dev)
-
 
3116
{
-
 
3117
    return 0;
-
 
3118
}
-
 
3119
 
-
 
3120
static inline u8 inb(u16 port)
-
 
3121
{
-
 
3122
        u8 v;
-
 
3123
        asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
-
 
3124
        return v;
-
 
3125
}
-
 
3126
 
-
 
3127
static inline void outb(u8 v, u16 port)
-
 
3128
{
3546
	if (ring->trace_irq_req == NULL && ring->irq_get(ring))
Line 3129... Line 3547...
3129
        asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
3547
		i915_gem_request_assign(&ring->trace_irq_req, req);