aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 6badc1596ceb..b2b46c52294c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -40,8 +40,6 @@
40#include <drm/i915_drm.h> 40#include <drm/i915_drm.h>
41#include "i915_drv.h" 41#include "i915_drv.h"
42 42
43#if defined(CONFIG_DEBUG_FS)
44
45enum { 43enum {
46 ACTIVE_LIST, 44 ACTIVE_LIST,
47 INACTIVE_LIST, 45 INACTIVE_LIST,
@@ -406,16 +404,26 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
406 seq_putc(m, '\n'); 404 seq_putc(m, '\n');
407 list_for_each_entry_reverse(file, &dev->filelist, lhead) { 405 list_for_each_entry_reverse(file, &dev->filelist, lhead) {
408 struct file_stats stats; 406 struct file_stats stats;
407 struct task_struct *task;
409 408
410 memset(&stats, 0, sizeof(stats)); 409 memset(&stats, 0, sizeof(stats));
411 idr_for_each(&file->object_idr, per_file_stats, &stats); 410 idr_for_each(&file->object_idr, per_file_stats, &stats);
411 /*
412 * Although we have a valid reference on file->pid, that does
413 * not guarantee that the task_struct who called get_pid() is
414 * still alive (e.g. get_pid(current) => fork() => exit()).
415 * Therefore, we need to protect this ->comm access using RCU.
416 */
417 rcu_read_lock();
418 task = pid_task(file->pid, PIDTYPE_PID);
412 seq_printf(m, "%s: %u objects, %zu bytes (%zu active, %zu inactive, %zu unbound)\n", 419 seq_printf(m, "%s: %u objects, %zu bytes (%zu active, %zu inactive, %zu unbound)\n",
413 get_pid_task(file->pid, PIDTYPE_PID)->comm, 420 task ? task->comm : "<unknown>",
414 stats.count, 421 stats.count,
415 stats.total, 422 stats.total,
416 stats.active, 423 stats.active,
417 stats.inactive, 424 stats.inactive,
418 stats.unbound); 425 stats.unbound);
426 rcu_read_unlock();
419 } 427 }
420 428
421 mutex_unlock(&dev->struct_mutex); 429 mutex_unlock(&dev->struct_mutex);
@@ -1170,6 +1178,50 @@ static int ironlake_drpc_info(struct seq_file *m)
1170 return 0; 1178 return 0;
1171} 1179}
1172 1180
1181static int vlv_drpc_info(struct seq_file *m)
1182{
1183
1184 struct drm_info_node *node = (struct drm_info_node *) m->private;
1185 struct drm_device *dev = node->minor->dev;
1186 struct drm_i915_private *dev_priv = dev->dev_private;
1187 u32 rpmodectl1, rcctl1;
1188 unsigned fw_rendercount = 0, fw_mediacount = 0;
1189
1190 rpmodectl1 = I915_READ(GEN6_RP_CONTROL);
1191 rcctl1 = I915_READ(GEN6_RC_CONTROL);
1192
1193 seq_printf(m, "Video Turbo Mode: %s\n",
1194 yesno(rpmodectl1 & GEN6_RP_MEDIA_TURBO));
1195 seq_printf(m, "Turbo enabled: %s\n",
1196 yesno(rpmodectl1 & GEN6_RP_ENABLE));
1197 seq_printf(m, "HW control enabled: %s\n",
1198 yesno(rpmodectl1 & GEN6_RP_ENABLE));
1199 seq_printf(m, "SW control enabled: %s\n",
1200 yesno((rpmodectl1 & GEN6_RP_MEDIA_MODE_MASK) ==
1201 GEN6_RP_MEDIA_SW_MODE));
1202 seq_printf(m, "RC6 Enabled: %s\n",
1203 yesno(rcctl1 & (GEN7_RC_CTL_TO_MODE |
1204 GEN6_RC_CTL_EI_MODE(1))));
1205 seq_printf(m, "Render Power Well: %s\n",
1206 (I915_READ(VLV_GTLC_PW_STATUS) &
1207 VLV_GTLC_PW_RENDER_STATUS_MASK) ? "Up" : "Down");
1208 seq_printf(m, "Media Power Well: %s\n",
1209 (I915_READ(VLV_GTLC_PW_STATUS) &
1210 VLV_GTLC_PW_MEDIA_STATUS_MASK) ? "Up" : "Down");
1211
1212 spin_lock_irq(&dev_priv->uncore.lock);
1213 fw_rendercount = dev_priv->uncore.fw_rendercount;
1214 fw_mediacount = dev_priv->uncore.fw_mediacount;
1215 spin_unlock_irq(&dev_priv->uncore.lock);
1216
1217 seq_printf(m, "Forcewake Render Count = %u\n", fw_rendercount);
1218 seq_printf(m, "Forcewake Media Count = %u\n", fw_mediacount);
1219
1220
1221 return 0;
1222}
1223
1224
1173static int gen6_drpc_info(struct seq_file *m) 1225static int gen6_drpc_info(struct seq_file *m)
1174{ 1226{
1175 1227
@@ -1275,7 +1327,9 @@ static int i915_drpc_info(struct seq_file *m, void *unused)
1275 struct drm_info_node *node = (struct drm_info_node *) m->private; 1327 struct drm_info_node *node = (struct drm_info_node *) m->private;
1276 struct drm_device *dev = node->minor->dev; 1328 struct drm_device *dev = node->minor->dev;
1277 1329
1278 if (IS_GEN6(dev) || IS_GEN7(dev)) 1330 if (IS_VALLEYVIEW(dev))
1331 return vlv_drpc_info(m);
1332 else if (IS_GEN6(dev) || IS_GEN7(dev))
1279 return gen6_drpc_info(m); 1333 return gen6_drpc_info(m);
1280 else 1334 else
1281 return ironlake_drpc_info(m); 1335 return ironlake_drpc_info(m);
@@ -1287,7 +1341,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
1287 struct drm_device *dev = node->minor->dev; 1341 struct drm_device *dev = node->minor->dev;
1288 drm_i915_private_t *dev_priv = dev->dev_private; 1342 drm_i915_private_t *dev_priv = dev->dev_private;
1289 1343
1290 if (!I915_HAS_FBC(dev)) { 1344 if (!HAS_FBC(dev)) {
1291 seq_puts(m, "FBC unsupported on this chipset\n"); 1345 seq_puts(m, "FBC unsupported on this chipset\n");
1292 return 0; 1346 return 0;
1293 } 1347 }
@@ -1349,7 +1403,7 @@ static int i915_ips_status(struct seq_file *m, void *unused)
1349 return 0; 1403 return 0;
1350 } 1404 }
1351 1405
1352 if (I915_READ(IPS_CTL) & IPS_ENABLE) 1406 if (IS_BROADWELL(dev) || I915_READ(IPS_CTL) & IPS_ENABLE)
1353 seq_puts(m, "enabled\n"); 1407 seq_puts(m, "enabled\n");
1354 else 1408 else
1355 seq_puts(m, "disabled\n"); 1409 seq_puts(m, "disabled\n");
@@ -2117,8 +2171,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
2117 info->dev = dev; 2171 info->dev = dev;
2118 ent = debugfs_create_file(info->name, S_IRUGO, root, info, 2172 ent = debugfs_create_file(info->name, S_IRUGO, root, info,
2119 &i915_pipe_crc_fops); 2173 &i915_pipe_crc_fops);
2120 if (IS_ERR(ent)) 2174 if (!ent)
2121 return PTR_ERR(ent); 2175 return -ENOMEM;
2122 2176
2123 return drm_add_fake_info_node(minor, ent, info); 2177 return drm_add_fake_info_node(minor, ent, info);
2124} 2178}
@@ -3133,8 +3187,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
3133 S_IRUSR, 3187 S_IRUSR,
3134 root, dev, 3188 root, dev,
3135 &i915_forcewake_fops); 3189 &i915_forcewake_fops);
3136 if (IS_ERR(ent)) 3190 if (!ent)
3137 return PTR_ERR(ent); 3191 return -ENOMEM;
3138 3192
3139 return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops); 3193 return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
3140} 3194}
@@ -3151,8 +3205,8 @@ static int i915_debugfs_create(struct dentry *root,
3151 S_IRUGO | S_IWUSR, 3205 S_IRUGO | S_IWUSR,
3152 root, dev, 3206 root, dev,
3153 fops); 3207 fops);
3154 if (IS_ERR(ent)) 3208 if (!ent)
3155 return PTR_ERR(ent); 3209 return -ENOMEM;
3156 3210
3157 return drm_add_fake_info_node(minor, ent, fops); 3211 return drm_add_fake_info_node(minor, ent, fops);
3158} 3212}
@@ -3282,5 +3336,3 @@ void i915_debugfs_cleanup(struct drm_minor *minor)
3282 drm_debugfs_remove_files(info_list, 1, minor); 3336 drm_debugfs_remove_files(info_list, 1, minor);
3283 } 3337 }
3284} 3338}
3285
3286#endif /* CONFIG_DEBUG_FS */