Subversion Repositories Kolibri OS

Rev

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

Rev 4539 Rev 4560
Line 64... Line 64...
64
#define DRIVER_NAME		"i915"
64
#define DRIVER_NAME		"i915"
65
#define DRIVER_DESC		"Intel Graphics"
65
#define DRIVER_DESC		"Intel Graphics"
66
#define DRIVER_DATE		"20080730"
66
#define DRIVER_DATE		"20080730"
Line 67... Line 67...
67
 
67
 
-
 
68
enum pipe {
68
enum pipe {
69
	INVALID_PIPE = -1,
69
	PIPE_A = 0,
70
	PIPE_A = 0,
70
	PIPE_B,
71
	PIPE_B,
71
	PIPE_C,
72
	PIPE_C,
72
	I915_MAX_PIPES
73
	I915_MAX_PIPES
Line 98... Line 99...
98
	PORT_E,
99
	PORT_E,
99
	I915_MAX_PORTS
100
	I915_MAX_PORTS
100
};
101
};
101
#define port_name(p) ((p) + 'A')
102
#define port_name(p) ((p) + 'A')
Line -... Line 103...
-
 
103
 
-
 
104
#define I915_NUM_PHYS_VLV 1
-
 
105
 
-
 
106
enum dpio_channel {
-
 
107
	DPIO_CH0,
-
 
108
	DPIO_CH1
-
 
109
};
-
 
110
 
-
 
111
enum dpio_phy {
-
 
112
	DPIO_PHY0,
-
 
113
	DPIO_PHY1
-
 
114
};
102
 
115
 
103
enum intel_display_power_domain {
116
enum intel_display_power_domain {
104
	POWER_DOMAIN_PIPE_A,
117
	POWER_DOMAIN_PIPE_A,
105
	POWER_DOMAIN_PIPE_B,
118
	POWER_DOMAIN_PIPE_B,
106
	POWER_DOMAIN_PIPE_C,
119
	POWER_DOMAIN_PIPE_C,
107
	POWER_DOMAIN_PIPE_A_PANEL_FITTER,
120
	POWER_DOMAIN_PIPE_A_PANEL_FITTER,
108
	POWER_DOMAIN_PIPE_B_PANEL_FITTER,
121
	POWER_DOMAIN_PIPE_B_PANEL_FITTER,
109
	POWER_DOMAIN_PIPE_C_PANEL_FITTER,
122
	POWER_DOMAIN_PIPE_C_PANEL_FITTER,
110
	POWER_DOMAIN_TRANSCODER_A,
123
	POWER_DOMAIN_TRANSCODER_A,
111
	POWER_DOMAIN_TRANSCODER_B,
124
	POWER_DOMAIN_TRANSCODER_B,
112
	POWER_DOMAIN_TRANSCODER_C,
125
	POWER_DOMAIN_TRANSCODER_C,
-
 
126
	POWER_DOMAIN_TRANSCODER_EDP,
-
 
127
	POWER_DOMAIN_VGA,
-
 
128
	POWER_DOMAIN_AUDIO,
-
 
129
	POWER_DOMAIN_INIT,
-
 
130
 
113
	POWER_DOMAIN_TRANSCODER_EDP = POWER_DOMAIN_TRANSCODER_A + 0xF,
131
	POWER_DOMAIN_NUM,
Line -... Line 132...
-
 
132
};
-
 
133
 
114
};
134
#define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
115
 
135
 
116
#define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A)
136
#define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A)
-
 
137
#define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \
117
#define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \
138
		((pipe) + POWER_DOMAIN_PIPE_A_PANEL_FITTER)
-
 
139
#define POWER_DOMAIN_TRANSCODER(tran) \
-
 
140
	((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \
-
 
141
	 (tran) + POWER_DOMAIN_TRANSCODER_A)
-
 
142
 
-
 
143
#define HSW_ALWAYS_ON_POWER_DOMAINS (		\
-
 
144
	BIT(POWER_DOMAIN_PIPE_A) |		\
-
 
145
	BIT(POWER_DOMAIN_TRANSCODER_EDP))
-
 
146
#define BDW_ALWAYS_ON_POWER_DOMAINS (		\
-
 
147
	BIT(POWER_DOMAIN_PIPE_A) |		\
Line 118... Line 148...
118
		((pipe) + POWER_DOMAIN_PIPE_A_PANEL_FITTER)
148
	BIT(POWER_DOMAIN_TRANSCODER_EDP) |	\
119
#define POWER_DOMAIN_TRANSCODER(tran) ((tran) + POWER_DOMAIN_TRANSCODER_A)
149
	BIT(POWER_DOMAIN_PIPE_A_PANEL_FITTER))
120
 
150
 
121
enum hpd_pin {
151
enum hpd_pin {
Line 235... Line 265...
235
 
265
 
236
struct intel_opregion {
266
struct intel_opregion {
237
	struct opregion_header __iomem *header;
267
	struct opregion_header __iomem *header;
238
	struct opregion_acpi __iomem *acpi;
268
	struct opregion_acpi __iomem *acpi;
-
 
269
	struct opregion_swsci __iomem *swsci;
-
 
270
	u32 swsci_gbda_sub_functions;
239
	struct opregion_swsci __iomem *swsci;
271
	u32 swsci_sbcb_sub_functions;
240
	struct opregion_asle __iomem *asle;
272
	struct opregion_asle __iomem *asle;
241
	void __iomem *vbt;
273
	void __iomem *vbt;
-
 
274
	u32 __iomem *lid_state;
242
	u32 __iomem *lid_state;
275
	struct work_struct asle_work;
243
};
276
};
Line 244... Line 277...
244
#define OPREGION_SIZE            (8*1024)
277
#define OPREGION_SIZE            (8*1024)
245
 
278
 
Line 295... Line 328...
295
	/* our own tracking of ring head and tail */
328
	/* our own tracking of ring head and tail */
296
	u32 cpu_ring_head[I915_NUM_RINGS];
329
	u32 cpu_ring_head[I915_NUM_RINGS];
297
	u32 cpu_ring_tail[I915_NUM_RINGS];
330
	u32 cpu_ring_tail[I915_NUM_RINGS];
298
	u32 error; /* gen6+ */
331
	u32 error; /* gen6+ */
299
	u32 err_int; /* gen7 */
332
	u32 err_int; /* gen7 */
-
 
333
	u32 bbstate[I915_NUM_RINGS];
300
	u32 instpm[I915_NUM_RINGS];
334
	u32 instpm[I915_NUM_RINGS];
301
	u32 instps[I915_NUM_RINGS];
335
	u32 instps[I915_NUM_RINGS];
302
	u32 extra_instdone[I915_NUM_INSTDONE_REG];
336
	u32 extra_instdone[I915_NUM_INSTDONE_REG];
303
	u32 seqno[I915_NUM_RINGS];
337
	u32 seqno[I915_NUM_RINGS];
304
	u64 bbaddr;
338
	u64 bbaddr[I915_NUM_RINGS];
305
	u32 fault_reg[I915_NUM_RINGS];
339
	u32 fault_reg[I915_NUM_RINGS];
306
	u32 done_reg;
340
	u32 done_reg;
307
	u32 faddr[I915_NUM_RINGS];
341
	u32 faddr[I915_NUM_RINGS];
308
	u64 fence[I915_MAX_NUM_FENCES];
342
	u64 fence[I915_MAX_NUM_FENCES];
309
	struct timeval time;
343
	struct timeval time;
310
	struct drm_i915_error_ring {
344
	struct drm_i915_error_ring {
-
 
345
		bool valid;
311
	struct drm_i915_error_object {
346
	struct drm_i915_error_object {
312
		int page_count;
347
		int page_count;
313
		u32 gtt_offset;
348
		u32 gtt_offset;
314
		u32 *pages[0];
349
		u32 *pages[0];
315
		} *ringbuffer, *batchbuffer, *ctx;
350
		} *ringbuffer, *batchbuffer, *ctx;
Line 331... Line 366...
331
		s32 pinned:2;
366
		s32 pinned:2;
332
		u32 tiling:2;
367
		u32 tiling:2;
333
		u32 dirty:1;
368
		u32 dirty:1;
334
		u32 purgeable:1;
369
		u32 purgeable:1;
335
		s32 ring:4;
370
		s32 ring:4;
336
		u32 cache_level:2;
371
		u32 cache_level:3;
337
	} **active_bo, **pinned_bo;
372
	} **active_bo, **pinned_bo;
338
	u32 *active_bo_count, *pinned_bo_count;
373
	u32 *active_bo_count, *pinned_bo_count;
339
	struct intel_overlay_error_state *overlay;
374
	struct intel_overlay_error_state *overlay;
340
	struct intel_display_error_state *display;
375
	struct intel_display_error_state *display;
-
 
376
	int hangcheck_score[I915_NUM_RINGS];
-
 
377
	enum intel_ring_hangcheck_action hangcheck_action[I915_NUM_RINGS];
341
};
378
};
Line -... Line 379...
-
 
379
 
342
 
380
struct intel_connector;
343
struct intel_crtc_config;
381
struct intel_crtc_config;
344
struct intel_crtc;
382
struct intel_crtc;
345
struct intel_limit;
383
struct intel_limit;
Line 346... Line 384...
346
struct dpll;
384
struct dpll;
347
 
385
 
348
struct drm_i915_display_funcs {
386
struct drm_i915_display_funcs {
349
	bool (*fbc_enabled)(struct drm_device *dev);
387
	bool (*fbc_enabled)(struct drm_device *dev);
350
	void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
388
	void (*enable_fbc)(struct drm_crtc *crtc);
351
	void (*disable_fbc)(struct drm_device *dev);
389
	void (*disable_fbc)(struct drm_device *dev);
352
	int (*get_display_clock_speed)(struct drm_device *dev);
390
	int (*get_display_clock_speed)(struct drm_device *dev);
353
	int (*get_fifo_size)(struct drm_device *dev, int plane);
391
	int (*get_fifo_size)(struct drm_device *dev, int plane);
Line 367... Line 405...
367
	bool (*find_dpll)(const struct intel_limit *limit,
405
	bool (*find_dpll)(const struct intel_limit *limit,
368
			  struct drm_crtc *crtc,
406
			  struct drm_crtc *crtc,
369
			  int target, int refclk,
407
			  int target, int refclk,
370
			  struct dpll *match_clock,
408
			  struct dpll *match_clock,
371
			  struct dpll *best_clock);
409
			  struct dpll *best_clock);
372
	void (*update_wm)(struct drm_device *dev);
410
	void (*update_wm)(struct drm_crtc *crtc);
373
	void (*update_sprite_wm)(struct drm_plane *plane,
411
	void (*update_sprite_wm)(struct drm_plane *plane,
374
				 struct drm_crtc *crtc,
412
				 struct drm_crtc *crtc,
375
				 uint32_t sprite_width, int pixel_size,
413
				 uint32_t sprite_width, int pixel_size,
376
				 bool enable, bool scaled);
414
				 bool enable, bool scaled);
377
	void (*modeset_global_resources)(struct drm_device *dev);
415
	void (*modeset_global_resources)(struct drm_device *dev);
378
	/* Returns the active state of the crtc, and if the crtc is active,
416
	/* Returns the active state of the crtc, and if the crtc is active,
379
	 * fills out the pipe-config with the hw state. */
417
	 * fills out the pipe-config with the hw state. */
380
	bool (*get_pipe_config)(struct intel_crtc *,
418
	bool (*get_pipe_config)(struct intel_crtc *,
381
				struct intel_crtc_config *);
419
				struct intel_crtc_config *);
382
	void (*get_clock)(struct intel_crtc *, struct intel_crtc_config *);
-
 
383
	int (*crtc_mode_set)(struct drm_crtc *crtc,
420
	int (*crtc_mode_set)(struct drm_crtc *crtc,
384
			     int x, int y,
421
			     int x, int y,
385
			     struct drm_framebuffer *old_fb);
422
			     struct drm_framebuffer *old_fb);
386
	void (*crtc_enable)(struct drm_crtc *crtc);
423
	void (*crtc_enable)(struct drm_crtc *crtc);
387
	void (*crtc_disable)(struct drm_crtc *crtc);
424
	void (*crtc_disable)(struct drm_crtc *crtc);
388
	void (*off)(struct drm_crtc *crtc);
425
	void (*off)(struct drm_crtc *crtc);
389
	void (*write_eld)(struct drm_connector *connector,
426
	void (*write_eld)(struct drm_connector *connector,
390
			  struct drm_crtc *crtc);
427
			  struct drm_crtc *crtc,
-
 
428
			  struct drm_display_mode *mode);
391
	void (*fdi_link_train)(struct drm_crtc *crtc);
429
	void (*fdi_link_train)(struct drm_crtc *crtc);
392
	void (*init_clock_gating)(struct drm_device *dev);
430
	void (*init_clock_gating)(struct drm_device *dev);
393
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
431
	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
394
			  struct drm_framebuffer *fb,
432
			  struct drm_framebuffer *fb,
395
			  struct drm_i915_gem_object *obj,
433
			  struct drm_i915_gem_object *obj,
Line 400... Line 438...
400
	/* clock updates for mode set */
438
	/* clock updates for mode set */
401
	/* cursor updates */
439
	/* cursor updates */
402
	/* render clock increase/decrease */
440
	/* render clock increase/decrease */
403
	/* display clock increase/decrease */
441
	/* display clock increase/decrease */
404
	/* pll clock increase/decrease */
442
	/* pll clock increase/decrease */
-
 
443
 
-
 
444
	int (*setup_backlight)(struct intel_connector *connector);
-
 
445
	uint32_t (*get_backlight)(struct intel_connector *connector);
-
 
446
	void (*set_backlight)(struct intel_connector *connector,
-
 
447
			      uint32_t level);
-
 
448
	void (*disable_backlight)(struct intel_connector *connector);
-
 
449
	void (*enable_backlight)(struct intel_connector *connector);
405
};
450
};
Line 406... Line 451...
406
 
451
 
407
struct intel_uncore_funcs {
452
struct intel_uncore_funcs {
-
 
453
	void (*force_wake_get)(struct drm_i915_private *dev_priv,
408
	void (*force_wake_get)(struct drm_i915_private *dev_priv);
454
							int fw_engine);
-
 
455
	void (*force_wake_put)(struct drm_i915_private *dev_priv,
-
 
456
							int fw_engine);
-
 
457
 
-
 
458
	uint8_t  (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
-
 
459
	uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
-
 
460
	uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
-
 
461
	uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
-
 
462
 
-
 
463
	void (*mmio_writeb)(struct drm_i915_private *dev_priv, off_t offset,
-
 
464
				uint8_t val, bool trace);
-
 
465
	void (*mmio_writew)(struct drm_i915_private *dev_priv, off_t offset,
-
 
466
				uint16_t val, bool trace);
-
 
467
	void (*mmio_writel)(struct drm_i915_private *dev_priv, off_t offset,
-
 
468
				uint32_t val, bool trace);
-
 
469
	void (*mmio_writeq)(struct drm_i915_private *dev_priv, off_t offset,
409
	void (*force_wake_put)(struct drm_i915_private *dev_priv);
470
				uint64_t val, bool trace);
Line 410... Line 471...
410
};
471
};
411
 
472
 
Line 412... Line 473...
412
struct intel_uncore {
473
struct intel_uncore {
Line 413... Line 474...
413
	spinlock_t lock; /** lock is also taken in irq contexts. */
474
	spinlock_t lock; /** lock is also taken in irq contexts. */
414
 
475
 
-
 
476
	struct intel_uncore_funcs funcs;
-
 
477
 
-
 
478
	unsigned fifo_count;
-
 
479
	unsigned forcewake_count;
-
 
480
 
415
	struct intel_uncore_funcs funcs;
481
	unsigned fw_rendercount;
Line 416... Line 482...
416
 
482
	unsigned fw_mediacount;
417
	unsigned fifo_count;
483
 
418
	unsigned forcewake_count;
484
	struct delayed_work force_wake_work;
Line 430... Line 496...
430
	func(is_broadwater) sep \
496
	func(is_broadwater) sep \
431
	func(is_crestline) sep \
497
	func(is_crestline) sep \
432
	func(is_ivybridge) sep \
498
	func(is_ivybridge) sep \
433
	func(is_valleyview) sep \
499
	func(is_valleyview) sep \
434
	func(is_haswell) sep \
500
	func(is_haswell) sep \
435
	func(has_force_wake) sep \
501
	func(is_preliminary) sep \
436
	func(has_fbc) sep \
502
	func(has_fbc) sep \
437
	func(has_pipe_cxsr) sep \
503
	func(has_pipe_cxsr) sep \
438
	func(has_hotplug) sep \
504
	func(has_hotplug) sep \
439
	func(cursor_needs_physical) sep \
505
	func(cursor_needs_physical) sep \
440
	func(has_overlay) sep \
506
	func(has_overlay) sep \
441
	func(overlay_needs_physical) sep \
507
	func(overlay_needs_physical) sep \
442
	func(supports_tv) sep \
508
	func(supports_tv) sep \
443
	func(has_bsd_ring) sep \
-
 
444
	func(has_blt_ring) sep \
-
 
445
	func(has_vebox_ring) sep \
-
 
446
	func(has_llc) sep \
509
	func(has_llc) sep \
447
	func(has_ddi) sep \
510
	func(has_ddi) sep \
448
	func(has_fpga_dbg)
511
	func(has_fpga_dbg)
Line 449... Line 512...
449
 
512
 
Line 452... Line 515...
452
 
515
 
453
struct intel_device_info {
516
struct intel_device_info {
454
	u32 display_mmio_offset;
517
	u32 display_mmio_offset;
455
	u8 num_pipes:3;
518
	u8 num_pipes:3;
-
 
519
	u8 gen;
456
	u8 gen;
520
	u8 ring_mask; /* Rings supported by the HW */
457
	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
521
	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
Line 458... Line 522...
458
};
522
};
459
 
523
 
Line 552... Line 616...
552
#define gtt_total_entries(gtt) ((gtt).base.total >> PAGE_SHIFT)
616
#define gtt_total_entries(gtt) ((gtt).base.total >> PAGE_SHIFT)
Line 553... Line 617...
553
 
617
 
554
struct i915_hw_ppgtt {
618
struct i915_hw_ppgtt {
555
	struct i915_address_space base;
619
	struct i915_address_space base;
-
 
620
	unsigned num_pd_entries;
556
	unsigned num_pd_entries;
621
	union {
-
 
622
	struct page **pt_pages;
-
 
623
		struct page *gen8_pt_pages;
-
 
624
	};
-
 
625
    struct page **pd_pages;
-
 
626
	int num_pd_pages;
-
 
627
	int num_pt_pages;
557
	struct page **pt_pages;
628
	union {
-
 
629
	uint32_t pd_offset;
-
 
630
		dma_addr_t pd_dma_addr[4];
-
 
631
	};
558
	uint32_t pd_offset;
632
	union {
-
 
633
	dma_addr_t *pt_dma_addr;
559
	dma_addr_t *pt_dma_addr;
634
		dma_addr_t *gen8_pt_dma_addr[4];
560
 
635
	};
561
	int (*enable)(struct drm_device *dev);
636
	int (*enable)(struct drm_device *dev);
Line 562... Line 637...
562
};
637
};
563
 
638
 
Line 580... Line 655...
580
	struct list_head vma_link; /* Link in the object's VMA list */
655
	struct list_head vma_link; /* Link in the object's VMA list */
Line 581... Line 656...
581
 
656
 
582
	/** This vma's place in the batchbuffer or on the eviction list */
657
	/** This vma's place in the batchbuffer or on the eviction list */
Line -... Line 658...
-
 
658
	struct list_head exec_list;
-
 
659
 
-
 
660
	/**
-
 
661
	 * Used for performing relocations during execbuffer insertion.
-
 
662
	 */
-
 
663
	struct hlist_node exec_node;
-
 
664
	unsigned long exec_handle;
583
	struct list_head exec_list;
665
	struct drm_i915_gem_exec_object2 *exec_entry;
Line 584... Line 666...
584
 
666
 
585
};
667
};
586
 
668
 
Line 587... Line 669...
587
struct i915_ctx_hang_stats {
669
struct i915_ctx_hang_stats {
588
	/* This context had batch pending when hang was declared */
670
	/* This context had batch pending when hang was declared */
-
 
671
	unsigned batch_pending;
-
 
672
 
-
 
673
	/* This context had batch active when hang was declared */
-
 
674
	unsigned batch_active;
-
 
675
 
-
 
676
	/* Time when this context was last blamed for a GPU reset */
589
	unsigned batch_pending;
677
	unsigned long guilty_ts;
Line 590... Line 678...
590
 
678
 
591
	/* This context had batch active when hang was declared */
679
	/* This context is banned to submit more work */
592
	unsigned batch_active;
680
	bool banned;
593
};
681
};
594
 
682
 
595
/* This must match up with the value previously used for execbuf2.rsvd1. */
683
/* This must match up with the value previously used for execbuf2.rsvd1. */
-
 
684
#define DEFAULT_CONTEXT_ID 0
596
#define DEFAULT_CONTEXT_ID 0
685
struct i915_hw_context {
597
struct i915_hw_context {
686
	struct kref ref;
598
	struct kref ref;
687
	int id;
599
	int id;
688
	bool is_initialized;
-
 
689
	uint8_t remap_slice;
-
 
690
	struct drm_i915_file_private *file_priv;
600
	bool is_initialized;
691
	struct intel_ring_buffer *ring;
Line 601... Line 692...
601
	struct drm_i915_file_private *file_priv;
692
	struct drm_i915_gem_object *obj;
602
	struct intel_ring_buffer *ring;
693
	struct i915_ctx_hang_stats hang_stats;
603
	struct drm_i915_gem_object *obj;
694
 
Line 615... Line 706...
615
 
706
 
616
	struct intel_fbc_work {
707
	struct intel_fbc_work {
617
		struct delayed_work work;
708
		struct delayed_work work;
618
		struct drm_crtc *crtc;
709
		struct drm_crtc *crtc;
619
		struct drm_framebuffer *fb;
-
 
620
		int interval;
710
		struct drm_framebuffer *fb;
Line 621... Line 711...
621
	} *fbc_work;
711
	} *fbc_work;
622
 
712
 
623
	enum no_fbc_reason {
713
	enum no_fbc_reason {
Line 633... Line 723...
633
	FBC_MODULE_PARAM,
723
	FBC_MODULE_PARAM,
634
		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
724
		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
635
	} no_fbc_reason;
725
	} no_fbc_reason;
636
};
726
};
Line 637... Line 727...
637
 
727
 
638
enum no_psr_reason {
-
 
639
	PSR_NO_SOURCE, /* Not supported on platform */
-
 
640
	PSR_NO_SINK, /* Not supported by panel */
-
 
641
	PSR_MODULE_PARAM,
-
 
642
	PSR_CRTC_NOT_ACTIVE,
-
 
643
	PSR_PWR_WELL_ENABLED,
-
 
644
	PSR_NOT_TILED,
728
struct i915_psr {
645
	PSR_SPRITE_ENABLED,
-
 
646
	PSR_S3D_ENABLED,
-
 
647
	PSR_INTERLACED_ENABLED,
729
	bool sink_support;
648
	PSR_HSW_NOT_DDIA,
730
	bool source_ok;
Line 649... Line 731...
649
};
731
};
650
 
732
 
651
enum intel_pch {
733
enum intel_pch {
Line 662... Line 744...
662
};
744
};
Line 663... Line 745...
663
 
745
 
664
#define QUIRK_PIPEA_FORCE (1<<0)
746
#define QUIRK_PIPEA_FORCE (1<<0)
665
#define QUIRK_LVDS_SSC_DISABLE (1<<1)
747
#define QUIRK_LVDS_SSC_DISABLE (1<<1)
666
#define QUIRK_INVERT_BRIGHTNESS (1<<2)
-
 
Line 667... Line 748...
667
#define QUIRK_NO_PCH_PWM_ENABLE (1<<3)
748
#define QUIRK_INVERT_BRIGHTNESS (1<<2)
668
 
749
 
Line 669... Line 750...
669
struct intel_fbdev;
750
struct intel_fbdev;
Line 714... Line 795...
714
	u32 saveDSPATILEOFF;
795
	u32 saveDSPATILEOFF;
715
	u32 savePFIT_PGM_RATIOS;
796
	u32 savePFIT_PGM_RATIOS;
716
	u32 saveBLC_HIST_CTL;
797
	u32 saveBLC_HIST_CTL;
717
	u32 saveBLC_PWM_CTL;
798
	u32 saveBLC_PWM_CTL;
718
	u32 saveBLC_PWM_CTL2;
799
	u32 saveBLC_PWM_CTL2;
-
 
800
	u32 saveBLC_HIST_CTL_B;
719
	u32 saveBLC_CPU_PWM_CTL;
801
	u32 saveBLC_CPU_PWM_CTL;
720
	u32 saveBLC_CPU_PWM_CTL2;
802
	u32 saveBLC_CPU_PWM_CTL2;
721
	u32 saveFPB0;
803
	u32 saveFPB0;
722
	u32 saveFPB1;
804
	u32 saveFPB1;
723
	u32 saveDPLL_B;
805
	u32 saveDPLL_B;
Line 833... Line 915...
833
struct intel_gen6_power_mgmt {
915
struct intel_gen6_power_mgmt {
834
	/* work and pm_iir are protected by dev_priv->irq_lock */
916
	/* work and pm_iir are protected by dev_priv->irq_lock */
835
	struct work_struct work;
917
	struct work_struct work;
836
	u32 pm_iir;
918
	u32 pm_iir;
Line 837... Line -...
837
 
-
 
838
	/* On vlv we need to manually drop to Vmin with a delayed work. */
-
 
839
	struct delayed_work vlv_work;
-
 
840
 
919
 
841
	/* The below variables an all the rps hw state are protected by
920
	/* The below variables an all the rps hw state are protected by
842
	 * dev->struct mutext. */
921
	 * dev->struct mutext. */
843
	u8 cur_delay;
922
	u8 cur_delay;
844
	u8 min_delay;
923
	u8 min_delay;
845
	u8 max_delay;
924
	u8 max_delay;
-
 
925
	u8 rpe_delay;
-
 
926
	u8 rp1_delay;
846
	u8 rpe_delay;
927
	u8 rp0_delay;
Line -... Line 928...
-
 
928
	u8 hw_max;
-
 
929
 
-
 
930
	int last_adj;
-
 
931
	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
847
	u8 hw_max;
932
 
Line 848... Line 933...
848
 
933
	bool enabled;
849
	struct delayed_work delayed_resume_work;
934
	struct delayed_work delayed_resume_work;
850
 
935
 
Line 880... Line 965...
880
	struct drm_i915_gem_object *renderctx;
965
	struct drm_i915_gem_object *renderctx;
881
};
966
};
Line 882... Line 967...
882
 
967
 
883
/* Power well structure for haswell */
968
/* Power well structure for haswell */
884
struct i915_power_well {
969
struct i915_power_well {
885
	struct drm_device *device;
970
	const char *name;
886
	spinlock_t lock;
971
	bool always_on;
887
	/* power well enable/disable usage count */
972
	/* power well enable/disable usage count */
-
 
973
	int count;
-
 
974
	unsigned long domains;
-
 
975
	void *data;
-
 
976
	void (*set)(struct drm_device *dev, struct i915_power_well *power_well,
-
 
977
		    bool enable);
-
 
978
	bool (*is_enabled)(struct drm_device *dev,
-
 
979
			   struct i915_power_well *power_well);
-
 
980
};
-
 
981
 
-
 
982
struct i915_power_domains {
-
 
983
	/*
-
 
984
	 * Power wells needed for initialization at driver init and suspend
-
 
985
	 * time are on. They are kept on until after the first modeset.
-
 
986
	 */
888
	int count;
987
	bool init_power_on;
-
 
988
	int power_well_count;
-
 
989
 
-
 
990
	struct mutex lock;
-
 
991
	int domain_use_count[POWER_DOMAIN_NUM];
889
	int i915_request;
992
	struct i915_power_well *power_wells;
Line 890... Line 993...
890
};
993
};
891
 
994
 
892
struct i915_dri1_state {
995
struct i915_dri1_state {
Line 912... Line 1015...
912
	 * transitioned away from for kernel modesetting.
1015
	 * transitioned away from for kernel modesetting.
913
	 */
1016
	 */
914
	int mm_suspended;
1017
	int mm_suspended;
915
};
1018
};
Line -... Line 1019...
-
 
1019
 
916
 
1020
#define MAX_L3_SLICES 2
917
struct intel_l3_parity {
1021
struct intel_l3_parity {
918
	u32 *remap_info;
1022
	u32 *remap_info[MAX_L3_SLICES];
-
 
1023
	struct work_struct error_work;
919
	struct work_struct error_work;
1024
	int which_slice;
Line 920... Line 1025...
920
};
1025
};
921
 
1026
 
922
struct i915_gem_mm {
1027
struct i915_gem_mm {
Line 936... Line 1041...
936
	unsigned long stolen_base; /* limited to low memory (32-bit) */
1041
	unsigned long stolen_base; /* limited to low memory (32-bit) */
Line 937... Line 1042...
937
 
1042
 
938
	/** PPGTT used for aliasing the PPGTT with the GTT */
1043
	/** PPGTT used for aliasing the PPGTT with the GTT */
Line 939... Line -...
939
	struct i915_hw_ppgtt *aliasing_ppgtt;
-
 
940
 
-
 
941
	bool shrinker_no_lock_stealing;
1044
	struct i915_hw_ppgtt *aliasing_ppgtt;
942
 
1045
 
Line 943... Line 1046...
943
	/** LRU list of objects with fence regs on them. */
1046
	/** LRU list of objects with fence regs on them. */
944
	struct list_head fence_list;
1047
	struct list_head fence_list;
Line 951... Line 1054...
951
	 * fires, go retire requests.
1054
	 * fires, go retire requests.
952
	 */
1055
	 */
953
	struct delayed_work retire_work;
1056
	struct delayed_work retire_work;
Line 954... Line 1057...
954
 
1057
 
-
 
1058
	/**
-
 
1059
	 * When we detect an idle GPU, we want to turn on
-
 
1060
	 * powersaving features. So once we see that there
-
 
1061
	 * are no more requests outstanding and no more
-
 
1062
	 * arrive within a small period of time, we fire
-
 
1063
	 * off the idle_work.
-
 
1064
	 */
-
 
1065
	struct delayed_work idle_work;
-
 
1066
 
955
	/**
1067
	/**
956
	 * Are we in a non-interruptible section of code like
1068
	 * Are we in a non-interruptible section of code like
957
	 * modesetting?
1069
	 * modesetting?
958
	 */
1070
	 */
Line 988... Line 1100...
988
 
1100
 
989
struct i915_gpu_error {
1101
struct i915_gpu_error {
990
	/* For hangcheck timer */
1102
	/* For hangcheck timer */
991
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
1103
#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
-
 
1104
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
-
 
1105
	/* Hang gpu twice in this window and your context gets banned */
-
 
1106
#define DRM_I915_CTX_BAN_PERIOD DIV_ROUND_UP(8*DRM_I915_HANGCHECK_PERIOD, 1000)
992
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
1107
 
Line 993... Line 1108...
993
	struct timer_list hangcheck_timer;
1108
	struct timer_list hangcheck_timer;
994
 
1109
 
995
	/* For reset and error_state handling. */
1110
	/* For reset and error_state handling. */
996
	spinlock_t lock;
1111
	spinlock_t lock;
997
	/* Protected by the above dev->gpu_error.lock. */
1112
	/* Protected by the above dev->gpu_error.lock. */
Line -... Line 1113...
-
 
1113
	struct drm_i915_error_state *first_error;
998
	struct drm_i915_error_state *first_error;
1114
	struct work_struct work;
Line 999... Line 1115...
999
	struct work_struct work;
1115
 
1000
 
1116
 
-
 
1117
	unsigned long missed_irq_rings;
-
 
1118
 
-
 
1119
	/**
-
 
1120
	 * State variable controlling the reset flow and count
-
 
1121
	 *
1001
	unsigned long last_reset;
1122
	 * This is a counter which gets incremented when reset is triggered,
-
 
1123
	 * and again when reset has been handled. So odd values (lowest bit set)
-
 
1124
	 * means that reset is in progress and even values that
1002
 
1125
	 * (reset_counter >> 1):th reset was successfully completed.
-
 
1126
	 *
-
 
1127
	 * If reset is not completed succesfully, the I915_WEDGE bit is
1003
	/**
1128
	 * set meaning that hardware is terminally sour and there is no
1004
	 * State variable and reset counter controlling the reset flow
1129
	 * recovery. All waiters on the reset_queue will be woken when
1005
	 *
1130
	 * that happens.
1006
	 * Upper bits are for the reset counter.  This counter is used by the
1131
	 *
1007
	 * wait_seqno code to race-free noticed that a reset event happened and
1132
	 * This counter is used by the wait_seqno code to notice that reset
1008
	 * that it needs to restart the entire ioctl (since most likely the
1133
	 * event happened and it needs to restart the entire ioctl (since most
1009
	 * seqno it waited for won't ever signal anytime soon).
1134
	 * likely the seqno it waited for won't ever signal anytime soon).
1010
	 *
-
 
1011
	 * This is important for lock-free wait paths, where no contended lock
-
 
1012
	 * naturally enforces the correct ordering between the bail-out of the
-
 
1013
	 * waiter and the gpu reset work code.
-
 
1014
	 *
-
 
1015
	 * Lowest bit controls the reset state machine: Set means a reset is in
-
 
1016
	 * progress. This state will (presuming we don't have any bugs) decay
1135
	 *
1017
	 * into either unset (successful reset) or the special WEDGED value (hw
1136
	 * This is important for lock-free wait paths, where no contended lock
Line 1018... Line -...
1018
	 * terminally sour). All waiters on the reset_queue will be woken when
-
 
1019
	 * that happens.
-
 
1020
	 */
-
 
1021
	atomic_t reset_counter;
-
 
1022
 
-
 
1023
	/**
-
 
1024
	 * Special values/flags for reset_counter
-
 
1025
	 *
1137
	 * naturally enforces the correct ordering between the bail-out of the
1026
	 * Note that the code relies on
1138
	 * waiter and the gpu reset work code.
Line 1027... Line 1139...
1027
	 * 	I915_WEDGED & I915_RESET_IN_PROGRESS_FLAG
1139
	 */
1028
	 * being true.
1140
	atomic_t reset_counter;
1029
	 */
1141
 
1030
#define I915_RESET_IN_PROGRESS_FLAG	1
1142
#define I915_RESET_IN_PROGRESS_FLAG	1
1031
#define I915_WEDGED			0xffffffff
1143
#define I915_WEDGED			(1 << 31)
Line 1032... Line 1144...
1032
 
1144
 
1033
	/**
1145
	/**
-
 
1146
	 * Waitqueue to signal when the reset has completed. Used by clients
-
 
1147
	 * that wait for dev_priv->mm.wedged to settle.
-
 
1148
	 */
1034
	 * Waitqueue to signal when the reset has completed. Used by clients
1149
	wait_queue_head_t reset_queue;
Line 1035... Line 1150...
1035
	 * that wait for dev_priv->mm.wedged to settle.
1150
 
1036
	 */
1151
	/* For gpu hang simulation. */
1037
	wait_queue_head_t reset_queue;
1152
	unsigned int stop_rings;
1038
 
1153
 
1039
	/* For gpu hang simulation. */
1154
	/* For missed irq/seqno simulation. */
Line -... Line 1155...
-
 
1155
	unsigned int test_irq_rings;
-
 
1156
};
-
 
1157
 
-
 
1158
enum modeset_restore {
-
 
1159
	MODESET_ON_LID_OPEN,
-
 
1160
	MODESET_DONE,
-
 
1161
	MODESET_SUSPENDED,
-
 
1162
};
1040
	unsigned int stop_rings;
1163
 
1041
};
1164
struct ddi_vbt_port_info {
1042
 
1165
	uint8_t hdmi_level_shift;
Line 1043... Line 1166...
1043
enum modeset_restore {
1166
 
Line 1069... Line 1192...
1069
	bool edp_initialized;
1192
	bool edp_initialized;
1070
	bool edp_support;
1193
	bool edp_support;
1071
	int edp_bpp;
1194
	int edp_bpp;
1072
	struct edp_power_seq edp_pps;
1195
	struct edp_power_seq edp_pps;
Line -... Line 1196...
-
 
1196
 
-
 
1197
	struct {
-
 
1198
		u16 pwm_freq_hz;
-
 
1199
		bool active_low_pwm;
-
 
1200
	} backlight;
-
 
1201
 
-
 
1202
	/* MIPI DSI */
-
 
1203
	struct {
-
 
1204
		u16 panel_id;
-
 
1205
	} dsi;
1073
 
1206
 
Line 1074... Line 1207...
1074
	int crt_ddc_pin;
1207
	int crt_ddc_pin;
1075
 
1208
 
-
 
1209
	int child_dev_num;
-
 
1210
	union child_device_config *child_dev;
1076
	int child_dev_num;
1211
 
Line 1077... Line 1212...
1077
	struct child_device_config *child_dev;
1212
	struct ddi_vbt_port_info ddi_port_info[I915_MAX_PORTS];
1078
};
1213
};
1079
 
1214
 
Line 1088... Line 1223...
1088
	uint32_t spr_val;
1223
	uint32_t spr_val;
1089
	uint32_t cur_val;
1224
	uint32_t cur_val;
1090
	uint32_t fbc_val;
1225
	uint32_t fbc_val;
1091
};
1226
};
Line -... Line 1227...
-
 
1227
 
-
 
1228
struct ilk_wm_values {
-
 
1229
	uint32_t wm_pipe[3];
-
 
1230
	uint32_t wm_lp[3];
-
 
1231
	uint32_t wm_lp_spr[3];
-
 
1232
	uint32_t wm_linetime[3];
-
 
1233
	bool enable_fbc_wm;
-
 
1234
	enum intel_ddb_partitioning partitioning;
-
 
1235
};
1092
 
1236
 
1093
/*
1237
/*
1094
 * This struct tracks the state needed for the Package C8+ feature.
1238
 * This struct tracks the state needed for the Package C8+ feature.
1095
 *
1239
 *
1096
 * Package states C8 and deeper are really deep PC states that can only be
1240
 * Package states C8 and deeper are really deep PC states that can only be
Line 1157... Line 1301...
1157
		uint32_t gtier;
1301
		uint32_t gtier;
1158
		uint32_t gen6_pmimr;
1302
		uint32_t gen6_pmimr;
1159
	} regsave;
1303
	} regsave;
1160
};
1304
};
Line -... Line 1305...
-
 
1305
 
-
 
1306
struct i915_runtime_pm {
-
 
1307
	bool suspended;
-
 
1308
};
-
 
1309
 
-
 
1310
enum intel_pipe_crc_source {
-
 
1311
	INTEL_PIPE_CRC_SOURCE_NONE,
-
 
1312
	INTEL_PIPE_CRC_SOURCE_PLANE1,
-
 
1313
	INTEL_PIPE_CRC_SOURCE_PLANE2,
-
 
1314
	INTEL_PIPE_CRC_SOURCE_PF,
-
 
1315
	INTEL_PIPE_CRC_SOURCE_PIPE,
-
 
1316
	/* TV/DP on pre-gen5/vlv can't use the pipe source. */
-
 
1317
	INTEL_PIPE_CRC_SOURCE_TV,
-
 
1318
	INTEL_PIPE_CRC_SOURCE_DP_B,
-
 
1319
	INTEL_PIPE_CRC_SOURCE_DP_C,
-
 
1320
	INTEL_PIPE_CRC_SOURCE_DP_D,
-
 
1321
	INTEL_PIPE_CRC_SOURCE_AUTO,
-
 
1322
	INTEL_PIPE_CRC_SOURCE_MAX,
-
 
1323
};
-
 
1324
 
-
 
1325
struct intel_pipe_crc_entry {
-
 
1326
	uint32_t frame;
-
 
1327
	uint32_t crc[5];
-
 
1328
};
-
 
1329
 
-
 
1330
#define INTEL_PIPE_CRC_ENTRIES_NR	128
-
 
1331
struct intel_pipe_crc {
-
 
1332
	spinlock_t lock;
-
 
1333
	bool opened;		/* exclusive access to the result file */
-
 
1334
	struct intel_pipe_crc_entry *entries;
-
 
1335
	enum intel_pipe_crc_source source;
-
 
1336
	int head, tail;
-
 
1337
	wait_queue_head_t wq;
-
 
1338
};
1161
 
1339
 
1162
typedef struct drm_i915_private {
1340
typedef struct drm_i915_private {
Line 1163... Line 1341...
1163
	struct drm_device *dev;
1341
	struct drm_device *dev;
Line 1201... Line 1379...
1201
 
1379
 
1202
	/* DPIO indirect register protection */
1380
	/* DPIO indirect register protection */
Line 1203... Line 1381...
1203
	struct mutex dpio_lock;
1381
	struct mutex dpio_lock;
-
 
1382
 
1204
 
1383
	/** Cached value of IMR to avoid reads in updating the bitfield */
-
 
1384
	union {
-
 
1385
	u32 irq_mask;
1205
	/** Cached value of IMR to avoid reads in updating the bitfield */
1386
		u32 de_irq_mask[I915_MAX_PIPES];
1206
	u32 irq_mask;
1387
	};
Line 1207... Line 1388...
1207
	u32 gt_irq_mask;
1388
	u32 gt_irq_mask;
1208
	u32 pm_irq_mask;
1389
	u32 pm_irq_mask;
Line 1227... Line 1408...
1227
	struct intel_opregion opregion;
1408
	struct intel_opregion opregion;
1228
	struct intel_vbt_data vbt;
1409
	struct intel_vbt_data vbt;
Line 1229... Line 1410...
1229
 
1410
 
1230
	/* overlay */
1411
	/* overlay */
1231
	struct intel_overlay *overlay;
-
 
Line 1232... Line -...
1232
	unsigned int sprite_scaling_enabled;
-
 
1233
 
-
 
1234
	/* backlight */
-
 
1235
	struct {
-
 
1236
		int level;
1412
	struct intel_overlay *overlay;
1237
		bool enabled;
1413
 
1238
		spinlock_t lock; /* bl registers and the above bl fields */
-
 
Line 1239... Line 1414...
1239
		struct backlight_device *device;
1414
	/* backlight registers and fields in struct intel_panel */
1240
	} backlight;
1415
	spinlock_t backlight_lock;
Line 1241... Line 1416...
1241
 
1416
 
Line 1280... Line 1455...
1280
 
1455
 
1281
    struct drm_crtc *plane_to_crtc_mapping[3];
1456
    struct drm_crtc *plane_to_crtc_mapping[3];
1282
    struct drm_crtc *pipe_to_crtc_mapping[3];
1457
    struct drm_crtc *pipe_to_crtc_mapping[3];
Line -... Line 1458...
-
 
1458
	wait_queue_head_t pending_flip_queue;
-
 
1459
 
-
 
1460
#ifdef CONFIG_DEBUG_FS
-
 
1461
	struct intel_pipe_crc pipe_crc[I915_MAX_PIPES];
1283
	wait_queue_head_t pending_flip_queue;
1462
#endif
1284
 
1463
 
1285
	int num_shared_dpll;
1464
	int num_shared_dpll;
-
 
1465
	struct intel_shared_dpll shared_dplls[I915_NUM_PLLS];
Line 1286... Line 1466...
1286
	struct intel_shared_dpll shared_dplls[I915_NUM_PLLS];
1466
	struct intel_ddi_plls ddi_plls;
1287
	struct intel_ddi_plls ddi_plls;
1467
	int dpio_phy_iosf_port[I915_NUM_PHYS_VLV];
1288
 
1468
 
1289
	/* Reclocking support */
1469
	/* Reclocking support */
Line 1305... Line 1485...
1305
 
1485
 
1306
	/* ilk-only ips/rps state. Everything in here is protected by the global
1486
	/* ilk-only ips/rps state. Everything in here is protected by the global
1307
	 * mchdev_lock in intel_pm.c */
1487
	 * mchdev_lock in intel_pm.c */
Line 1308... Line -...
1308
	struct intel_ilk_power_mgmt ips;
-
 
1309
 
1488
	struct intel_ilk_power_mgmt ips;
Line 1310... Line 1489...
1310
	/* Haswell power well */
1489
 
Line 1311... Line 1490...
1311
	struct i915_power_well power_well;
1490
	struct i915_power_domains power_domains;
Line 1312... Line 1491...
1312
 
1491
 
Line -... Line 1492...
-
 
1492
	struct i915_psr psr;
1313
	enum no_psr_reason no_psr_reason;
1493
 
1314
 
1494
	struct i915_gpu_error gpu_error;
-
 
1495
 
Line 1315... Line 1496...
1315
	struct i915_gpu_error gpu_error;
1496
	struct drm_i915_gem_object *vlv_pctx;
1316
 
1497
 
1317
	struct drm_i915_gem_object *vlv_pctx;
1498
#ifdef CONFIG_DRM_I915_FBDEV
1318
 
1499
	/* list of fbdev register on this device */
1319
	/* list of fbdev register on this device */
1500
    struct intel_fbdev *fbdev;
Line 1320... Line 1501...
1320
    struct intel_fbdev *fbdev;
1501
#endif
1321
 
1502
 
Line 1322... Line -...
1322
	/*
-
 
1323
	 * The console may be contended at resume, but we don't
1503
	/*
-
 
1504
	 * The console may be contended at resume, but we don't
Line 1324... Line 1505...
1324
	 * want it to block on it.
1505
	 * want it to block on it.
Line 1325... Line 1506...
1325
	 */
1506
	 */
Line 1345... Line 1526...
1345
		uint16_t pri_latency[5];
1526
		uint16_t pri_latency[5];
1346
		/* sprite */
1527
		/* sprite */
1347
		uint16_t spr_latency[5];
1528
		uint16_t spr_latency[5];
1348
		/* cursor */
1529
		/* cursor */
1349
		uint16_t cur_latency[5];
1530
		uint16_t cur_latency[5];
-
 
1531
 
-
 
1532
		/* current hardware state */
-
 
1533
		struct ilk_wm_values hw;
1350
	} wm;
1534
	} wm;
Line 1351... Line 1535...
1351
 
1535
 
Line -... Line 1536...
-
 
1536
	struct i915_package_c8 pc8;
-
 
1537
 
1352
	struct i915_package_c8 pc8;
1538
	struct i915_runtime_pm pm;
1353
 
1539
 
1354
	/* Old dri1 support infrastructure, beware the dragons ya fools entering
1540
	/* Old dri1 support infrastructure, beware the dragons ya fools entering
1355
	 * here! */
1541
	 * here! */
1356
	struct i915_dri1_state dri1;
1542
	struct i915_dri1_state dri1;
Line 1408... Line 1594...
1408
	struct list_head global_list;
1594
	struct list_head global_list;
Line 1409... Line 1595...
1409
 
1595
 
1410
    struct list_head ring_list;
1596
    struct list_head ring_list;
1411
	/** Used in execbuf to temporarily hold a ref */
1597
	/** Used in execbuf to temporarily hold a ref */
1412
	struct list_head obj_exec_link;
-
 
1413
    /** This object's place in the batchbuffer or on the eviction list */
-
 
Line 1414... Line 1598...
1414
    struct list_head exec_list;
1598
	struct list_head obj_exec_link;
1415
 
1599
 
1416
    /**
1600
    /**
1417
	 * This is set if the object is on the active lists (has pending
1601
	 * This is set if the object is on the active lists (has pending
Line 1495... Line 1679...
1495
 
1679
 
1496
	/* prime dma-buf support */
1680
	/* prime dma-buf support */
1497
	void *dma_buf_vmapping;
1681
	void *dma_buf_vmapping;
Line 1498... Line -...
1498
	int vmapping_count;
-
 
1499
 
-
 
1500
    /**
-
 
1501
     * Used for performing relocations during execbuffer insertion.
-
 
1502
     */
-
 
1503
    struct hlist_node exec_node;
-
 
1504
    unsigned long exec_handle;
-
 
1505
    struct drm_i915_gem_exec_object2 *exec_entry;
1682
	int vmapping_count;
Line 1506... Line 1683...
1506
 
1683
 
1507
	struct intel_ring_buffer *ring;
1684
	struct intel_ring_buffer *ring;
1508
 
1685
 
Line 1513... Line 1690...
1513
    uint32_t last_fenced_seqno;
1690
    uint32_t last_fenced_seqno;
Line 1514... Line 1691...
1514
 
1691
 
1515
    /** Current tiling stride for the object, if it's tiled. */
1692
    /** Current tiling stride for the object, if it's tiled. */
Line -... Line 1693...
-
 
1693
    uint32_t stride;
-
 
1694
 
-
 
1695
	/** References from framebuffers, locks out tiling changes. */
1516
    uint32_t stride;
1696
	unsigned long framebuffer_references;
1517
 
1697
 
Line 1518... Line 1698...
1518
    /** Record of address bit 17 of each page at last unbind. */
1698
    /** Record of address bit 17 of each page at last unbind. */
1519
    unsigned long *bit_17;
1699
    unsigned long *bit_17;
1520
 
1700
 
Line 1521... Line 1701...
1521
    /** User space pin count and filp owning the pin */
1701
    /** User space pin count and filp owning the pin */
1522
    uint32_t user_pin_count;
1702
	unsigned long user_pin_count;
1523
    struct drm_file *pin_filp;
1703
    struct drm_file *pin_filp;
Line 1568... Line 1748...
1568
	/** file_priv list entry for this request */
1748
	/** file_priv list entry for this request */
1569
	struct list_head client_list;
1749
	struct list_head client_list;
1570
};
1750
};
Line 1571... Line 1751...
1571
 
1751
 
-
 
1752
struct drm_i915_file_private {
-
 
1753
	struct drm_i915_private *dev_priv;
1572
struct drm_i915_file_private {
1754
 
1573
	struct {
1755
	struct {
1574
		spinlock_t lock;
1756
		spinlock_t lock;
-
 
1757
		struct list_head request_list;
1575
		struct list_head request_list;
1758
		struct delayed_work idle_work;
1576
	} mm;
1759
	} mm;
Line 1577... Line 1760...
1577
	struct idr context_idr;
1760
	struct idr context_idr;
-
 
1761
 
1578
 
1762
	struct i915_ctx_hang_stats hang_stats;
Line 1579... Line 1763...
1579
	struct i915_ctx_hang_stats hang_stats;
1763
	atomic_t rps_wait_boost;
Line 1580... Line 1764...
1580
};
1764
};
1581
 
1765
 
1582
#define INTEL_INFO(dev)	(to_i915(dev)->info)
1766
#define INTEL_INFO(dev)	(to_i915(dev)->info)
1583
 
1767
 
1584
#define IS_I830(dev)		((dev)->pci_device == 0x3577)
1768
#define IS_I830(dev)		((dev)->pdev->device == 0x3577)
1585
#define IS_845G(dev)		((dev)->pci_device == 0x2562)
1769
#define IS_845G(dev)		((dev)->pdev->device == 0x2562)
1586
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
1770
#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
1587
#define IS_I865G(dev)		((dev)->pci_device == 0x2572)
1771
#define IS_I865G(dev)		((dev)->pdev->device == 0x2572)
1588
#define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
1772
#define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
1589
#define IS_I915GM(dev)		((dev)->pci_device == 0x2592)
1773
#define IS_I915GM(dev)		((dev)->pdev->device == 0x2592)
1590
#define IS_I945G(dev)		((dev)->pci_device == 0x2772)
1774
#define IS_I945G(dev)		((dev)->pdev->device == 0x2772)
1591
#define IS_I945GM(dev)		(INTEL_INFO(dev)->is_i945gm)
1775
#define IS_I945GM(dev)		(INTEL_INFO(dev)->is_i945gm)
1592
#define IS_BROADWATER(dev)	(INTEL_INFO(dev)->is_broadwater)
1776
#define IS_BROADWATER(dev)	(INTEL_INFO(dev)->is_broadwater)
1593
#define IS_CRESTLINE(dev)	(INTEL_INFO(dev)->is_crestline)
1777
#define IS_CRESTLINE(dev)	(INTEL_INFO(dev)->is_crestline)
1594
#define IS_GM45(dev)		((dev)->pci_device == 0x2A42)
1778
#define IS_GM45(dev)		((dev)->pdev->device == 0x2A42)
1595
#define IS_G4X(dev)		(INTEL_INFO(dev)->is_g4x)
1779
#define IS_G4X(dev)		(INTEL_INFO(dev)->is_g4x)
1596
#define IS_PINEVIEW_G(dev)	((dev)->pci_device == 0xa001)
1780
#define IS_PINEVIEW_G(dev)	((dev)->pdev->device == 0xa001)
1597
#define IS_PINEVIEW_M(dev)	((dev)->pci_device == 0xa011)
1781
#define IS_PINEVIEW_M(dev)	((dev)->pdev->device == 0xa011)
1598
#define IS_PINEVIEW(dev)	(INTEL_INFO(dev)->is_pineview)
1782
#define IS_PINEVIEW(dev)	(INTEL_INFO(dev)->is_pineview)
1599
#define IS_G33(dev)		(INTEL_INFO(dev)->is_g33)
1783
#define IS_G33(dev)		(INTEL_INFO(dev)->is_g33)
1600
#define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
1784
#define IS_IRONLAKE_M(dev)	((dev)->pdev->device == 0x0046)
1601
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
1785
#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
1602
#define IS_IVB_GT1(dev)		((dev)->pci_device == 0x0156 || \
1786
#define IS_IVB_GT1(dev)		((dev)->pdev->device == 0x0156 || \
1603
				 (dev)->pci_device == 0x0152 ||	\
1787
				 (dev)->pdev->device == 0x0152 || \
1604
				 (dev)->pci_device == 0x015a)
1788
				 (dev)->pdev->device == 0x015a)
1605
#define IS_SNB_GT1(dev)		((dev)->pci_device == 0x0102 || \
1789
#define IS_SNB_GT1(dev)		((dev)->pdev->device == 0x0102 || \
-
 
1790
				 (dev)->pdev->device == 0x0106 || \
1606
				 (dev)->pci_device == 0x0106 ||	\
1791
				 (dev)->pdev->device == 0x010A)
1607
				 (dev)->pci_device == 0x010A)
1792
#define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
1608
#define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
1793
#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
-
 
1794
#define IS_BROADWELL(dev)	(INTEL_INFO(dev)->gen == 8)
-
 
1795
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
-
 
1796
#define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
-
 
1797
				 ((dev)->pdev->device & 0xFF00) == 0x0C00)
1609
#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
1798
#define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
1610
#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
1799
				 (((dev)->pdev->device & 0xf) == 0x2  || \
-
 
1800
				 ((dev)->pdev->device & 0xf) == 0x6 || \
-
 
1801
				 ((dev)->pdev->device & 0xf) == 0xe))
-
 
1802
#define IS_HSW_ULT(dev)		(IS_HASWELL(dev) && \
-
 
1803
				 ((dev)->pdev->device & 0xFF00) == 0x0A00)
Line 1611... Line 1804...
1611
#define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
1804
#define IS_ULT(dev)		(IS_HSW_ULT(dev) || IS_BDW_ULT(dev))
1612
				 ((dev)->pci_device & 0xFF00) == 0x0C00)
1805
#define IS_HSW_GT3(dev)		(IS_HASWELL(dev) && \
1613
#define IS_ULT(dev)		(IS_HASWELL(dev) && \
1806
				 ((dev)->pdev->device & 0x00F0) == 0x0020)
1614
				 ((dev)->pci_device & 0xFF00) == 0x0A00)
1807
#define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
Line 1623... Line 1816...
1623
#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
1816
#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
1624
#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
1817
#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
1625
#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
1818
#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
1626
#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
1819
#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
1627
#define IS_GEN7(dev)	(INTEL_INFO(dev)->gen == 7)
1820
#define IS_GEN7(dev)	(INTEL_INFO(dev)->gen == 7)
-
 
1821
#define IS_GEN8(dev)	(INTEL_INFO(dev)->gen == 8)
Line -... Line 1822...
-
 
1822
 
-
 
1823
#define RENDER_RING		(1<
-
 
1824
#define BSD_RING		(1<
-
 
1825
#define BLT_RING		(1<
1628
 
1826
#define VEBOX_RING		(1<
1629
#define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
1827
#define HAS_BSD(dev)            (INTEL_INFO(dev)->ring_mask & BSD_RING)
1630
#define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
1828
#define HAS_BLT(dev)            (INTEL_INFO(dev)->ring_mask & BLT_RING)
1631
#define HAS_VEBOX(dev)          (INTEL_INFO(dev)->has_vebox_ring)
1829
#define HAS_VEBOX(dev)            (INTEL_INFO(dev)->ring_mask & VEBOX_RING)
1632
#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
1830
#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
1633
#define HAS_WT(dev)            (IS_HASWELL(dev) && to_i915(dev)->ellc_size)
1831
#define HAS_WT(dev)            (IS_HASWELL(dev) && to_i915(dev)->ellc_size)
Line 1634... Line 1832...
1634
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
1832
#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
Line 1648... Line 1846...
1648
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
1846
#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
1649
						      IS_I915GM(dev)))
1847
						      IS_I915GM(dev)))
1650
#define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
1848
#define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
1651
#define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
1849
#define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
1652
#define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
1850
#define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
1653
#define SUPPORTS_EDP(dev)		(IS_IRONLAKE_M(dev))
-
 
1654
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
1851
#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
1655
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
1852
#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
Line 1656... Line 1853...
1656
 
1853
 
1657
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
1854
#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
1658
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
1855
#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
Line 1659... Line 1856...
1659
#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
1856
#define HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
Line 1660... Line 1857...
1660
 
1857
 
1661
#define HAS_IPS(dev)		(IS_ULT(dev))
-
 
1662
 
1858
#define HAS_IPS(dev)		(IS_ULT(dev) || IS_BROADWELL(dev))
-
 
1859
 
-
 
1860
#define HAS_DDI(dev)		(INTEL_INFO(dev)->has_ddi)
-
 
1861
#define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
Line 1663... Line 1862...
1663
#define HAS_DDI(dev)		(INTEL_INFO(dev)->has_ddi)
1862
#define HAS_PSR(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev))
1664
#define HAS_POWER_WELL(dev)	(IS_HASWELL(dev))
1863
#define HAS_PC8(dev)		(IS_HASWELL(dev)) /* XXX HSW:ULX */
1665
#define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
1864
#define HAS_RUNTIME_PM(dev)	(IS_HASWELL(dev))
1666
 
1865
 
Line 1676... Line 1875...
1676
#define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
1875
#define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
1677
#define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
1876
#define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
1678
#define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP)
1877
#define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP)
1679
#define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE)
1878
#define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE)
Line -... Line 1879...
-
 
1879
 
1680
 
1880
/* DPF == dynamic parity feature */
1681
#define HAS_FORCE_WAKE(dev) (INTEL_INFO(dev)->has_force_wake)
-
 
1682
 
1881
#define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
Line 1683... Line 1882...
1683
#define HAS_L3_GPU_CACHE(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
1882
#define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
Line 1684... Line 1883...
1684
 
1883
 
Line 1685... Line -...
1685
#define GT_FREQUENCY_MULTIPLIER 50
-
 
1686
 
-
 
1687
#include "i915_trace.h"
-
 
1688
 
-
 
1689
/**
-
 
1690
 * RC6 is a special power stage which allows the GPU to enter an very
-
 
1691
 * low-voltage mode when idle, using down to 0V while at this stage.  This
-
 
1692
 * stage is entered automatically when the GPU is idle when RC6 support is
-
 
1693
 * enabled, and as soon as new workload arises GPU wakes up automatically as well.
-
 
1694
 *
-
 
1695
 * There are different RC6 modes available in Intel GPU, which differentiate
-
 
1696
 * among each other with the latency required to enter and leave RC6 and
-
 
1697
 * voltage consumed by the GPU in different states.
-
 
1698
 *
-
 
1699
 * The combination of the following flags define which states GPU is allowed
-
 
1700
 * to enter, while RC6 is the normal RC6 state, RC6p is the deep RC6, and
-
 
1701
 * RC6pp is deepest RC6. Their support by hardware varies according to the
-
 
1702
 * GPU, BIOS, chipset and platform. RC6 is usually the safest one and the one
-
 
1703
 * which brings the most power savings; deeper states save more power, but
-
 
1704
 * require higher latency to switch to and wake up.
-
 
1705
 */
-
 
1706
#define INTEL_RC6_ENABLE			(1<<0)
1884
#define GT_FREQUENCY_MULTIPLIER 50
1707
#define INTEL_RC6p_ENABLE			(1<<1)
1885
 
1708
#define INTEL_RC6pp_ENABLE			(1<<2)
1886
#include "i915_trace.h"
1709
 
1887
 
1710
extern unsigned int i915_fbpercrtc      __always_unused;
1888
extern unsigned int i915_fbpercrtc      __always_unused;
Line 1762... Line 1940...
1762
/* i915_irq.c */
1940
/* i915_irq.c */
1763
void i915_queue_hangcheck(struct drm_device *dev);
1941
void i915_queue_hangcheck(struct drm_device *dev);
1764
void i915_handle_error(struct drm_device *dev, bool wedged);
1942
void i915_handle_error(struct drm_device *dev, bool wedged);
Line 1765... Line 1943...
1765
 
1943
 
1766
extern void intel_irq_init(struct drm_device *dev);
-
 
1767
extern void intel_pm_init(struct drm_device *dev);
1944
extern void intel_irq_init(struct drm_device *dev);
1768
extern void intel_hpd_init(struct drm_device *dev);
-
 
Line 1769... Line 1945...
1769
extern void intel_pm_init(struct drm_device *dev);
1945
extern void intel_hpd_init(struct drm_device *dev);
1770
 
1946
 
1771
extern void intel_uncore_sanitize(struct drm_device *dev);
1947
extern void intel_uncore_sanitize(struct drm_device *dev);
1772
extern void intel_uncore_early_sanitize(struct drm_device *dev);
-
 
1773
extern void intel_uncore_init(struct drm_device *dev);
1948
extern void intel_uncore_early_sanitize(struct drm_device *dev);
-
 
1949
extern void intel_uncore_init(struct drm_device *dev);
Line 1774... Line 1950...
1774
extern void intel_uncore_clear_errors(struct drm_device *dev);
1950
extern void intel_uncore_check_errors(struct drm_device *dev);
1775
extern void intel_uncore_check_errors(struct drm_device *dev);
1951
extern void intel_uncore_fini(struct drm_device *dev);
Line 1776... Line 1952...
1776
 
1952
 
1777
void
1953
void
Line 1778... Line 1954...
1778
i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1954
i915_enable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe, u32 mask);
1779
 
1955
 
1780
void
1956
void
1781
i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1957
i915_disable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe, u32 mask);
Line 1828... Line 2004...
1828
int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
2004
int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
1829
			struct drm_file *file_priv);
2005
			struct drm_file *file_priv);
1830
void i915_gem_load(struct drm_device *dev);
2006
void i915_gem_load(struct drm_device *dev);
1831
void *i915_gem_object_alloc(struct drm_device *dev);
2007
void *i915_gem_object_alloc(struct drm_device *dev);
1832
void i915_gem_object_free(struct drm_i915_gem_object *obj);
2008
void i915_gem_object_free(struct drm_i915_gem_object *obj);
1833
int i915_gem_init_object(struct drm_gem_object *obj);
-
 
1834
void i915_gem_object_init(struct drm_i915_gem_object *obj,
2009
void i915_gem_object_init(struct drm_i915_gem_object *obj,
1835
			 const struct drm_i915_gem_object_ops *ops);
2010
			 const struct drm_i915_gem_object_ops *ops);
1836
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
2011
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
1837
						  size_t size);
2012
						  size_t size);
1838
void i915_gem_free_object(struct drm_gem_object *obj);
2013
void i915_gem_free_object(struct drm_gem_object *obj);
1839
struct i915_vma *i915_gem_vma_create(struct drm_i915_gem_object *obj,
-
 
1840
				     struct i915_address_space *vm);
-
 
1841
void i915_gem_vma_destroy(struct i915_vma *vma);
2014
void i915_gem_vma_destroy(struct i915_vma *vma);
Line 1842... Line 2015...
1842
 
2015
 
1843
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
2016
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
1844
				     struct i915_address_space *vm,
2017
				     struct i915_address_space *vm,
Line 1847... Line 2020...
1847
				     bool nonblocking);
2020
				     bool nonblocking);
1848
void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
2021
void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
1849
int __must_check i915_vma_unbind(struct i915_vma *vma);
2022
int __must_check i915_vma_unbind(struct i915_vma *vma);
1850
int __must_check i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj);
2023
int __must_check i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj);
1851
int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
2024
int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
-
 
2025
void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
1852
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
2026
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
1853
void i915_gem_lastclose(struct drm_device *dev);
2027
void i915_gem_lastclose(struct drm_device *dev);
Line 1854... Line 2028...
1854
 
2028
 
1855
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
2029
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
Line 1874... Line 2048...
1874
}
2048
}
Line 1875... Line 2049...
1875
 
2049
 
1876
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
2050
int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
1877
int i915_gem_object_sync(struct drm_i915_gem_object *obj,
2051
int i915_gem_object_sync(struct drm_i915_gem_object *obj,
1878
			 struct intel_ring_buffer *to);
2052
			 struct intel_ring_buffer *to);
1879
void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
2053
void i915_vma_move_to_active(struct i915_vma *vma,
1880
				    struct intel_ring_buffer *ring);
-
 
1881
 
2054
				    struct intel_ring_buffer *ring);
1882
int i915_gem_dumb_create(struct drm_file *file_priv,
2055
int i915_gem_dumb_create(struct drm_file *file_priv,
1883
			 struct drm_device *dev,
2056
			 struct drm_device *dev,
1884
			 struct drm_mode_create_dumb *args);
2057
			 struct drm_mode_create_dumb *args);
1885
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
2058
int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
Line 1917... Line 2090...
1917
		WARN_ON(dev_priv->fence_regs[obj->fence_reg].pin_count <= 0);
2090
		WARN_ON(dev_priv->fence_regs[obj->fence_reg].pin_count <= 0);
1918
		dev_priv->fence_regs[obj->fence_reg].pin_count--;
2091
		dev_priv->fence_regs[obj->fence_reg].pin_count--;
1919
	}
2092
	}
1920
}
2093
}
Line 1921... Line 2094...
1921
 
2094
 
1922
void i915_gem_retire_requests(struct drm_device *dev);
2095
bool i915_gem_retire_requests(struct drm_device *dev);
1923
void i915_gem_retire_requests_ring(struct intel_ring_buffer *ring);
2096
void i915_gem_retire_requests_ring(struct intel_ring_buffer *ring);
1924
int __must_check i915_gem_check_wedge(struct i915_gpu_error *error,
2097
int __must_check i915_gem_check_wedge(struct i915_gpu_error *error,
1925
				      bool interruptible);
2098
				      bool interruptible);
1926
static inline bool i915_reset_in_progress(struct i915_gpu_error *error)
2099
static inline bool i915_reset_in_progress(struct i915_gpu_error *error)
1927
{
2100
{
1928
	return unlikely(atomic_read(&error->reset_counter)
2101
	return unlikely(atomic_read(&error->reset_counter)
1929
			& I915_RESET_IN_PROGRESS_FLAG);
2102
			& (I915_RESET_IN_PROGRESS_FLAG | I915_WEDGED));
Line 1930... Line 2103...
1930
}
2103
}
1931
 
2104
 
1932
static inline bool i915_terminally_wedged(struct i915_gpu_error *error)
2105
static inline bool i915_terminally_wedged(struct i915_gpu_error *error)
-
 
2106
{
-
 
2107
	return atomic_read(&error->reset_counter) & I915_WEDGED;
-
 
2108
}
-
 
2109
 
-
 
2110
static inline u32 i915_reset_count(struct i915_gpu_error *error)
1933
{
2111
{
Line 1934... Line 2112...
1934
	return atomic_read(&error->reset_counter) == I915_WEDGED;
2112
	return ((atomic_read(&error->reset_counter) & ~I915_WEDGED) + 1) / 2;
1935
}
2113
}
1936
 
2114
 
1937
void i915_gem_reset(struct drm_device *dev);
2115
void i915_gem_reset(struct drm_device *dev);
1938
bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
2116
bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
1939
int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
2117
int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
1940
int __must_check i915_gem_init(struct drm_device *dev);
2118
int __must_check i915_gem_init(struct drm_device *dev);
1941
int __must_check i915_gem_init_hw(struct drm_device *dev);
2119
int __must_check i915_gem_init_hw(struct drm_device *dev);
1942
void i915_gem_l3_remap(struct drm_device *dev);
2120
int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice);
1943
void i915_gem_init_swizzling(struct drm_device *dev);
2121
void i915_gem_init_swizzling(struct drm_device *dev);
1944
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
2122
void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
1945
int __must_check i915_gpu_idle(struct drm_device *dev);
2123
int __must_check i915_gpu_idle(struct drm_device *dev);
1946
int __must_check i915_gem_idle(struct drm_device *dev);
2124
int __must_check i915_gem_suspend(struct drm_device *dev);
1947
int __i915_add_request(struct intel_ring_buffer *ring,
2125
int __i915_add_request(struct intel_ring_buffer *ring,
1948
				  struct drm_file *file,
2126
				  struct drm_file *file,
Line 1968... Line 2146...
1968
				int id,
2146
				int id,
1969
				int align);
2147
				int align);
1970
void i915_gem_detach_phys_object(struct drm_device *dev,
2148
void i915_gem_detach_phys_object(struct drm_device *dev,
1971
				 struct drm_i915_gem_object *obj);
2149
				 struct drm_i915_gem_object *obj);
1972
void i915_gem_free_all_phys_object(struct drm_device *dev);
2150
void i915_gem_free_all_phys_object(struct drm_device *dev);
-
 
2151
int i915_gem_open(struct drm_device *dev, struct drm_file *file);
1973
void i915_gem_release(struct drm_device *dev, struct drm_file *file);
2152
void i915_gem_release(struct drm_device *dev, struct drm_file *file);
Line 1974... Line 2153...
1974
 
2153
 
1975
uint32_t
2154
uint32_t
1976
i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode);
2155
i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode);
Line 1999... Line 2178...
1999
struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
2178
struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
2000
				     struct i915_address_space *vm);
2179
				     struct i915_address_space *vm);
2001
struct i915_vma *
2180
struct i915_vma *
2002
i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
2181
i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
2003
				  struct i915_address_space *vm);
2182
				  struct i915_address_space *vm);
-
 
2183
 
-
 
2184
struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj);
-
 
2185
 
2004
/* Some GGTT VM helpers */
2186
/* Some GGTT VM helpers */
2005
#define obj_to_ggtt(obj) \
2187
#define obj_to_ggtt(obj) \
2006
	(&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
2188
	(&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
2007
static inline bool i915_is_ggtt(struct i915_address_space *vm)
2189
static inline bool i915_is_ggtt(struct i915_address_space *vm)
2008
{
2190
{
Line 2035... Line 2217...
2035
		      bool nonblocking)
2217
		      bool nonblocking)
2036
{
2218
{
2037
	return i915_gem_object_pin(obj, obj_to_ggtt(obj), alignment,
2219
	return i915_gem_object_pin(obj, obj_to_ggtt(obj), alignment,
2038
				   map_and_fenceable, nonblocking);
2220
				   map_and_fenceable, nonblocking);
2039
}
2221
}
2040
#undef obj_to_ggtt
-
 
Line 2041... Line 2222...
2041
 
2222
 
2042
/* i915_gem_context.c */
2223
/* i915_gem_context.c */
2043
void i915_gem_context_init(struct drm_device *dev);
2224
int __must_check i915_gem_context_init(struct drm_device *dev);
2044
void i915_gem_context_fini(struct drm_device *dev);
2225
void i915_gem_context_fini(struct drm_device *dev);
2045
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
2226
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
2046
int i915_switch_context(struct intel_ring_buffer *ring,
2227
int i915_switch_context(struct intel_ring_buffer *ring,
2047
			struct drm_file *file, int to_id);
2228
			struct drm_file *file, int to_id);
Line 2098... Line 2279...
2098
					  int min_size,
2279
					  int min_size,
2099
					  unsigned alignment,
2280
					  unsigned alignment,
2100
					  unsigned cache_level,
2281
					  unsigned cache_level,
2101
					  bool mappable,
2282
					  bool mappable,
2102
					  bool nonblock);
2283
					  bool nonblock);
-
 
2284
int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle);
2103
int i915_gem_evict_everything(struct drm_device *dev);
2285
int i915_gem_evict_everything(struct drm_device *dev);
Line 2104... Line 2286...
2104
 
2286
 
2105
/* i915_gem_stolen.c */
2287
/* i915_gem_stolen.c */
2106
int i915_gem_init_stolen(struct drm_device *dev);
2288
int i915_gem_init_stolen(struct drm_device *dev);
Line 2137... Line 2319...
2137
#endif
2319
#endif
Line 2138... Line 2320...
2138
 
2320
 
2139
/* i915_debugfs.c */
2321
/* i915_debugfs.c */
2140
int i915_debugfs_init(struct drm_minor *minor);
2322
int i915_debugfs_init(struct drm_minor *minor);
-
 
2323
void i915_debugfs_cleanup(struct drm_minor *minor);
-
 
2324
#ifdef CONFIG_DEBUG_FS
-
 
2325
void intel_display_crc_init(struct drm_device *dev);
-
 
2326
#else
-
 
2327
static inline void intel_display_crc_init(struct drm_device *dev) {}
Line 2141... Line 2328...
2141
void i915_debugfs_cleanup(struct drm_minor *minor);
2328
#endif
2142
 
2329
 
2143
/* i915_gpu_error.c */
2330
/* i915_gpu_error.c */
2144
__printf(2, 3)
2331
__printf(2, 3)
Line 2190... Line 2377...
2190
	return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
2377
	return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
2191
}
2378
}
2192
extern void intel_i2c_reset(struct drm_device *dev);
2379
extern void intel_i2c_reset(struct drm_device *dev);
Line 2193... Line 2380...
2193
 
2380
 
2194
/* intel_opregion.c */
2381
/* intel_opregion.c */
2195
extern int intel_opregion_setup(struct drm_device *dev);
2382
struct intel_encoder;
-
 
2383
#ifdef CONFIG_ACPI
2196
#ifdef CONFIG_ACPI
2384
extern int intel_opregion_setup(struct drm_device *dev);
2197
extern void intel_opregion_init(struct drm_device *dev);
2385
extern void intel_opregion_init(struct drm_device *dev);
2198
extern void intel_opregion_fini(struct drm_device *dev);
2386
extern void intel_opregion_fini(struct drm_device *dev);
-
 
2387
extern void intel_opregion_asle_intr(struct drm_device *dev);
-
 
2388
extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
-
 
2389
					 bool enable);
-
 
2390
extern int intel_opregion_notify_adapter(struct drm_device *dev,
2199
extern void intel_opregion_asle_intr(struct drm_device *dev);
2391
					 pci_power_t state);
-
 
2392
#else
2200
#else
2393
static inline int intel_opregion_setup(struct drm_device *dev) { return 0; }
2201
static inline void intel_opregion_init(struct drm_device *dev) { return; }
2394
static inline void intel_opregion_init(struct drm_device *dev) { return; }
2202
static inline void intel_opregion_fini(struct drm_device *dev) { return; }
2395
static inline void intel_opregion_fini(struct drm_device *dev) { return; }
-
 
2396
static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
-
 
2397
static inline int
-
 
2398
intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
-
 
2399
{
-
 
2400
	return 0;
-
 
2401
}
-
 
2402
static inline int
-
 
2403
intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
-
 
2404
{
-
 
2405
	return 0;
2203
static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
2406
}
Line 2204... Line 2407...
2204
#endif
2407
#endif
2205
 
2408
 
2206
/* intel_acpi.c */
2409
/* intel_acpi.c */
Line 2235... Line 2438...
2235
extern int intel_enable_rc6(const struct drm_device *dev);
2438
extern int intel_enable_rc6(const struct drm_device *dev);
Line 2236... Line 2439...
2236
 
2439
 
2237
extern bool i915_semaphore_is_enabled(struct drm_device *dev);
2440
extern bool i915_semaphore_is_enabled(struct drm_device *dev);
2238
int i915_reg_read_ioctl(struct drm_device *dev, void *data,
2441
int i915_reg_read_ioctl(struct drm_device *dev, void *data,
-
 
2442
			struct drm_file *file);
-
 
2443
int i915_get_reset_stats_ioctl(struct drm_device *dev, void *data,
Line 2239... Line 2444...
2239
			struct drm_file *file);
2444
			       struct drm_file *file);
2240
 
2445
 
2241
/* overlay */
2446
/* overlay */
2242
#ifdef CONFIG_DEBUG_FS
2447
#ifdef CONFIG_DEBUG_FS
Line 2252... Line 2457...
2252
 
2457
 
2253
/* On SNB platform, before reading ring registers forcewake bit
2458
/* On SNB platform, before reading ring registers forcewake bit
2254
 * must be set to prevent GT core from power down and stale values being
2459
 * must be set to prevent GT core from power down and stale values being
2255
 * returned.
2460
 * returned.
2256
 */
2461
 */
2257
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
2462
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine);
Line 2258... Line 2463...
2258
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
2463
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
2259
 
2464
 
Line 2260... Line 2465...
2260
int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val);
2465
int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val);
2261
int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u8 mbox, u32 val);
2466
int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u8 mbox, u32 val);
2262
 
2467
 
2263
/* intel_sideband.c */
2468
/* intel_sideband.c */
2264
u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr);
2469
u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr);
2265
void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val);
2470
void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val);
-
 
2471
u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr);
-
 
2472
u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg);
-
 
2473
void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-
 
2474
u32 vlv_cck_read(struct drm_i915_private *dev_priv, u32 reg);
-
 
2475
void vlv_cck_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-
 
2476
u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg);
-
 
2477
void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-
 
2478
u32 vlv_bunit_read(struct drm_i915_private *dev_priv, u32 reg);
-
 
2479
void vlv_bunit_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-
 
2480
u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg);
2266
u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr);
2481
void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
2267
u32 vlv_dpio_read(struct drm_i915_private *dev_priv, int reg);
2482
u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg);
2268
void vlv_dpio_write(struct drm_i915_private *dev_priv, int reg, u32 val);
2483
void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int reg, u32 val);
2269
u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg,
2484
u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg,
-
 
2485
		   enum intel_sbi_destination destination);
-
 
2486
void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
Line 2270... Line 2487...
2270
		   enum intel_sbi_destination destination);
2487
		     enum intel_sbi_destination destination);
2271
void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
2488
u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg);
Line 2272... Line -...
2272
		     enum intel_sbi_destination destination);
-
 
2273
 
2489
void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
2274
int vlv_gpu_freq(int ddr_freq, int val);
-
 
2275
int vlv_freq_opcode(int ddr_freq, int val);
-
 
2276
 
-
 
2277
#define __i915_read(x) \
-
 
2278
	u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg, bool trace);
-
 
2279
__i915_read(8)
-
 
2280
__i915_read(16)
-
 
2281
__i915_read(32)
2490
 
2282
__i915_read(64)
-
 
2283
#undef __i915_read
-
 
2284
 
-
 
2285
#define __i915_write(x) \
-
 
2286
	void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val, bool trace);
-
 
2287
__i915_write(8)
-
 
2288
__i915_write(16)
-
 
2289
__i915_write(32)
-
 
2290
__i915_write(64)
-
 
2291
#undef __i915_write
-
 
2292
 
-
 
2293
#define I915_READ8(reg)		i915_read8(dev_priv, (reg), true)
-
 
2294
#define I915_WRITE8(reg, val)	i915_write8(dev_priv, (reg), (val), true)
-
 
2295
 
-
 
2296
#define I915_READ16(reg)	i915_read16(dev_priv, (reg), true)
-
 
2297
#define I915_WRITE16(reg, val)	i915_write16(dev_priv, (reg), (val), true)
-
 
2298
#define I915_READ16_NOTRACE(reg)	i915_read16(dev_priv, (reg), false)
-
 
2299
#define I915_WRITE16_NOTRACE(reg, val)	i915_write16(dev_priv, (reg), (val), false)
-
 
Line -... Line 2491...
-
 
2491
int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val);
-
 
2492
int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);
-
 
2493
 
-
 
2494
void vlv_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine);
-
 
2495
void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
-
 
2496
 
-
 
2497
#define FORCEWAKE_VLV_RENDER_RANGE_OFFSET(reg) \
-
 
2498
	(((reg) >= 0x2000 && (reg) < 0x4000) ||\
-
 
2499
	((reg) >= 0x5000 && (reg) < 0x8000) ||\
-
 
2500
	((reg) >= 0xB000 && (reg) < 0x12000) ||\
-
 
2501
	((reg) >= 0x2E000 && (reg) < 0x30000))
-
 
2502
 
-
 
2503
#define FORCEWAKE_VLV_MEDIA_RANGE_OFFSET(reg)\
-
 
2504
	(((reg) >= 0x12000 && (reg) < 0x14000) ||\
-
 
2505
	((reg) >= 0x22000 && (reg) < 0x24000) ||\
-
 
2506
	((reg) >= 0x30000 && (reg) < 0x40000))
-
 
2507
 
-
 
2508
#define FORCEWAKE_RENDER	(1 << 0)
-
 
2509
#define FORCEWAKE_MEDIA		(1 << 1)
-
 
2510
#define FORCEWAKE_ALL		(FORCEWAKE_RENDER | FORCEWAKE_MEDIA)
-
 
2511
 
-
 
2512
 
-
 
2513
#define I915_READ8(reg)		dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
-
 
2514
#define I915_WRITE8(reg, val)	dev_priv->uncore.funcs.mmio_writeb(dev_priv, (reg), (val), true)
-
 
2515
 
-
 
2516
#define I915_READ16(reg)	dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), true)
-
 
2517
#define I915_WRITE16(reg, val)	dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), true)
-
 
2518
#define I915_READ16_NOTRACE(reg)	dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), false)
-
 
2519
#define I915_WRITE16_NOTRACE(reg, val)	dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), false)
2300
 
2520
 
2301
#define I915_READ(reg)		i915_read32(dev_priv, (reg), true)
2521
#define I915_READ(reg)		dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), true)
Line 2302... Line 2522...
2302
#define I915_WRITE(reg, val)	i915_write32(dev_priv, (reg), (val), true)
2522
#define I915_WRITE(reg, val)	dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
2303
#define I915_READ_NOTRACE(reg)		i915_read32(dev_priv, (reg), false)
2523
#define I915_READ_NOTRACE(reg)		dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), false)
Line 2304... Line 2524...
2304
#define I915_WRITE_NOTRACE(reg, val)	i915_write32(dev_priv, (reg), (val), false)
2524
#define I915_WRITE_NOTRACE(reg, val)	dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), false)
Line 2370... Line 2590...
2370
 
2590
 
2371
void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode);
2591
void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode);
2372
struct drm_i915_gem_object
2592
struct drm_i915_gem_object
Line 2373... Line 2593...
2373
*kos_gem_fb_object_create(struct drm_device *dev, u32 gtt_offset, u32 size);
2593
*kos_gem_fb_object_create(struct drm_device *dev, u32 gtt_offset, u32 size);
-
 
2594
 
2374
 
2595
extern struct drm_i915_gem_object *main_fb_obj;
2375
extern struct drm_i915_gem_object *fb_obj;
2596
 
2376
static struct drm_i915_gem_object *get_fb_obj()
2597
static struct drm_i915_gem_object *get_fb_obj()
2377
{
2598
{
Line 2378... Line -...
2378
    return fb_obj;
-
 
2379
};
2599
    return main_fb_obj;
Line 2380... Line 2600...
2380
 
2600
};