37 #include <linux/i2c.h>
47 #define DRIVER_AUTHOR "Tungsten Graphics, Inc."
49 #define DRIVER_NAME "i915"
50 #define DRIVER_DESC "Intel Graphics"
51 #define DRIVER_DATE "20080730"
59 #define pipe_name(p) ((p) + 'A')
66 #define plane_name(p) ((p) + 'A')
76 #define port_name(p) ((p) + 'A')
78 #define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
80 #define for_each_pipe(p) for ((p) = 0; (p) < dev_priv->num_pipe; (p)++)
82 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
83 list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
84 if ((intel_encoder)->base.crtc == (__crtc))
94 #define I915_NUM_PLLS 2
106 #define DRIVER_MAJOR 1
107 #define DRIVER_MINOR 6
108 #define DRIVER_PATCHLEVEL 0
110 #define WATCH_COHERENCY 0
111 #define WATCH_LISTS 0
114 #define I915_GEM_PHYS_CURSOR_0 1
115 #define I915_GEM_PHYS_CURSOR_1 2
116 #define I915_GEM_PHYS_OVERLAY_REGS 3
117 #define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
148 #define OPREGION_SIZE (8*1024)
151 struct intel_overlay_error_state;
157 #define I915_FENCE_REG_NONE -1
158 #define I915_MAX_NUM_FENCES 16
160 #define I915_MAX_NUM_FENCE_BITS 5
177 struct intel_display_error_state;
284 #define DEV_INFO_FLAGS \
285 DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
286 DEV_INFO_FLAG(is_i85x) DEV_INFO_SEP \
287 DEV_INFO_FLAG(is_i915g) DEV_INFO_SEP \
288 DEV_INFO_FLAG(is_i945gm) DEV_INFO_SEP \
289 DEV_INFO_FLAG(is_g33) DEV_INFO_SEP \
290 DEV_INFO_FLAG(need_gfx_hws) DEV_INFO_SEP \
291 DEV_INFO_FLAG(is_g4x) DEV_INFO_SEP \
292 DEV_INFO_FLAG(is_pineview) DEV_INFO_SEP \
293 DEV_INFO_FLAG(is_broadwater) DEV_INFO_SEP \
294 DEV_INFO_FLAG(is_crestline) DEV_INFO_SEP \
295 DEV_INFO_FLAG(is_ivybridge) DEV_INFO_SEP \
296 DEV_INFO_FLAG(is_valleyview) DEV_INFO_SEP \
297 DEV_INFO_FLAG(is_haswell) DEV_INFO_SEP \
298 DEV_INFO_FLAG(has_force_wake) DEV_INFO_SEP \
299 DEV_INFO_FLAG(has_fbc) DEV_INFO_SEP \
300 DEV_INFO_FLAG(has_pipe_cxsr) DEV_INFO_SEP \
301 DEV_INFO_FLAG(has_hotplug) DEV_INFO_SEP \
302 DEV_INFO_FLAG(cursor_needs_physical) DEV_INFO_SEP \
303 DEV_INFO_FLAG(has_overlay) DEV_INFO_SEP \
304 DEV_INFO_FLAG(overlay_needs_physical) DEV_INFO_SEP \
305 DEV_INFO_FLAG(supports_tv) DEV_INFO_SEP \
306 DEV_INFO_FLAG(has_bsd_ring) DEV_INFO_SEP \
307 DEV_INFO_FLAG(has_blt_ring) DEV_INFO_SEP \
308 DEV_INFO_FLAG(has_llc)
338 #define I915_PPGTT_PD_ENTRIES 512
339 #define I915_PPGTT_PT_ENTRIES 1024
350 #define DEFAULT_CONTEXT_ID 0
377 #define QUIRK_PIPEA_FORCE (1<<0)
378 #define QUIRK_LVDS_SSC_DISABLE (1<<1)
379 #define QUIRK_INVERT_BRIGHTNESS (1<<2)
454 #define DRM_I915_HANGCHECK_PERIOD 1500
885 #define for_each_ring(ring__, dev_priv__, i__) \
886 for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \
887 if (((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__)))
983 #define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf
1061 #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
1102 #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
1104 #define IS_I830(dev) ((dev)->pci_device == 0x3577)
1105 #define IS_845G(dev) ((dev)->pci_device == 0x2562)
1106 #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
1107 #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1108 #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
1109 #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1110 #define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1111 #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm)
1112 #define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater)
1113 #define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline)
1114 #define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
1115 #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x)
1116 #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001)
1117 #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011)
1118 #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview)
1119 #define IS_G33(dev) (INTEL_INFO(dev)->is_g33)
1120 #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042)
1121 #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
1122 #define IS_IVYBRIDGE(dev) (INTEL_INFO(dev)->is_ivybridge)
1123 #define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
1124 #define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
1125 #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1133 #define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2)
1134 #define IS_GEN3(dev) (INTEL_INFO(dev)->gen == 3)
1135 #define IS_GEN4(dev) (INTEL_INFO(dev)->gen == 4)
1136 #define IS_GEN5(dev) (INTEL_INFO(dev)->gen == 5)
1137 #define IS_GEN6(dev) (INTEL_INFO(dev)->gen == 6)
1138 #define IS_GEN7(dev) (INTEL_INFO(dev)->gen == 7)
1140 #define HAS_BSD(dev) (INTEL_INFO(dev)->has_bsd_ring)
1141 #define HAS_BLT(dev) (INTEL_INFO(dev)->has_blt_ring)
1142 #define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc)
1143 #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1145 #define HAS_HW_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 6)
1146 #define HAS_ALIASING_PPGTT(dev) (INTEL_INFO(dev)->gen >=6 && !IS_VALLEYVIEW(dev))
1148 #define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
1149 #define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical)
1154 #define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
1156 #define SUPPORTS_DIGITAL_OUTPUTS(dev) (!IS_GEN2(dev) && !IS_PINEVIEW(dev))
1157 #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_GEN5(dev))
1158 #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_GEN5(dev))
1159 #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev))
1160 #define SUPPORTS_TV(dev) (INTEL_INFO(dev)->supports_tv)
1161 #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug)
1163 #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1165 #define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
1166 #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
1167 #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
1169 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
1171 #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
1172 #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
1173 #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
1174 #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
1175 #define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE)
1177 #define HAS_FORCE_WAKE(dev) (INTEL_INFO(dev)->has_force_wake)
1179 #define HAS_L3_GPU_CACHE(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
1181 #define GT_FREQUENCY_MULTIPLIER 50
1202 #define INTEL_RC6_ENABLE (1<<0)
1203 #define INTEL_RC6p_ENABLE (1<<1)
1204 #define INTEL_RC6pp_ENABLE (1<<2)
1220 extern unsigned int i915_preliminary_hw_support
__read_mostly;
1235 struct drm_file *file_priv);
1237 struct drm_file *file_priv);
1239 #ifdef CONFIG_COMPAT
1240 extern long i915_compat_ioctl(
struct file *filp,
unsigned int cmd,
1271 #ifdef CONFIG_DEBUG_FS
1274 #define i915_destroy_error_state(x)
1280 struct drm_file *file_priv);
1282 struct drm_file *file_priv);
1284 struct drm_file *file_priv);
1286 struct drm_file *file_priv);
1288 struct drm_file *file_priv);
1290 struct drm_file *file_priv);
1292 struct drm_file *file_priv);
1294 struct drm_file *file_priv);
1296 struct drm_file *file_priv);
1298 struct drm_file *file_priv);
1300 struct drm_file *file_priv);
1302 struct drm_file *file_priv);
1304 struct drm_file *file_priv);
1306 struct drm_file *
file);
1308 struct drm_file *
file);
1310 struct drm_file *file_priv);
1312 struct drm_file *file_priv);
1314 struct drm_file *file_priv);
1316 struct drm_file *file_priv);
1318 struct drm_file *file_priv);
1320 struct drm_file *file_priv);
1322 struct drm_file *file_priv);
1324 struct drm_file *file_priv);
1345 int nents = obj->
pages->nents;
1354 return sg_page(sg+n);
1387 return (
int32_t)(seq1 - seq2) >= 0;
1435 struct drm_file *
file,
1470 struct drm_gem_object *gem_obj,
int flags);
1477 struct drm_file *
file,
int to_id);
1479 struct drm_file *
file);
1481 struct drm_file *
file);
1499 unsigned long start,
1500 unsigned long mappable_end,
1506 unsigned cache_level,
1526 #define i915_verify_lists(dev) 0
1572 extern void intel_opregion_asle_intr(
struct drm_device *
dev);
1573 extern void intel_opregion_gse_intr(
struct drm_device *
dev);
1574 extern void intel_opregion_enable_asle(
struct drm_device *
dev);
1576 static inline void intel_opregion_init(
struct drm_device *
dev) {
return; }
1577 static inline void intel_opregion_fini(
struct drm_device *
dev) {
return; }
1578 static inline void intel_opregion_asle_intr(
struct drm_device *
dev) {
return; }
1579 static inline void intel_opregion_gse_intr(
struct drm_device *
dev) {
return; }
1580 static inline void intel_opregion_enable_asle(
struct drm_device *
dev) {
return; }
1610 struct drm_file *
file);
1613 #ifdef CONFIG_DEBUG_FS
1614 extern struct intel_overlay_error_state *intel_overlay_capture_error_state(
struct drm_device *
dev);
1615 extern void intel_overlay_print_error_state(
struct seq_file *
m,
struct intel_overlay_error_state *
error);
1617 extern struct intel_display_error_state *intel_display_capture_error_state(
struct drm_device *
dev);
1618 extern void intel_display_print_error_state(
struct seq_file *
m,
1620 struct intel_display_error_state *
error);
1631 #define __i915_read(x, y) \
1632 u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg);
1640 #define __i915_write(x, y) \
1641 void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val);
1649 #define I915_READ8(reg) i915_read8(dev_priv, (reg))
1650 #define I915_WRITE8(reg, val) i915_write8(dev_priv, (reg), (val))
1652 #define I915_READ16(reg) i915_read16(dev_priv, (reg))
1653 #define I915_WRITE16(reg, val) i915_write16(dev_priv, (reg), (val))
1654 #define I915_READ16_NOTRACE(reg) readw(dev_priv->regs + (reg))
1655 #define I915_WRITE16_NOTRACE(reg, val) writew(val, dev_priv->regs + (reg))
1657 #define I915_READ(reg) i915_read32(dev_priv, (reg))
1658 #define I915_WRITE(reg, val) i915_write32(dev_priv, (reg), (val))
1659 #define I915_READ_NOTRACE(reg) readl(dev_priv->regs + (reg))
1660 #define I915_WRITE_NOTRACE(reg, val) writel(val, dev_priv->regs + (reg))
1662 #define I915_WRITE64(reg, val) i915_write64(dev_priv, (reg), (val))
1663 #define I915_READ64(reg) i915_read64(dev_priv, (reg))
1665 #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg)
1666 #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg)