From: Harry Wentland <harry.wentland@amd.com> To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org> Cc: Sebastian Wick <sebastian.wick@redhat.com>, Melissa Wen <mwen@igalia.com>, Pekka Paalanen <ppaalanen@gmail.com>, Vitaly.Prosyak@amd.com, Joshua Ashton <joshua@froggi.es> Subject: [PATCH v5 12/13] drm/amd/display: Add debugfs for testing output colorspace Date: Tue, 6 Jun 2023 16:26:06 -0400 [thread overview] Message-ID: <20230606202607.122914-13-harry.wentland@amd.com> (raw) In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> 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. v4: - Fix function doc comment - Fix sRGB debug print Signed-off-by: Harry Wentland <harry.wentland@amd.com> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton <joshua@froggi.es> Cc: Simon Ser <contact@emersion.fr> Cc: Melissa Wen <mwen@igalia.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@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 82234397dd44..caf13b2e8cb6 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 @@ -906,6 +906,61 @@ static int amdgpu_current_bpc_show(struct seq_file *m, void *data) } DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc); +/* + * Returns the current colorspace 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, "sRGB"); + 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; + 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 @@ -3139,6 +3194,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); } /* -- 2.41.0
WARNING: multiple messages have this Message-ID (diff)
From: Harry Wentland <harry.wentland@amd.com> To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org> Cc: Sebastian Wick <sebastian.wick@redhat.com>, Simon Ser <contact@emersion.fr>, Melissa Wen <mwen@igalia.com>, Pekka Paalanen <ppaalanen@gmail.com>, Vitaly.Prosyak@amd.com, Harry Wentland <harry.wentland@amd.com>, Joshua Ashton <joshua@froggi.es> Subject: [PATCH v5 12/13] drm/amd/display: Add debugfs for testing output colorspace Date: Tue, 6 Jun 2023 16:26:06 -0400 [thread overview] Message-ID: <20230606202607.122914-13-harry.wentland@amd.com> (raw) In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> 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. v4: - Fix function doc comment - Fix sRGB debug print Signed-off-by: Harry Wentland <harry.wentland@amd.com> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton <joshua@froggi.es> Cc: Simon Ser <contact@emersion.fr> Cc: Melissa Wen <mwen@igalia.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@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 82234397dd44..caf13b2e8cb6 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 @@ -906,6 +906,61 @@ static int amdgpu_current_bpc_show(struct seq_file *m, void *data) } DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc); +/* + * Returns the current colorspace 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, "sRGB"); + 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; + 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 @@ -3139,6 +3194,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); } /* -- 2.41.0
next prev parent reply other threads:[~2023-06-06 20:26 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-06 20:25 [PATCH v5 00/13] Enable Colorspace connector property in amdgpu Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-06 20:25 ` [PATCH v5 01/13] drm/connector: Convert DRM_MODE_COLORIMETRY to enum Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-06 20:25 ` [PATCH v5 02/13] drm/connector: Add enum documentation to drm_colorspace Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-06 20:25 ` [PATCH v5 03/13] drm/connector: Pull out common create_colorspace_property code Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-06 20:25 ` [PATCH v5 04/13] drm/connector: Use common colorspace_names array Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-07 9:37 ` Simon Ser 2023-06-07 9:37 ` Simon Ser 2023-06-07 9:46 ` Simon Ser 2023-06-07 9:46 ` Simon Ser 2023-06-06 20:25 ` [PATCH v5 05/13] drm/connector: Print connector colorspace in state debugfs Harry Wentland 2023-06-06 20:25 ` Harry Wentland 2023-06-06 20:26 ` [PATCH v5 06/13] drm/connector: Allow drivers to pass list of supported colorspaces Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-07 9:42 ` Simon Ser 2023-06-07 9:42 ` Simon Ser 2023-06-06 20:26 ` [PATCH v5 07/13] drm/amd/display: Always pass connector_state to stream validation Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:26 ` [PATCH v5 08/13] drm/amd/display: Register Colorspace property for DP and HDMI Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:26 ` [PATCH v5 09/13] drm/amd/display: Signal mode_changed if colorspace changed Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:26 ` [PATCH v5 10/13] drm/amd/display: Send correct DP colorspace infopacket Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:26 ` [PATCH v5 11/13] drm/amd/display: Always set crtcinfo from create_stream_for_sink Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:26 ` Harry Wentland [this message] 2023-06-06 20:26 ` [PATCH v5 12/13] drm/amd/display: Add debugfs for testing output colorspace Harry Wentland 2023-06-06 20:26 ` [PATCH v5 13/13] drm/amd/display: Refactor avi_info_frame colorimetry determination Harry Wentland 2023-06-06 20:26 ` Harry Wentland 2023-06-06 20:53 ` [PATCH v5 00/13] Enable Colorspace connector property in amdgpu Joshua Ashton 2023-06-06 20:53 ` Joshua Ashton
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=20230606202607.122914-13-harry.wentland@amd.com \ --to=harry.wentland@amd.com \ --cc=Vitaly.Prosyak@amd.com \ --cc=amd-gfx@lists.freedesktop.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=joshua@froggi.es \ --cc=mwen@igalia.com \ --cc=ppaalanen@gmail.com \ --cc=sebastian.wick@redhat.com \ /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: linkBe 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.