Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2867457lqo; Mon, 20 May 2024 22:12:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPhjxCKJAkWc6qhJJNaaT4lIbZ56LxBqbYZXvvhz5BWoAGsTHxyXtiTB7jXBqAXKZLqJ1dqQ6TgVxlIn4FyySEmyl8/+pEP73oOU9hDg== X-Google-Smtp-Source: AGHT+IETGTC84YunV0lvmPv08yVOJEE0/LLBgBzvavOGw21hV0hrm8ni3yAsmv7r49XwohQwEau1 X-Received: by 2002:a17:906:3a8d:b0:a58:7172:1ab0 with SMTP id a640c23a62f3a-a5d5a46d792mr731198666b.16.1716268357373; Mon, 20 May 2024 22:12:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716268357; cv=pass; d=google.com; s=arc-20160816; b=wpzGkKd0ykr0gemJseCgHi9mpwWG7si9nPLGR7NYYM5Zw+qsW6thkAcPtnxd2dSRQ1 Sc1LkajV5KkCYN3KYj8sCgqWEifXwxl2g2rpBymcQpchOUq9wXJ3ebB5LtUz+eOm7wkz gGq3GAmTi69kvOzbskayEM/nccLKnAgiOfQ847Qg762C014fhFqyMBVhaGjzxTZb0w19 UqsXlFKyalXQfCzYM48VNnc7Hsvu/EbCutHAE0/+KdYh3n17IyCl6ux2Ngsl3dHJZjEP DrCRlVu7h+44uEPK8zbA64Yi8xL0tmIJMgHbylomYcf/q3zoF8RfcPw+gZ13VE4Hh/g6 u6dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GUapn7dPFkmrdlk6ElpkaCznwDwGsC/allixWXQKesY=; fh=dl22nHtcI9/jVTqhKX1cgUEefbG6JBgaChvv6I/i6Cw=; b=TSVwxBxU0fn/3JqVFiJIAOZUWLtZtSBqItWgtix7wtnGCiIfukI/yWztLlj6caQg9M e0bU+ua6onZ1r8Vjd2+1ydj0xJUzkuoEre5Xj3cy2TCrmlS2bxsWM1SGakyO+hIMS554 xuLAQl14UOv7pPe8iaFbWfar1qg3rOCeesnyMR72dZvoSPb/Sex/18Pw11HIRAl9U/Kj LxRLNJnv3oPzlrdCWr/J03AtIiLpm4uoVkGg0PZn9iJH5sNVVNzPJP1GeKbaU93tDl/O /MZs0tiy6/VWTq/f5imFVuiEmtdYZVlKav7Sx9w/UlPlQVHI8eYwxcQP7KnFc0SUdwBu xnuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yw6lzc8U; 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-184499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184499-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba3c27si1456739666b.565.2024.05.20.22.12.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 22:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yw6lzc8U; 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-184499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184499-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 CFDB61F223C9 for ; Tue, 21 May 2024 05:12:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12D223D97F; Tue, 21 May 2024 05:12:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yw6lzc8U" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 877362E85E for ; Tue, 21 May 2024 05:12:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716268349; cv=none; b=gDdwuC6E4jN4pOeBhLoKv+KDoKwtrlyWJz9X6BMgaPrMQZumorVDB5oHmCgxpidhh0zlpzrbML1yA8UyE7ylj9zF+ta5f/ooLHWjn7ORctUB/MuCV4azu8sLfhk6NcA8Ib8lzONKUd30PUNZNlBi3Yb5I3TmIStd0zSojZjcitA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716268349; c=relaxed/simple; bh=DJcQJid1iwq86SYshDjjvgo7lJTAqL3J+xs5+ZhIU/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZNd2Y5sXJLom8ijXUCouZJCN8BhAVPLIv/tsUSlO12/6DE8Y8S6DLYywaRJOem+GG9jXJfwjkuTwYLHbaCMPumUR+j3Ig29q90jRXaYVM0V1JiNltcrjY8UV5p9HTN+mKbl0/dFldaVDCN6jPgPmaCXvXjIVW2+CsiYNAX/wtHQ= 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=Yw6lzc8U; arc=none smtp.client-ip=209.85.208.173 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-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e2da49e86bso5936441fa.0 for ; Mon, 20 May 2024 22:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716268346; x=1716873146; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GUapn7dPFkmrdlk6ElpkaCznwDwGsC/allixWXQKesY=; b=Yw6lzc8UawtHbKelfELy31eKj6XJwJBG7BoaI36fccQ9oaBlXRhuIxEIWV00bCwwQZ +ZLTMoPf+QIe3/fyk4hGyg0sE0iafH97Ir8aBS2h9yN0gnJxDRRWW8btH7xeeL8BYzIY U+ZqlejFx5c319g0vHJD8Ed2BcUJenD22oG1b8LPiZrfD5UOPkdgYZBQExuel5ySdVqU 75ciI9F4IZHZpgV0yE3+7yNfww9tFqWvSOvseTRV0xCLXLfoHqvLso3ZJQDykyrQBysL YX78DRmEAffM+Uy+iD2cD9JIn8nVEowPRjOcCGToGZIzfZjyxQ+VRpbkgA+TPOEqsRa1 EZxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716268346; x=1716873146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GUapn7dPFkmrdlk6ElpkaCznwDwGsC/allixWXQKesY=; b=AyE800LEfVk8V4KbXwQkcR/mfAqXyS/z1UBUnP+1fdPnycvEWuM7fXwrF731HLvns3 LkcN1t10BL19A14ubsv/xMT1891263sk6VmjoOs92VkJoLCAEoDljFHR9HJgA+T+vZtn N7wiVLuuMztqBWTK1/dmmAR1NrTqU3R9txfhckbO7EZ+kBIw4nyw+R2nzMeg9Iv/MQWN ww4omG+NQcAMNmVJL3uC0rLPDo4RiNdOcR5Gy63wzPcOT8raA0zBCEUyQQ8/VTiQQU9C C9OF2stT3H67jmsWRW6cNabh/c7i0tVb0WbbLNhjyPvqIVjgYPwVmDJkXnR91fi7/LAt 5ijg== X-Forwarded-Encrypted: i=1; AJvYcCW8QvUwf+K8GqfJk/MwsQLGBKrayE7ncaNnBNzzOajex/ind/qVtZ1bX/s1aIWGSRT5FL3JF7Xym6zKyQ4DeobVLkZNxeTleWo+nlqg X-Gm-Message-State: AOJu0YyXIRIIoLzfYqY2habMqlKv4ASUmGG6Jd/OvZuMwJPCaEVWQs6j +YeILOt4kAlN439RHENzG+wkfq751gafnCfesmZpIhqVBN2tRCsp X-Received: by 2002:a2e:a1ca:0:b0:2e5:67a7:dda7 with SMTP id 38308e7fff4ca-2e567a7df67mr201821891fa.3.1716268345399; Mon, 20 May 2024 22:12:25 -0700 (PDT) Received: from workstation.localdomain ([2001:4647:930d:0:6cc8:8362:4e13:c7e4]) by smtp.googlemail.com with ESMTPSA id 38308e7fff4ca-2e4d0ef09ffsm35540931fa.59.2024.05.20.22.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 22:12:24 -0700 (PDT) From: Rino Andre Johnsen To: alexander.deucher@amd.com Cc: Rino Andre Johnsen , Harry Wentland , Leo Li , Rodrigo Siqueira , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Aurabindo Pillai , Hersen Wu , Hamza Mahfooz , Wayne Lin , Srinivasan Shanmugam , Fangzhi Zuo , Tom Chung , Mario Limonciello , Nicholas Kazlauskas , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] drm/amd/display: Add pixel encoding info to debugfs Date: Tue, 21 May 2024 07:11:23 +0200 Message-ID: <20240521051140.30509-1-rinoandrejohnsen@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [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 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(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); } /* -- 2.45.1