Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp237832lqp; Wed, 22 May 2024 03:08:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVcENV9A9KuHoHXqNgNecODAgkjmzs6tZKfLxTtO3bjfbFBz9H7TcKmvLZai3AydycmojhiwvlTKbdsyRGgS22B/sLjEwTYIzJG+A4jvg== X-Google-Smtp-Source: AGHT+IFfH1aqmrKCT60IXRpDbW//oEyPg+H1FKD4AH88XkKtQgRtL/BPyDdbikQ7wzW8wxfxv8gP X-Received: by 2002:a17:907:b13:b0:a58:eba0:6716 with SMTP id a640c23a62f3a-a62281989f5mr83727266b.60.1716372486524; Wed, 22 May 2024 03:08:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716372486; cv=pass; d=google.com; s=arc-20160816; b=QJ0R3bI8I9MUxZXkMdICCgAjcJQkZoOCenvIUCoOkjY+3wbm+zBFzG8RhYCsJqBJfF mfAgP1Og/U1u7+ff4dr7Xr+rvY2HSL7Fx3sTnSF337nLqxLtvZLyUVm721PR82oOYxl8 hLJfiW+wcAWxAZ66fcxQEyyMClT81e1pLvM8XWgF0x0g2sXwfhX4hSpeHckinJXbQdVZ Iei2OuJyyBKfVfZcQy0/7NOty83nIslP5ixl0yAaeSWstYZb9/ixTGKECWI1Q9VcE0jY l41m/Hy3Lg/2qwfwlZqsH6OihfZ7GJFEiv+DtMYwBwD45MmtXVb4USvud/nKkOVp2X4U NQoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=WYAIfZw1pkV8spolfI/p1xvCTUqzpLywcb68T4prkxU=; fh=BpZF12At8W37U6VIiQvQPTIfd2CF6vq0vd6auMAD6gc=; b=Wm2QcH2fxrmfKEZ+v4Kd4LxOS+xER3wNlgkc4ad1SmFcC6kQpec3CxT4Nr+v4IvwHm asNK0MhgUVFaLgk4WvdrSMZUZurqXQ1FvfFzqmR6T7hScjExCTV8z9dwpeMT52VNJ2My HZNns9KB7LVMckKtTsF7Pam3fDWYfSY2mVYgwC6ByefT9Ta4w99XMb4kIueXAtwqhnPZ V9xvSYlKKxmAMWiRvYNCiKIAU8HrhhaWIyp6kUMukpy+oxr9SpFLqwF+k3cUvzkHodnj lUJPRqU15AL359QiITd+A46zFqqTsHIF1DUkf+uJ1uAF9Q1/0sbIeiLeEqE323fn5QOu a2kA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RmbARhV3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186032-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186032-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17be6d0esi1470699266b.825.2024.05.22.03.08.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186032-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RmbARhV3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186032-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186032-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1F11A1F21B26 for ; Wed, 22 May 2024 10:08:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D0C2823CD; Wed, 22 May 2024 10:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RmbARhV3" Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A5DA81AC9 for ; Wed, 22 May 2024 10:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716372470; cv=none; b=D2WYHXE9Zd43fUSAtwyJFP4c4ZoMIMvaRnTtKpg4zu4yrrBzL1cx7FkizG4jQxvRwSvbrFvKpVszuH+YgxLapasEijKQwA+fehtDQslSLAzmzlbW2GLNyXoY29hjzz+j+XW3ZFKHf+nwTZKEk9fqE2/tLT56BSkOV+N/ycKFqHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716372470; c=relaxed/simple; bh=2xQGrIJl8ucc90zmBMPS7OMS6ws/ES8DgrgvhddFQjU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HZ61LWv9xttFM4Cc9AhUL+Ku1OdltQjf0wDmoKDCb0X1LY5Iu1qRw7tq0g8OU+NlWiodnFsGxnA1koPp8GTDk89Q70Dbh589YxjqZpGMpTiyANtdAfn2Fx2TnWAMCX4/V7AvJQlWOcb//Cj07CLlwXDyBeXG0oKtSHdUTqT+M+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RmbARhV3; arc=none smtp.client-ip=209.85.219.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-df4da0579b6so53910276.0 for ; Wed, 22 May 2024 03:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716372467; x=1716977267; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WYAIfZw1pkV8spolfI/p1xvCTUqzpLywcb68T4prkxU=; b=RmbARhV3j08tZ2WmJcjqoE/C1igaXs9JsL//egJIdm2KjAy6CasCbNpelUdOtEUZGL QAHoE419+zzk+5k0L5+yUXTrrwRd8fQJuuZ4cXN1gbfOxr3FZ64yg6NxoBkEWD4BGhHr ZRzmt2XS8+pvwcQk6KGRS0hZogD8C9SoXqecG3C1c09xdOHFVptZRE0yTeMQ5D86dZIr iBU3ezxY5uFJPR+lqBA834YC0g+hDlwV6ZzxnEPJQccrWa5C4NL38fiBsXjMx/7BoA90 gYggsQ2xP3xV3518tH8n3jYDEbS/Wo9uBovBoD9yJMHn9fsFiPc7Af2t6I5yrw/SqqOa zkFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716372467; x=1716977267; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WYAIfZw1pkV8spolfI/p1xvCTUqzpLywcb68T4prkxU=; b=Lk/wxY62J+SGNc+D83f1DGnauJr7lCAnJHvKgnyUmYArqtjFXSsWVPOuC3I/9dCyJP 6eTEM/kcxqTqxPMg9Ji7zo6QbDUGy1mdrGpHQEuLcttdkGVborwFLiVFBBVZNsI6k1Tf 9n6OmVBCYyhfl37w6wsQGWeI/TmF8N/GReq8mLM2pMIh0cslJBx/hsWryaK1Y0fmKNYg NRZe0cD2ZWHIP7Y/MQC3xdB0X4ETh3GCN7s8q+fbz9LP5x8waKb625XVsWl9b22RI/e6 Jro6ycmB+4IIMEOs62+Pe/ZcK+bgU44EqbFI2R8m5ZYjJ+QoWsKZMoy89PbwvHPiKmrd My/g== X-Forwarded-Encrypted: i=1; AJvYcCXng+IXSnuKCbU4V0ZCgZBcrSq0RrOvlmcYPgoW1wXDVdNb5ZfhTTtq5vWj6/KYPZgh/tkLCYX2IPh5vxeLnHI6nIbIlUiNzgLrap/5 X-Gm-Message-State: AOJu0YzY7NlxHuaDUTAh1DQkfln+BB8qWPFI/BJ54is70Y/yGI4TOJIe vOEdr8KoSeaAIvfvOmteelr4Vu924CupzI3PKNOs9wEpsYTp2yyksT/ywnNQq9aIg/C9xbMevon tbnCT3uaP5lOF/KmNYOBSvoyTMz8= X-Received: by 2002:a05:6902:2411:b0:df4:4724:8755 with SMTP id 3f1490d57ef6-df4e0a80fedmr1699384276.1.1716372467286; Wed, 22 May 2024 03:07:47 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240521051140.30509-1-rinoandrejohnsen@gmail.com> <17782a6e-db84-4c20-874a-342b9655ffc5@amd.com> <86410711-9b88-448c-9148-109f81b1ca55@amd.com> In-Reply-To: <86410711-9b88-448c-9148-109f81b1ca55@amd.com> From: =?UTF-8?Q?Rino_Andr=C3=A9_Johnsen?= Date: Wed, 22 May 2024 12:07:36 +0200 Message-ID: Subject: Re: [PATCH v2] drm/amd/display: Add pixel encoding info to debugfs To: Mario Limonciello Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , alexander.deucher@amd.com, Harry Wentland , Leo Li , Rodrigo Siqueira , "Pan, Xinhui" , David Airlie , Daniel Vetter , Aurabindo Pillai , Hersen Wu , Hamza Mahfooz , Wayne Lin , Srinivasan Shanmugam , Fangzhi Zuo , Tom Chung , Nicholas Kazlauskas , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable To be perfectly honest with you, I haven't given that much though. I used the 'bpc' and 'colorspace' property in debugfs, since I could not find that information anywhere else. And since I also needed to verify the pixel encoding being used, I added it where those other values were. That made for a simple and easy addition for this property. If you want me to do this differently, let me know. And please point me to the standardized DRM property where I should expose the values. Rino On Tue, May 21, 2024 at 10:55=E2=80=AFPM Mario Limonciello wrote: > > On 5/21/2024 15:06, Rino Andr=C3=A9 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=E2=80=AFPM Christian K=C3=B6nig > > 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_pixelencodin= g > >> > >> 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 th= ere. > >> > >> Regards, > >> Christian. > >> > >>> > >>> Signed-off-by: Rino Andre Johnsen > >>> --- > >>> > >>> 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(stru= ct 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, voi= d *data) > >>> +{ > >>> + struct drm_crtc *crtc =3D m->private; > >>> + struct drm_device *dev =3D crtc->dev; > >>> + struct dm_crtc_state *dm_crtc_state; > >>> + int res =3D -ENODEV; > >>> + > >>> + mutex_lock(&dev->mode_config.mutex); > >>> + drm_modeset_lock(&crtc->mutex, NULL); > >>> + if (crtc->state =3D=3D NULL) > >>> + goto unlock; > >>> + > >>> + dm_crtc_state =3D to_dm_crtc_state(crtc->state); > >>> + if (dm_crtc_state->stream =3D=3D 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 =3D 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->d= ebugfs_entry, > >>> crtc, &amdgpu_current_colorspace_fops); > >>> + debugfs_create_file("amdgpu_current_pixelencoding", 0644, crtc-= >debugfs_entry, > >>> + crtc, &amdgpu_current_pixelencoding_fops); > >>> } > >>> > >>> /* > >> >