All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 06/14] drm: Add plane->name and use it in debug prints
Date: Tue,  8 Dec 2015 18:41:54 +0200	[thread overview]
Message-ID: <1449592922-5545-7-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1449592922-5545-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Show a sensible name for the plane in debug mesages. The driver
may supply its own name, otherwise the core genrates the name
("plane-0", "plane-1" etc.).

v2: kstrdup() the name passed by the caller (Jani)
v3: Generate a default name if the driver doesn't supply one

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic.c        | 12 ++++++------
 drivers/gpu/drm/drm_atomic_helper.c |  4 ++--
 drivers/gpu/drm/drm_crtc.c          | 30 ++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h              |  2 ++
 4 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index feb66895e48c..6a21e5c378c1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -549,8 +549,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 	state->planes[index] = plane;
 	plane_state->state = state;
 
-	DRM_DEBUG_ATOMIC("Added [PLANE:%d] %p state to %p\n",
-			 plane->base.id, plane_state, state);
+	DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
+			 plane->base.id, plane->name, plane_state, state);
 
 	if (plane_state->crtc) {
 		struct drm_crtc_state *crtc_state;
@@ -770,8 +770,8 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
 	}
 
 	if (plane_switching_crtc(state->state, plane, state)) {
-		DRM_DEBUG_ATOMIC("[PLANE:%d] switching CRTC directly\n",
-				 plane->base.id);
+		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] switching CRTC directly\n",
+				 plane->base.id, plane->name);
 		return -EINVAL;
 	}
 
@@ -1248,8 +1248,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 	for_each_plane_in_state(state, plane, plane_state, i) {
 		ret = drm_atomic_plane_check(plane, plane_state);
 		if (ret) {
-			DRM_DEBUG_ATOMIC("[PLANE:%d] atomic core check failed\n",
-					 plane->base.id);
+			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n",
+					 plane->base.id, plane->name);
 			return ret;
 		}
 	}
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 6ba3fe5639e4..63f925b75357 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -545,8 +545,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
 
 		ret = funcs->atomic_check(plane, plane_state);
 		if (ret) {
-			DRM_DEBUG_ATOMIC("[PLANE:%d] atomic driver check failed\n",
-					 plane->base.id);
+			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n",
+					 plane->base.id, plane->name);
 			return ret;
 		}
 	}
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index ae2c6c5d48e9..9fe085b2efbf 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1181,6 +1181,18 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
 }
 EXPORT_SYMBOL(drm_encoder_cleanup);
 
+static unsigned int drm_num_planes(struct drm_device *dev)
+{
+	unsigned int num = 0;
+	struct drm_plane *tmp;
+
+	drm_for_each_plane(tmp, dev) {
+		num++;
+	}
+
+	return num;
+}
+
 /**
  * drm_universal_plane_init - Initialize a new universal plane object
  * @dev: DRM device
@@ -1224,6 +1236,22 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
 		return -ENOMEM;
 	}
 
+	if (name) {
+		va_list ap;
+
+		va_start(ap, name);
+		plane->name = kvasprintf(GFP_KERNEL, name, ap);
+		va_end(ap);
+	} else {
+		plane->name = kasprintf(GFP_KERNEL, "plane-%d",
+					drm_num_planes(dev));
+	}
+	if (!plane->name) {
+		kfree(plane->format_types);
+		drm_mode_object_put(dev, &plane->base);
+		return -ENOMEM;
+	}
+
 	memcpy(plane->format_types, formats, format_count * sizeof(uint32_t));
 	plane->format_count = format_count;
 	plane->possible_crtcs = possible_crtcs;
@@ -1314,6 +1342,8 @@ void drm_plane_cleanup(struct drm_plane *plane)
 	if (plane->state && plane->funcs->atomic_destroy_state)
 		plane->funcs->atomic_destroy_state(plane, plane->state);
 
+	kfree(plane->name);
+
 	memset(plane, 0, sizeof(*plane));
 }
 EXPORT_SYMBOL(drm_plane_cleanup);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 083b5d42c578..49885a2aef34 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1496,6 +1496,8 @@ struct drm_plane {
 	struct drm_device *dev;
 	struct list_head head;
 
+	char *name;
+
 	struct drm_modeset_lock mutex;
 
 	struct drm_mode_object base;
-- 
2.4.10

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

  parent reply	other threads:[~2015-12-08 16:41 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:41 [PATCH v4 00/14] drm: Give crtcs and planes actual names (v4) ville.syrjala
2015-12-08 16:41 ` [PATCH v2 01/14] drm: Pass 'name' to drm_crtc_init_with_planes() ville.syrjala
2015-12-09  8:21   ` [Intel-gfx] " Jani Nikula
2015-12-09 12:01     ` Ville Syrjälä
2015-12-09 14:19   ` [PATCH v3 " ville.syrjala
2015-12-08 16:41 ` [PATCH v2 02/14] drm: Pass 'name' to drm_universal_plane_init() ville.syrjala
2015-12-09 14:19   ` [PATCH v3 " ville.syrjala
2015-12-08 16:41 ` [PATCH 03/14] drm: Pass 'name' to drm_encoder_init() ville.syrjala
2015-12-09 14:20   ` [PATCH v2 " ville.syrjala
2015-12-08 16:41 ` [PATCH 04/14] drm: Use driver specified encoder name ville.syrjala
2015-12-09  7:32   ` [Intel-gfx] " Daniel Vetter
2015-12-09  7:33     ` Daniel Vetter
2015-12-09 11:56     ` Ville Syrjälä
2015-12-08 16:41 ` [PATCH v3 05/14] drm: Add crtc->name and use it in debug messages ville.syrjala
2015-12-08 16:41 ` ville.syrjala [this message]
2015-12-11  8:17   ` [PATCH v3 06/14] drm: Add plane->name and use it in debug prints Daniel Vetter
2015-12-08 16:41 ` [PATCH 07/14] drm/i915: Use crtc->name in debug messages ville.syrjala
2015-12-08 16:41 ` [PATCH 08/14] drm/i915: Use plane->name in debug prints ville.syrjala
2015-12-08 16:41 ` [PATCH v4 09/14] drm/i915: Set crtc->name to "pipe A", "pipe B", etc ville.syrjala
2015-12-08 16:41 ` [PATCH v3 10/14] drm/i915: Fix plane init failure paths ville.syrjala
2015-12-08 16:41 ` [PATCH 11/14] drm/i915: Don't leak primary/cursor planes on crtc init failure ville.syrjala
2015-12-08 16:42 ` [PATCH v3 12/14] drm/i915: Give meaningful names to all the planes ville.syrjala
2015-12-08 16:42 ` [PATCH 13/14] drm/i915: Give encoders useful names ville.syrjala
2015-12-09  8:35   ` [Intel-gfx] " Jani Nikula
2015-12-09 11:59     ` Ville Syrjälä
2015-12-09 13:50       ` Jani Nikula
2015-12-09 14:21   ` [PATCH v2 " ville.syrjala
2015-12-08 16:42 ` [PATCH 14/14] drm/i915: Add debug prints for encoder modeset hooks ville.syrjala
2015-12-09  8:53 ` [Intel-gfx] [PATCH v4 00/14] drm: Give crtcs and planes actual names (v4) Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449592922-5545-7-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.