Skip to content
Permalink
Browse files

Intel: Implement Passthrough-Range

  • Loading branch information...
fritsch committed Sep 30, 2015
1 parent acb886f commit eda74857fc19bda193e477922194bd7be8034f08
@@ -0,0 +1,125 @@
From 2ede4f1aabc37c6726c4edf39636d6411957bfad Mon Sep 17 00:00:00 2001
From: fritsch <Peter.Fruehberger@gmail.com>
Date: Wed, 30 Sep 2015 20:57:49 +0200
Subject: [PATCH] Implement Color Range (passthrough) by lauri v1 Initial v2
Fix a hunk

---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/intel_drv.h | 7 +++++++
drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++--
drivers/gpu/drm/i915/intel_modes.c | 1 +
4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7d53d7e..5d45cd8 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3206,6 +3206,7 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
#define INTEL_BROADCAST_RGB_AUTO 0
#define INTEL_BROADCAST_RGB_FULL 1
#define INTEL_BROADCAST_RGB_LIMITED 2
+#define INTEL_BROADCAST_RGB_VIDEO 3

static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
{
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 68d1f74..637d13b 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -299,6 +299,12 @@ struct intel_crtc_state {
*/
bool limited_color_range;

+ /*
+ * Use reduced/limited/broadcast rgb range without compressing
+ *
+ */
+ bool video_color_range;
+
/* DP has a bunch of special case unfortunately, so mark the pipe
* accordingly. */
bool has_dp_encoder;
@@ -574,6 +580,7 @@ struct intel_hdmi {
int ddc_bus;
uint32_t color_range;
bool color_range_auto;
+ bool color_range_video;
bool has_hdmi_sink;
bool has_audio;
enum hdmi_force_audio force_audio;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index bfbe07b..8a45c16 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -437,7 +437,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
}

if (intel_hdmi->rgb_quant_range_selectable) {
- if (intel_crtc->config->limited_color_range)
+ if (intel_crtc->config->limited_color_range ||
+ intel_crtc->config->video_color_range)
frame.avi.quantization_range =
HDMI_QUANTIZATION_RANGE_LIMITED;
else
@@ -1017,6 +1018,9 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
if (intel_hdmi->color_range)
pipe_config->limited_color_range = true;

+ if (intel_hdmi->color_range_video)
+ pipe_config->video_color_range = true;
+
if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev))
pipe_config->has_pch_encoder = true;

@@ -1209,25 +1213,34 @@ intel_hdmi_set_property(struct drm_connector *connector,
if (property == dev_priv->broadcast_rgb_property) {
bool old_auto = intel_hdmi->color_range_auto;
uint32_t old_range = intel_hdmi->color_range;
+ bool old_range_video = intel_hdmi->color_range_video;

switch (val) {
case INTEL_BROADCAST_RGB_AUTO:
intel_hdmi->color_range_auto = true;
+ intel_hdmi->color_range_video = false;
break;
case INTEL_BROADCAST_RGB_FULL:
intel_hdmi->color_range_auto = false;
intel_hdmi->color_range = 0;
+ intel_hdmi->color_range_video = false;
break;
case INTEL_BROADCAST_RGB_LIMITED:
intel_hdmi->color_range_auto = false;
intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
+ intel_hdmi->color_range_video = true;
break;
+ case INTEL_BROADCAST_RGB_VIDEO:
+ intel_hdmi->color_range_auto = false;
+ intel_hdmi->color_range = 0;
+ intel_hdmi->color_range_video = true;
default:
return -EINVAL;
}

if (old_auto == intel_hdmi->color_range_auto &&
- old_range == intel_hdmi->color_range)
+ old_range == intel_hdmi->color_range &&
+ old_range_video == intel_hdmi->color_range_video)
return 0;

goto done;
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 0e860f3..db39cbb 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -103,6 +103,7 @@ static const struct drm_prop_enum_list broadcast_rgb_names[] = {
{ INTEL_BROADCAST_RGB_AUTO, "Automatic" },
{ INTEL_BROADCAST_RGB_FULL, "Full" },
{ INTEL_BROADCAST_RGB_LIMITED, "Limited 16:235" },
+ { INTEL_BROADCAST_RGB_VIDEO, "Video 16:235 pass-through" },
};

void
--
2.1.4

@@ -4,6 +4,6 @@ FB_TYPE="$(grep '^0 ' /proc/fb | sed 's/[^[:space:]] //')"
if [ "$FB_TYPE" == "inteldrmfb" ]; then
OUTPUT=`/usr/bin/xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
for out in $OUTPUT ; do
/usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Full"
/usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Video 16:235 pass-through"
done
fi

0 comments on commit eda7485

Please sign in to comment.
You can’t perform that action at this time.