[PATCH 14/16] drm/amd/display: Add debugfs for testing output colorspace

Pekka Paalanen ppaalanen at gmail.com
Tue Dec 13 10:35:59 UTC 2022


On Mon, 12 Dec 2022 13:21:35 -0500
Harry Wentland <harry.wentland at amd.com> wrote:

> In order to IGT test colorspace we'll want to print
> the currently enabled colorspace on a stream. We add
> a new debugfs to do so, using the same scheme as
> current bpc reporting.
> 
> This might also come in handy when debugging display
> issues.
> 
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> Cc: Pekka Paalanen <ppaalanen at gmail.com>
> Cc: Sebastian Wick <sebastian.wick at redhat.com>
> Cc: Vitaly.Prosyak at amd.com
> Cc: Uma Shankar <uma.shankar at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Joshua Ashton <joshua at froggi.es>
> Cc: dri-devel at lists.freedesktop.org
> Cc: amd-gfx at lists.freedesktop.org
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 461037a3dd75..d95d1c9f4805 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -935,6 +935,61 @@ static int amdgpu_current_bpc_show(struct seq_file *m, void *data)
>  }
>  DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc);
>  
> +/*
> + * Returns the current bpc for the crtc.
> + * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/amdgpu_current_colorspace
> + */
> +static int amdgpu_current_colorspace_show(struct seq_file *m, void *data)
> +{
> +	struct drm_crtc *crtc = m->private;
> +	struct drm_device *dev = crtc->dev;
> +	struct dm_crtc_state *dm_crtc_state = NULL;
> +	int res = -ENODEV;
> +
> +	mutex_lock(&dev->mode_config.mutex);
> +	drm_modeset_lock(&crtc->mutex, NULL);
> +	if (crtc->state == NULL)
> +		goto unlock;
> +
> +	dm_crtc_state = to_dm_crtc_state(crtc->state);
> +	if (dm_crtc_state->stream == NULL)
> +		goto unlock;
> +
> +	switch (dm_crtc_state->stream->output_color_space) {
> +	case COLOR_SPACE_SRGB:
> +		seq_printf(m, "RGB");

What does COLOR_SPACE_SRGB mean? Printing it as "RGB" seems suspicious.
Should this be "sRGB" or "BT709_RGB" instead?

> +		break;
> +	case COLOR_SPACE_YCBCR601:
> +	case COLOR_SPACE_YCBCR601_LIMITED:
> +		seq_printf(m, "BT601_YCC");
> +		break;
> +	case COLOR_SPACE_YCBCR709:
> +	case COLOR_SPACE_YCBCR709_LIMITED:
> +		seq_printf(m, "BT709_YCC");
> +		break;
> +	case COLOR_SPACE_ADOBERGB:
> +		seq_printf(m, "opRGB");
> +		break;
> +	case COLOR_SPACE_2020_RGB_FULLRANGE:
> +		seq_printf(m, "BT2020_RGB");
> +		break;
> +	case COLOR_SPACE_2020_YCBCR:
> +		seq_printf(m, "BT2020_YCC");
> +		break;

What do these actually mean?

Are these a combination of colorimetry and color representation
(YCbCr/ICtCp - RGB conversion)?

Should these match enum drm_colorspace entries?


Thanks,
pq


> +	default:
> +		goto unlock;
> +	}
> +	res = 0;
> +
> +unlock:
> +	drm_modeset_unlock(&crtc->mutex);
> +	mutex_unlock(&dev->mode_config.mutex);
> +
> +	return res;
> +}
> +DEFINE_SHOW_ATTRIBUTE(amdgpu_current_colorspace);
> +
> +
>  /*
>   * Example usage:
>   * Disable dsc passthrough, i.e.,: have dsc decoding at converver, not external RX
> @@ -3326,6 +3381,8 @@ void crtc_debugfs_init(struct drm_crtc *crtc)
>  #endif
>  	debugfs_create_file("amdgpu_current_bpc", 0644, crtc->debugfs_entry,
>  			    crtc, &amdgpu_current_bpc_fops);
> +	debugfs_create_file("amdgpu_current_colorspace", 0644, crtc->debugfs_entry,
> +			    crtc, &amdgpu_current_colorspace_fops);
>  }
>  
>  /*

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20221213/db4da1bf/attachment.sig>


More information about the amd-gfx mailing list