drm/i915/gtt: Introduce struct i915_page_dma
[cascardo/linux.git] / drivers / gpu / drm / i915 / i915_debugfs.c
index 2ad71ef..b509844 100644 (file)
@@ -198,7 +198,7 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct i915_address_space *vm = &dev_priv->gtt.base;
        struct i915_vma *vma;
-       size_t total_obj_size, total_gtt_size;
+       u64 total_obj_size, total_gtt_size;
        int count, ret;
 
        ret = mutex_lock_interruptible(&dev->struct_mutex);
@@ -231,7 +231,7 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
        }
        mutex_unlock(&dev->struct_mutex);
 
-       seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
+       seq_printf(m, "Total %d objects, %llu bytes, %llu GTT size\n",
                   count, total_obj_size, total_gtt_size);
        return 0;
 }
@@ -253,7 +253,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
        struct drm_device *dev = node->minor->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj;
-       size_t total_obj_size, total_gtt_size;
+       u64 total_obj_size, total_gtt_size;
        LIST_HEAD(stolen);
        int count, ret;
 
@@ -292,7 +292,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
        }
        mutex_unlock(&dev->struct_mutex);
 
-       seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
+       seq_printf(m, "Total %d objects, %llu bytes, %llu GTT size\n",
                   count, total_obj_size, total_gtt_size);
        return 0;
 }
@@ -310,10 +310,10 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
 
 struct file_stats {
        struct drm_i915_file_private *file_priv;
-       int count;
-       size_t total, unbound;
-       size_t global, shared;
-       size_t active, inactive;
+       unsigned long count;
+       u64 total, unbound;
+       u64 global, shared;
+       u64 active, inactive;
 };
 
 static int per_file_stats(int id, void *ptr, void *data)
@@ -370,7 +370,7 @@ static int per_file_stats(int id, void *ptr, void *data)
 
 #define print_file_stats(m, name, stats) do { \
        if (stats.count) \
-               seq_printf(m, "%s: %u objects, %zu bytes (%zu active, %zu inactive, %zu global, %zu shared, %zu unbound)\n", \
+               seq_printf(m, "%s: %lu objects, %llu bytes (%llu active, %llu inactive, %llu global, %llu shared, %llu unbound)\n", \
                           name, \
                           stats.count, \
                           stats.total, \
@@ -420,7 +420,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
        struct drm_device *dev = node->minor->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        u32 count, mappable_count, purgeable_count;
-       size_t size, mappable_size, purgeable_size;
+       u64 size, mappable_size, purgeable_size;
        struct drm_i915_gem_object *obj;
        struct i915_address_space *vm = &dev_priv->gtt.base;
        struct drm_file *file;
@@ -437,17 +437,17 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
 
        size = count = mappable_size = mappable_count = 0;
        count_objects(&dev_priv->mm.bound_list, global_list);
-       seq_printf(m, "%u [%u] objects, %zu [%zu] bytes in gtt\n",
+       seq_printf(m, "%u [%u] objects, %llu [%llu] bytes in gtt\n",
                   count, mappable_count, size, mappable_size);
 
        size = count = mappable_size = mappable_count = 0;
        count_vmas(&vm->active_list, mm_list);
-       seq_printf(m, "  %u [%u] active objects, %zu [%zu] bytes\n",
+       seq_printf(m, "  %u [%u] active objects, %llu [%llu] bytes\n",
                   count, mappable_count, size, mappable_size);
 
        size = count = mappable_size = mappable_count = 0;
        count_vmas(&vm->inactive_list, mm_list);
-       seq_printf(m, "  %u [%u] inactive objects, %zu [%zu] bytes\n",
+       seq_printf(m, "  %u [%u] inactive objects, %llu [%llu] bytes\n",
                   count, mappable_count, size, mappable_size);
 
        size = count = purgeable_size = purgeable_count = 0;
@@ -456,7 +456,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
                if (obj->madv == I915_MADV_DONTNEED)
                        purgeable_size += obj->base.size, ++purgeable_count;
        }
-       seq_printf(m, "%u unbound objects, %zu bytes\n", count, size);
+       seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
 
        size = count = mappable_size = mappable_count = 0;
        list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
@@ -473,16 +473,16 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
                        ++purgeable_count;
                }
        }
-       seq_printf(m, "%u purgeable objects, %zu bytes\n",
+       seq_printf(m, "%u purgeable objects, %llu bytes\n",
                   purgeable_count, purgeable_size);
-       seq_printf(m, "%u pinned mappable objects, %zu bytes\n",
+       seq_printf(m, "%u pinned mappable objects, %llu bytes\n",
                   mappable_count, mappable_size);
-       seq_printf(m, "%u fault mappable objects, %zu bytes\n",
+       seq_printf(m, "%u fault mappable objects, %llu bytes\n",
                   count, size);
 
-       seq_printf(m, "%zu [%lu] gtt total\n",
+       seq_printf(m, "%llu [%llu] gtt total\n",
                   dev_priv->gtt.base.total,
-                  dev_priv->gtt.mappable_end - dev_priv->gtt.base.start);
+                  (u64)dev_priv->gtt.mappable_end - dev_priv->gtt.base.start);
 
        seq_putc(m, '\n');
        print_batch_pool_stats(m, dev_priv);
@@ -519,7 +519,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data)
        uintptr_t list = (uintptr_t) node->info_ent->data;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj;
-       size_t total_obj_size, total_gtt_size;
+       u64 total_obj_size, total_gtt_size;
        int count, ret;
 
        ret = mutex_lock_interruptible(&dev->struct_mutex);
@@ -541,7 +541,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data)
 
        mutex_unlock(&dev->struct_mutex);
 
-       seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
+       seq_printf(m, "Total %d objects, %llu bytes, %llu GTT size\n",
                   count, total_obj_size, total_gtt_size);
 
        return 0;
@@ -1581,6 +1581,21 @@ static int i915_drpc_info(struct seq_file *m, void *unused)
                return ironlake_drpc_info(m);
 }
 
+static int i915_frontbuffer_tracking(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;
+
+       seq_printf(m, "FB tracking busy bits: 0x%08x\n",
+                  dev_priv->fb_tracking.busy_bits);
+
+       seq_printf(m, "FB tracking flip bits: 0x%08x\n",
+                  dev_priv->fb_tracking.flip_bits);
+
+       return 0;
+}
+
 static int i915_fbc_status(struct seq_file *m, void *unused)
 {
        struct drm_info_node *node = m->private;
@@ -1594,49 +1609,16 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 
        intel_runtime_pm_get(dev_priv);
 
-       if (intel_fbc_enabled(dev)) {
+       if (intel_fbc_enabled(dev))
                seq_puts(m, "FBC enabled\n");
-       } else {
-               seq_puts(m, "FBC disabled: ");
-               switch (dev_priv->fbc.no_fbc_reason) {
-               case FBC_OK:
-                       seq_puts(m, "FBC actived, but currently disabled in hardware");
-                       break;
-               case FBC_UNSUPPORTED:
-                       seq_puts(m, "unsupported by this chipset");
-                       break;
-               case FBC_NO_OUTPUT:
-                       seq_puts(m, "no outputs");
-                       break;
-               case FBC_STOLEN_TOO_SMALL:
-                       seq_puts(m, "not enough stolen memory");
-                       break;
-               case FBC_UNSUPPORTED_MODE:
-                       seq_puts(m, "mode not supported");
-                       break;
-               case FBC_MODE_TOO_LARGE:
-                       seq_puts(m, "mode too large");
-                       break;
-               case FBC_BAD_PLANE:
-                       seq_puts(m, "FBC unsupported on plane");
-                       break;
-               case FBC_NOT_TILED:
-                       seq_puts(m, "scanout buffer not tiled");
-                       break;
-               case FBC_MULTIPLE_PIPES:
-                       seq_puts(m, "multiple pipes are enabled");
-                       break;
-               case FBC_MODULE_PARAM:
-                       seq_puts(m, "disabled per module param (default off)");
-                       break;
-               case FBC_CHIP_DEFAULT:
-                       seq_puts(m, "disabled per chip default");
-                       break;
-               default:
-                       seq_puts(m, "unknown reason");
-               }
-               seq_putc(m, '\n');
-       }
+       else
+               seq_printf(m, "FBC disabled: %s\n",
+                         intel_no_fbc_reason_str(dev_priv->fbc.no_fbc_reason));
+
+       if (INTEL_INFO(dev_priv)->gen >= 7)
+               seq_printf(m, "Compressing: %s\n",
+                          yesno(I915_READ(FBC_STATUS2) &
+                                FBC_COMPRESSION_MASK));
 
        intel_runtime_pm_put(dev_priv);
 
@@ -2245,7 +2227,7 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
                struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
 
                seq_puts(m, "aliasing PPGTT:\n");
-               seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd.pd_offset);
+               seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd.base.ggtt_offset);
 
                ppgtt->debug_dump(ppgtt, m);
        }
@@ -2783,13 +2765,16 @@ static int i915_display_info(struct seq_file *m, void *unused)
        seq_printf(m, "---------\n");
        for_each_intel_crtc(dev, crtc) {
                bool active;
+               struct intel_crtc_state *pipe_config;
                int x, y;
 
+               pipe_config = to_intel_crtc_state(crtc->base.state);
+
                seq_printf(m, "CRTC %d: pipe: %c, active=%s (size=%dx%d)\n",
                           crtc->base.base.id, pipe_name(crtc->pipe),
-                          yesno(crtc->active), crtc->config->pipe_src_w,
-                          crtc->config->pipe_src_h);
-               if (crtc->active) {
+                          yesno(pipe_config->base.active),
+                          pipe_config->pipe_src_w, pipe_config->pipe_src_h);
+               if (pipe_config->base.active) {
                        intel_crtc_info(m, crtc);
 
                        active = cursor_position(dev, crtc->pipe, &x, &y);
@@ -3030,7 +3015,7 @@ static void drrs_status_per_crtc(struct seq_file *m,
 
        seq_puts(m, "\n\n");
 
-       if (intel_crtc->config->has_drrs) {
+       if (to_intel_crtc_state(intel_crtc->base.state)->has_drrs) {
                struct intel_panel *panel;
 
                mutex_lock(&drrs->mutex);
@@ -3082,7 +3067,7 @@ static int i915_drrs_status(struct seq_file *m, void *unused)
        for_each_intel_crtc(dev, intel_crtc) {
                drm_modeset_lock(&intel_crtc->base.mutex, NULL);
 
-               if (intel_crtc->active) {
+               if (intel_crtc->base.state->active) {
                        active_crtc_cnt++;
                        seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
 
@@ -3624,22 +3609,33 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *crtc =
                to_intel_crtc(dev_priv->pipe_to_crtc_mapping[PIPE_A]);
+       struct intel_crtc_state *pipe_config;
 
        drm_modeset_lock_all(dev);
+       pipe_config = to_intel_crtc_state(crtc->base.state);
+
        /*
         * If we use the eDP transcoder we need to make sure that we don't
         * bypass the pfit, since otherwise the pipe CRC source won't work. Only
         * relevant on hsw with pipe A when using the always-on power well
         * routing.
         */
-       if (crtc->config->cpu_transcoder == TRANSCODER_EDP &&
-           !crtc->config->pch_pfit.enabled) {
-               crtc->config->pch_pfit.force_thru = true;
+       if (pipe_config->cpu_transcoder == TRANSCODER_EDP &&
+           !pipe_config->pch_pfit.enabled) {
+               bool active = pipe_config->base.active;
+
+               if (active) {
+                       intel_crtc_control(&crtc->base, false);
+                       pipe_config = to_intel_crtc_state(crtc->base.state);
+               }
+
+               pipe_config->pch_pfit.force_thru = true;
 
                intel_display_power_get(dev_priv,
                                        POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
 
-               intel_crtc_reset(crtc);
+               if (active)
+                       intel_crtc_control(&crtc->base, true);
        }
        drm_modeset_unlock_all(dev);
 }
@@ -3649,6 +3645,7 @@ static void hsw_undo_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *crtc =
                to_intel_crtc(dev_priv->pipe_to_crtc_mapping[PIPE_A]);
+       struct intel_crtc_state *pipe_config;
 
        drm_modeset_lock_all(dev);
        /*
@@ -3657,13 +3654,22 @@ static void hsw_undo_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
         * relevant on hsw with pipe A when using the always-on power well
         * routing.
         */
-       if (crtc->config->pch_pfit.force_thru) {
-               crtc->config->pch_pfit.force_thru = false;
+       pipe_config = to_intel_crtc_state(crtc->base.state);
+       if (pipe_config->pch_pfit.force_thru) {
+               bool active = pipe_config->base.active;
+
+               if (active) {
+                       intel_crtc_control(&crtc->base, false);
+                       pipe_config = to_intel_crtc_state(crtc->base.state);
+               }
 
-               intel_crtc_reset(crtc);
+               pipe_config->pch_pfit.force_thru = false;
 
                intel_display_power_put(dev_priv,
                                        POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
+
+               if (active)
+                       intel_crtc_control(&crtc->base, true);
        }
        drm_modeset_unlock_all(dev);
 }
@@ -3779,7 +3785,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
                                 pipe_name(pipe));
 
                drm_modeset_lock(&crtc->base.mutex, NULL);
-               if (crtc->active)
+               if (crtc->base.state->active)
                        intel_wait_for_vblank(dev, pipe);
                drm_modeset_unlock(&crtc->base.mutex);
 
@@ -5030,6 +5036,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_drpc_info", i915_drpc_info, 0},
        {"i915_emon_status", i915_emon_status, 0},
        {"i915_ring_freq_table", i915_ring_freq_table, 0},
+       {"i915_frontbuffer_tracking", i915_frontbuffer_tracking, 0},
        {"i915_fbc_status", i915_fbc_status, 0},
        {"i915_ips_status", i915_ips_status, 0},
        {"i915_sr_status", i915_sr_status, 0},