UPSTREAM: drm/i915: Fix Limited Range Color Handling

Some panels support limited range output (16-235) compared
to full range RGB values (0-255). Also userspace can control
the RGB range using "Broadcast RGB" property. Currently the
code to handle full range to limited range is broken. This
patch fixes the same by properly scaling down all the full
range co-efficients with limited range scaling factor.

BUG=chromium:848540, b:138612512
TEST=boot on samus-kernelnext, test all resolutions with USB-C attached
monitor to make sure colors are never washed out

Signed-off-by: Johnson Lin <johnson.lin@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1517327489-26128-1-git-send-email-uma.shankar@intel.com
(cherry picked from commit db9c06dfff43b2a040ba2b4f2300c30e454dd930)
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>

Change-Id: Idd4092c779a60fb7f55fc6f8cf0ae956136e6d4d
Signed-off-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Jon Flatley <jflat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1729910
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Jon Flatley <jflat@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
(cherry picked from commit 04b5e08e2e1e8ffb90fa23dfbf43784efe23f4f1)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1738444
1 file changed