All of lore.kernel.org
 help / color / mirror / Atom feed
* Some lost drm patches
@ 2013-05-08 16:03 Damien Lespiau
  2013-05-08 16:03 ` [PATCH 1/5] drm: Add missing break in the command line mode parsing code Damien Lespiau
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

I just collected a few sad patches crying in the dark alley of the Internet
that dri-devel can sometimes be. A few of them even have a r-b tag by
benevolent and fatherly figures. All they want is to find a new home!

-- 
Damien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] drm: Add missing break in the command line mode parsing code
  2013-05-08 16:03 Some lost drm patches Damien Lespiau
@ 2013-05-08 16:03 ` Damien Lespiau
  2013-05-08 16:03 ` [PATCH 2/5] drm: Make the HPD status updates debug logs more readable Damien Lespiau
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

As we parse the string given on the command line one char at a time, it
seems that we do want a break at every case.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
---
 drivers/gpu/drm/drm_modes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 04fa6f1..b1d4836 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1123,6 +1123,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 				was_digit = false;
 			} else
 				goto done;
+			break;
 		case '0' ... '9':
 			was_digit = true;
 			break;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] drm: Make the HPD status updates debug logs more readable
  2013-05-08 16:03 Some lost drm patches Damien Lespiau
  2013-05-08 16:03 ` [PATCH 1/5] drm: Add missing break in the command line mode parsing code Damien Lespiau
@ 2013-05-08 16:03 ` Damien Lespiau
  2013-05-08 16:43   ` Chris Wilson
  2013-05-08 16:43   ` Ville Syrjälä
  2013-05-08 16:03 ` [PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected Damien Lespiau
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

Instead of just printing "status updated from 1 to 2", make those enum
numbers immediately readable.

v2: Also patch output_poll_execute() (Daniel Vetter)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 7b2d378..8976eb6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
 
+static const char *connector_status_str(enum drm_connector_status status)
+{
+	switch (status) {
+	case connector_status_connected:
+		return "connected";
+	case connector_status_disconnected:
+		return "disconnected";
+	default:
+		return "unknown";
+	}
+}
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct *work)
 			continue;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}
@@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
 		old_status = connector->status;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected
  2013-05-08 16:03 Some lost drm patches Damien Lespiau
  2013-05-08 16:03 ` [PATCH 1/5] drm: Add missing break in the command line mode parsing code Damien Lespiau
  2013-05-08 16:03 ` [PATCH 2/5] drm: Make the HPD status updates debug logs more readable Damien Lespiau
@ 2013-05-08 16:03 ` Damien Lespiau
  2013-05-08 16:03 ` [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation Damien Lespiau
  2013-05-08 16:03 ` [PATCH 5/5] drm: Use names of ioctls in debug traces Damien Lespiau
  4 siblings, 0 replies; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

drm_helper_probe_single_connector_modes() is responsible for pruning the
previously detected modes on a disconnected connector. We don't really
need to log, again, the full list of modes that used to be valid when
connected.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 8976eb6..4fea4a3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -121,6 +121,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		connector->helper_private;
 	int count = 0;
 	int mode_flags = 0;
+	bool verbose_prune = true;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
 			drm_get_connector_name(connector));
@@ -149,6 +150,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
 			connector->base.id, drm_get_connector_name(connector));
 		drm_mode_connector_update_edid_property(connector, NULL);
+		verbose_prune = false;
 		goto prune;
 	}
 
@@ -182,7 +184,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 	}
 
 prune:
-	drm_mode_prune_invalid(dev, &connector->modes, true);
+	drm_mode_prune_invalid(dev, &connector->modes, verbose_prune);
 
 	if (list_empty(&connector->modes))
 		return 0;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation
  2013-05-08 16:03 Some lost drm patches Damien Lespiau
                   ` (2 preceding siblings ...)
  2013-05-08 16:03 ` [PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected Damien Lespiau
@ 2013-05-08 16:03 ` Damien Lespiau
  2013-05-08 16:43   ` Ville Syrjälä
  2013-05-08 16:03 ` [PATCH 5/5] drm: Use names of ioctls in debug traces Damien Lespiau
  4 siblings, 1 reply; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

From: "Lespiau, Damien" <damien.lespiau@intel.com>

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 include/drm/drm_crtc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d65..23fb185 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -660,7 +660,7 @@ struct drm_plane_funcs {
  * @gamma_store: gamma correction table
  * @enabled: enabled flag
  * @funcs: helper functions
- * @helper_private: storage for drver layer
+ * @helper_private: storage for driver layer
  * @properties: property tracking for this plane
  */
 struct drm_plane {
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] drm: Use names of ioctls in debug traces
  2013-05-08 16:03 Some lost drm patches Damien Lespiau
                   ` (3 preceding siblings ...)
  2013-05-08 16:03 ` [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation Damien Lespiau
@ 2013-05-08 16:03 ` Damien Lespiau
  2013-05-08 16:55   ` [Intel-gfx] " Ville Syrjälä
  4 siblings, 1 reply; 14+ messages in thread
From: Damien Lespiau @ 2013-05-08 16:03 UTC (permalink / raw)
  To: intel-gfx, dri-devel

From: Chris Cummins <christopher.e.cummins@intel.com>

The intention here is to make the output of dmesg with full verbosity a
bit easier for a human to parse. This commit transforms:

[drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
[drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

into:

[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

Signed-off-by: Chris Cummins <christopher.e.cummins@intel.com>
---
 drivers/gpu/drm/drm_drv.c | 20 +++++++++++++-------
 include/drm/drmP.h        |  3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 25f91cd..0382f6e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
 
 #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
-	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0}
+	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl}
 
 /** Ioctl table */
 static struct drm_ioctl_desc drm_ioctls[] = {
@@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
 {
 	struct drm_file *file_priv = filp->private_data;
 	struct drm_device *dev;
-	struct drm_ioctl_desc *ioctl;
+	struct drm_ioctl_desc *ioctl = NULL;
 	drm_ioctl_t *func;
 	unsigned int nr = DRM_IOCTL_NR(cmd);
 	int retcode = -EINVAL;
@@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
 	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
 	++file_priv->ioctl_count;
 
-	DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
-		  task_pid_nr(current), cmd, nr,
-		  (long)old_encode_dev(file_priv->minor->device),
-		  file_priv->authenticated);
-
 	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
 	    ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
 		goto err_i1;
@@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
 	} else
 		goto err_i1;
 
+	DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
+		  task_pid_nr(current),
+		  (long)old_encode_dev(file_priv->minor->device),
+		  file_priv->authenticated, ioctl->name);
+
 	/* Do not trust userspace, use our own definition */
 	func = ioctl->func;
 	/* is there a local override? */
@@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
 	}
 
       err_i1:
+	if (!ioctl)
+		DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
+			  task_pid_nr(current),
+			  (long)old_encode_dev(file_priv->minor->device),
+			  file_priv->authenticated, cmd, nr);
+
 	if (kdata != stack_kdata)
 		kfree(kdata);
 	atomic_dec(&dev->ioctl_count);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d74..379787c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -316,6 +316,7 @@ struct drm_ioctl_desc {
 	int flags;
 	drm_ioctl_t *func;
 	unsigned int cmd_drv;
+	const char *name;
 };
 
 /**
@@ -324,7 +325,7 @@ struct drm_ioctl_desc {
  */
 
 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)			\
-	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
+	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
 
 struct drm_magic_entry {
 	struct list_head head;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm: Make the HPD status updates debug logs more readable
  2013-05-08 16:03 ` [PATCH 2/5] drm: Make the HPD status updates debug logs more readable Damien Lespiau
@ 2013-05-08 16:43   ` Chris Wilson
  2013-05-08 16:43   ` Ville Syrjälä
  1 sibling, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2013-05-08 16:43 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx, dri-devel

On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> 
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)

For bonus points, only emit the message when it is updated.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm: Make the HPD status updates debug logs more readable
  2013-05-08 16:03 ` [PATCH 2/5] drm: Make the HPD status updates debug logs more readable Damien Lespiau
  2013-05-08 16:43   ` Chris Wilson
@ 2013-05-08 16:43   ` Ville Syrjälä
  2013-05-10  6:27     ` Jani Nikula
  1 sibling, 1 reply; 14+ messages in thread
From: Ville Syrjälä @ 2013-05-08 16:43 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx, dri-devel

On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 7b2d378..8976eb6 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
>  
> +static const char *connector_status_str(enum drm_connector_status status)
> +{
> +	switch (status) {
> +	case connector_status_connected:
> +		return "connected";
> +	case connector_status_disconnected:
> +		return "disconnected";
> +	default:
> +		return "unknown";
> +	}
> +}

drm_get_connector_status_name()

> +
>  #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
>  static void output_poll_execute(struct work_struct *work)
>  {
> @@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct *work)
>  			continue;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> @@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
>  		old_status = connector->status;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> -- 
> 1.8.1.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation
  2013-05-08 16:03 ` [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation Damien Lespiau
@ 2013-05-08 16:43   ` Ville Syrjälä
  0 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2013-05-08 16:43 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx, dri-devel

On Wed, May 08, 2013 at 05:03:33PM +0100, Damien Lespiau wrote:
> From: "Lespiau, Damien" <damien.lespiau@intel.com>
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  include/drm/drm_crtc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index e3e0d65..23fb185 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -660,7 +660,7 @@ struct drm_plane_funcs {
>   * @gamma_store: gamma correction table
>   * @enabled: enabled flag
>   * @funcs: helper functions
> - * @helper_private: storage for drver layer
> + * @helper_private: storage for driver layer

I just killed this guy. Well, assuming my patch gets accepted.

>   * @properties: property tracking for this plane
>   */
>  struct drm_plane {
> -- 
> 1.8.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH 5/5] drm: Use names of ioctls in debug traces
  2013-05-08 16:03 ` [PATCH 5/5] drm: Use names of ioctls in debug traces Damien Lespiau
@ 2013-05-08 16:55   ` Ville Syrjälä
  2013-05-09  1:46     ` Ben Widawsky
  2013-05-09 13:20     ` [PATCH v2 " Chris Cummins
  0 siblings, 2 replies; 14+ messages in thread
From: Ville Syrjälä @ 2013-05-08 16:55 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx, dri-devel

On Wed, May 08, 2013 at 05:03:34PM +0100, Damien Lespiau wrote:
> From: Chris Cummins <christopher.e.cummins@intel.com>
> 
> The intention here is to make the output of dmesg with full verbosity a
> bit easier for a human to parse. This commit transforms:
> 
> [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> 
> into:
> 
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]

I like it. But I made drm_ioctls const recently so the patch needs a
small refresh.

BTW am I the only one who hates the DRM_IOCTL_DEF_DRV() macro? Thanks to
the cpp magic it's difficult to look up the ioctls using cscope. OTOH
with this patch looking up the numbers does become less important.

> Signed-off-by: Chris Cummins <christopher.e.cummins@intel.com>
> ---
>  drivers/gpu/drm/drm_drv.c | 20 +++++++++++++-------
>  include/drm/drmP.h        |  3 ++-
>  2 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 25f91cd..0382f6e 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
>  		       struct drm_file *file_priv);
>  
>  #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
> -	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0}
> +	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl}
>  
>  /** Ioctl table */
>  static struct drm_ioctl_desc drm_ioctls[] = {
> @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
>  {
>  	struct drm_file *file_priv = filp->private_data;
>  	struct drm_device *dev;
> -	struct drm_ioctl_desc *ioctl;
> +	struct drm_ioctl_desc *ioctl = NULL;
>  	drm_ioctl_t *func;
>  	unsigned int nr = DRM_IOCTL_NR(cmd);
>  	int retcode = -EINVAL;
> @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
>  	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
>  	++file_priv->ioctl_count;
>  
> -	DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
> -		  task_pid_nr(current), cmd, nr,
> -		  (long)old_encode_dev(file_priv->minor->device),
> -		  file_priv->authenticated);
> -
>  	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
>  	    ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
>  		goto err_i1;
> @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
>  	} else
>  		goto err_i1;
>  
> +	DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> +		  task_pid_nr(current),
> +		  (long)old_encode_dev(file_priv->minor->device),
> +		  file_priv->authenticated, ioctl->name);
> +
>  	/* Do not trust userspace, use our own definition */
>  	func = ioctl->func;
>  	/* is there a local override? */
> @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
>  	}
>  
>        err_i1:
> +	if (!ioctl)
> +		DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
> +			  task_pid_nr(current),
> +			  (long)old_encode_dev(file_priv->minor->device),
> +			  file_priv->authenticated, cmd, nr);
> +
>  	if (kdata != stack_kdata)
>  		kfree(kdata);
>  	atomic_dec(&dev->ioctl_count);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2d94d74..379787c 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
>  	int flags;
>  	drm_ioctl_t *func;
>  	unsigned int cmd_drv;
> +	const char *name;
>  };
>  
>  /**
> @@ -324,7 +325,7 @@ struct drm_ioctl_desc {
>   */
>  
>  #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)			\
> -	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
> +	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
>  
>  struct drm_magic_entry {
>  	struct list_head head;
> -- 
> 1.8.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH 5/5] drm: Use names of ioctls in debug traces
  2013-05-08 16:55   ` [Intel-gfx] " Ville Syrjälä
@ 2013-05-09  1:46     ` Ben Widawsky
  2013-05-09 13:20     ` [PATCH v2 " Chris Cummins
  1 sibling, 0 replies; 14+ messages in thread
From: Ben Widawsky @ 2013-05-09  1:46 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Wed, May 08, 2013 at 07:55:18PM +0300, Ville Syrjälä wrote:
> On Wed, May 08, 2013 at 05:03:34PM +0100, Damien Lespiau wrote:
> > From: Chris Cummins <christopher.e.cummins@intel.com>
> > 
> > The intention here is to make the output of dmesg with full verbosity a
> > bit easier for a human to parse. This commit transforms:
> > 
> > [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
> > [drm:drm_mode_addfb], [FB:32]
> > [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
> > [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> > [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
> > [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> > 
> > into:
> > 
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
> > [drm:drm_mode_addfb], [FB:32]
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
> > [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
> > [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> 
> I like it. But I made drm_ioctls const recently so the patch needs a
> small refresh.
> 
> BTW am I the only one who hates the DRM_IOCTL_DEF_DRV() macro? Thanks to
> the cpp magic it's difficult to look up the ioctls using cscope. OTOH
> with this patch looking up the numbers does become less important.

You are not the only one who hates it.

> 
> > Signed-off-by: Chris Cummins <christopher.e.cummins@intel.com>
> > ---
> >  drivers/gpu/drm/drm_drv.c | 20 +++++++++++++-------
> >  include/drm/drmP.h        |  3 ++-
> >  2 files changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index 25f91cd..0382f6e 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
> >  		       struct drm_file *file_priv);
> >  
> >  #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
> > -	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0}
> > +	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl}
> >  
> >  /** Ioctl table */
> >  static struct drm_ioctl_desc drm_ioctls[] = {
> > @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
> >  {
> >  	struct drm_file *file_priv = filp->private_data;
> >  	struct drm_device *dev;
> > -	struct drm_ioctl_desc *ioctl;
> > +	struct drm_ioctl_desc *ioctl = NULL;
> >  	drm_ioctl_t *func;
> >  	unsigned int nr = DRM_IOCTL_NR(cmd);
> >  	int retcode = -EINVAL;
> > @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
> >  	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
> >  	++file_priv->ioctl_count;
> >  
> > -	DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
> > -		  task_pid_nr(current), cmd, nr,
> > -		  (long)old_encode_dev(file_priv->minor->device),
> > -		  file_priv->authenticated);
> > -
> >  	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
> >  	    ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
> >  		goto err_i1;
> > @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
> >  	} else
> >  		goto err_i1;
> >  
> > +	DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> > +		  task_pid_nr(current),
> > +		  (long)old_encode_dev(file_priv->minor->device),
> > +		  file_priv->authenticated, ioctl->name);
> > +
> >  	/* Do not trust userspace, use our own definition */
> >  	func = ioctl->func;
> >  	/* is there a local override? */
> > @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
> >  	}
> >  
> >        err_i1:
> > +	if (!ioctl)
> > +		DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
> > +			  task_pid_nr(current),
> > +			  (long)old_encode_dev(file_priv->minor->device),
> > +			  file_priv->authenticated, cmd, nr);
> > +
> >  	if (kdata != stack_kdata)
> >  		kfree(kdata);
> >  	atomic_dec(&dev->ioctl_count);
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 2d94d74..379787c 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
> >  	int flags;
> >  	drm_ioctl_t *func;
> >  	unsigned int cmd_drv;
> > +	const char *name;
> >  };
> >  
> >  /**
> > @@ -324,7 +325,7 @@ struct drm_ioctl_desc {
> >   */
> >  
> >  #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)			\
> > -	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
> > +	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
> >  
> >  struct drm_magic_entry {
> >  	struct list_head head;
> > -- 
> > 1.8.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 5/5] drm: Use names of ioctls in debug traces
  2013-05-08 16:55   ` [Intel-gfx] " Ville Syrjälä
  2013-05-09  1:46     ` Ben Widawsky
@ 2013-05-09 13:20     ` Chris Cummins
  2013-05-09 13:29       ` Alex Deucher
  1 sibling, 1 reply; 14+ messages in thread
From: Chris Cummins @ 2013-05-09 13:20 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx, dri-devel

The intention here is to make the output of dmesg with full verbosity a
bit easier for a human to parse. This commit transforms:

[drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
[drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

into:

[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

v2: drm_ioctls is now a constant (Ville Syrjälä)

Signed-off-by: Chris Cummins <christopher.e.cummins@intel.com>
---
 drivers/gpu/drm/drm_drv.c | 20 +++++++++++++-------
 include/drm/drmP.h        |  3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 0ba4dcb..dfa228b 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
 
 #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
-	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0}
+	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl}
 
 /** Ioctl table */
 static const struct drm_ioctl_desc drm_ioctls[] = {
@@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
 {
 	struct drm_file *file_priv = filp->private_data;
 	struct drm_device *dev;
-	const struct drm_ioctl_desc *ioctl;
+	const struct drm_ioctl_desc *ioctl = NULL;
 	drm_ioctl_t *func;
 	unsigned int nr = DRM_IOCTL_NR(cmd);
 	int retcode = -EINVAL;
@@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
 	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
 	++file_priv->ioctl_count;
 
-	DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
-		  task_pid_nr(current), cmd, nr,
-		  (long)old_encode_dev(file_priv->minor->device),
-		  file_priv->authenticated);
-
 	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
 	    ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
 		goto err_i1;
@@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
 	} else
 		goto err_i1;
 
+	DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
+		  task_pid_nr(current),
+		  (long)old_encode_dev(file_priv->minor->device),
+		  file_priv->authenticated, ioctl->name);
+
 	/* Do not trust userspace, use our own definition */
 	func = ioctl->func;
 	/* is there a local override? */
@@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
 	}
 
       err_i1:
+	if (!ioctl)
+		DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
+			  task_pid_nr(current),
+			  (long)old_encode_dev(file_priv->minor->device),
+			  file_priv->authenticated, cmd, nr);
+
 	if (kdata != stack_kdata)
 		kfree(kdata);
 	atomic_dec(&dev->ioctl_count);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d74..379787c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -316,6 +316,7 @@ struct drm_ioctl_desc {
 	int flags;
 	drm_ioctl_t *func;
 	unsigned int cmd_drv;
+	const char *name;
 };
 
 /**
@@ -324,7 +325,7 @@ struct drm_ioctl_desc {
  */
 
 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)			\
-	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
+	[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
 
 struct drm_magic_entry {
 	struct list_head head;
-- 
1.8.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 5/5] drm: Use names of ioctls in debug traces
  2013-05-09 13:20     ` [PATCH v2 " Chris Cummins
@ 2013-05-09 13:29       ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2013-05-09 13:29 UTC (permalink / raw)
  To: Chris Cummins; +Cc: intel-gfx, dri-devel

On Thu, May 9, 2013 at 9:20 AM, Chris Cummins
<christopher.e.cummins@intel.com> wrote:
> The intention here is to make the output of dmesg with full verbosity a
> bit easier for a human to parse. This commit transforms:
>
> [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
>
> into:
>
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
>
> v2: drm_ioctls is now a constant (Ville Syrjälä)
>
> Signed-off-by: Chris Cummins <christopher.e.cummins@intel.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_drv.c | 20 +++++++++++++-------
>  include/drm/drmP.h        |  3 ++-
>  2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 0ba4dcb..dfa228b 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
>                        struct drm_file *file_priv);
>
>  #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
> -       [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0}
> +       [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl}
>
>  /** Ioctl table */
>  static const struct drm_ioctl_desc drm_ioctls[] = {
> @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
>  {
>         struct drm_file *file_priv = filp->private_data;
>         struct drm_device *dev;
> -       const struct drm_ioctl_desc *ioctl;
> +       const struct drm_ioctl_desc *ioctl = NULL;
>         drm_ioctl_t *func;
>         unsigned int nr = DRM_IOCTL_NR(cmd);
>         int retcode = -EINVAL;
> @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
>         atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
>         ++file_priv->ioctl_count;
>
> -       DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
> -                 task_pid_nr(current), cmd, nr,
> -                 (long)old_encode_dev(file_priv->minor->device),
> -                 file_priv->authenticated);
> -
>         if ((nr >= DRM_CORE_IOCTL_COUNT) &&
>             ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
>                 goto err_i1;
> @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
>         } else
>                 goto err_i1;
>
> +       DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> +                 task_pid_nr(current),
> +                 (long)old_encode_dev(file_priv->minor->device),
> +                 file_priv->authenticated, ioctl->name);
> +
>         /* Do not trust userspace, use our own definition */
>         func = ioctl->func;
>         /* is there a local override? */
> @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
>         }
>
>        err_i1:
> +       if (!ioctl)
> +               DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
> +                         task_pid_nr(current),
> +                         (long)old_encode_dev(file_priv->minor->device),
> +                         file_priv->authenticated, cmd, nr);
> +
>         if (kdata != stack_kdata)
>                 kfree(kdata);
>         atomic_dec(&dev->ioctl_count);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2d94d74..379787c 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
>         int flags;
>         drm_ioctl_t *func;
>         unsigned int cmd_drv;
> +       const char *name;
>  };
>
>  /**
> @@ -324,7 +325,7 @@ struct drm_ioctl_desc {
>   */
>
>  #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)                        \
> -       [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
> +       [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
>
>  struct drm_magic_entry {
>         struct list_head head;
> --
> 1.8.1.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm: Make the HPD status updates debug logs more readable
  2013-05-08 16:43   ` Ville Syrjälä
@ 2013-05-10  6:27     ` Jani Nikula
  0 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2013-05-10  6:27 UTC (permalink / raw)
  To: Ville Syrjälä, Damien Lespiau; +Cc: intel-gfx, dri-devel

On Wed, 08 May 2013, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
>> +static const char *connector_status_str(enum drm_connector_status status)
>> +{
>> +	switch (status) {
>> +	case connector_status_connected:
>> +		return "connected";
>> +	case connector_status_disconnected:
>> +		return "disconnected";
>> +	default:
>> +		return "unknown";
>> +	}
>> +}
>
> drm_get_connector_status_name()

...and export it and use in intel_hpd_irq_event() in i915/i915_irq.c too
please.

Jani.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-10  6:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 16:03 Some lost drm patches Damien Lespiau
2013-05-08 16:03 ` [PATCH 1/5] drm: Add missing break in the command line mode parsing code Damien Lespiau
2013-05-08 16:03 ` [PATCH 2/5] drm: Make the HPD status updates debug logs more readable Damien Lespiau
2013-05-08 16:43   ` Chris Wilson
2013-05-08 16:43   ` Ville Syrjälä
2013-05-10  6:27     ` Jani Nikula
2013-05-08 16:03 ` [PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected Damien Lespiau
2013-05-08 16:03 ` [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation Damien Lespiau
2013-05-08 16:43   ` Ville Syrjälä
2013-05-08 16:03 ` [PATCH 5/5] drm: Use names of ioctls in debug traces Damien Lespiau
2013-05-08 16:55   ` [Intel-gfx] " Ville Syrjälä
2013-05-09  1:46     ` Ben Widawsky
2013-05-09 13:20     ` [PATCH v2 " Chris Cummins
2013-05-09 13:29       ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.