From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rino André Johnsen" <rinoandrejohnsen@gmail.com>,
"Christian König" <christian.koenig@amd.com>
Cc: alexander.deucher@amd.com,
Harry Wentland <harry.wentland@amd.com>,
Leo Li <sunpeng.li@amd.com>,
Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Hersen Wu <hersenxs.wu@amd.com>,
Hamza Mahfooz <hamza.mahfooz@amd.com>,
Wayne Lin <wayne.lin@amd.com>,
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Fangzhi Zuo <jerry.zuo@amd.com>,
Tom Chung <chiahsuan.chung@amd.com>,
Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drm/amd/display: Add pixel encoding info to debugfs
Date: Tue, 21 May 2024 15:55:34 -0500 [thread overview]
Message-ID: <86410711-9b88-448c-9148-109f81b1ca55@amd.com> (raw)
In-Reply-To: <CAACkh=-B-jH6g7KY7Nn_7Y_+gHPQ7G5Z5AZ0=a=_ifjcmsorcw@mail.gmail.com>
On 5/21/2024 15:06, Rino André Johnsen wrote:
> What is already there in debugfs is 'bpc' and 'colorspace', but not
> the pixel encoding/format.
> I have searched high and low for that to be able to verify that my
> monitor and computer are using my preferred combination of all those
> three values.
>
> I do think it should be available as a standard DRM CRTC property, but
> for the time being, I figured that a simple debugfs property would be
> sufficient for time being.
>
It's just about as much work either way to populate it though, why do it
twice instead of just doing it right the first time?
> Rino
>
>
> On Tue, May 21, 2024 at 9:04 PM Christian König
> <christian.koenig@amd.com> wrote:
>>
>> Am 21.05.24 um 07:11 schrieb Rino Andre Johnsen:
>>> [Why]
>>> For debugging and testing purposes.
>>>
>>> [How]
>>> Create amdgpu_current_pixelencoding debugfs entry.
>>> Usage: cat /sys/kernel/debug/dri/1/crtc-0/amdgpu_current_pixelencoding
>>
>> Why isn't that available as standard DRM CRTC property in either sysfs
>> or debugfs?
>>
>> I think the format specifiers should already be available somewhere there.
>>
>> Regards,
>> Christian.
>>
>>>
>>> Signed-off-by: Rino Andre Johnsen <rinoandrejohnsen@gmail.com>
>>> ---
>>>
>>> Changes in v2:
>>> 1. Do not initialize dm_crtc_state to NULL.
>>> ---
>>> .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 47 +++++++++++++++++++
>>> 1 file changed, 47 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 27d5c6077630..4254d4a4b56b 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
>>> @@ -1160,6 +1160,51 @@ static int amdgpu_current_colorspace_show(struct seq_file *m, void *data)
>>> }
>>> DEFINE_SHOW_ATTRIBUTE(amdgpu_current_colorspace);
>>>
>>> +/*
>>> + * Returns the current pixelencoding for the crtc.
>>> + * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/amdgpu_current_pixelencoding
>>> + */
>>> +static int amdgpu_current_pixelencoding_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;
>>> + 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->timing.pixel_encoding) {
>>> + case PIXEL_ENCODING_RGB:
>>> + seq_puts(m, "RGB");
>>> + break;
>>> + case PIXEL_ENCODING_YCBCR422:
>>> + seq_puts(m, "YCBCR422");
>>> + break;
>>> + case PIXEL_ENCODING_YCBCR444:
>>> + seq_puts(m, "YCBCR444");
>>> + break;
>>> + case PIXEL_ENCODING_YCBCR420:
>>> + seq_puts(m, "YCBCR420");
>>> + 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_pixelencoding);
>>>
>>> /*
>>> * Example usage:
>>> @@ -3688,6 +3733,8 @@ void crtc_debugfs_init(struct drm_crtc *crtc)
>>> crtc, &amdgpu_current_bpc_fops);
>>> debugfs_create_file("amdgpu_current_colorspace", 0644, crtc->debugfs_entry,
>>> crtc, &amdgpu_current_colorspace_fops);
>>> + debugfs_create_file("amdgpu_current_pixelencoding", 0644, crtc->debugfs_entry,
>>> + crtc, &amdgpu_current_pixelencoding_fops);
>>> }
>>>
>>> /*
>>
next prev parent reply other threads:[~2024-05-21 20:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-20 21:07 [PATCH] " Rino Andre Johnsen
2024-05-21 1:35 ` Mario Limonciello
2024-05-21 5:11 ` [PATCH v2] " Rino Andre Johnsen
2024-05-21 19:03 ` Christian König
2024-05-21 20:06 ` Rino André Johnsen
2024-05-21 20:55 ` Mario Limonciello [this message]
2024-05-22 10:07 ` Rino André Johnsen
2024-05-22 13:36 ` Mario Limonciello
2024-05-22 13:40 ` Simon Ser
2024-05-23 2:51 ` Rino André Johnsen
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=86410711-9b88-448c-9148-109f81b1ca55@amd.com \
--to=mario.limonciello@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=chiahsuan.chung@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamza.mahfooz@amd.com \
--cc=harry.wentland@amd.com \
--cc=hersenxs.wu@amd.com \
--cc=jerry.zuo@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicholas.kazlauskas@amd.com \
--cc=rinoandrejohnsen@gmail.com \
--cc=srinivasan.shanmugam@amd.com \
--cc=sunpeng.li@amd.com \
--cc=wayne.lin@amd.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®