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 3/5] drm: Add drm_connector_state_select_rgb_quantization_range() helper
Date: Mon, 13 Apr 2020 23:40:24 +0200 [thread overview]
Message-ID: <20200413214024.46500-4-dev@pp3345.net> (raw)
In-Reply-To: <20200413214024.46500-1-dev@pp3345.net>
This helper can be used to determine the appropriate RGB quantization range
based on a connector's "RGB quantization range" property and a mode.
Signed-off-by: Yussuf Khalil <dev@pp3345.net>
---
drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 4 ++++
2 files changed, 35 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index e60d3b6e5e56..d5a46bbf284e 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -2187,6 +2187,37 @@ int drm_connector_set_panel_orientation_with_quirk(
}
EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
+/**
+ * drm_connector_state_select_rgb_quantization_range - find RGB quantization
+ * range appropriate for a connector's state and mode
+ *
+ * @state: state of the connector for which to determine the range
+ * @mode: mode for which to determine the range
+ *
+ * For a given connector state (i.e., RGB quantization range property) and a
+ * given mode, determine which RGB quantization range should be used.
+ *
+ * Returns:
+ * A constant from the HDMI quantization range enum.
+ */
+enum hdmi_quantization_range drm_connector_state_select_rgb_quantization_range(
+ const struct drm_connector_state *state,
+ const struct drm_display_mode *mode)
+{
+ switch (state->rgb_quantization_range) {
+ default:
+ WARN_ON(1);
+ /* fallthrough */
+ case DRM_MODE_RGB_QUANTIZATION_RANGE_AUTOMATIC:
+ return drm_default_rgb_quant_range(mode);
+ case DRM_MODE_RGB_QUANTIZATION_RANGE_FULL:
+ return HDMI_QUANTIZATION_RANGE_FULL;
+ case DRM_MODE_RGB_QUANTIZATION_RANGE_LIMITED:
+ return HDMI_QUANTIZATION_RANGE_LIMITED;
+ }
+}
+EXPORT_SYMBOL(drm_connector_state_select_rgb_quantization_range);
+
int drm_connector_set_obj_prop(struct drm_mode_object *obj,
struct drm_property *property,
uint64_t value)
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index f605e0fbcc0e..43ce305d882f 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -42,6 +42,7 @@ struct drm_property_blob;
struct drm_printer;
struct edid;
struct i2c_adapter;
+struct drm_display_mode;
enum drm_connector_force {
DRM_FORCE_UNSPECIFIED,
@@ -1621,6 +1622,9 @@ int drm_connector_set_panel_orientation_with_quirk(
int width, int height);
int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
int min, int max);
+enum hdmi_quantization_range drm_connector_state_select_rgb_quantization_range(
+ const struct drm_connector_state *state,
+ const struct drm_display_mode *mode);
/**
* struct drm_tile_group - Tile group metadata
--
2.26.0
next prev parent reply other threads:[~2020-04-13 21:51 UTC|newest]
Thread overview: 19+ 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 ` [PATCH 1/5] drm/modes: Indicate CEA-861 CE modes to user-space Yussuf Khalil
2020-04-14 12:41 ` Daniel Vetter
2020-04-16 13:51 ` Yussuf Khalil
2020-04-17 14:57 ` Daniel Vetter
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 21:40 ` Yussuf Khalil [this message]
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 ` [PATCH 5/5] drm/i915: Replace "Broadcast RGB" with "RGB quantization range" property Yussuf Khalil
2020-04-13 22:35 ` Simon Ser
2020-04-14 11:17 ` Jani Nikula
2020-04-14 11:21 ` Jani Nikula
2020-04-14 12:34 ` Daniel Vetter
2020-04-14 21:11 ` Yussuf Khalil
2020-04-15 7:33 ` Jani Nikula
2020-04-15 11:13 ` Daniel Vetter
2020-04-16 13:44 ` Yussuf Khalil
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-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox