From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19D873A256D; Wed, 22 Apr 2026 16:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776876618; cv=none; b=kWV8o8r0id9ORQFzzvXKKI8hZqJ0THosNy+EVhJBcUF+3t2rNxxwSwQ8mYCeV8nQhaxJ22xuGHx+KLttKUN6RcCn/kB2Z/t1tUP7PUMCV0LxPbR+s5c6ADQ5il55dC+LvbEUsZrhKL1eGErJMsuXpopN/SzNbzYXP9jSTTwcc8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776876618; c=relaxed/simple; bh=UCmSgUjJtI2QadOlApDQ9KaMKnRWMYQzLGMA20U0664=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nTmMpfFn+GOj9CEb77X88qXCJ5zHtODOLoRGSahtcAIRT1AcZZbQjauY+sDX7mGt6wWtg/XybdIZjXjhmPzKjwrod9oBq6l/EuL+K7rS9KntuCRgVKQ+2GSK/QP33e3nZtniUnZu2EbWdRlD3bKJTYkd8LU1eEQaZ7cgECk9WyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=raYYqRBk; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="raYYqRBk" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 1033A1A33AF; Wed, 22 Apr 2026 16:50:13 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D9F525FA8F; Wed, 22 Apr 2026 16:50:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9C1A610460C18; Wed, 22 Apr 2026 18:50:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1776876611; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=giJ2awXj70aqSOugAh4wxF2d1ZKTvpS12Unh1ZHckMA=; b=raYYqRBkE2KhAd4O9Brdpmi1iNDfwcQmDtvKX0uDDMBD3esjVuqtZ1AxzIwQTbFNEbWojU gOVHB3c6J3bwO7GkpQSs/icfcDi2r1pZBcaWx+XPZ3fQwXRYCASIzYBJAbJYs2QktXbnKg VNLDi9YYNskHVNQLVnf84PnxeUV1j1C0MKoAsGGMPqbCeq/gkrb34RAed1+IC6F1DD2y48 /iHlgjNObrZ/SEIMQ2iZGvpmoDj7Nc19lhectS4DCsJODeRx/YSw72vLm8QmK8jm69S9Bo aLatz0W/H0ohcv5wreednly3lbga9UxIyWLCaROcvjsiCXiSRTZOwaSBq7Kv/w== From: Louis Chauvet Date: Wed, 22 Apr 2026 18:48:27 +0200 Subject: [PATCH v4 30/37] drm/vkms: Introduce configfs for connector supported colorspace Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260422-vkms-all-config-v4-30-dbb52e9aadc3@bootlin.com> References: <20260422-vkms-all-config-v4-0-dbb52e9aadc3@bootlin.com> In-Reply-To: <20260422-vkms-all-config-v4-0-dbb52e9aadc3@bootlin.com> To: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet , Shuah Khan , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: victoria@system76.com, sebastian.wick@redhat.com, victoria@system76.com, airlied@gmail.com, thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Louis Chauvet , llvm@lists.linux.dev, Luca Ceresoli X-Mailer: b4 0.16-dev X-Last-TLS-Session-Version: TLSv1.3 Add the attribute supported_colorspaces to configure the supported colorspace of a connector. It will allows emulating some HDR features of displays. This feature is only supported for HDMI, DP and eDP connectors. Reviewed-by: Luca Ceresoli Signed-off-by: Louis Chauvet --- Documentation/ABI/testing/configfs-vkms | 8 +++++++ Documentation/gpu/vkms.rst | 7 +++++- drivers/gpu/drm/vkms/vkms_configfs.c | 40 +++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/configfs-vkms b/Documentation/ABI/testing/configfs-vkms index 7f0dd0789f0a..1b80ad111a04 100644 --- a/Documentation/ABI/testing/configfs-vkms +++ b/Documentation/ABI/testing/configfs-vkms @@ -40,6 +40,14 @@ Description: Type of the connector. Possible values match those exposed by the "type" field in drm_connector. +What: /sys/kernel/config/vkms//connectors//supported_colorspaces +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Supported colorspaces for HDMI, DP, and eDP connectors. + Value is a bitfield, where 0x1 = NO_DATA, 0x2 = SMPTE_170M_YCC, + etc. See enum drm_colorspace for full list. + What: /sys/kernel/config/vkms//connectors//possible_encoders Date: Nov 2025 Contact: dri-devel@lists.freedesktop.org diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst index db86a956e137..a6215bbe1c52 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -138,11 +138,16 @@ Last but not least, create one or more connectors:: sudo mkdir /config/vkms/my-vkms/connectors/connector0 -Connectors have 2 configurable attribute: +Connectors have 3 configurable attribute: - status: Connection status: 1 connected, 2 disconnected, 3 unknown (same values as those exposed by the "status" property of a connector) - type: Type of connector. Same values as exposed by the "type" field in drm_connector. +- supported_colorspaces: Supported colorspaces values for HDMI, DP and eDP connectors. + If supported_colorspaces is not 0, the HDR_OUTPUT_METADATA will also be created. + Value is a bitfield, 0x1 = NO_DATA, 0x2 = SMPTE_170M_YCC... see enum drm_colorspace + for full list. + To finish the configuration, link the different pipeline items:: diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c index a0b3347b2bd8..5994b9a999b1 100644 --- a/drivers/gpu/drm/vkms/vkms_configfs.c +++ b/drivers/gpu/drm/vkms/vkms_configfs.c @@ -1236,12 +1236,52 @@ static ssize_t connector_type_store(struct config_item *item, return count; } +static ssize_t connector_supported_colorspaces_show(struct config_item *item, char *page) +{ + struct vkms_configfs_connector *connector; + int colorspaces; + + connector = connector_item_to_vkms_configfs_connector(item); + + scoped_guard(mutex, &connector->dev->lock) + colorspaces = vkms_config_connector_get_supported_colorspaces(connector->config); + + return sprintf(page, "%u", colorspaces); +} + +static ssize_t connector_supported_colorspaces_store(struct config_item *item, + const char *page, size_t count) +{ + struct vkms_configfs_connector *connector; + int val, ret; + + connector = connector_item_to_vkms_configfs_connector(item); + + ret = kstrtouint(page, 10, &val); + if (ret) + return ret; + + if ((val & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) + return -EINVAL; + + scoped_guard(mutex, &connector->dev->lock) { + if (connector->dev->enabled) + return -EBUSY; + + vkms_config_connector_set_supported_colorspaces(connector->config, val); + } + + return count; +} + CONFIGFS_ATTR(connector_, status); CONFIGFS_ATTR(connector_, type); +CONFIGFS_ATTR(connector_, supported_colorspaces); static struct configfs_attribute *connector_item_attrs[] = { &connector_attr_status, &connector_attr_type, + &connector_attr_supported_colorspaces, NULL, }; -- 2.54.0