drm/i915/bdw: Pin the context backing objects to GGTT on-demand
[deliverable/linux.git] / drivers / gpu / drm / i915 / i915_debugfs.c
index e60d5c2f4a35fe9c69d54d1c92638b90f2537102..bb1458381dc45d8704f86a950b7d9bc46879feb2 100644 (file)
@@ -116,7 +116,7 @@ static const char *get_tiling_flag(struct drm_i915_gem_object *obj)
 
 static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
 {
-       return obj->has_global_gtt_mapping ? "g" : " ";
+       return i915_gem_obj_to_ggtt(obj) ? "g" : " ";
 }
 
 static void
@@ -1799,10 +1799,16 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
                                continue;
 
                        if (ctx_obj) {
-                               struct page *page = i915_gem_object_get_page(ctx_obj, 1);
-                               uint32_t *reg_state = kmap_atomic(page);
+                               struct page *page;
+                               uint32_t *reg_state;
                                int j;
 
+                               i915_gem_obj_ggtt_pin(ctx_obj,
+                                               GEN8_LR_CONTEXT_ALIGN, 0);
+
+                               page = i915_gem_object_get_page(ctx_obj, 1);
+                               reg_state = kmap_atomic(page);
+
                                seq_printf(m, "CONTEXT: %s %u\n", ring->name,
                                                intel_execlists_ctx_id(ctx_obj));
 
@@ -1814,6 +1820,8 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
                                }
                                kunmap_atomic(reg_state);
 
+                               i915_gem_object_ggtt_unpin(ctx_obj);
+
                                seq_putc(m, '\n');
                        }
                }
@@ -2630,14 +2638,15 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
                struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i];
 
                seq_printf(m, "DPLL%i: %s, id: %i\n", i, pll->name, pll->id);
-               seq_printf(m, " refcount: %i, active: %i, on: %s\n", pll->refcount,
-                          pll->active, yesno(pll->on));
+               seq_printf(m, " crtc_mask: 0x%08x, active: %d, on: %s\n",
+                          pll->config.crtc_mask, pll->active, yesno(pll->on));
                seq_printf(m, " tracked hardware state:\n");
-               seq_printf(m, " dpll:    0x%08x\n", pll->hw_state.dpll);
-               seq_printf(m, " dpll_md: 0x%08x\n", pll->hw_state.dpll_md);
-               seq_printf(m, " fp0:     0x%08x\n", pll->hw_state.fp0);
-               seq_printf(m, " fp1:     0x%08x\n", pll->hw_state.fp1);
-               seq_printf(m, " wrpll:   0x%08x\n", pll->hw_state.wrpll);
+               seq_printf(m, " dpll:    0x%08x\n", pll->config.hw_state.dpll);
+               seq_printf(m, " dpll_md: 0x%08x\n",
+                          pll->config.hw_state.dpll_md);
+               seq_printf(m, " fp0:     0x%08x\n", pll->config.hw_state.fp0);
+               seq_printf(m, " fp1:     0x%08x\n", pll->config.hw_state.fp1);
+               seq_printf(m, " wrpll:   0x%08x\n", pll->config.hw_state.wrpll);
        }
        drm_modeset_unlock_all(dev);
 
@@ -2678,6 +2687,42 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
        return 0;
 }
 
+static int i915_ddb_info(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct skl_ddb_allocation *ddb;
+       struct skl_ddb_entry *entry;
+       enum pipe pipe;
+       int plane;
+
+       drm_modeset_lock_all(dev);
+
+       ddb = &dev_priv->wm.skl_hw.ddb;
+
+       seq_printf(m, "%-15s%8s%8s%8s\n", "", "Start", "End", "Size");
+
+       for_each_pipe(dev_priv, pipe) {
+               seq_printf(m, "Pipe %c\n", pipe_name(pipe));
+
+               for_each_plane(pipe, plane) {
+                       entry = &ddb->plane[pipe][plane];
+                       seq_printf(m, "  Plane%-8d%8u%8u%8u\n", plane + 1,
+                                  entry->start, entry->end,
+                                  skl_ddb_entry_size(entry));
+               }
+
+               entry = &ddb->cursor[pipe];
+               seq_printf(m, "  %-13s%8u%8u%8u\n", "Cursor", entry->start,
+                          entry->end, skl_ddb_entry_size(entry));
+       }
+
+       drm_modeset_unlock_all(dev);
+
+       return 0;
+}
+
 struct pipe_crc_info {
        const char *name;
        struct drm_device *dev;
@@ -2971,6 +3016,8 @@ static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe,
                                break;
                        }
                        break;
+               default:
+                       break;
                }
        }
        drm_modeset_unlock_all(dev);
@@ -3520,7 +3567,7 @@ static const struct file_operations i915_display_crc_ctl_fops = {
        .write = display_crc_ctl_write
 };
 
-static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
+static void wm_latency_show(struct seq_file *m, const uint16_t wm[8])
 {
        struct drm_device *dev = m->private;
        int num_levels = ilk_wm_max_level(dev) + 1;
@@ -3531,13 +3578,17 @@ static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
        for (level = 0; level < num_levels; level++) {
                unsigned int latency = wm[level];
 
-               /* WM1+ latency values in 0.5us units */
-               if (level > 0)
+               /*
+                * - WM1+ latency values in 0.5us units
+                * - latencies are in us on gen9
+                */
+               if (INTEL_INFO(dev)->gen >= 9)
+                       latency *= 10;
+               else if (level > 0)
                        latency *= 5;
 
                seq_printf(m, "WM%d %u (%u.%u usec)\n",
-                          level, wm[level],
-                          latency / 10, latency % 10);
+                          level, wm[level], latency / 10, latency % 10);
        }
 
        drm_modeset_unlock_all(dev);
@@ -3546,8 +3597,15 @@ static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
 static int pri_wm_latency_show(struct seq_file *m, void *data)
 {
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       const uint16_t *latencies;
 
-       wm_latency_show(m, to_i915(dev)->wm.pri_latency);
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.pri_latency;
+
+       wm_latency_show(m, latencies);
 
        return 0;
 }
@@ -3555,8 +3613,15 @@ static int pri_wm_latency_show(struct seq_file *m, void *data)
 static int spr_wm_latency_show(struct seq_file *m, void *data)
 {
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       const uint16_t *latencies;
 
-       wm_latency_show(m, to_i915(dev)->wm.spr_latency);
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.spr_latency;
+
+       wm_latency_show(m, latencies);
 
        return 0;
 }
@@ -3564,8 +3629,15 @@ static int spr_wm_latency_show(struct seq_file *m, void *data)
 static int cur_wm_latency_show(struct seq_file *m, void *data)
 {
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       const uint16_t *latencies;
 
-       wm_latency_show(m, to_i915(dev)->wm.cur_latency);
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.cur_latency;
+
+       wm_latency_show(m, latencies);
 
        return 0;
 }
@@ -3601,11 +3673,11 @@ static int cur_wm_latency_open(struct inode *inode, struct file *file)
 }
 
 static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
-                               size_t len, loff_t *offp, uint16_t wm[5])
+                               size_t len, loff_t *offp, uint16_t wm[8])
 {
        struct seq_file *m = file->private_data;
        struct drm_device *dev = m->private;
-       uint16_t new[5] = { 0 };
+       uint16_t new[8] = { 0 };
        int num_levels = ilk_wm_max_level(dev) + 1;
        int level;
        int ret;
@@ -3619,7 +3691,9 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
 
        tmp[len] = '\0';
 
-       ret = sscanf(tmp, "%hu %hu %hu %hu %hu", &new[0], &new[1], &new[2], &new[3], &new[4]);
+       ret = sscanf(tmp, "%hu %hu %hu %hu %hu %hu %hu %hu",
+                    &new[0], &new[1], &new[2], &new[3],
+                    &new[4], &new[5], &new[6], &new[7]);
        if (ret != num_levels)
                return -EINVAL;
 
@@ -3639,8 +3713,15 @@ static ssize_t pri_wm_latency_write(struct file *file, const char __user *ubuf,
 {
        struct seq_file *m = file->private_data;
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       uint16_t *latencies;
 
-       return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.pri_latency);
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.pri_latency;
+
+       return wm_latency_write(file, ubuf, len, offp, latencies);
 }
 
 static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf,
@@ -3648,8 +3729,15 @@ static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf,
 {
        struct seq_file *m = file->private_data;
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       uint16_t *latencies;
 
-       return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.spr_latency);
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.spr_latency;
+
+       return wm_latency_write(file, ubuf, len, offp, latencies);
 }
 
 static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf,
@@ -3657,8 +3745,15 @@ static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf,
 {
        struct seq_file *m = file->private_data;
        struct drm_device *dev = m->private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       uint16_t *latencies;
+
+       if (INTEL_INFO(dev)->gen >= 9)
+               latencies = dev_priv->wm.skl_latency;
+       else
+               latencies = to_i915(dev)->wm.cur_latency;
 
-       return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.cur_latency);
+       return wm_latency_write(file, ubuf, len, offp, latencies);
 }
 
 static const struct file_operations i915_pri_wm_latency_fops = {
@@ -4201,6 +4296,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_shared_dplls_info", i915_shared_dplls_info, 0},
        {"i915_dp_mst_info", i915_dp_mst_info, 0},
        {"i915_wa_registers", i915_wa_registers, 0},
+       {"i915_ddb_info", i915_ddb_info, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
This page took 0.042656 seconds and 5 git commands to generate.