From: Yussuf Khalil <dev@pp3345.net>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Yussuf Khalil <dev@pp3345.net>
Subject: [PATCH 2/5] drm: Add "RGB quantization range" connector property
Date: Mon, 13 Apr 2020 23:40:23 +0200 [thread overview]
Message-ID: <20200413214024.46500-3-dev@pp3345.net> (raw)
In-Reply-To: <20200413214024.46500-1-dev@pp3345.net>
Add a new "RGB quantization range" property with three possible values:
Automatic, Limited, and Full. User-space may use this property to override
the automatic selection of the RGB range as specified by CTA-861. Drivers
should attach this property to all CTA-861 sinks.
Signed-off-by: Yussuf Khalil <dev@pp3345.net>
---
drivers/gpu/drm/drm_atomic_uapi.c | 4 ++++
drivers/gpu/drm/drm_connector.c | 35 +++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 23 ++++++++++++++++++++
include/drm/drm_mode_config.h | 7 +++++++
4 files changed, 69 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index a1e5e262bae2..f12b3a40c6cf 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -766,6 +766,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
fence_ptr);
} else if (property == connector->max_bpc_property) {
state->max_requested_bpc = val;
+ } else if (property == config->rgb_quantization_range_property) {
+ state->rgb_quantization_range = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,
state, property, val);
@@ -842,6 +844,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
*val = 0;
} else if (property == connector->max_bpc_property) {
*val = state->max_requested_bpc;
+ } else if (property == config->rgb_quantization_range_property) {
+ *val = state->rgb_quantization_range;
} 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 644f0ad10671..e60d3b6e5e56 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -929,6 +929,12 @@ static const struct drm_prop_enum_list dp_colorspaces[] = {
{ DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" },
};
+static const struct drm_prop_enum_list rgb_quantization_range_options[] = {
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC, "Automatic" },
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED, "Limited" },
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_FULL, "Full" },
+};
+
/**
* DOC: standard connector properties
*
@@ -1804,6 +1810,35 @@ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector)
}
EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);
+/**
+ * drm_mode_create_rgb_quantization_range_property - create RGB quantization
+ * range property
+ * @dev: device to create the RGB quantization range property on.
+ *
+ * Called by a driver the first time it's needed, must be attached to connectors
+ * of CEA-861-compliant sinks.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_rgb_quantization_range_property(struct drm_device *dev)
+{
+ if (dev->mode_config.rgb_quantization_range_property)
+ return 0;
+
+ dev->mode_config.rgb_quantization_range_property =
+ drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+ "RGB quantization range",
+ rgb_quantization_range_options,
+ ARRAY_SIZE(rgb_quantization_range_options));
+
+ if (!dev->mode_config.rgb_quantization_range_property)
+ return -ENOMEM;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_rgb_quantization_range_property);
+
/**
* drm_mode_create_content_type_property - create content type property
* @dev: DRM device
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 19ae6bb5c85b..f605e0fbcc0e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -303,6 +303,22 @@ struct drm_monitor_range_info {
#define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT 14
#define DRM_MODE_COLORIMETRY_BT601_YCC 15
+/**
+ * enum drm_rgb_quantization_range - rgb_quantization_range property value
+ *
+ * This enum lists the possible options for the rgb_quantization_range property.
+ *
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC: Let the driver select the
+ * appropriate quantization range.
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED: Force limited range RGB.
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_FULL: Force full range RGB.
+ */
+enum drm_rgb_quantization_range {
+ DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC = 0,
+ DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED = 1,
+ DRM_MODE_RGB_QUANTIZATION_RANGE_FULL = 2,
+};
+
/**
* enum drm_bus_flags - bus_flags info for &drm_display_info
*
@@ -661,6 +677,12 @@ struct drm_connector_state {
*/
u32 colorspace;
+ /**
+ * @rgb_quantization_range: Connector property to control the selected
+ * RGB quantization range for CEA-861 outputs.
+ */
+ u32 rgb_quantization_range;
+
/**
* @writeback_job: Writeback job for writeback connectors
*
@@ -1575,6 +1597,7 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);
int drm_mode_create_content_type_property(struct drm_device *dev);
+int drm_mode_create_rgb_quantization_range_property(struct drm_device *dev);
void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
const struct drm_connector_state *conn_state);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 3bcbe30339f0..745587f6b83c 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -855,6 +855,13 @@ struct drm_mode_config {
*/
struct drm_property *hdcp_content_type_property;
+ /**
+ * @rgb_quantization_range_property: Connector property to allow
+ * user-space to override the RGB quantization range for CEA-861
+ * outputs.
+ */
+ struct drm_property *rgb_quantization_range_property;
+
/* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow;
--
2.26.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Yussuf Khalil <dev@pp3345.net>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Yussuf Khalil <dev@pp3345.net>
Subject: [PATCH 2/5] drm: Add "RGB quantization range" connector property
Date: Mon, 13 Apr 2020 23:40:23 +0200 [thread overview]
Message-ID: <20200413214024.46500-3-dev@pp3345.net> (raw)
In-Reply-To: <20200413214024.46500-1-dev@pp3345.net>
Add a new "RGB quantization range" property with three possible values:
Automatic, Limited, and Full. User-space may use this property to override
the automatic selection of the RGB range as specified by CTA-861. Drivers
should attach this property to all CTA-861 sinks.
Signed-off-by: Yussuf Khalil <dev@pp3345.net>
---
drivers/gpu/drm/drm_atomic_uapi.c | 4 ++++
drivers/gpu/drm/drm_connector.c | 35 +++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 23 ++++++++++++++++++++
include/drm/drm_mode_config.h | 7 +++++++
4 files changed, 69 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index a1e5e262bae2..f12b3a40c6cf 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -766,6 +766,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
fence_ptr);
} else if (property == connector->max_bpc_property) {
state->max_requested_bpc = val;
+ } else if (property == config->rgb_quantization_range_property) {
+ state->rgb_quantization_range = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,
state, property, val);
@@ -842,6 +844,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
*val = 0;
} else if (property == connector->max_bpc_property) {
*val = state->max_requested_bpc;
+ } else if (property == config->rgb_quantization_range_property) {
+ *val = state->rgb_quantization_range;
} 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 644f0ad10671..e60d3b6e5e56 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -929,6 +929,12 @@ static const struct drm_prop_enum_list dp_colorspaces[] = {
{ DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" },
};
+static const struct drm_prop_enum_list rgb_quantization_range_options[] = {
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC, "Automatic" },
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED, "Limited" },
+ { DRM_MODE_RGB_QUANTIZATION_RANGE_FULL, "Full" },
+};
+
/**
* DOC: standard connector properties
*
@@ -1804,6 +1810,35 @@ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector)
}
EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);
+/**
+ * drm_mode_create_rgb_quantization_range_property - create RGB quantization
+ * range property
+ * @dev: device to create the RGB quantization range property on.
+ *
+ * Called by a driver the first time it's needed, must be attached to connectors
+ * of CEA-861-compliant sinks.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_rgb_quantization_range_property(struct drm_device *dev)
+{
+ if (dev->mode_config.rgb_quantization_range_property)
+ return 0;
+
+ dev->mode_config.rgb_quantization_range_property =
+ drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+ "RGB quantization range",
+ rgb_quantization_range_options,
+ ARRAY_SIZE(rgb_quantization_range_options));
+
+ if (!dev->mode_config.rgb_quantization_range_property)
+ return -ENOMEM;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_rgb_quantization_range_property);
+
/**
* drm_mode_create_content_type_property - create content type property
* @dev: DRM device
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 19ae6bb5c85b..f605e0fbcc0e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -303,6 +303,22 @@ struct drm_monitor_range_info {
#define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT 14
#define DRM_MODE_COLORIMETRY_BT601_YCC 15
+/**
+ * enum drm_rgb_quantization_range - rgb_quantization_range property value
+ *
+ * This enum lists the possible options for the rgb_quantization_range property.
+ *
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC: Let the driver select the
+ * appropriate quantization range.
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED: Force limited range RGB.
+ * @DRM_MODE_RGB_QUANTIZATION_RANGE_FULL: Force full range RGB.
+ */
+enum drm_rgb_quantization_range {
+ DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC = 0,
+ DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED = 1,
+ DRM_MODE_RGB_QUANTIZATION_RANGE_FULL = 2,
+};
+
/**
* enum drm_bus_flags - bus_flags info for &drm_display_info
*
@@ -661,6 +677,12 @@ struct drm_connector_state {
*/
u32 colorspace;
+ /**
+ * @rgb_quantization_range: Connector property to control the selected
+ * RGB quantization range for CEA-861 outputs.
+ */
+ u32 rgb_quantization_range;
+
/**
* @writeback_job: Writeback job for writeback connectors
*
@@ -1575,6 +1597,7 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);
int drm_mode_create_content_type_property(struct drm_device *dev);
+int drm_mode_create_rgb_quantization_range_property(struct drm_device *dev);
void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
const struct drm_connector_state *conn_state);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 3bcbe30339f0..745587f6b83c 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -855,6 +855,13 @@ struct drm_mode_config {
*/
struct drm_property *hdcp_content_type_property;
+ /**
+ * @rgb_quantization_range_property: Connector property to allow
+ * user-space to override the RGB quantization range for CEA-861
+ * outputs.
+ */
+ struct drm_property *rgb_quantization_range_property;
+
/* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow;
--
2.26.0
next prev parent reply other threads:[~2020-04-13 21:51 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 21:40 [PATCH 0/5] Improving the situation regarding RGB quantization ranges Yussuf Khalil
2020-04-13 21:40 ` Yussuf Khalil
2020-04-13 21:40 ` [PATCH 1/5] drm/modes: Indicate CEA-861 CE modes to user-space Yussuf Khalil
2020-04-13 21:40 ` Yussuf Khalil
2020-04-14 12:41 ` Daniel Vetter
2020-04-14 12:41 ` Daniel Vetter
2020-04-16 13:51 ` Yussuf Khalil
2020-04-16 13:51 ` Yussuf Khalil
2020-04-17 14:57 ` Daniel Vetter
2020-04-17 14:57 ` Daniel Vetter
2020-04-13 21:40 ` Yussuf Khalil [this message]
2020-04-13 21:40 ` [PATCH 2/5] drm: Add "RGB quantization range" connector property Yussuf Khalil
2020-04-13 22:32 ` Simon Ser
2020-04-13 22:32 ` Simon Ser
2020-04-13 21:40 ` [PATCH 3/5] drm: Add drm_connector_state_select_rgb_quantization_range() helper Yussuf Khalil
2020-04-13 21:40 ` Yussuf Khalil
2020-04-13 21:40 ` [PATCH 4/5] drm/atomic-helper: Consider RGB quantization changes to be mode changes Yussuf Khalil
2020-04-13 21:40 ` Yussuf Khalil
2020-04-13 21:40 ` [PATCH 5/5] drm/i915: Replace "Broadcast RGB" with "RGB quantization range" property Yussuf Khalil
2020-04-13 21:40 ` Yussuf Khalil
2020-04-13 22:35 ` Simon Ser
2020-04-13 22:35 ` Simon Ser
2020-04-14 11:17 ` Jani Nikula
2020-04-14 11:17 ` Jani Nikula
2020-04-14 11:21 ` Jani Nikula
2020-04-14 11:21 ` Jani Nikula
2020-04-14 12:34 ` Daniel Vetter
2020-04-14 12:34 ` Daniel Vetter
2020-04-14 21:11 ` Yussuf Khalil
2020-04-14 21:11 ` Yussuf Khalil
2020-04-15 7:33 ` Jani Nikula
2020-04-15 7:33 ` Jani Nikula
2020-04-15 11:13 ` Daniel Vetter
2020-04-15 11:13 ` Daniel Vetter
2020-04-16 13:44 ` Yussuf Khalil
2020-04-16 13:44 ` Yussuf Khalil
2020-04-17 14:59 ` Daniel Vetter
2020-04-17 14:59 ` Daniel Vetter
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=20200413214024.46500-3-dev@pp3345.net \
--to=dev@pp3345.net \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.