From: nixuser1980 Subject: Intel DRM Driver - Weathered Colours Patch Date: Wed, 19 Oct 2016 20:36:47 +0800 Message-ID: <5434d6be-c2eb-655b-031f-a9a97f1ca7a4@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E34E35FEC7660D9B6251C4C0" Return-path: Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id B7DD389F92 for ; Wed, 19 Oct 2016 12:36:52 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id r16so2395739pfg.3 for ; Wed, 19 Oct 2016 05:36:52 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org Cc: Jesse Barnes List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --------------E34E35FEC7660D9B6251C4C0 Content-Type: multipart/alternative; boundary="------------B24EC955C7F63845C7E4FAC7" --------------B24EC955C7F63845C7E4FAC7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello All, Please find a proposed workaround patch for a weathered colours (incorrect assignment to Limited RGB setting) issue. The weathered colour issue is documented at: https://bugs.archlinux.org/task/46472 https://wiki.archlinux.org/index.php/Intel_graphics#Weathered_colors_.28color_range_problem.29 https://losca.blogspot.com.au/2013/11/workaround-for-setting-full-rgb-when.html This patch, which I have shared with Jesse Barnes, provides a kernel command line option "i915.rgb_mode" with two usable options: i915.rgb_mode=1 gives forced Full RGB Mode; i915.rgb_mode=2 gives forced Limited RGB Mode. Any other value passed to i915.rgb_mode will call the default Automatic RGB mode. A limitation of this patch is that the KMS framebuffer needs to be interrupted, such as occurs when xorg-server starts. i.e. if xorg-server were not to be started, the weathered colour issue remains in effect, even with a switch from one tty to another. For reference, the machine that I am testing on is a 4770k (Haswell, Core i7). I am investigating the issue further to improve this workaround so that the change from KMS to xorg-server is not required for the patch to come into effect. I have tested this patch on Debian Testing. -Damien Sticklen --------------B24EC955C7F63845C7E4FAC7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Hello All,

Please find a proposed workaround patch for a weathered colours (incorrect assignment to Limited RGB setting) issue.
The weathered colour issue is documented at:

https://bugs.archlinux.org/task/46472
https://wiki.archlinux.org/index.php/Intel_graphics#Weathered_colors_.28color_range_problem.29
https://losca.blogspot.com.au/2013/11/workaround-for-setting-full-rgb-when.html


This patch, which I have shared with Jesse Barnes, provides a kernel command line option "i915.rgb_mode" with two usable options:

i915.rgb_mode=1 gives forced Full RGB Mode;
i915.rgb_mode=2 gives forced Limited RGB Mode.

Any other value passed to i915.rgb_mode will call the default Automatic RGB mode.

A limitation of this patch is that the KMS framebuffer needs to be interrupted, such as occurs when xorg-server starts.
i.e. if xorg-server were not to be started, the weathered colour issue remains in effect, even with a switch from one tty to another.
For reference, the machine that I am testing on is a 4770k (Haswell, Core i7).
I am investigating the issue further to improve this workaround so that the change from KMS to xorg-server is not required for the patch to come into effect.

I have tested this patch on Debian Testing.


-Damien Sticklen
--------------B24EC955C7F63845C7E4FAC7-- --------------E34E35FEC7660D9B6251C4C0 Content-Type: text/x-diff; name="linux-4.8.1-intel_rgb_patch.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux-4.8.1-intel_rgb_patch.patch" diff -ruN linux-4.8.1/drivers/gpu/drm/i915/i915_params.c linux-4.8.1-patched/drivers/gpu/drm/i915/i915_params.c --- linux-4.8.1/drivers/gpu/drm/i915/i915_params.c 2016-10-07 21:03:33.000000000 +0800 +++ linux-4.8.1-patched/drivers/gpu/drm/i915/i915_params.c 2016-10-18 21:36:12.051442687 +0800 @@ -54,6 +54,7 @@ .verbose_state_checks = 1, .nuclear_pageflip = 0, .edp_vswing = 0, + .rgb_mode = 0, .enable_guc_loading = 0, .enable_guc_submission = 0, .guc_log_level = -1, @@ -200,6 +201,10 @@ "(0=use value from vbt [default], 1=low power swing(200mV)," "2=default swing(400mV))"); +/* Override for the RGB Mode Auto detection that was introduced in Linux 3.8. This will provide the user with FULL, and LIMITED on the kernel commandline */ +module_param_named(rgb_mode, i915.rgb_mode, int, 0400); +MODULE_PARM_DESC(rgb_mode, "Override RGB Mode (1=Full RGB MODE, 2=Limited RGB Mode; Default: 0 (Automatic RGB Mode - Lets the driver select))"); + module_param_named_unsafe(enable_guc_loading, i915.enable_guc_loading, int, 0400); MODULE_PARM_DESC(enable_guc_loading, "Enable GuC firmware loading " diff -ruN linux-4.8.1/drivers/gpu/drm/i915/i915_params.h linux-4.8.1-patched/drivers/gpu/drm/i915/i915_params.h --- linux-4.8.1/drivers/gpu/drm/i915/i915_params.h 2016-10-07 21:03:33.000000000 +0800 +++ linux-4.8.1-patched/drivers/gpu/drm/i915/i915_params.h 2016-10-18 21:36:12.059442587 +0800 @@ -51,6 +51,7 @@ int use_mmio_flip; int mmio_debug; int edp_vswing; + int rgb_mode; /* Do not allow the kernel to select the output color width */ unsigned int inject_load_failure; /* leave bools at the end to not create holes */ bool enable_hangcheck; diff -ruN linux-4.8.1/drivers/gpu/drm/i915/intel_hdmi.c linux-4.8.1-patched/drivers/gpu/drm/i915/intel_hdmi.c --- linux-4.8.1/drivers/gpu/drm/i915/intel_hdmi.c 2016-10-07 21:03:33.000000000 +0800 +++ linux-4.8.1-patched/drivers/gpu/drm/i915/intel_hdmi.c 2016-10-18 21:36:12.059442587 +0800 @@ -1585,7 +1585,22 @@ goto done; } + /* Implement the RGB Override specified on the kernel command line*/ if (property == dev_priv->broadcast_rgb_property) { + if (i915.rgb_mode == 1) { + intel_hdmi->color_range_auto = false; + intel_hdmi->limited_color_range = false; + + goto done; + } + else if (i915.rgb_mode == 2) { + intel_hdmi->color_range_auto = false; + intel_hdmi->limited_color_range = true; + + goto done; + } + + /* If an override option is not provided in the kernel commandline, let the driver select the mode */ bool old_auto = intel_hdmi->color_range_auto; bool old_range = intel_hdmi->limited_color_range; --------------E34E35FEC7660D9B6251C4C0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --------------E34E35FEC7660D9B6251C4C0--