[Intel-gfx] [PATCH v3 06/14] drm: Add plane->name and use it in debug prints
Daniel Vetter
daniel at ffwll.ch
Fri Dec 11 00:17:51 PST 2015
On Tue, Dec 08, 2015 at 06:41:54PM +0200, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at 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 at linux.intel.com>
Merged up to this one to drm-misc. I guess given how things align with 4.5
probably easier to pull in the remaining i915 bits for 4.6.
Thanks, Daniel
> ---
> 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
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list