[PATCH 3/4] drm/i915: Register perf_ ioctls directly in i915_perf file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marius Vlad <marius.vlad0@xxxxxxxxx>

Signed-off-by: Marius Vlad <marius.vlad0@xxxxxxxxx>
Signed-off-by: Marius-Adrian Negreanu <groleo@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_drv.c  |  3 ---
 drivers/gpu/drm/i915/i915_perf.c | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 73be83d..09f8c6c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1243,9 +1243,6 @@ static struct drm_ioctl_desc i915_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 };
 
 /**
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 94185d6..0b2a9d5 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -3374,6 +3374,12 @@ static struct ctl_table dev_root[] = {
 	{}
 };
 
+static struct drm_ioctl_desc i915_perf_ioctls[] = {
+	DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+};
+
 /**
  * i915_perf_init - initialize i915-perf state on module load
  * @dev_priv: i915 device instance
@@ -3385,6 +3391,8 @@ static struct ctl_table dev_root[] = {
  */
 void i915_perf_init(struct drm_i915_private *dev_priv)
 {
+	unsigned int i;
+	struct drm_device *dev = &dev_priv->drm;
 	dev_priv->perf.oa.timestamp_frequency = 0;
 
 	if (IS_HASWELL(dev_priv)) {
@@ -3483,6 +3491,11 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
 
 		dev_priv->perf.initialized = true;
 	}
+
+	/* register ioctls */
+	for (i = 0; i < ARRAY_SIZE(i915_perf_ioctls); i++)
+		dev->driver->ioctl_register(dev, &i915_perf_ioctls[i]);
+
 }
 
 static int destroy_config(int id, void *p, void *data)
@@ -3501,9 +3514,14 @@ static int destroy_config(int id, void *p, void *data)
  */
 void i915_perf_fini(struct drm_i915_private *dev_priv)
 {
+	unsigned int i;
+	struct drm_device *dev = NULL;
+
 	if (!dev_priv->perf.initialized)
 		return;
 
+	dev = &dev_priv->drm;
+
 	idr_for_each(&dev_priv->perf.metrics_idr, destroy_config, dev_priv);
 	idr_destroy(&dev_priv->perf.metrics_idr);
 
@@ -3511,5 +3529,8 @@ void i915_perf_fini(struct drm_i915_private *dev_priv)
 
 	memset(&dev_priv->perf.oa.ops, 0, sizeof(dev_priv->perf.oa.ops));
 
+	for (i = 0; i < ARRAY_SIZE(i915_perf_ioctls); i++)
+		dev->driver->ioctl_deregister(dev, &i915_perf_ioctls[i]);
+
 	dev_priv->perf.initialized = false;
 }
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux