drm/i915/bdw: Macro for LRCs and module option for Execlists
[deliverable/linux.git] / drivers / gpu / drm / i915 / i915_drv.h
index 7db16bee29975e68016224aa1dd25a8d19f8131a..fd2aa15ce02b59ed4398d4d1b9cfc1aebf6b9b80 100644 (file)
@@ -35,6 +35,7 @@
 #include "i915_reg.h"
 #include "intel_bios.h"
 #include "intel_ringbuffer.h"
+#include "intel_lrc.h"
 #include "i915_gem_gtt.h"
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
@@ -53,7 +54,7 @@
 
 #define DRIVER_NAME            "i915"
 #define DRIVER_DESC            "Intel Graphics"
-#define DRIVER_DATE            "20140620"
+#define DRIVER_DATE            "20140808"
 
 enum pipe {
        INVALID_PIPE = -1,
@@ -171,6 +172,11 @@ enum hpd_pin {
 #define for_each_intel_crtc(dev, intel_crtc) \
        list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
 
+#define for_each_intel_encoder(dev, intel_encoder)             \
+       list_for_each_entry(intel_encoder,                      \
+                           &(dev)->mode_config.encoder_list,   \
+                           base.head)
+
 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
        list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
                if ((intel_encoder)->base.crtc == (__crtc))
@@ -179,6 +185,10 @@ enum hpd_pin {
        list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \
                if ((intel_connector)->base.encoder == (__encoder))
 
+#define for_each_power_domain(domain, mask)                            \
+       for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++)     \
+               if ((1 << (domain)) & (mask))
+
 struct drm_i915_private;
 struct i915_mmu_object;
 
@@ -193,10 +203,13 @@ enum intel_dpll_id {
 #define I915_NUM_PLLS 2
 
 struct intel_dpll_hw_state {
+       /* i9xx, pch plls */
        uint32_t dpll;
        uint32_t dpll_md;
        uint32_t fp0;
        uint32_t fp1;
+
+       /* hsw, bdw */
        uint32_t wrpll;
 };
 
@@ -310,6 +323,7 @@ struct drm_i915_error_state {
        u32 eir;
        u32 pgtbl_er;
        u32 ier;
+       u32 gtier[4];
        u32 ccid;
        u32 derrmr;
        u32 forcewake;
@@ -436,8 +450,8 @@ struct drm_i915_display_funcs {
        void (*update_wm)(struct drm_crtc *crtc);
        void (*update_sprite_wm)(struct drm_plane *plane,
                                 struct drm_crtc *crtc,
-                                uint32_t sprite_width, int pixel_size,
-                                bool enable, bool scaled);
+                                uint32_t sprite_width, uint32_t sprite_height,
+                                int pixel_size, bool enable, bool scaled);
        void (*modeset_global_resources)(struct drm_device *dev);
        /* Returns the active state of the crtc, and if the crtc is active,
         * fills out the pipe-config with the hw state. */
@@ -545,6 +559,7 @@ struct intel_uncore {
 
 struct intel_device_info {
        u32 display_mmio_offset;
+       u16 device_id;
        u8 num_pipes:3;
        u8 num_sprites[I915_MAX_PIPES];
        u8 gen;
@@ -629,6 +644,8 @@ struct i915_fbc {
        struct drm_mm_node compressed_fb;
        struct drm_mm_node *compressed_llb;
 
+       bool false_color;
+
        struct intel_fbc_work {
                struct delayed_work work;
                struct drm_crtc *crtc;
@@ -654,13 +671,15 @@ struct i915_drrs {
        struct intel_connector *connector;
 };
 
+struct intel_dp;
 struct i915_psr {
+       struct mutex lock;
        bool sink_support;
        bool source_ok;
-       bool setup_done;
-       bool enabled;
+       struct intel_dp *enabled;
        bool active;
        struct delayed_work work;
+       unsigned busy_frontbuffer_bits;
 };
 
 enum intel_pch {
@@ -679,6 +698,7 @@ enum intel_sbi_destination {
 #define QUIRK_PIPEA_FORCE (1<<0)
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)
 #define QUIRK_INVERT_BRIGHTNESS (1<<2)
+#define QUIRK_BACKLIGHT_PRESENT (1<<3)
 
 struct intel_fbdev;
 struct intel_fbc_work;
@@ -931,6 +951,7 @@ struct intel_gen6_power_mgmt {
        u8 efficient_freq;      /* AKA RPe. Pre-determined balanced frequency */
        u8 rp1_freq;            /* "less than" RP0 power/freqency */
        u8 rp0_freq;            /* Non-overclocked max frequency. */
+       u32 cz_freq;
 
        u32 ei_interrupt_count;
 
@@ -1218,6 +1239,12 @@ enum modeset_restore {
 };
 
 struct ddi_vbt_port_info {
+       /*
+        * This is an index in the HDMI/DVI DDI buffer translation table.
+        * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't
+        * populate this field.
+        */
+#define HDMI_LEVEL_SHIFT_UNKNOWN       0xff
        uint8_t hdmi_level_shift;
 
        uint8_t supports_dvi:1;
@@ -1263,6 +1290,7 @@ struct intel_vbt_data {
                u16 pwm_freq_hz;
                bool present;
                bool active_low_pwm;
+               u8 min_brightness;      /* min_brightness/255 of max */
        } backlight;
 
        /* MIPI DSI */
@@ -1332,7 +1360,7 @@ struct ilk_wm_values {
  */
 struct i915_runtime_pm {
        bool suspended;
-       bool irqs_disabled;
+       bool _irqs_disabled;
 };
 
 enum intel_pipe_crc_source {
@@ -1751,13 +1779,6 @@ struct drm_i915_gem_object {
         * Only honoured if hardware has relevant pte bit
         */
        unsigned long gt_ro:1;
-
-       /*
-        * Is the GPU currently using a fence to access this buffer,
-        */
-       unsigned int pending_fenced_gpu_access:1;
-       unsigned int fenced_gpu_access:1;
-
        unsigned int cache_level:3;
 
        unsigned int has_aliasing_ppgtt_mapping:1;
@@ -1961,51 +1982,55 @@ struct drm_i915_cmd_table {
        int count;
 };
 
-#define INTEL_INFO(dev)        (&to_i915(dev)->info)
+/* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */
+#define __I915__(p)    ((sizeof(*(p)) == sizeof(struct drm_i915_private)) ? \
+                        (struct drm_i915_private *)(p) : to_i915(p))
+#define INTEL_INFO(p)  (&__I915__(p)->info)
+#define INTEL_DEVID(p) (INTEL_INFO(p)->device_id)
 
-#define IS_I830(dev)           ((dev)->pdev->device == 0x3577)
-#define IS_845G(dev)           ((dev)->pdev->device == 0x2562)
+#define IS_I830(dev)           (INTEL_DEVID(dev) == 0x3577)
+#define IS_845G(dev)           (INTEL_DEVID(dev) == 0x2562)
 #define IS_I85X(dev)           (INTEL_INFO(dev)->is_i85x)
-#define IS_I865G(dev)          ((dev)->pdev->device == 0x2572)
+#define IS_I865G(dev)          (INTEL_DEVID(dev) == 0x2572)
 #define IS_I915G(dev)          (INTEL_INFO(dev)->is_i915g)
-#define IS_I915GM(dev)         ((dev)->pdev->device == 0x2592)
-#define IS_I945G(dev)          ((dev)->pdev->device == 0x2772)
+#define IS_I915GM(dev)         (INTEL_DEVID(dev) == 0x2592)
+#define IS_I945G(dev)          (INTEL_DEVID(dev) == 0x2772)
 #define IS_I945GM(dev)         (INTEL_INFO(dev)->is_i945gm)
 #define IS_BROADWATER(dev)     (INTEL_INFO(dev)->is_broadwater)
 #define IS_CRESTLINE(dev)      (INTEL_INFO(dev)->is_crestline)
-#define IS_GM45(dev)           ((dev)->pdev->device == 0x2A42)
+#define IS_GM45(dev)           (INTEL_DEVID(dev) == 0x2A42)
 #define IS_G4X(dev)            (INTEL_INFO(dev)->is_g4x)
-#define IS_PINEVIEW_G(dev)     ((dev)->pdev->device == 0xa001)
-#define IS_PINEVIEW_M(dev)     ((dev)->pdev->device == 0xa011)
+#define IS_PINEVIEW_G(dev)     (INTEL_DEVID(dev) == 0xa001)
+#define IS_PINEVIEW_M(dev)     (INTEL_DEVID(dev) == 0xa011)
 #define IS_PINEVIEW(dev)       (INTEL_INFO(dev)->is_pineview)
 #define IS_G33(dev)            (INTEL_INFO(dev)->is_g33)
-#define IS_IRONLAKE_M(dev)     ((dev)->pdev->device == 0x0046)
+#define IS_IRONLAKE_M(dev)     (INTEL_DEVID(dev) == 0x0046)
 #define IS_IVYBRIDGE(dev)      (INTEL_INFO(dev)->is_ivybridge)
-#define IS_IVB_GT1(dev)                ((dev)->pdev->device == 0x0156 || \
-                                (dev)->pdev->device == 0x0152 || \
-                                (dev)->pdev->device == 0x015a)
-#define IS_SNB_GT1(dev)                ((dev)->pdev->device == 0x0102 || \
-                                (dev)->pdev->device == 0x0106 || \
-                                (dev)->pdev->device == 0x010A)
+#define IS_IVB_GT1(dev)                (INTEL_DEVID(dev) == 0x0156 || \
+                                INTEL_DEVID(dev) == 0x0152 || \
+                                INTEL_DEVID(dev) == 0x015a)
+#define IS_SNB_GT1(dev)                (INTEL_DEVID(dev) == 0x0102 || \
+                                INTEL_DEVID(dev) == 0x0106 || \
+                                INTEL_DEVID(dev) == 0x010A)
 #define IS_VALLEYVIEW(dev)     (INTEL_INFO(dev)->is_valleyview)
 #define IS_CHERRYVIEW(dev)     (INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
 #define IS_HASWELL(dev)        (INTEL_INFO(dev)->is_haswell)
 #define IS_BROADWELL(dev)      (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
 #define IS_MOBILE(dev)         (INTEL_INFO(dev)->is_mobile)
 #define IS_HSW_EARLY_SDV(dev)  (IS_HASWELL(dev) && \
-                                ((dev)->pdev->device & 0xFF00) == 0x0C00)
+                                (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
 #define IS_BDW_ULT(dev)                (IS_BROADWELL(dev) && \
-                                (((dev)->pdev->device & 0xf) == 0x2  || \
-                                ((dev)->pdev->device & 0xf) == 0x6 || \
-                                ((dev)->pdev->device & 0xf) == 0xe))
+                                ((INTEL_DEVID(dev) & 0xf) == 0x2  || \
+                                (INTEL_DEVID(dev) & 0xf) == 0x6 || \
+                                (INTEL_DEVID(dev) & 0xf) == 0xe))
 #define IS_HSW_ULT(dev)                (IS_HASWELL(dev) && \
-                                ((dev)->pdev->device & 0xFF00) == 0x0A00)
+                                (INTEL_DEVID(dev) & 0xFF00) == 0x0A00)
 #define IS_ULT(dev)            (IS_HSW_ULT(dev) || IS_BDW_ULT(dev))
 #define IS_HSW_GT3(dev)                (IS_HASWELL(dev) && \
-                                ((dev)->pdev->device & 0x00F0) == 0x0020)
+                                (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
 /* ULX machines are also considered ULT. */
-#define IS_HSW_ULX(dev)                ((dev)->pdev->device == 0x0A0E || \
-                                (dev)->pdev->device == 0x0A1E)
+#define IS_HSW_ULX(dev)                (INTEL_DEVID(dev) == 0x0A0E || \
+                                INTEL_DEVID(dev) == 0x0A1E)
 #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
 
 /*
@@ -2037,10 +2062,11 @@ struct drm_i915_cmd_table {
 #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_HW_CONTEXTS(dev)   (INTEL_INFO(dev)->gen >= 6)
+#define HAS_LOGICAL_RING_CONTEXTS(dev) 0
 #define HAS_ALIASING_PPGTT(dev)        (INTEL_INFO(dev)->gen >= 6)
 #define HAS_PPGTT(dev)         (INTEL_INFO(dev)->gen >= 7 && !IS_GEN8(dev))
-#define USES_PPGTT(dev)                intel_enable_ppgtt(dev, false)
-#define USES_FULL_PPGTT(dev)   intel_enable_ppgtt(dev, true)
+#define USES_PPGTT(dev)                (i915.enable_ppgtt)
+#define USES_FULL_PPGTT(dev)   (i915.enable_ppgtt == 2)
 
 #define HAS_OVERLAY(dev)               (INTEL_INFO(dev)->has_overlay)
 #define OVERLAY_NEEDS_PHYSICAL(dev)    (INTEL_INFO(dev)->overlay_needs_physical)
@@ -2093,6 +2119,8 @@ struct drm_i915_cmd_table {
 #define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP)
 #define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE)
 
+#define HAS_GMCH_DISPLAY(dev) (INTEL_INFO(dev)->gen < 5 || IS_VALLEYVIEW(dev))
+
 /* DPF == dynamic parity feature */
 #define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 #define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
@@ -2122,6 +2150,7 @@ struct i915_params {
        int enable_rc6;
        int enable_fbc;
        int enable_ppgtt;
+       int enable_execlists;
        int enable_psr;
        unsigned int preliminary_hw_support;
        int disable_power_well;
@@ -2136,6 +2165,7 @@ struct i915_params {
        bool disable_display;
        bool disable_vtd_wa;
        int use_mmio_flip;
+       bool mmio_debug;
 };
 extern struct i915_params i915 __read_mostly;
 
@@ -2692,8 +2722,6 @@ extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
 extern void intel_init_pch_refclk(struct drm_device *dev);
 extern void gen6_set_rps(struct drm_device *dev, u8 val);
 extern void valleyview_set_rps(struct drm_device *dev, u8 val);
-extern int valleyview_rps_max_freq(struct drm_i915_private *dev_priv);
-extern int valleyview_rps_min_freq(struct drm_i915_private *dev_priv);
 extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
                                  bool enable);
 extern void intel_detect_pch(struct drm_device *dev);
@@ -2803,10 +2831,10 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);
 
 static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
 {
-       if (HAS_PCH_SPLIT(dev))
-               return CPU_VGACNTRL;
-       else if (IS_VALLEYVIEW(dev))
+       if (IS_VALLEYVIEW(dev))
                return VLV_VGACNTRL;
+       else if (INTEL_INFO(dev)->gen >= 5)
+               return CPU_VGACNTRL;
        else
                return VGACNTRL;
 }
This page took 0.032866 seconds and 5 git commands to generate.