summaryrefslogtreecommitdiff
path: root/drm_debugfs.c
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2017-05-19 22:57:06 -0700
committerSinclair Yeh <syeh@vmware.com>2017-06-14 19:39:41 +0200
commit3c5a89bce93a6b19eb4580411196c04abff094bf (patch)
tree2b671166ad6ee92d523809b33211313b802c3eb4 /drm_debugfs.c
parent90732761ce998497c52a0997721e244a942b88ec (diff)
vmwgfx: Update stand alone to v4.11
* Skipped update to drm_mm and drm_vma_manager because the switch to using interval tree makes porting difficult. * Added memdup_user_nul(), but replaced kmalloc_track_caller() with kmalloc() due to a compilation error. * Removed building and usage of debugfs_crc * VMWGFX_COMPAT_NO_VAF no longer seems to be required * Tested on CentOS 6.5, RHEL 6.8: 2.6.32-696 RHEL 7.3: 3.10.0-514 Ubuntu 14.04: 4.2.0-35 Ubuntu 16.04: 4.4.0-78 Ubuntu 16.04: 4.12-rc1 Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drm_debugfs.c')
-rw-r--r--drm_debugfs.c78
1 files changed, 67 insertions, 11 deletions
diff --git a/drm_debugfs.c b/drm_debugfs.c
index 0ff1c6c..b8a5518 100644
--- a/drm_debugfs.c
+++ b/drm_debugfs.c
@@ -32,10 +32,13 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
+#include <linux/slab.h>
#include <linux/export.h>
#include "drmP.h"
#include "drm_edid.h"
+#include "drm_atomic.h"
#include "drm_internal.h"
+#include "drm_crtc_internal.h"
#if defined(CONFIG_DEBUG_FS)
@@ -45,12 +48,7 @@
static const struct drm_info_list drm_debugfs_list[] = {
{"name", drm_name_info, 0},
- {"vm", drm_vm_info, 0},
{"clients", drm_clients_info, 0},
-#ifndef VMWGFX_STANDALONE
- {"bufs", drm_bufs_info, 0},
- {"vma", drm_vma_info, 0},
-#endif
};
#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
@@ -82,7 +80,8 @@ static const struct file_operations drm_debugfs_fops = {
* \return Zero on success, non-zero on failure
*
* Create a given set of debugfs files represented by an array of
- * gdm_debugfs_lists in the given root directory.
+ * &drm_info_list in the given root directory. These files will be removed
+ * automatically on drm_debugfs_cleanup().
*/
int drm_debugfs_create_files(const struct drm_info_list *files, int count,
struct dentry *root, struct drm_minor *minor)
@@ -107,8 +106,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
root, tmp, &drm_debugfs_fops);
if (!ent) {
- DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n",
- root->d_name.name, files[i].name);
+ DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/%s\n",
+ root, files[i].name);
kfree(tmp);
ret = -1;
goto fail;
@@ -166,6 +165,14 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
return ret;
}
+ if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
+ ret = drm_atomic_debugfs_init(minor);
+ if (ret) {
+ DRM_ERROR("Failed to create atomic debugfs files\n");
+ return ret;
+ }
+ }
+
if (dev->driver->debugfs_init) {
ret = dev->driver->debugfs_init(minor);
if (ret) {
@@ -211,6 +218,19 @@ int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
}
EXPORT_SYMBOL(drm_debugfs_remove_files);
+static void drm_debugfs_remove_all_files(struct drm_minor *minor)
+{
+ struct drm_info_node *node, *tmp;
+
+ mutex_lock(&minor->debugfs_lock);
+ list_for_each_entry_safe(node, tmp, &minor->debugfs_list, list) {
+ debugfs_remove(node->dent);
+ list_del(&node->list);
+ kfree(node);
+ }
+ mutex_unlock(&minor->debugfs_lock);
+}
+
/**
* Cleanup the debugfs filesystem resources.
*
@@ -229,9 +249,9 @@ int drm_debugfs_cleanup(struct drm_minor *minor)
if (dev->driver->debugfs_cleanup)
dev->driver->debugfs_cleanup(minor);
- drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
+ drm_debugfs_remove_all_files(minor);
- debugfs_remove(minor->debugfs_root);
+ debugfs_remove_recursive(minor->debugfs_root);
minor->debugfs_root = NULL;
return 0;
@@ -418,5 +438,41 @@ void drm_debugfs_connector_remove(struct drm_connector *connector)
connector->debugfs_entry = NULL;
}
-#endif /* CONFIG_DEBUG_FS */
+int drm_debugfs_crtc_add(struct drm_crtc *crtc)
+{
+ struct drm_minor *minor = crtc->dev->primary;
+ struct dentry *root;
+ char *name;
+
+ name = kasprintf(GFP_KERNEL, "crtc-%d", crtc->index);
+ if (!name)
+ return -ENOMEM;
+
+ root = debugfs_create_dir(name, minor->debugfs_root);
+ kfree(name);
+ if (!root)
+ return -ENOMEM;
+
+ crtc->debugfs_entry = root;
+
+#ifndef VMWGFX_STANDALONE
+ if (drm_debugfs_crtc_crc_add(crtc))
+ goto error;
+#endif
+ return 0;
+
+#ifndef VMWGFX_STANDALONE
+error:
+ drm_debugfs_crtc_remove(crtc);
+ return -ENOMEM;
+#endif
+}
+
+void drm_debugfs_crtc_remove(struct drm_crtc *crtc)
+{
+ debugfs_remove_recursive(crtc->debugfs_entry);
+ crtc->debugfs_entry = NULL;
+}
+
+#endif /* CONFIG_DEBUG_FS */