Merge tag 'drm-intel-next-2014-12-19' of git://anongit.freedesktop.org/drm-intel...
[cascardo/linux.git] / drivers / gpu / drm / i915 / i915_drv.h
index 25832e5..fd7a493 100644 (file)
@@ -55,7 +55,7 @@
 
 #define DRIVER_NAME            "i915"
 #define DRIVER_DESC            "Intel Graphics"
-#define DRIVER_DATE            "20141205"
+#define DRIVER_DATE            "20141219"
 
 #undef WARN_ON
 /* Many gcc seem to no see through this and fall over :( */
 #define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
                             (long) (x), __func__);
 
+/* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
+ * WARN_ON()) for hw state sanity checks to check for unexpected conditions
+ * which may not necessarily be a user visible problem.  This will either
+ * WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to
+ * enable distros and users to tailor their preferred amount of i915 abrt
+ * spam.
+ */
+#define I915_STATE_WARN(condition, format...) ({                       \
+       int __ret_warn_on = !!(condition);                              \
+       if (unlikely(__ret_warn_on)) {                                  \
+               if (i915.verbose_state_checks)                          \
+                       __WARN_printf(format);                          \
+               else                                                    \
+                       DRM_ERROR(format);                              \
+       }                                                               \
+       unlikely(__ret_warn_on);                                        \
+})
+
+#define I915_STATE_WARN_ON(condition) ({                               \
+       int __ret_warn_on = !!(condition);                              \
+       if (unlikely(__ret_warn_on)) {                                  \
+               if (i915.verbose_state_checks)                          \
+                       __WARN_printf("WARN_ON(" #condition ")\n");     \
+               else                                                    \
+                       DRM_ERROR("WARN_ON(" #condition ")\n");         \
+       }                                                               \
+       unlikely(__ret_warn_on);                                        \
+})
+
 enum pipe {
        INVALID_PIPE = -1,
        PIPE_A = 0,
@@ -936,6 +965,7 @@ struct i915_suspend_saved_registers {
        u32 savePIPEB_LINK_N1;
        u32 saveMCHBAR_RENDER_STANDBY;
        u32 savePCH_PORT_HOTPLUG;
+       u16 saveGCDGMBUS;
 };
 
 struct vlv_s0ix_state {
@@ -2401,6 +2431,7 @@ struct i915_params {
        bool disable_vtd_wa;
        int use_mmio_flip;
        bool mmio_debug;
+       bool verbose_state_checks;
 };
 extern struct i915_params i915 __read_mostly;
 
@@ -2599,9 +2630,8 @@ void i915_vma_move_to_active(struct i915_vma *vma,
 int i915_gem_dumb_create(struct drm_file *file_priv,
                         struct drm_device *dev,
                         struct drm_mode_create_dumb *args);
-int i915_gem_dumb_map_offset(struct drm_file *file_priv,
-                            struct drm_device *dev, uint32_t handle,
-                            uint64_t *offset);
+int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
+                     uint32_t handle, uint64_t *offset);
 /**
  * Returns true if seq1 is later than seq2.
  */
@@ -2965,6 +2995,7 @@ int i915_parse_cmds(struct intel_engine_cs *ring,
                    struct drm_i915_gem_object *batch_obj,
                    struct drm_i915_gem_object *shadow_batch_obj,
                    u32 batch_start_offset,
+                   u32 batch_len,
                    bool is_master);
 
 /* i915_suspend.c */
@@ -3179,6 +3210,11 @@ static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m)
        return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
 }
 
+static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
+{
+        return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
+}
+
 static inline unsigned long
 timespec_to_jiffies_timeout(const struct timespec *value)
 {