i915_drv.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  1. /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
  2. */
  3. /*
  4. *
  5. * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  6. * All Rights Reserved.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the
  10. * "Software"), to deal in the Software without restriction, including
  11. * without limitation the rights to use, copy, modify, merge, publish,
  12. * distribute, sub license, and/or sell copies of the Software, and to
  13. * permit persons to whom the Software is furnished to do so, subject to
  14. * the following conditions:
  15. *
  16. * The above copyright notice and this permission notice (including the
  17. * next paragraph) shall be included in all copies or substantial portions
  18. * of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  23. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  24. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. *
  28. */
  29. #ifndef _I915_DRV_H_
  30. #define _I915_DRV_H_
  31. #include "i915_reg.h"
  32. #include "intel_bios.h"
  33. #include <linux/io-mapping.h>
  34. /* General customization:
  35. */
  36. #define DRIVER_AUTHOR "Tungsten Graphics, Inc."
  37. #define DRIVER_NAME "i915"
  38. #define DRIVER_DESC "Intel Graphics"
  39. #define DRIVER_DATE "20080730"
  40. enum pipe {
  41. PIPE_A = 0,
  42. PIPE_B,
  43. };
  44. enum plane {
  45. PLANE_A = 0,
  46. PLANE_B,
  47. };
  48. #define I915_NUM_PIPE 2
  49. /* Interface history:
  50. *
  51. * 1.1: Original.
  52. * 1.2: Add Power Management
  53. * 1.3: Add vblank support
  54. * 1.4: Fix cmdbuffer path, add heap destroy
  55. * 1.5: Add vblank pipe configuration
  56. * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
  57. * - Support vertical blank on secondary display pipe
  58. */
  59. #define DRIVER_MAJOR 1
  60. #define DRIVER_MINOR 6
  61. #define DRIVER_PATCHLEVEL 0
  62. #define WATCH_COHERENCY 0
  63. #define WATCH_BUF 0
  64. #define WATCH_EXEC 0
  65. #define WATCH_LRU 0
  66. #define WATCH_RELOC 0
  67. #define WATCH_INACTIVE 0
  68. #define WATCH_PWRITE 0
  69. #define I915_GEM_PHYS_CURSOR_0 1
  70. #define I915_GEM_PHYS_CURSOR_1 2
  71. #define I915_GEM_PHYS_OVERLAY_REGS 3
  72. #define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
  73. struct drm_i915_gem_phys_object {
  74. int id;
  75. struct page **page_list;
  76. drm_dma_handle_t *handle;
  77. struct drm_gem_object *cur_obj;
  78. };
  79. typedef struct _drm_i915_ring_buffer {
  80. unsigned long Size;
  81. u8 *virtual_start;
  82. int head;
  83. int tail;
  84. int space;
  85. drm_local_map_t map;
  86. struct drm_gem_object *ring_obj;
  87. } drm_i915_ring_buffer_t;
  88. struct mem_block {
  89. struct mem_block *next;
  90. struct mem_block *prev;
  91. int start;
  92. int size;
  93. struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
  94. };
  95. struct opregion_header;
  96. struct opregion_acpi;
  97. struct opregion_swsci;
  98. struct opregion_asle;
  99. struct intel_opregion {
  100. struct opregion_header *header;
  101. struct opregion_acpi *acpi;
  102. struct opregion_swsci *swsci;
  103. struct opregion_asle *asle;
  104. int enabled;
  105. };
  106. struct drm_i915_master_private {
  107. drm_local_map_t *sarea;
  108. struct _drm_i915_sarea *sarea_priv;
  109. };
  110. #define I915_FENCE_REG_NONE -1
  111. struct drm_i915_fence_reg {
  112. struct drm_gem_object *obj;
  113. };
  114. struct sdvo_device_mapping {
  115. u8 dvo_port;
  116. u8 slave_addr;
  117. u8 dvo_wiring;
  118. u8 initialized;
  119. };
  120. struct drm_i915_error_state {
  121. u32 eir;
  122. u32 pgtbl_er;
  123. u32 pipeastat;
  124. u32 pipebstat;
  125. u32 ipeir;
  126. u32 ipehr;
  127. u32 instdone;
  128. u32 acthd;
  129. u32 instpm;
  130. u32 instps;
  131. u32 instdone1;
  132. u32 seqno;
  133. u64 bbaddr;
  134. struct timeval time;
  135. struct drm_i915_error_object {
  136. int page_count;
  137. u32 gtt_offset;
  138. u32 *pages[0];
  139. } *ringbuffer, *batchbuffer[2];
  140. struct drm_i915_error_buffer {
  141. size_t size;
  142. u32 name;
  143. u32 seqno;
  144. u32 gtt_offset;
  145. u32 read_domains;
  146. u32 write_domain;
  147. u32 fence_reg;
  148. s32 pinned:2;
  149. u32 tiling:2;
  150. u32 dirty:1;
  151. u32 purgeable:1;
  152. } *active_bo;
  153. u32 active_bo_count;
  154. };
  155. struct drm_i915_display_funcs {
  156. void (*dpms)(struct drm_crtc *crtc, int mode);
  157. bool (*fbc_enabled)(struct drm_crtc *crtc);
  158. void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
  159. void (*disable_fbc)(struct drm_device *dev);
  160. int (*get_display_clock_speed)(struct drm_device *dev);
  161. int (*get_fifo_size)(struct drm_device *dev, int plane);
  162. void (*update_wm)(struct drm_device *dev, int planea_clock,
  163. int planeb_clock, int sr_hdisplay, int pixel_size);
  164. /* clock updates for mode set */
  165. /* cursor updates */
  166. /* render clock increase/decrease */
  167. /* display clock increase/decrease */
  168. /* pll clock increase/decrease */
  169. /* clock gating init */
  170. };
  171. struct intel_overlay;
  172. struct intel_device_info {
  173. u8 is_mobile : 1;
  174. u8 is_i8xx : 1;
  175. u8 is_i85x : 1;
  176. u8 is_i915g : 1;
  177. u8 is_i9xx : 1;
  178. u8 is_i945gm : 1;
  179. u8 is_i965g : 1;
  180. u8 is_i965gm : 1;
  181. u8 is_g33 : 1;
  182. u8 need_gfx_hws : 1;
  183. u8 is_g4x : 1;
  184. u8 is_pineview : 1;
  185. u8 is_ironlake : 1;
  186. u8 is_gen6 : 1;
  187. u8 has_fbc : 1;
  188. u8 has_rc6 : 1;
  189. u8 has_pipe_cxsr : 1;
  190. u8 has_hotplug : 1;
  191. u8 cursor_needs_physical : 1;
  192. };
  193. enum no_fbc_reason {
  194. FBC_STOLEN_TOO_SMALL, /* not enough space to hold compressed buffers */
  195. FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
  196. FBC_MODE_TOO_LARGE, /* mode too large for compression */
  197. FBC_BAD_PLANE, /* fbc not supported on plane */
  198. FBC_NOT_TILED, /* buffer not tiled */
  199. };
  200. typedef struct drm_i915_private {
  201. struct drm_device *dev;
  202. const struct intel_device_info *info;
  203. int has_gem;
  204. void __iomem *regs;
  205. struct pci_dev *bridge_dev;
  206. drm_i915_ring_buffer_t ring;
  207. drm_dma_handle_t *status_page_dmah;
  208. void *hw_status_page;
  209. dma_addr_t dma_status_page;
  210. uint32_t counter;
  211. unsigned int status_gfx_addr;
  212. drm_local_map_t hws_map;
  213. struct drm_gem_object *hws_obj;
  214. struct drm_gem_object *pwrctx;
  215. struct resource mch_res;
  216. unsigned int cpp;
  217. int back_offset;
  218. int front_offset;
  219. int current_page;
  220. int page_flipping;
  221. wait_queue_head_t irq_queue;
  222. atomic_t irq_received;
  223. /** Protects user_irq_refcount and irq_mask_reg */
  224. spinlock_t user_irq_lock;
  225. /** Refcount for i915_user_irq_get() versus i915_user_irq_put(). */
  226. int user_irq_refcount;
  227. u32 trace_irq_seqno;
  228. /** Cached value of IMR to avoid reads in updating the bitfield */
  229. u32 irq_mask_reg;
  230. u32 pipestat[2];
  231. /** splitted irq regs for graphics and display engine on Ironlake,
  232. irq_mask_reg is still used for display irq. */
  233. u32 gt_irq_mask_reg;
  234. u32 gt_irq_enable_reg;
  235. u32 de_irq_enable_reg;
  236. u32 pch_irq_mask_reg;
  237. u32 pch_irq_enable_reg;
  238. u32 hotplug_supported_mask;
  239. struct work_struct hotplug_work;
  240. int tex_lru_log_granularity;
  241. int allow_batchbuffer;
  242. struct mem_block *agp_heap;
  243. unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
  244. int vblank_pipe;
  245. /* For hangcheck timer */
  246. #define DRM_I915_HANGCHECK_PERIOD 75 /* in jiffies */
  247. struct timer_list hangcheck_timer;
  248. int hangcheck_count;
  249. uint32_t last_acthd;
  250. struct drm_mm vram;
  251. unsigned long cfb_size;
  252. unsigned long cfb_pitch;
  253. int cfb_fence;
  254. int cfb_plane;
  255. int irq_enabled;
  256. struct intel_opregion opregion;
  257. /* overlay */
  258. struct intel_overlay *overlay;
  259. /* LVDS info */
  260. int backlight_duty_cycle; /* restore backlight to this value */
  261. bool panel_wants_dither;
  262. struct drm_display_mode *panel_fixed_mode;
  263. struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
  264. struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
  265. /* Feature bits from the VBIOS */
  266. unsigned int int_tv_support:1;
  267. unsigned int lvds_dither:1;
  268. unsigned int lvds_vbt:1;
  269. unsigned int int_crt_support:1;
  270. unsigned int lvds_use_ssc:1;
  271. unsigned int edp_support:1;
  272. int lvds_ssc_freq;
  273. int edp_bpp;
  274. struct notifier_block lid_notifier;
  275. int crt_ddc_bus; /* 0 = unknown, else GPIO to use for CRT DDC */
  276. struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
  277. int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
  278. int num_fence_regs; /* 8 on pre-965, 16 otherwise */
  279. unsigned int fsb_freq, mem_freq;
  280. spinlock_t error_lock;
  281. struct drm_i915_error_state *first_error;
  282. struct work_struct error_work;
  283. struct workqueue_struct *wq;
  284. /* Display functions */
  285. struct drm_i915_display_funcs display;
  286. /* Register state */
  287. bool modeset_on_lid;
  288. u8 saveLBB;
  289. u32 saveDSPACNTR;
  290. u32 saveDSPBCNTR;
  291. u32 saveDSPARB;
  292. u32 saveHWS;
  293. u32 savePIPEACONF;
  294. u32 savePIPEBCONF;
  295. u32 savePIPEASRC;
  296. u32 savePIPEBSRC;
  297. u32 saveFPA0;
  298. u32 saveFPA1;
  299. u32 saveDPLL_A;
  300. u32 saveDPLL_A_MD;
  301. u32 saveHTOTAL_A;
  302. u32 saveHBLANK_A;
  303. u32 saveHSYNC_A;
  304. u32 saveVTOTAL_A;
  305. u32 saveVBLANK_A;
  306. u32 saveVSYNC_A;
  307. u32 saveBCLRPAT_A;
  308. u32 saveTRANSACONF;
  309. u32 saveTRANS_HTOTAL_A;
  310. u32 saveTRANS_HBLANK_A;
  311. u32 saveTRANS_HSYNC_A;
  312. u32 saveTRANS_VTOTAL_A;
  313. u32 saveTRANS_VBLANK_A;
  314. u32 saveTRANS_VSYNC_A;
  315. u32 savePIPEASTAT;
  316. u32 saveDSPASTRIDE;
  317. u32 saveDSPASIZE;
  318. u32 saveDSPAPOS;
  319. u32 saveDSPAADDR;
  320. u32 saveDSPASURF;
  321. u32 saveDSPATILEOFF;
  322. u32 savePFIT_PGM_RATIOS;
  323. u32 saveBLC_HIST_CTL;
  324. u32 saveBLC_PWM_CTL;
  325. u32 saveBLC_PWM_CTL2;
  326. u32 saveBLC_CPU_PWM_CTL;
  327. u32 saveBLC_CPU_PWM_CTL2;
  328. u32 saveFPB0;
  329. u32 saveFPB1;
  330. u32 saveDPLL_B;
  331. u32 saveDPLL_B_MD;
  332. u32 saveHTOTAL_B;
  333. u32 saveHBLANK_B;
  334. u32 saveHSYNC_B;
  335. u32 saveVTOTAL_B;
  336. u32 saveVBLANK_B;
  337. u32 saveVSYNC_B;
  338. u32 saveBCLRPAT_B;
  339. u32 saveTRANSBCONF;
  340. u32 saveTRANS_HTOTAL_B;
  341. u32 saveTRANS_HBLANK_B;
  342. u32 saveTRANS_HSYNC_B;
  343. u32 saveTRANS_VTOTAL_B;
  344. u32 saveTRANS_VBLANK_B;
  345. u32 saveTRANS_VSYNC_B;
  346. u32 savePIPEBSTAT;
  347. u32 saveDSPBSTRIDE;
  348. u32 saveDSPBSIZE;
  349. u32 saveDSPBPOS;
  350. u32 saveDSPBADDR;
  351. u32 saveDSPBSURF;
  352. u32 saveDSPBTILEOFF;
  353. u32 saveVGA0;
  354. u32 saveVGA1;
  355. u32 saveVGA_PD;
  356. u32 saveVGACNTRL;
  357. u32 saveADPA;
  358. u32 saveLVDS;
  359. u32 savePP_ON_DELAYS;
  360. u32 savePP_OFF_DELAYS;
  361. u32 saveDVOA;
  362. u32 saveDVOB;
  363. u32 saveDVOC;
  364. u32 savePP_ON;
  365. u32 savePP_OFF;
  366. u32 savePP_CONTROL;
  367. u32 savePP_DIVISOR;
  368. u32 savePFIT_CONTROL;
  369. u32 save_palette_a[256];
  370. u32 save_palette_b[256];
  371. u32 saveDPFC_CB_BASE;
  372. u32 saveFBC_CFB_BASE;
  373. u32 saveFBC_LL_BASE;
  374. u32 saveFBC_CONTROL;
  375. u32 saveFBC_CONTROL2;
  376. u32 saveIER;
  377. u32 saveIIR;
  378. u32 saveIMR;
  379. u32 saveDEIER;
  380. u32 saveDEIMR;
  381. u32 saveGTIER;
  382. u32 saveGTIMR;
  383. u32 saveFDI_RXA_IMR;
  384. u32 saveFDI_RXB_IMR;
  385. u32 saveCACHE_MODE_0;
  386. u32 saveMI_ARB_STATE;
  387. u32 saveSWF0[16];
  388. u32 saveSWF1[16];
  389. u32 saveSWF2[3];
  390. u8 saveMSR;
  391. u8 saveSR[8];
  392. u8 saveGR[25];
  393. u8 saveAR_INDEX;
  394. u8 saveAR[21];
  395. u8 saveDACMASK;
  396. u8 saveCR[37];
  397. uint64_t saveFENCE[16];
  398. u32 saveCURACNTR;
  399. u32 saveCURAPOS;
  400. u32 saveCURABASE;
  401. u32 saveCURBCNTR;
  402. u32 saveCURBPOS;
  403. u32 saveCURBBASE;
  404. u32 saveCURSIZE;
  405. u32 saveDP_B;
  406. u32 saveDP_C;
  407. u32 saveDP_D;
  408. u32 savePIPEA_GMCH_DATA_M;
  409. u32 savePIPEB_GMCH_DATA_M;
  410. u32 savePIPEA_GMCH_DATA_N;
  411. u32 savePIPEB_GMCH_DATA_N;
  412. u32 savePIPEA_DP_LINK_M;
  413. u32 savePIPEB_DP_LINK_M;
  414. u32 savePIPEA_DP_LINK_N;
  415. u32 savePIPEB_DP_LINK_N;
  416. u32 saveFDI_RXA_CTL;
  417. u32 saveFDI_TXA_CTL;
  418. u32 saveFDI_RXB_CTL;
  419. u32 saveFDI_TXB_CTL;
  420. u32 savePFA_CTL_1;
  421. u32 savePFB_CTL_1;
  422. u32 savePFA_WIN_SZ;
  423. u32 savePFB_WIN_SZ;
  424. u32 savePFA_WIN_POS;
  425. u32 savePFB_WIN_POS;
  426. u32 savePCH_DREF_CONTROL;
  427. u32 saveDISP_ARB_CTL;
  428. u32 savePIPEA_DATA_M1;
  429. u32 savePIPEA_DATA_N1;
  430. u32 savePIPEA_LINK_M1;
  431. u32 savePIPEA_LINK_N1;
  432. u32 savePIPEB_DATA_M1;
  433. u32 savePIPEB_DATA_N1;
  434. u32 savePIPEB_LINK_M1;
  435. u32 savePIPEB_LINK_N1;
  436. u32 saveMCHBAR_RENDER_STANDBY;
  437. struct {
  438. struct drm_mm gtt_space;
  439. struct io_mapping *gtt_mapping;
  440. int gtt_mtrr;
  441. /**
  442. * Membership on list of all loaded devices, used to evict
  443. * inactive buffers under memory pressure.
  444. *
  445. * Modifications should only be done whilst holding the
  446. * shrink_list_lock spinlock.
  447. */
  448. struct list_head shrink_list;
  449. /**
  450. * List of objects currently involved in rendering from the
  451. * ringbuffer.
  452. *
  453. * Includes buffers having the contents of their GPU caches
  454. * flushed, not necessarily primitives. last_rendering_seqno
  455. * represents when the rendering involved will be completed.
  456. *
  457. * A reference is held on the buffer while on this list.
  458. */
  459. spinlock_t active_list_lock;
  460. struct list_head active_list;
  461. /**
  462. * List of objects which are not in the ringbuffer but which
  463. * still have a write_domain which needs to be flushed before
  464. * unbinding.
  465. *
  466. * last_rendering_seqno is 0 while an object is in this list.
  467. *
  468. * A reference is held on the buffer while on this list.
  469. */
  470. struct list_head flushing_list;
  471. /**
  472. * List of objects currently pending a GPU write flush.
  473. *
  474. * All elements on this list will belong to either the
  475. * active_list or flushing_list, last_rendering_seqno can
  476. * be used to differentiate between the two elements.
  477. */
  478. struct list_head gpu_write_list;
  479. /**
  480. * LRU list of objects which are not in the ringbuffer and
  481. * are ready to unbind, but are still in the GTT.
  482. *
  483. * last_rendering_seqno is 0 while an object is in this list.
  484. *
  485. * A reference is not held on the buffer while on this list,
  486. * as merely being GTT-bound shouldn't prevent its being
  487. * freed, and we'll pull it off the list in the free path.
  488. */
  489. struct list_head inactive_list;
  490. /** LRU list of objects with fence regs on them. */
  491. struct list_head fence_list;
  492. /**
  493. * List of breadcrumbs associated with GPU requests currently
  494. * outstanding.
  495. */
  496. struct list_head request_list;
  497. /**
  498. * We leave the user IRQ off as much as possible,
  499. * but this means that requests will finish and never
  500. * be retired once the system goes idle. Set a timer to
  501. * fire periodically while the ring is running. When it
  502. * fires, go retire requests.
  503. */
  504. struct delayed_work retire_work;
  505. uint32_t next_gem_seqno;
  506. /**
  507. * Waiting sequence number, if any
  508. */
  509. uint32_t waiting_gem_seqno;
  510. /**
  511. * Last seq seen at irq time
  512. */
  513. uint32_t irq_gem_seqno;
  514. /**
  515. * Flag if the X Server, and thus DRM, is not currently in
  516. * control of the device.
  517. *
  518. * This is set between LeaveVT and EnterVT. It needs to be
  519. * replaced with a semaphore. It also needs to be
  520. * transitioned away from for kernel modesetting.
  521. */
  522. int suspended;
  523. /**
  524. * Flag if the hardware appears to be wedged.
  525. *
  526. * This is set when attempts to idle the device timeout.
  527. * It prevents command submission from occuring and makes
  528. * every pending request fail
  529. */
  530. atomic_t wedged;
  531. /** Bit 6 swizzling required for X tiling */
  532. uint32_t bit_6_swizzle_x;
  533. /** Bit 6 swizzling required for Y tiling */
  534. uint32_t bit_6_swizzle_y;
  535. /* storage for physical objects */
  536. struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
  537. } mm;
  538. struct sdvo_device_mapping sdvo_mappings[2];
  539. /* indicate whether the LVDS_BORDER should be enabled or not */
  540. unsigned int lvds_border_bits;
  541. struct drm_crtc *plane_to_crtc_mapping[2];
  542. struct drm_crtc *pipe_to_crtc_mapping[2];
  543. wait_queue_head_t pending_flip_queue;
  544. /* Reclocking support */
  545. bool render_reclock_avail;
  546. bool lvds_downclock_avail;
  547. /* indicate whether the LVDS EDID is OK */
  548. bool lvds_edid_good;
  549. /* indicates the reduced downclock for LVDS*/
  550. int lvds_downclock;
  551. struct work_struct idle_work;
  552. struct timer_list idle_timer;
  553. bool busy;
  554. u16 orig_clock;
  555. int child_dev_num;
  556. struct child_device_config *child_dev;
  557. struct drm_connector *int_lvds_connector;
  558. bool mchbar_need_disable;
  559. u8 cur_delay;
  560. u8 min_delay;
  561. u8 max_delay;
  562. enum no_fbc_reason no_fbc_reason;
  563. } drm_i915_private_t;
  564. /** driver private structure attached to each drm_gem_object */
  565. struct drm_i915_gem_object {
  566. struct drm_gem_object *obj;
  567. /** Current space allocated to this object in the GTT, if any. */
  568. struct drm_mm_node *gtt_space;
  569. /** This object's place on the active/flushing/inactive lists */
  570. struct list_head list;
  571. /** This object's place on GPU write list */
  572. struct list_head gpu_write_list;
  573. /** This object's place on the fenced object LRU */
  574. struct list_head fence_list;
  575. /**
  576. * This is set if the object is on the active or flushing lists
  577. * (has pending rendering), and is not set if it's on inactive (ready
  578. * to be unbound).
  579. */
  580. int active;
  581. /**
  582. * This is set if the object has been written to since last bound
  583. * to the GTT
  584. */
  585. int dirty;
  586. /** AGP memory structure for our GTT binding. */
  587. DRM_AGP_MEM *agp_mem;
  588. struct page **pages;
  589. int pages_refcount;
  590. /**
  591. * Current offset of the object in GTT space.
  592. *
  593. * This is the same as gtt_space->start
  594. */
  595. uint32_t gtt_offset;
  596. /**
  597. * Fake offset for use by mmap(2)
  598. */
  599. uint64_t mmap_offset;
  600. /**
  601. * Fence register bits (if any) for this object. Will be set
  602. * as needed when mapped into the GTT.
  603. * Protected by dev->struct_mutex.
  604. */
  605. int fence_reg;
  606. /** How many users have pinned this object in GTT space */
  607. int pin_count;
  608. /** Breadcrumb of last rendering to the buffer. */
  609. uint32_t last_rendering_seqno;
  610. /** Current tiling mode for the object. */
  611. uint32_t tiling_mode;
  612. uint32_t stride;
  613. /** Record of address bit 17 of each page at last unbind. */
  614. long *bit_17;
  615. /** AGP mapping type (AGP_USER_MEMORY or AGP_USER_CACHED_MEMORY */
  616. uint32_t agp_type;
  617. /**
  618. * If present, while GEM_DOMAIN_CPU is in the read domain this array
  619. * flags which individual pages are valid.
  620. */
  621. uint8_t *page_cpu_valid;
  622. /** User space pin count and filp owning the pin */
  623. uint32_t user_pin_count;
  624. struct drm_file *pin_filp;
  625. /** for phy allocated objects */
  626. struct drm_i915_gem_phys_object *phys_obj;
  627. /**
  628. * Used for checking the object doesn't appear more than once
  629. * in an execbuffer object list.
  630. */
  631. int in_execbuffer;
  632. /**
  633. * Advice: are the backing pages purgeable?
  634. */
  635. int madv;
  636. /**
  637. * Number of crtcs where this object is currently the fb, but
  638. * will be page flipped away on the next vblank. When it
  639. * reaches 0, dev_priv->pending_flip_queue will be woken up.
  640. */
  641. atomic_t pending_flip;
  642. };
  643. #define to_intel_bo(x) ((struct drm_i915_gem_object *) (x)->driver_private)
  644. /**
  645. * Request queue structure.
  646. *
  647. * The request queue allows us to note sequence numbers that have been emitted
  648. * and may be associated with active buffers to be retired.
  649. *
  650. * By keeping this list, we can avoid having to do questionable
  651. * sequence-number comparisons on buffer last_rendering_seqnos, and associate
  652. * an emission time with seqnos for tracking how far ahead of the GPU we are.
  653. */
  654. struct drm_i915_gem_request {
  655. /** GEM sequence number associated with this request. */
  656. uint32_t seqno;
  657. /** Time at which this request was emitted, in jiffies. */
  658. unsigned long emitted_jiffies;
  659. /** global list entry for this request */
  660. struct list_head list;
  661. /** file_priv list entry for this request */
  662. struct list_head client_list;
  663. };
  664. struct drm_i915_file_private {
  665. struct {
  666. struct list_head request_list;
  667. } mm;
  668. };
  669. enum intel_chip_family {
  670. CHIP_I8XX = 0x01,
  671. CHIP_I9XX = 0x02,
  672. CHIP_I915 = 0x04,
  673. CHIP_I965 = 0x08,
  674. };
  675. extern struct drm_ioctl_desc i915_ioctls[];
  676. extern int i915_max_ioctl;
  677. extern unsigned int i915_fbpercrtc;
  678. extern unsigned int i915_powersave;
  679. extern unsigned int i915_lvds_downclock;
  680. extern int i915_suspend(struct drm_device *dev, pm_message_t state);
  681. extern int i915_resume(struct drm_device *dev);
  682. extern void i915_save_display(struct drm_device *dev);
  683. extern void i915_restore_display(struct drm_device *dev);
  684. extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
  685. extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
  686. /* i915_dma.c */
  687. extern void i915_kernel_lost_context(struct drm_device * dev);
  688. extern int i915_driver_load(struct drm_device *, unsigned long flags);
  689. extern int i915_driver_unload(struct drm_device *);
  690. extern int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv);
  691. extern void i915_driver_lastclose(struct drm_device * dev);
  692. extern void i915_driver_preclose(struct drm_device *dev,
  693. struct drm_file *file_priv);
  694. extern void i915_driver_postclose(struct drm_device *dev,
  695. struct drm_file *file_priv);
  696. extern int i915_driver_device_is_agp(struct drm_device * dev);
  697. extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
  698. unsigned long arg);
  699. extern int i915_emit_box(struct drm_device *dev,
  700. struct drm_clip_rect *boxes,
  701. int i, int DR1, int DR4);
  702. extern int i965_reset(struct drm_device *dev, u8 flags);
  703. /* i915_irq.c */
  704. void i915_hangcheck_elapsed(unsigned long data);
  705. void i915_destroy_error_state(struct drm_device *dev);
  706. extern int i915_irq_emit(struct drm_device *dev, void *data,
  707. struct drm_file *file_priv);
  708. extern int i915_irq_wait(struct drm_device *dev, void *data,
  709. struct drm_file *file_priv);
  710. void i915_user_irq_get(struct drm_device *dev);
  711. void i915_trace_irq_get(struct drm_device *dev, u32 seqno);
  712. void i915_user_irq_put(struct drm_device *dev);
  713. extern void i915_enable_interrupt (struct drm_device *dev);
  714. extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
  715. extern void i915_driver_irq_preinstall(struct drm_device * dev);
  716. extern int i915_driver_irq_postinstall(struct drm_device *dev);
  717. extern void i915_driver_irq_uninstall(struct drm_device * dev);
  718. extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
  719. struct drm_file *file_priv);
  720. extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
  721. struct drm_file *file_priv);
  722. extern int i915_enable_vblank(struct drm_device *dev, int crtc);
  723. extern void i915_disable_vblank(struct drm_device *dev, int crtc);
  724. extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
  725. extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
  726. extern int i915_vblank_swap(struct drm_device *dev, void *data,
  727. struct drm_file *file_priv);
  728. extern void i915_enable_irq(drm_i915_private_t *dev_priv, u32 mask);
  729. void
  730. i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
  731. void
  732. i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
  733. void intel_enable_asle (struct drm_device *dev);
  734. /* i915_mem.c */
  735. extern int i915_mem_alloc(struct drm_device *dev, void *data,
  736. struct drm_file *file_priv);
  737. extern int i915_mem_free(struct drm_device *dev, void *data,
  738. struct drm_file *file_priv);
  739. extern int i915_mem_init_heap(struct drm_device *dev, void *data,
  740. struct drm_file *file_priv);
  741. extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
  742. struct drm_file *file_priv);
  743. extern void i915_mem_takedown(struct mem_block **heap);
  744. extern void i915_mem_release(struct drm_device * dev,
  745. struct drm_file *file_priv, struct mem_block *heap);
  746. /* i915_gem.c */
  747. int i915_gem_init_ioctl(struct drm_device *dev, void *data,
  748. struct drm_file *file_priv);
  749. int i915_gem_create_ioctl(struct drm_device *dev, void *data,
  750. struct drm_file *file_priv);
  751. int i915_gem_pread_ioctl(struct drm_device *dev, void *data,
  752. struct drm_file *file_priv);
  753. int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
  754. struct drm_file *file_priv);
  755. int i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
  756. struct drm_file *file_priv);
  757. int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
  758. struct drm_file *file_priv);
  759. int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
  760. struct drm_file *file_priv);
  761. int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
  762. struct drm_file *file_priv);
  763. int i915_gem_execbuffer(struct drm_device *dev, void *data,
  764. struct drm_file *file_priv);
  765. int i915_gem_execbuffer2(struct drm_device *dev, void *data,
  766. struct drm_file *file_priv);
  767. int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
  768. struct drm_file *file_priv);
  769. int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
  770. struct drm_file *file_priv);
  771. int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
  772. struct drm_file *file_priv);
  773. int i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
  774. struct drm_file *file_priv);
  775. int i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
  776. struct drm_file *file_priv);
  777. int i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
  778. struct drm_file *file_priv);
  779. int i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
  780. struct drm_file *file_priv);
  781. int i915_gem_set_tiling(struct drm_device *dev, void *data,
  782. struct drm_file *file_priv);
  783. int i915_gem_get_tiling(struct drm_device *dev, void *data,
  784. struct drm_file *file_priv);
  785. int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
  786. struct drm_file *file_priv);
  787. void i915_gem_load(struct drm_device *dev);
  788. int i915_gem_init_object(struct drm_gem_object *obj);
  789. void i915_gem_free_object(struct drm_gem_object *obj);
  790. int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
  791. void i915_gem_object_unpin(struct drm_gem_object *obj);
  792. int i915_gem_object_unbind(struct drm_gem_object *obj);
  793. void i915_gem_release_mmap(struct drm_gem_object *obj);
  794. void i915_gem_lastclose(struct drm_device *dev);
  795. uint32_t i915_get_gem_seqno(struct drm_device *dev);
  796. bool i915_seqno_passed(uint32_t seq1, uint32_t seq2);
  797. int i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
  798. int i915_gem_object_put_fence_reg(struct drm_gem_object *obj);
  799. void i915_gem_retire_requests(struct drm_device *dev);
  800. void i915_gem_retire_work_handler(struct work_struct *work);
  801. void i915_gem_clflush_object(struct drm_gem_object *obj);
  802. int i915_gem_object_set_domain(struct drm_gem_object *obj,
  803. uint32_t read_domains,
  804. uint32_t write_domain);
  805. int i915_gem_init_ringbuffer(struct drm_device *dev);
  806. void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
  807. int i915_gem_do_init(struct drm_device *dev, unsigned long start,
  808. unsigned long end);
  809. int i915_gem_idle(struct drm_device *dev);
  810. uint32_t i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
  811. uint32_t flush_domains);
  812. int i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible);
  813. int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
  814. int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
  815. int write);
  816. int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj);
  817. int i915_gem_attach_phys_object(struct drm_device *dev,
  818. struct drm_gem_object *obj, int id);
  819. void i915_gem_detach_phys_object(struct drm_device *dev,
  820. struct drm_gem_object *obj);
  821. void i915_gem_free_all_phys_object(struct drm_device *dev);
  822. int i915_gem_object_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
  823. void i915_gem_object_put_pages(struct drm_gem_object *obj);
  824. void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
  825. void i915_gem_object_flush_write_domain(struct drm_gem_object *obj);
  826. void i915_gem_shrinker_init(void);
  827. void i915_gem_shrinker_exit(void);
  828. /* i915_gem_tiling.c */
  829. void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
  830. void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj);
  831. void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj);
  832. bool i915_tiling_ok(struct drm_device *dev, int stride, int size,
  833. int tiling_mode);
  834. bool i915_gem_object_fence_offset_ok(struct drm_gem_object *obj,
  835. int tiling_mode);
  836. /* i915_gem_debug.c */
  837. void i915_gem_dump_object(struct drm_gem_object *obj, int len,
  838. const char *where, uint32_t mark);
  839. #if WATCH_INACTIVE
  840. void i915_verify_inactive(struct drm_device *dev, char *file, int line);
  841. #else
  842. #define i915_verify_inactive(dev, file, line)
  843. #endif
  844. void i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle);
  845. void i915_gem_dump_object(struct drm_gem_object *obj, int len,
  846. const char *where, uint32_t mark);
  847. void i915_dump_lru(struct drm_device *dev, const char *where);
  848. /* i915_debugfs.c */
  849. int i915_debugfs_init(struct drm_minor *minor);
  850. void i915_debugfs_cleanup(struct drm_minor *minor);
  851. /* i915_suspend.c */
  852. extern int i915_save_state(struct drm_device *dev);
  853. extern int i915_restore_state(struct drm_device *dev);
  854. /* i915_suspend.c */
  855. extern int i915_save_state(struct drm_device *dev);
  856. extern int i915_restore_state(struct drm_device *dev);
  857. #ifdef CONFIG_ACPI
  858. /* i915_opregion.c */
  859. extern int intel_opregion_init(struct drm_device *dev, int resume);
  860. extern void intel_opregion_free(struct drm_device *dev, int suspend);
  861. extern void opregion_asle_intr(struct drm_device *dev);
  862. extern void ironlake_opregion_gse_intr(struct drm_device *dev);
  863. extern void opregion_enable_asle(struct drm_device *dev);
  864. #else
  865. static inline int intel_opregion_init(struct drm_device *dev, int resume) { return 0; }
  866. static inline void intel_opregion_free(struct drm_device *dev, int suspend) { return; }
  867. static inline void opregion_asle_intr(struct drm_device *dev) { return; }
  868. static inline void ironlake_opregion_gse_intr(struct drm_device *dev) { return; }
  869. static inline void opregion_enable_asle(struct drm_device *dev) { return; }
  870. #endif
  871. /* modesetting */
  872. extern void intel_modeset_init(struct drm_device *dev);
  873. extern void intel_modeset_cleanup(struct drm_device *dev);
  874. extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
  875. extern void i8xx_disable_fbc(struct drm_device *dev);
  876. extern void g4x_disable_fbc(struct drm_device *dev);
  877. /**
  878. * Lock test for when it's just for synchronization of ring access.
  879. *
  880. * In that case, we don't need to do it when GEM is initialized as nobody else
  881. * has access to the ring.
  882. */
  883. #define RING_LOCK_TEST_WITH_RETURN(dev, file_priv) do { \
  884. if (((drm_i915_private_t *)dev->dev_private)->ring.ring_obj == NULL) \
  885. LOCK_TEST_WITH_RETURN(dev, file_priv); \
  886. } while (0)
  887. #define I915_READ(reg) readl(dev_priv->regs + (reg))
  888. #define I915_WRITE(reg, val) writel(val, dev_priv->regs + (reg))
  889. #define I915_READ16(reg) readw(dev_priv->regs + (reg))
  890. #define I915_WRITE16(reg, val) writel(val, dev_priv->regs + (reg))
  891. #define I915_READ8(reg) readb(dev_priv->regs + (reg))
  892. #define I915_WRITE8(reg, val) writeb(val, dev_priv->regs + (reg))
  893. #define I915_WRITE64(reg, val) writeq(val, dev_priv->regs + (reg))
  894. #define I915_READ64(reg) readq(dev_priv->regs + (reg))
  895. #define POSTING_READ(reg) (void)I915_READ(reg)
  896. #define I915_VERBOSE 0
  897. #define RING_LOCALS volatile unsigned int *ring_virt__;
  898. #define BEGIN_LP_RING(n) do { \
  899. int bytes__ = 4*(n); \
  900. if (I915_VERBOSE) DRM_DEBUG("BEGIN_LP_RING(%d)\n", (n)); \
  901. /* a wrap must occur between instructions so pad beforehand */ \
  902. if (unlikely (dev_priv->ring.tail + bytes__ > dev_priv->ring.Size)) \
  903. i915_wrap_ring(dev); \
  904. if (unlikely (dev_priv->ring.space < bytes__)) \
  905. i915_wait_ring(dev, bytes__, __func__); \
  906. ring_virt__ = (unsigned int *) \
  907. (dev_priv->ring.virtual_start + dev_priv->ring.tail); \
  908. dev_priv->ring.tail += bytes__; \
  909. dev_priv->ring.tail &= dev_priv->ring.Size - 1; \
  910. dev_priv->ring.space -= bytes__; \
  911. } while (0)
  912. #define OUT_RING(n) do { \
  913. if (I915_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \
  914. *ring_virt__++ = (n); \
  915. } while (0)
  916. #define ADVANCE_LP_RING() do { \
  917. if (I915_VERBOSE) \
  918. DRM_DEBUG("ADVANCE_LP_RING %x\n", dev_priv->ring.tail); \
  919. I915_WRITE(PRB0_TAIL, dev_priv->ring.tail); \
  920. } while(0)
  921. /**
  922. * Reads a dword out of the status page, which is written to from the command
  923. * queue by automatic updates, MI_REPORT_HEAD, MI_STORE_DATA_INDEX, or
  924. * MI_STORE_DATA_IMM.
  925. *
  926. * The following dwords have a reserved meaning:
  927. * 0x00: ISR copy, updated when an ISR bit not set in the HWSTAM changes.
  928. * 0x04: ring 0 head pointer
  929. * 0x05: ring 1 head pointer (915-class)
  930. * 0x06: ring 2 head pointer (915-class)
  931. * 0x10-0x1b: Context status DWords (GM45)
  932. * 0x1f: Last written status offset. (GM45)
  933. *
  934. * The area from dword 0x20 to 0x3ff is available for driver usage.
  935. */
  936. #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
  937. #define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, I915_BREADCRUMB_INDEX)
  938. #define I915_GEM_HWS_INDEX 0x20
  939. #define I915_BREADCRUMB_INDEX 0x21
  940. extern int i915_wrap_ring(struct drm_device * dev);
  941. extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
  942. #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
  943. #define IS_I830(dev) ((dev)->pci_device == 0x3577)
  944. #define IS_845G(dev) ((dev)->pci_device == 0x2562)
  945. #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
  946. #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
  947. #define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx)
  948. #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
  949. #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
  950. #define IS_I945G(dev) ((dev)->pci_device == 0x2772)
  951. #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm)
  952. #define IS_I965G(dev) (INTEL_INFO(dev)->is_i965g)
  953. #define IS_I965GM(dev) (INTEL_INFO(dev)->is_i965gm)
  954. #define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
  955. #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x)
  956. #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001)
  957. #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011)
  958. #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview)
  959. #define IS_G33(dev) (INTEL_INFO(dev)->is_g33)
  960. #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042)
  961. #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
  962. #define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake)
  963. #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
  964. #define IS_GEN6(dev) (INTEL_INFO(dev)->is_gen6)
  965. #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
  966. #define IS_GEN3(dev) (IS_I915G(dev) || \
  967. IS_I915GM(dev) || \
  968. IS_I945G(dev) || \
  969. IS_I945GM(dev) || \
  970. IS_G33(dev) || \
  971. IS_PINEVIEW(dev))
  972. #define IS_GEN4(dev) ((dev)->pci_device == 0x2972 || \
  973. (dev)->pci_device == 0x2982 || \
  974. (dev)->pci_device == 0x2992 || \
  975. (dev)->pci_device == 0x29A2 || \
  976. (dev)->pci_device == 0x2A02 || \
  977. (dev)->pci_device == 0x2A12 || \
  978. (dev)->pci_device == 0x2E02 || \
  979. (dev)->pci_device == 0x2E12 || \
  980. (dev)->pci_device == 0x2E22 || \
  981. (dev)->pci_device == 0x2E32 || \
  982. (dev)->pci_device == 0x2A42 || \
  983. (dev)->pci_device == 0x2E42)
  984. #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
  985. /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
  986. * rows, which changed the alignment requirements and fence programming.
  987. */
  988. #define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \
  989. IS_I915GM(dev)))
  990. #define SUPPORTS_DIGITAL_OUTPUTS(dev) (IS_I9XX(dev) && !IS_PINEVIEW(dev))
  991. #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
  992. #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
  993. #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev))
  994. #define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \
  995. !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev))
  996. #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug)
  997. /* dsparb controlled by hw only */
  998. #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
  999. #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev))
  1000. #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
  1001. #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
  1002. #define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6)
  1003. #define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
  1004. IS_GEN6(dev))
  1005. #define PRIMARY_RINGBUFFER_SIZE (128*1024)
  1006. #endif