Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp153760lqg; Fri, 1 Mar 2024 00:41:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU//LiukZnOPOxNuVr9t/F2jnB2VmFx+0VSoudoasP5sI5pJrlpUycqeuWF2FsXUBEYwE9HbseL9WoVLHivw7WGrf918+/Nnx87lnBA+Q== X-Google-Smtp-Source: AGHT+IE9r1xWBVJukFSNsXCqJOLs5Np2HbqRZV0YccFFbo6NxGhVwe9SfNSiZYfuL0hf2FBF4Wpz X-Received: by 2002:a17:90b:f18:b0:29a:f227:a7ce with SMTP id br24-20020a17090b0f1800b0029af227a7cemr1520476pjb.12.1709282503476; Fri, 01 Mar 2024 00:41:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709282503; cv=pass; d=google.com; s=arc-20160816; b=0A3AqtzQNLuwXficeTIPif2SMx+QsIGlCGKsvHo1RwNKOVfw5OV2ZshXumpoBO8nfw /koa7zeJAormwzlhZzEMlyLcZof4K/LXxv6FXOqyC796bBr83cPll6lrn5GcNAOW5UCJ aHfvhb1OGEZOyIU0APbrtPJxjujYwm8fetii92IAbf5muv1JYuR7aVl6glaXW0dq5Khh bJ6cKv9+No3BelSMvjJdnKkbzKOi6XGRcelAcfhujuPLF7tYTFRRNWkpzQFdo/Xbb0li QVjlFmGQUzggbpzGFoNZvDuNmsazDWuDbIHCGuw+PCYJX+61l91PrAoAh0eLUfbuo20O n7dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=J8I03vM+oXOxUIIg1qsOdYqaLaQQk2vKEvN6KHDmZ+o=; fh=LFjF/xBg1Zi+UYzwMTidCwVjDk1vtn3HJBFs63X/r5M=; b=tre0tCzW9riZJZL9952dZCF121l/srBfutRnav2PN6hHX3WzY9+w0lmpZCVx7FXaql NYR28tLvKQ9ohlqMWEYIOSsbtP21qNUdRc+fdYslnTzlNeE5rTlg7BRwFzwrzfuoFWFW 07k75NpuI9xDs0TtNtIn6I8Bb7UMI6P5BYCVWDPdZuLI7Sw/63De9c1wTvH+pmcDgV/L 2wrERANNXnEu082UTr/BTxaaJowh6REblvr7yBI794+eWgA1kh8gZUzIwyiOR/K7sbg8 SSmcR6u872MSfs6Uo7xjeHlgEGvTUpNR7IemDjDtV20/fdYXUZijK75xltXo2Z40q9tT UM7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-88079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id sw16-20020a17090b2c9000b0029ac01ae3e5si3305783pjb.107.2024.03.01.00.41.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 00:41:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-88079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 722CFB21E2D for ; Fri, 1 Mar 2024 08:29:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E0E069DE7; Fri, 1 Mar 2024 08:29:26 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1A96C69D09; Fri, 1 Mar 2024 08:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709281765; cv=none; b=EtioagGJSefbjG9nIad79Soikka0QhmHIiF5mxTjqFAMaix2Rz+D2Emo8euF3SAdkpOW/qP6Iw/n1ea7N+n00RprwnJC2w7GgKfSGlB9v2DPuS5dJfJ9T61zMyIHJacc73x9eJmY6PsyCk/epPF/Xkidbk581ou+LbV8OLNaF8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709281765; c=relaxed/simple; bh=ghx+fCttyCcdBMfBk2oIxXf4N6hQcnpEYC8Q+9Ad/Ho=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n2pFKWhftcBblUHihA8n6oT8GjADPgqlFy96fQL3CxUVrTHKUxg2M8lB5qIesNoDe3N6DLnaPOjjyWW5Z/YzYqawpJTNPIkiwG68VFsm3+H2xsHV3wC1JUkMCKuzdDFoYAK1L4LOzLFKLxmob1/zGIpWxFQ5MKcG6B2iwsgWrPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468B9C433C7; Fri, 1 Mar 2024 08:29:19 +0000 (UTC) Message-ID: <5a8366aa-34b9-4f80-9b14-d92e99873349@xs4all.nl> Date: Fri, 1 Mar 2024 09:29:17 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 21/36] drm/connector: hdmi: Add Broadcast RGB property Content-Language: en-US, nl To: Sebastian Wick , Maxime Ripard Cc: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Dave Stevenson References: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> <20240222-kms-hdmi-connector-state-v7-21-8f4af575fce2@kernel.org> <20240229194726.GB166694@toolbox> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B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VHk/woaMZv c1Dm4Uvkv0Ilelt3Pb9J7zhcx6sm5T7v16VceF96jG61bnJ2GFS+QZerZp3PY27XgtPxRxYj AmFUeF486PHx/2Yi4u1rQpIpC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: <20240229194726.GB166694@toolbox> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 29/02/2024 20:47, Sebastian Wick wrote: > On Thu, Feb 22, 2024 at 07:14:07PM +0100, Maxime Ripard wrote: >> The i915 driver has a property to force the RGB range of an HDMI output. >> The vc4 driver then implemented the same property with the same >> semantics. KWin has support for it, and a PR for mutter is also there to >> support it. >> >> Both drivers implementing the same property with the same semantics, >> plus the userspace having support for it, is proof enough that it's >> pretty much a de-facto standard now and we can provide helpers for it. >> >> Let's plumb it into the newly created HDMI connector. >> >> Reviewed-by: Dave Stevenson >> Signed-off-by: Maxime Ripard >> --- >> Documentation/gpu/kms-properties.csv | 1 - >> drivers/gpu/drm/drm_atomic.c | 2 + >> drivers/gpu/drm/drm_atomic_state_helper.c | 4 +- >> drivers/gpu/drm/drm_atomic_uapi.c | 4 ++ >> drivers/gpu/drm/drm_connector.c | 89 +++++++++++++++++++++++++++++++ >> include/drm/drm_connector.h | 36 +++++++++++++ >> 6 files changed, 134 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/gpu/kms-properties.csv b/Documentation/gpu/kms-properties.csv >> index 0f9590834829..caef14c532d4 100644 >> --- a/Documentation/gpu/kms-properties.csv >> +++ b/Documentation/gpu/kms-properties.csv >> @@ -17,7 +17,6 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De >> ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector >> ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector >> ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB >> -i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normally in the range 0..1.0 are remapped to the range 16/255..235/255." >> ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD >> ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD >> ,,"""left_margin""",RANGE,"Min=0, Max= SDVO dependent",Connector,TBD >> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c >> index 26f9e525c0a0..3e57d98d8418 100644 >> --- a/drivers/gpu/drm/drm_atomic.c >> +++ b/drivers/gpu/drm/drm_atomic.c >> @@ -1145,6 +1145,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p, >> >> if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA || >> connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) { >> + drm_printf(p, "\tbroadcast_rgb=%s\n", >> + drm_hdmi_connector_get_broadcast_rgb_name(state->hdmi.broadcast_rgb)); >> drm_printf(p, "\toutput_bpc=%u\n", state->hdmi.output_bpc); >> drm_printf(p, "\toutput_format=%s\n", >> drm_hdmi_connector_get_output_format_name(state->hdmi.output_format)); >> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c >> index 9f517599f117..0e8fb653965a 100644 >> --- a/drivers/gpu/drm/drm_atomic_state_helper.c >> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c >> @@ -589,6 +589,7 @@ void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, >> >> new_state->max_bpc = max_bpc; >> new_state->max_requested_bpc = max_bpc; >> + new_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; >> } >> EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset); >> >> @@ -913,7 +914,8 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, >> if (ret) >> return ret; >> >> - if (old_state->hdmi.output_bpc != new_state->hdmi.output_bpc || >> + if (old_state->hdmi.broadcast_rgb != new_state->hdmi.broadcast_rgb || >> + old_state->hdmi.output_bpc != new_state->hdmi.output_bpc || >> old_state->hdmi.output_format != new_state->hdmi.output_format) { >> struct drm_crtc *crtc = new_state->crtc; >> struct drm_crtc_state *crtc_state; >> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c >> index 29d4940188d4..2b415b4ed506 100644 >> --- a/drivers/gpu/drm/drm_atomic_uapi.c >> +++ b/drivers/gpu/drm/drm_atomic_uapi.c >> @@ -776,6 +776,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, >> state->max_requested_bpc = val; >> } else if (property == connector->privacy_screen_sw_state_property) { >> state->privacy_screen_sw_state = val; >> + } else if (property == connector->broadcast_rgb_property) { >> + state->hdmi.broadcast_rgb = val; >> } else if (connector->funcs->atomic_set_property) { >> return connector->funcs->atomic_set_property(connector, >> state, property, val); >> @@ -859,6 +861,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, >> *val = state->max_requested_bpc; >> } else if (property == connector->privacy_screen_sw_state_property) { >> *val = state->privacy_screen_sw_state; >> + } else if (property == connector->broadcast_rgb_property) { >> + *val = state->hdmi.broadcast_rgb; >> } else if (connector->funcs->atomic_get_property) { >> return connector->funcs->atomic_get_property(connector, >> state, property, val); >> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c >> index 591d2d500f61..6ffe59d01698 100644 >> --- a/drivers/gpu/drm/drm_connector.c >> +++ b/drivers/gpu/drm/drm_connector.c >> @@ -1212,6 +1212,29 @@ static const u32 dp_colorspaces = >> BIT(DRM_MODE_COLORIMETRY_BT2020_CYCC) | >> BIT(DRM_MODE_COLORIMETRY_BT2020_YCC); >> >> +static const struct drm_prop_enum_list broadcast_rgb_names[] = { >> + { DRM_HDMI_BROADCAST_RGB_AUTO, "Automatic" }, >> + { DRM_HDMI_BROADCAST_RGB_FULL, "Full" }, >> + { DRM_HDMI_BROADCAST_RGB_LIMITED, "Limited 16:235" }, >> +}; >> + >> +/* >> + * drm_hdmi_connector_get_broadcast_rgb_name - Return a string for HDMI connector RGB broadcast selection >> + * @broadcast_rgb: Broadcast RGB selection to compute name of >> + * >> + * Returns: the name of the Broadcast RGB selection, or NULL if the type >> + * is not valid. >> + */ >> +const char * >> +drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb) >> +{ >> + if (broadcast_rgb > DRM_HDMI_BROADCAST_RGB_LIMITED) >> + return NULL; >> + >> + return broadcast_rgb_names[broadcast_rgb].name; >> +} >> +EXPORT_SYMBOL(drm_hdmi_connector_get_broadcast_rgb_name); >> + >> static const char * const output_format_str[] = { >> [HDMI_COLORSPACE_RGB] = "RGB", >> [HDMI_COLORSPACE_YUV420] = "YUV 4:2:0", >> @@ -1708,6 +1731,39 @@ EXPORT_SYMBOL(drm_connector_attach_dp_subconnector_property); >> /** >> * DOC: HDMI connector properties >> * >> + * Broadcast RGB (HDMI specific) >> + * Indicates the Quantization Range (Full vs Limited) used. The color >> + * processing pipeline will be adjusted to match the value of the >> + * property, and the Infoframes will be generated and sent accordingly. >> + * >> + * This property is only relevant if the HDMI output format is RGB. If >> + * it's one of the YCbCr variant, it will be ignored and the output will >> + * use a limited quantization range. > > Uh, maybe just say that the quantization range is selected automatically > in case a YCbCr output format is in use. I'm not sure every YCbCr > variant requires limited and even if it does, new formats could change > this. For HDMI every YCbCr output format is limited range by default. It is highly unlikely that future YCbCr formats would ever use full range by default. So I am fine with the current text since it is actually correct and it explicitly states which quantization range will be used. Regards, Hans > > With this changed, this patch is > > Reviewed-by: Sebastian Wick > >> + * >> + * The CRTC attached to the connector must be configured by user-space to >> + * always produce full-range pixels. >> + * >> + * The value of this property can be one of the following: >> + * >> + * Automatic: >> + * The quantization range is selected automatically based on the >> + * mode according to the HDMI specifications (HDMI 1.4b - Section >> + * 6.6 - Video Quantization Ranges). >> + * >> + * Full: >> + * Full quantization range is forced. >> + * >> + * Limited 16:235: >> + * Limited quantization range is forced. Unlike the name suggests, >> + * this works for any number of bits-per-component. >> + * >> + * Property values other than Automatic can result in colors being off (if >> + * limited is selected but the display expects full), or a black screen >> + * (if full is selected but the display expects limited). >> + * >> + * Drivers can set up this property by calling >> + * drm_connector_attach_broadcast_rgb_property(). >> + * >> * content type (HDMI specific): >> * Indicates content type setting to be used in HDMI infoframes to indicate >> * content type for the external device, so that it adjusts its display >> @@ -2570,6 +2626,39 @@ int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *conn >> } >> EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property); >> >> +/** >> + * drm_connector_attach_broadcast_rgb_property - attach "Broadcast RGB" property >> + * @connector: connector to attach the property on. >> + * >> + * This is used to add support for forcing the RGB range on a connector >> + * >> + * Returns: >> + * Zero on success, negative errno on failure. >> + */ >> +int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector) >> +{ >> + struct drm_device *dev = connector->dev; >> + struct drm_property *prop; >> + >> + prop = connector->broadcast_rgb_property; >> + if (!prop) { >> + prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, >> + "Broadcast RGB", >> + broadcast_rgb_names, >> + ARRAY_SIZE(broadcast_rgb_names)); >> + if (!prop) >> + return -EINVAL; >> + >> + connector->broadcast_rgb_property = prop; >> + } >> + >> + drm_object_attach_property(&connector->base, prop, >> + DRM_HDMI_BROADCAST_RGB_AUTO); >> + >> + return 0; >> +} >> +EXPORT_SYMBOL(drm_connector_attach_broadcast_rgb_property); >> + >> /** >> * drm_connector_attach_colorspace_property - attach "Colorspace" property >> * @connector: connector to attach the property on. >> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h >> index 8cda902934cd..bb6b6a36ade3 100644 >> --- a/include/drm/drm_connector.h >> +++ b/include/drm/drm_connector.h >> @@ -369,6 +369,29 @@ enum drm_panel_orientation { >> DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, >> }; >> >> +/** >> + * enum drm_hdmi_broadcast_rgb - Broadcast RGB Selection for an HDMI @drm_connector >> + */ >> +enum drm_hdmi_broadcast_rgb { >> + /** >> + * @DRM_HDMI_BROADCAST_RGB_AUTO: The RGB range is selected >> + * automatically based on the mode. >> + */ >> + DRM_HDMI_BROADCAST_RGB_AUTO, >> + >> + /** >> + * @DRM_HDMI_BROADCAST_RGB_FULL: Full range RGB is forced. >> + */ >> + DRM_HDMI_BROADCAST_RGB_FULL, >> + >> + /** >> + * @DRM_HDMI_BROADCAST_RGB_LIMITED: Limited range RGB is forced. >> + */ >> + DRM_HDMI_BROADCAST_RGB_LIMITED, >> +}; >> + >> +const char * >> +drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb); >> const char * >> drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt); >> >> @@ -1041,6 +1064,12 @@ struct drm_connector_state { >> * @drm_atomic_helper_connector_hdmi_check(). >> */ >> struct { >> + /** >> + * @broadcast_rgb: Connector property to pass the >> + * Broadcast RGB selection value. >> + */ >> + enum drm_hdmi_broadcast_rgb broadcast_rgb; >> + >> /** >> * @output_bpc: Bits per color channel to output. >> */ >> @@ -1753,6 +1782,12 @@ struct drm_connector { >> */ >> struct drm_property *privacy_screen_hw_state_property; >> >> + /** >> + * @broadcast_rgb_property: Connector property to set the >> + * Broadcast RGB selection to output with. >> + */ >> + struct drm_property *broadcast_rgb_property; >> + >> #define DRM_CONNECTOR_POLL_HPD (1 << 0) >> #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) >> #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) >> @@ -2092,6 +2127,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, >> u32 scaling_mode_mask); >> int drm_connector_attach_vrr_capable_property( >> struct drm_connector *connector); >> +int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector); >> int drm_connector_attach_colorspace_property(struct drm_connector *connector); >> int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector); >> bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state, >> >> -- >> 2.43.2 >> >