diff --git a/packages/linux/patches/4.1.10/linux-999-i915-implement-passthrough-colors.patch b/packages/linux/patches/4.1.10/linux-999-i915-implement-passthrough-colors.patch new file mode 100644 index 00000000000..2ccfd8ae8a3 --- /dev/null +++ b/packages/linux/patches/4.1.10/linux-999-i915-implement-passthrough-colors.patch @@ -0,0 +1,125 @@ +From 2ede4f1aabc37c6726c4edf39636d6411957bfad Mon Sep 17 00:00:00 2001 +From: fritsch +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 + diff --git a/projects/Generic/filesystem/usr/bin/intel-fullrange.sh b/projects/Generic/filesystem/usr/bin/intel-fullrange.sh new file mode 100644 index 00000000000..2a959b3d1a4 --- /dev/null +++ b/projects/Generic/filesystem/usr/bin/intel-fullrange.sh @@ -0,0 +1,11 @@ +#!/bin/sh +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 + # Hack - something is not yet fully right + /usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Video 16:235 pass-through" + /usr/bin/xrandr -display :0 --output $out --off; /usr/bin/xrandr -display :0 --output $out --auto + done +fi diff --git a/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange-resume.service b/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange-resume.service new file mode 100644 index 00000000000..b10a82ee79f --- /dev/null +++ b/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange-resume.service @@ -0,0 +1,13 @@ +[Unit] +Description=Restore full range after suspend +Before=sleep.target +StopWhenUnneeded=yes + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/true +ExecStop=-/bin/sh "/usr/bin/intel-fullrange.sh" + +[Install] +WantedBy=sleep.target diff --git a/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange.service b/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange.service new file mode 100644 index 00000000000..f1dab898708 --- /dev/null +++ b/projects/Generic/filesystem/usr/lib/systemd/system/intel-fullrange.service @@ -0,0 +1,14 @@ +[Unit] +Description=intel switch to full range +Before=kodi.service +After=graphical.target + +[Service] +Type=oneshot +Environment=DISPLAY=:0.0 +ExecStart=-/bin/sh "/usr/bin/intel-fullrange.sh" +StandardError=null +RemainAfterExit=yes + +[Install] +WantedBy=kodi.target