New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 746068 link

Starred by 6 users

Issue metadata

Status: Verified
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

kbl: HW overlays scaling doesn't always work correctly.

Project Member Reported by dcasta...@chromium.org, Jul 18 2017

Issue description

HW overlays on kbl has been recently turned on.
On Youtube we currently hit the overlay case as soon as the UI goes away (annotations and subtitles should be turned off too).

While it seems to work fine for lower resolution videos, if we keep increasing the resolution at one point the video in an HW overlays seems to be zoomed in compared to the composited one. The higher the resolution, the more it zooms in.

It's easy to notice the difference moving the cursor in and out of the video making it switch from HW overlay to compositing.

My first guess (unverified) would be that upscaling is working fine but downscaling isn't.
 
Cc: posciak@chromium.org
A convenient video to test the issue: https://www.youtube.com/watch?v=SlLFOrWvY_M
Cc: tarun.v...@intel.com
Chrome seems to pass the correct rects information.
Even looking at /sys/kernel/debug/dri/0/i915_display_info the crtc_size and src_size match my expectations:

--Plane id 29: type=OVL, crtc_pos= 345x 305, crtc_size=1280x 720, src_pos=0.0000x0.0000, src_size=3840.0000x2160.0000, format=AR24 little-endian (0x34325241), rotation=0 (0x00000001)
Components: OS>Kernel>Graphics
Labels: videoshortlist
Cc: acourbot@chromium.org tfiga@chromium.org
Cc: dongseon...@intel.com
Could you see the difference after https://chromium-review.googlesource.com/c/567809/ is landed? Let me check also.
I'm not sure how https://chromium-review.googlesource.com/c/567809/ has anything to do with this bug.
I'm talking about downscaling not working at all. When an HW overlay is displayed I see a significantly zoomed in version of the video.

It's probably not even scaling it, but just keeping the 1:1 pixel ratio and just cropping the buffer to the crtc rect instead of scaling it.
While https://chromium-review.googlesource.com/c/581880/ is a nice fix that we should land, I don't think it fixes this issue..
As you can see in #4 src_pos is 0.0000x0.0000, passing y instead of x is not changing much there.

Did you try to repro the issue and verify that your CL fixes the problem or were you just speculating in #9?
I just tried https://chromium-review.googlesource.com/c/581880/
While the CL is correct, it doesn't fix this problem since the src pos we pass is always 0,0. So passing y instead of x doesn't really change anything.

I can reproduce quite easily. I dug in a little on the display driver side, nothing obvious, I'll keep digging.
re #11 and #12,  are you guys referring to the hardware overlays zooming in/out when switching to composition or are you talking about a different problem?
daniel.charles@ correct, that's the issue we're talking about in this bug.

It seems that chrome is setting crtc/src rects correctly. The info in /sys/kernel/debug/dri/0/i915_display_info seems to confirm that.
#4 is a 4k video (src_rect confirms that) non fullscreen (crtc_pos= 345x305, crtc_size=1280x720 is the same even when I use smaller videos and they work fine, since it's the screenspace position/rect of the overlay).

When src_size is smaller than crtc_size I didn't notice any issue, the overlay gets upscaled correctly.

When src_size is bigger, the overlay seems to zoom in the buffer and crop it, instead of downscaling it. It's more evident with bigger buffers, so, I'm guessing no scaling is happening at all, and we're just re-centering and cropping the buffers. 

Can you easily reproduce it on Youtube or would you prefer a smaller and more targeted test case?
re #14, we can reproduce it easily as well.  We're working on it to find a root cause.  We'll keep everyone updated. 
I, Daniel, and Tarun tested it with upstream kernel. Upstream kernel fixed this issue.
Actually upstream kernel lets chromium know 4k video downscaling is not possible in the test phase.
[19628:19636:0724/142149.754167:ERROR:hardware_display_plane_manager_atomic.cc(78)] Failed to commit properties. test_only:true error: Invalid argument
However, cros v4.4 doesn't fail the test commit.

For some reasons, if the width of video is more than 1602 pixel (e.g. 1080p 1440p 4k), i915 cannot scale down. It's probably because of the limitation of horizontal scanout width.

We will figure out which patch fixes it in upstream and backport it to cros v4.4
We found the upstream commit that fixes this issue: 
"2017-06-01 09:48:19 +0200       Maarten Lankhorst       73b0ca8 drm/i915/skl+: consider max supported plane pixel rate while scaling".

But, the backport to 4.4 is a little convoluted, so it will take a little while before we can backport, test for this issue and for regressions and eventually have it merged.
Does #16 mean that we would not be able to support 1440p/4k video playback on HW overlays?
Thank you Tarun, do you have any idea how long it will take to backport it?

#16, are you saying that even with ToT kernel we can't get 1440p? That seems surprising considering that if I put a 1440p youtube video in fullscreen on eve we're already using overlays and it seems to work fine (no visual artifacts or wrong scaling)
This is from i915_display_info:
--Plane id 29: type=OVL, crtc_pos=   0x 125, crtc_size=2400x1350, src_pos=0.0000x0.0000, src_size=2560.0000x1440.0000, format=AR24 little-endian (0x34325241), rotation=0 (0x00000001)


> For some reasons, if the width of video is more than 1602 pixel (e.g. 1080p 1440p 4k), i915 cannot scale down. It's probably because of the limitation of horizontal scanout width.

Hmm, the reference manual says the following about the scalers:

> The scalers support horizontal source sizes up to 4096 pixels.
> The '7x5' scaler mode supports up to 2.99 in each direction.
> The 'Dynamic' scaler mode supports up to 2.99 in both directions when operating on horizontal source sizes up to 2048 pixels. It will only support up to 1.99 in the vertical direction when operating on horizontal source sizes greater than 2048 pixels.
> The 'NV12' scaler mode supports up to 1.99 downscaling in each direction.

In the failed cases I've observed, we're using the 7x5 (HQ) scaler on plane 1 going from 1705x959 -> 1280x720. This seems to be within the scaler's operating range, perhaps I'm missing something?
Sorry for confusion. #16 is written by simple careless observation.

Now we have more solid understand, which the kernel patch point out. https://patchwork.kernel.org/patch/9733149/

My hypothesis is wrong, which pixel rate only rely on src size.
Pixel rate is related to both src and target size.
The reference manual says "Down scaling effectively increases the pixel rate. Up scaling does not reduce the pixel rate."
in p205 https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol12-display.pdf

It means downscaling 1440p to fullscreen is fine while downscaling 1440p to small <video> element doesn't work.

New observation on eve.
1) fullscreen: 1080p 1440p works but 4k doesn't works
2) Youtube default view (1245x 730): 720p works but 1080p 1440p 4k doesn't work.

It's not fixed for all kabylake. Each kabylake would have different limitation. As the reference manual says "The scalers support horizontal source sizes up to 4096 pixels.", if the monitor is as big as 4k video, I believe 4k video overlay should work. On eve, the monitor requires (3840x2160 -> 2400x1350) downscaling for 4k video, so it exceeds display hardware limit unfortunately.


#19, The backport is now done, Daniele. We tested it out this specific issue and seems to be doing what _upstream_ does, on KBL. 

We will have to test for regressions on KBL as well as other platforms before we can get this merged, so I'll hand it over to validation guys by tomorrow and update once we have satisfactory results (hoping sometime next week b/c we have 3 platforms to test for).
Owner: dcasta...@chromium.org
Status: Started (was: Untriaged)
That's great. Thank you Tarun.
Hi folks - can you direct add me to cc? Thx.
Cc: matthew....@intel.corp-partner.google.com
i915 CLs gerrit link: https://chromium-review.googlesource.com/c/588605. Validation in progress
Note that I'm out next week (moving), so I won't be able to push this set of CLs. 
Issue 750194 has been merged into this issue.
Project Member

Comment 29 by bugdroid1@chromium.org, Aug 2 2017

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/9462bcbd381fbaecf962ce8059fb616e893ee850

commit 9462bcbd381fbaecf962ce8059fb616e893ee850
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 19:47:37 2017

UPSTREAM: drm/i915: Drop checks for max_pixclk failures in cdclk computation

commit 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
removed the possibility that intel_mode_max_pixclk() or
ilk_max_pixel_rate() might return an error, so let's get rid of the
error checks in the callers as well.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1462995892-32416-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit e1ff5f0126cd83b149060171a84a4b33972ea28b)
from drm-intel-next-2016-05-22
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I46502c85ba372c02f3f9b45f626ee6ad95fad316
Reviewed-on: https://chromium-review.googlesource.com/588063
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/9462bcbd381fbaecf962ce8059fb616e893ee850/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 30 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/9a33dfea4cdd3a09d1d23e2e9b54b48612fa22e9

commit 9a33dfea4cdd3a09d1d23e2e9b54b48612fa22e9
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 19:47:38 2017

UPSTREAM: drm/i915: Extract broadwell_calc_cdclk()

Try to reduce the amount of duplicated cdclk magic numbers by
moving the max_pixclk->cdclk conversion into a helper.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1462995892-32416-3-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit 587c7914154921ffa819aa61ef9057e68e9ad73f)
from drm-intel-next-2016-05-22
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Id6ae993dfac95a9c26debeceb6982c747a9425f8
Reviewed-on: https://chromium-review.googlesource.com/588064
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/9a33dfea4cdd3a09d1d23e2e9b54b48612fa22e9/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 31 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/4ae8f090820c2b98146b1cc54ebee019ef9e302b

commit 4ae8f090820c2b98146b1cc54ebee019ef9e302b
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 19:47:40 2017

UPSTREAM: drm/i915: Make 308 and 671 MHz cdclks more accurate on SKL

The SKL 308.57 MHz cdclk is probably 8640/28 = ~308.571 Mhz.
Similartly the 617.14 MHz cdclk is probably 8640/14 = ~617.143 MHz.
Let's use the slightly more accurate numbers. Potentially we might
change to computing all of these based on dividers, but let's
stick to the current theme for now..

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1463172100-24715-13-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
(cherry picked from commit 487ed2e4e9d62363ddd5fab2407100d3436fd0c9)
from drm-intel-next-2016-06-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ia64751c58541e918bfa1bca895bb68e1bf0b736c
Reviewed-on: https://chromium-review.googlesource.com/588065
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/4ae8f090820c2b98146b1cc54ebee019ef9e302b/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 32 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b1b2e0fb3fe0e9e0fe196e72efc8531a7d2fe51d

commit b1b2e0fb3fe0e9e0fe196e72efc8531a7d2fe51d
Author: Arthur Heymans <arthur@aheymans.xyz>
Date: Wed Aug 02 22:02:09 2017

BACKPORT: drm/i915: Get correct display clock on 945gm

This is according to Mobile Intel 945 Express Chipset
Family datasheet.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Link: http://patchwork.freedesktop.org/patch/msgid/20170131235026.26003-1-arthur@aheymans.xyz
Reviewed-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
(cherry picked from commit 6248017ae5301ccb51cda92c4117b573b9aff6bb)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "2a307c2 drm/i915: add some more "i" in platform
		 names for consistency" is very messy and we don't
		 really need it]
	drivers/gpu/drm/i915/intel_display.c

 Modified: [Tarun: Get back to using IS_845G to compensate for the above
		 conflict resolution]
 	drivers/gpu/drm/i915/intel_display.c

Change-Id: I273e7729d5ff5a86a1d4d9867729924a99f6b413
Reviewed-on: https://chromium-review.googlesource.com/588066
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/b1b2e0fb3fe0e9e0fe196e72efc8531a7d2fe51d/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/b1b2e0fb3fe0e9e0fe196e72efc8531a7d2fe51d/drivers/gpu/drm/i915/i915_reg.h

Project Member

Comment 33 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a64a1174581e5e1bd229af475260008256701328

commit a64a1174581e5e1bd229af475260008256701328
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Aug 02 22:02:10 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-21-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit e084e1b9cc1bb0717aaeccccec640e28cc141560)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Icee6b52d54d892113133d341ca6f5efd2e338cb3
Reviewed-on: https://chromium-review.googlesource.com/588587
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/a64a1174581e5e1bd229af475260008256701328/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 34 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/53a156a5c1c348f8f0c212a132ca7f2fa9a503b0

commit 53a156a5c1c348f8f0c212a132ca7f2fa9a503b0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Aug 02 22:02:11 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-20-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit 95cac28301072f884fe4b759d9022c002cb4c518)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Id4dbf91de596fb9c31ae786f788cd2f2691953f0
Reviewed-on: https://chromium-review.googlesource.com/588588
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/53a156a5c1c348f8f0c212a132ca7f2fa9a503b0/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 35 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/94a7db5ac53438f2bf6141f0b790d82de010110e

commit 94a7db5ac53438f2bf6141f0b790d82de010110e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Aug 02 22:02:13 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-22-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit e24ca054b065bf1dd5e36da7a29301e8797636ae)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I8bd961cb577a8463d7998df40346770ddaed0df4
Reviewed-on: https://chromium-review.googlesource.com/588589
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/94a7db5ac53438f2bf6141f0b790d82de010110e/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 36 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/604d7c48ef01e510c634f0f8ca98a1636cae8b21

commit 604d7c48ef01e510c634f0f8ca98a1636cae8b21
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Aug 02 22:02:14 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-23-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit 8ad32a05b5f0bc28144d79e2b1ef36f8159cca38)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ib33ec99f974d64fcb637ee068c0e1a47cafc9a89
Reviewed-on: https://chromium-review.googlesource.com/588590
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/604d7c48ef01e510c634f0f8ca98a1636cae8b21/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 37 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/513360234f2f9f8ee5f2d84eee756e75176e0e7f

commit 513360234f2f9f8ee5f2d84eee756e75176e0e7f
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:15 2017

BACKPORT: drm/i915: s/get_display_clock_speed/get_cdclk/

Rename the .get_display_clock_speed() hook to .get_cdclk().
.get_cdclk() is more specific (which clock) and it's much
shorter.

v2: Deal with IS_GEN9_BC()
v3: Deal with i945gm_get_display_clock_speed()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183146.19420-1-ville.syrjala@linux.intel.com
(cherry picked from commit c49a0d054a054cc07f9ef4982a72e55a710e87d0)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Macro related ctx delta due to the following. All of
		 these are naming related changes and shouldn't affect
		 functionality. Plus, they are messy to backport so we
		 can avoid them]

		 ["c0f8683 drm/i915: rename BROADWATER and CRESTLINE to
		 I965G and I965GM, respectively"]
		 ["2a307c2 drm/i915: add some more "i" in platform names
		 for consistency"]
		 ["b976dc5 drm/i915: Introduce IS_GEN9_BC for Skylake
		 and Kabylake"]
		 ["3e4274f drm/i915/glk: Add a IS_GEN9_LP() macro"]

	drivers/gpu/drm/i915/intel_display.c

Change-Id: I7051fe2d2731ba85954e74396a0990e6ae3c8013
Reviewed-on: https://chromium-review.googlesource.com/588591
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/513360234f2f9f8ee5f2d84eee756e75176e0e7f/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/513360234f2f9f8ee5f2d84eee756e75176e0e7f/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/513360234f2f9f8ee5f2d84eee756e75176e0e7f/drivers/gpu/drm/i915/intel_runtime_pm.c

Project Member

Comment 38 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/75d0b72d533f360dfe952f99ca855e1acada8666

commit 75d0b72d533f360dfe952f99ca855e1acada8666
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:17 2017

BACKPORT: drm/i915: Clean up the .get_cdclk() assignment if ladder

Let's clean up the mess we have in the if ladder that assigns the
.get_cdclk() hooks. The grouping of the platforms by the function
results in a thing that's not really legible, so let's do it the
other way around and order the if ladder by platform and duplicate
whatever assignments we need.

To further avoid confusion with the function names let's rename
them to just fixed_<freq>_get_cdclk(). The other option would
be to duplicate the functions entirely but it seems quite
pointless to do that since each one just returns a fixed value.

v2: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183226.19537-1-ville.syrjala@linux.intel.com
(cherry picked from commit 4717e8bb7341a00f44da3d1814ac53c5a2a1ce75)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Macro ctx delta b/c of "drm/i915: rename BROADWATER
		 and CRESTLINE to I965G and I965GM, respectively" and
		 "2a307c2 drm/i915: add some more "i" in platform names
		 for consistency". Both are messy to backport and not
		 needed here.]

	drivers/gpu/drm/i915/intel_display.c

Change-Id: I2e7e4afe91b8a49fe33b58539f79f429bccbf776
Reviewed-on: https://chromium-review.googlesource.com/588592
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/75d0b72d533f360dfe952f99ca855e1acada8666/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 39 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/755c3c35cce35c88aed908152ec98e4e6993cfe4

commit 755c3c35cce35c88aed908152ec98e4e6993cfe4
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:18 2017

BACKPORT: drm/i915: Move most cdclk/rawclk related code to intel_cdclk.c

Let's try to shrink intel_display.c a bit by moving the cdclk/rawclk
stuff to a new file. It's all reasonably self contained so we don't
even have to add that many non-static symbols.

We'll also take the opportunity to shuffle around the functions a bit
to get things in a more consistent order based on the platform.

v2: Add kernel-docs (Ander)
v3: Deal with IS_GEN9_BC()
v4: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183305.19656-1-ville.syrjala@linux.intel.com
(cherry picked from commit 7ff89ca2135814db74d7a1706b9abfb1448b8bed)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Tons of ctx delta due to Macro renaming and GLK
		 code, both of which are not required. Below is the
		 summary of thecommits that create this ctx delta.]

		 ["c0f8683 drm/i915: rename BROADWATER and CRESTLINE to
		 I965G and I965GM, respectively"]
		 ["2a307c2 drm/i915: add some more "i" in platform names
		 for consistency"]
		 ["b976dc5 drm/i915: Introduce IS_GEN9_BC for Skylake
		 and Kabylake"]
		 ["3e4274f drm/i915/glk: Add a IS_GEN9_LP() macro"]
		 ["89b3c3c drm/i915/glk: Reuse broxton's cdclk code for GLK"]
	drivers/gpu/drm/i915/intel_display.c

		["d4438f89e9d1 FROMGIT: drm/i915: Consistently use enum
		pipe for PCH transcoders"]
	drivers/gpu/drm/i915/intel_drv.h

 Modified: [Tarun: Modify as per intel_display.c conflict resolution]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ie396a325fdc6cb57567bd2136df937ca1f145edb
Reviewed-on: https://chromium-review.googlesource.com/588593
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/755c3c35cce35c88aed908152ec98e4e6993cfe4/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/755c3c35cce35c88aed908152ec98e4e6993cfe4/drivers/gpu/drm/i915/Makefile
[add] https://crrev.com/755c3c35cce35c88aed908152ec98e4e6993cfe4/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/755c3c35cce35c88aed908152ec98e4e6993cfe4/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/755c3c35cce35c88aed908152ec98e4e6993cfe4/Documentation/gpu/i915.rst

Project Member

Comment 40 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a64ffc45710643242a3b55394a14cfe6f6ab3492

commit a64ffc45710643242a3b55394a14cfe6f6ab3492
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:19 2017

BACKPORT: drm/i915: Pass computed vco to bxt_set_cdclk()

Rather than compute the vco inside bxt_set_cdclk() let's precompute it
outside and pass it in. A small step towards a fully precomputed cdclk
state.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170120182205.8141-7-ville.syrjala@linux.intel.com
(cherry picked from commit 8f0cfa4d2a628a53e469f98aff7988555d654bc6)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
		 for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

 Modified: [Tarun: Use variables for cdclk and vco as done in commit 89b3c3c]
 	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ibd5b24769a54721cdd5d365d55a437fa0639cf19
Reviewed-on: https://chromium-review.googlesource.com/588594
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/a64ffc45710643242a3b55394a14cfe6f6ab3492/drivers/gpu/drm/i915/intel_cdclk.c

Project Member

Comment 41 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a0f8320e214f8957237917509fccbdc6341d98d3

commit a0f8320e214f8957237917509fccbdc6341d98d3
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:21 2017

BACKPORT: drm/i915: Start moving the cdclk stuff into a distinct state structure

Introduce intel_cdclk state which for now will track the cdclk
frequency, the vco frequency and the reference frequency (not sure we
want the last one, but I put it there anyway). We'll also make the
.get_cdclk() function fill out this state structure rather than
just returning the current cdclk frequency.

One immediate benefit is that calling .get_cdclk() will no longer
clobber state stored under dev_priv unless ex[plicitly told to do
so. Previously it clobbered the vco and reference clocks stored
there on some platforms.

We'll expand the use of this structure to actually precomputing the
state and whatnot later.

v2: Constify intel_cdclk_state_compare()
v3: Document intel_cdclk_state_compare()
v4: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183345.19763-1-ville.syrjala@linux.intel.com
(cherry picked from commit 49cd97a35d9041b53ecf39d447f6a0f8f2de75eb)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
 		for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: I15542058d0b6de08141ddc5f1f5a70efcd2e166e
Reviewed-on: https://chromium-review.googlesource.com/588595
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_audio.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_runtime_pm.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/i915_debugfs.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_panel.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_dp.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/a0f8320e214f8957237917509fccbdc6341d98d3/drivers/gpu/drm/i915/intel_fbc.c

Project Member

Comment 42 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6

commit cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:22 2017

BACKPORT: drm/i915: Track full cdclk state for the logical and actual cdclk frequencies

The current dev_cdclk vs. cdclk vs. atomic_cdclk_freq is quite a mess.
So here I'm introducing the "actual" and "logical" naming for our
cdclk state. "actual" is what we'll bash into the hardware and "logical"
is what everyone should use for state computaion/checking and whatnot.
We'll track both using the intel_cdclk_state as both will need other
differing parameters than just the actual cdclk frequency.

While doing that we can at the same time unify the appearance of the
.modeset_calc_cdclk() implementations a little bit.

v2: Commit dev_priv->cdclk.actual since that already has the
    new state by the time .modeset_commit_cdclk() is called.
v3: s/locical/logical/ and improve the docs a bit

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170120182205.8141-9-ville.syrjala@linux.intel.com
(cherry picked from commit bb0f4aab0e7677e91cde443fecc18e71fbb85038)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
 		for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ifcf29d806fb383e96e2a4eb6d669779bd8659546
Reviewed-on: https://chromium-review.googlesource.com/588596
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/intel_dp.c
[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 43 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a2b107735d6450d7987173d40e2aeab9e5afb0da

commit a2b107735d6450d7987173d40e2aeab9e5afb0da
Author: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Date: Wed Aug 02 22:02:24 2017

UPSTREAM: drm/i915/glk: Pass dev_priv to intel_atomic_setup_scalers()

Pass dev_priv to intel_atomic_setup_scalers(). The next patch will need
a dev_priv pointer.

Cc: Ville Syrjl <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223071600.14356-4-ander.conselvan.de.oliveira@intel.com
(cherry picked from commit 6ebc69238df36bc61380a68f607a1c2039af134f)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ib0f5cda36f154e426d8643659ce592fb7a2fb7dd
Reviewed-on: https://chromium-review.googlesource.com/588597
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/a2b107735d6450d7987173d40e2aeab9e5afb0da/drivers/gpu/drm/i915/intel_atomic.c
[modify] https://crrev.com/a2b107735d6450d7987173d40e2aeab9e5afb0da/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/a2b107735d6450d7987173d40e2aeab9e5afb0da/drivers/gpu/drm/i915/intel_drv.h

Project Member

Comment 44 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/aa5d5e561fda5a0dfa3dadf11d4dd414763de8e6

commit aa5d5e561fda5a0dfa3dadf11d4dd414763de8e6
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:25 2017

UPSTREAM: drm/i915: Fix legacy cursor vs. watermarks for ILK-BDW

In order to make cursor updates actually safe wrt. watermark programming
we have to clear the legacy_cursor_update flag in the atomic state. That
will cause the regular atomic update path to do the necessary vblank
wait after the plane update if needed, otherwise the vblank wait would
be skipped and we'd feed the optimal watermarks to the hardware before
the plane update has actually happened.

To make the slow vs. fast path determination in
intel_legacy_cursor_update() a little simpler we can ignore the actual
visibility of the plane (which can only get computed once we've already
chosen out path) and instead we simply check whether the fb is being
set or cleared by the user. This means a fully clipped but logically
visible cursor will be considered visible as far as watermark
programming is concerned. We can do that for the cursor since it's a
fixed size plane and the clipped size doesn't play a role in the
watermark computation.

This should fix underruns that can occur when the cursor gets
enable/disabled or the size gets changed. Hopefully it's good enough
that only pure cursor movement and flips go through unthrottled.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Uwe Kleine-Knig <uwe@kleine-koenig.org>
Reported-by: Uwe Kleine-Knig <uwe@kleine-koenig.org>
Fixes: f79f26921ee1 ("drm/i915: Add a cursor hack to allow converting legacy page flip to atomic, v3.")
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170217150159.11683-1-ville.syrjala@linux.intel.com
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tested-by: Rafael Ristovski <rafael.ristovski@gmail.com>
(cherry picked from commit a5509abda48ecfc133fac6268e83fc1a93dba039)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I241f1c4cf9284164f6ab401cf7ac570858ca7af7
Reviewed-on: https://chromium-review.googlesource.com/588598
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/aa5d5e561fda5a0dfa3dadf11d4dd414763de8e6/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/aa5d5e561fda5a0dfa3dadf11d4dd414763de8e6/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 45 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b346789c54488fd8a6949b35d97b3dd6e625de87

commit b346789c54488fd8a6949b35d97b3dd6e625de87
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:26 2017

UPSTREAM: drm/i915: Extract intel_wm_plane_visible()

All platforms that lack double buffered watermarks will need to
handle the legacy cursor updates in the same way. So let's extract the
logic to determine the plane visibility into a small helper. For
simplicity we'll make the function DTRT for any plane, but only apply
the special sauce for cursor planes.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314151050.12194-1-ville.syrjala@linux.intel.com
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
(cherry picked from commit 24304d81930fdee0784ac27c0bf8d6a27f529382)
from drm-intel-next-2017-04-03
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I39efb678bea7ea007580d71a0b4a3c772fe7c713
Reviewed-on: https://chromium-review.googlesource.com/588599
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/b346789c54488fd8a6949b35d97b3dd6e625de87/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 46 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2b71422202c17bea17daff7041d9075631b3f303

commit 2b71422202c17bea17daff7041d9075631b3f303
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Wed Aug 02 22:02:27 2017

UPSTREAM: drm/i915: Fix SKL cursor watermarks

Use intel_wm_plane_visible() to determine cursor visibility for SKL+
also. Previously SKL+ would check the actual visibility which now
conflicts with the assumptions in intel_legacy_cursor_update().

We also change SKL+ to compute the cursor watermarks based on the
unclipped cursor size, just as we do on all the other platforms.
Using the clipped size could now result in garbage results.

Testcase: igt/kms_chv_cursor_fail
Fixes: a5509abda48e ("drm/i915: Fix legacy cursor vs. watermarks for ILK-BDW")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100195
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314151050.12194-2-ville.syrjala@linux.intel.com
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@collabora.co.uk>
Tested-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
(cherry picked from commit 93aa2a1c25e562cc0ca69c3175333fe33fdf055b)
from drm-intel-next-2017-04-03
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ica3bffc40d919b5715e7b6ff0125e037b1fe1dd7
Reviewed-on: https://chromium-review.googlesource.com/588600
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/2b71422202c17bea17daff7041d9075631b3f303/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 47 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/6c160c74dc68ce1763543aa9be6bc8a53d7a3590

commit 6c160c74dc68ce1763543aa9be6bc8a53d7a3590
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Wed Aug 02 22:02:29 2017

UPSTREAM: drm/i915: fix naming of fixed_16_16 wrapper.

fixed_16_16_div_round_up(_u64), wrapper for fixed_16_16 division
operation don't really round_up the result. Wrapper round_up only the
fraction part of the result to make it 16-bit.
This patch eliminates round_up keyword from the wrapper.

Later patch will introduce the new wrapper to do rounding-off the result
and give unt32_t output to cleanup mix use of fixed_16_16_t & uint32_t
variables.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-2-mahesh1.kumar@intel.com
(cherry picked from commit afbc95cd0c4792a72f384bbcb98251617db40107)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I26b35e2a8dda7e9772a9dce813866d97bfced320
Reviewed-on: https://chromium-review.googlesource.com/588601
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/6c160c74dc68ce1763543aa9be6bc8a53d7a3590/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/6c160c74dc68ce1763543aa9be6bc8a53d7a3590/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 48 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b6d8c19754f6c728e922ea208457e0a2e8c92a37

commit b6d8c19754f6c728e922ea208457e0a2e8c92a37
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 00:26:35 2017

UPSTREAM: drm/i915: Add more wrapper for fixed_point_16_16 operations

This patch adds few wrapper to perform fixed_point_16_16 operations
mul_round_up_u32_fixed16 : Multiplies u32 and fixed_16_16_t variables
			   & returns u32 result with rounding-up.
mul_fixed16 : Multiplies two fixed_16_16_t variable & returns fixed_16_16
div_round_up_fixed16 : Perform division operation on fixed_16_16_t
		       variables & return u32 result with round-off
div_round_up_u32_fixed16 : devide uint32_t variable by fixed_16_16 variable
			   and round_up the result to uint32_t.

These wrappers will be used by later patches in the series.

Changes from V1:
 - Rename wrapper as per Matt's comment
Changes from V2:
 - Fix indentation

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-3-mahesh1.kumar@intel.com
(cherry picked from commit a9d055de65a714f67a3b47dcceee1dc450743c83)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I943375ea9633cf4ea6a30a5f5612384ad76bed3d
Reviewed-on: https://chromium-review.googlesource.com/588602
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/b6d8c19754f6c728e922ea208457e0a2e8c92a37/drivers/gpu/drm/i915/i915_drv.h

Project Member

Comment 49 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/7ab076aba671d9fc56eb779d9a96c992183ec83f

commit 7ab076aba671d9fc56eb779d9a96c992183ec83f
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 00:26:36 2017

UPSTREAM: drm/i915: Use fixed_16_16 wrapper for division operation

Don't use fixed_16_16 structure members directly, instead use wrapper to
perform fixed_16_16 division operation.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-4-mahesh1.kumar@intel.com
(cherry picked from commit d273ecce3dde63168ed7840e2b8e5659da0df0f5)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I0f5092c19435797e0a4cb8053e92c62a6cb05dd6
Reviewed-on: https://chromium-review.googlesource.com/588603
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/7ab076aba671d9fc56eb779d9a96c992183ec83f/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 50 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c37390ca1fd8223ba01d7d22409254c86e36fcb4

commit c37390ca1fd8223ba01d7d22409254c86e36fcb4
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 00:26:38 2017

UPSTREAM: drm/i915/skl+: calculate pixel_rate & relative_data_rate in fixed point

This patch make changes to calculate adjusted plane pixel rate &
plane downscale amount using fixed_point functions available.
This patch will give uniformity in code, & will help to avoid mixing of
32bit uint32_t variable for fixed-16.16 with fixed_16_16_t variables in
later patch in the series.

Changes from V1:
 - Rebase based on wrapper name change
 - Remove unnecessary comment

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-5-mahesh1.kumar@intel.com
(cherry picked from commit 7084b50bdd8f8b8fc232fb8642d83de913575baa)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I519bec99187d6122dbfe2bc8389c0bad27ed0c31
Reviewed-on: https://chromium-review.googlesource.com/588604
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/c37390ca1fd8223ba01d7d22409254c86e36fcb4/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 51 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db

commit ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db
Author: Mahesh Kumar <mahesh1.kumar@intel.com>
Date: Thu Aug 03 00:26:39 2017

UPSTREAM: drm/i915/skl+: consider max supported plane pixel rate while scaling

A display resolution is only supported if it meets all the restrictions
below for Maximum Pipe Pixel Rate.

The display resolution must fit within the maximum pixel rate output
from the pipe. Make sure that the display pipe is able to feed pixels at
a rate required to support the desired resolution.
For each enabled plane on the pipe {
    If plane scaling enabled {
	Horizontal down scale amount = Maximum[1, plane horizontal size /
		    scaler horizontal window size]
	Vertical down scale amount = Maximum[1, plane vertical size /
		    scaler vertical window size]
	Plane down scale amount = Horizontal down scale amount *
		    Vertical down scale amount
	Plane Ratio = 1 / Plane down scale amount
    }
    Else {
	Plane Ratio = 1
    }
    If plane source pixel format is 64 bits per pixel {
	Plane Ratio = Plane Ratio * 8/9
    }
}

Pipe Ratio = Minimum Plane Ratio of all enabled planes on the pipe

If pipe scaling is enabled {
    Horizontal down scale amount = Maximum[1, pipe horizontal source size /
		scaler horizontal window size]
    Vertical down scale amount = Maximum[1, pipe vertical source size /
		scaler vertical window size]
    Note: The progressive fetch - interlace display mode is equivalent to a
		2.0 vertical down scale
    Pipe down scale amount = Horizontal down scale amount *
		Vertical down scale amount
    Pipe Ratio = Pipe Ratio / Pipe down scale amount
}

Pipe maximum pixel rate = CDCLK frequency * Pipe Ratio

In this patch our calculation is based on pipe downscale amount
(plane max downscale amount * pipe downscale amount) instead of Pipe
Ratio. So,
max supported crtc clock with given scaling = CDCLK / pipe downscale.
Flip will fail if,
current crtc clock > max supported crct clock with given scaling.

Changes since V1:
 - separate out fixed_16_16 wrapper API definition
Changes since V2:
 - Fix buggy crtc !active condition (Maarten)
 - use intel_wm_plane_visible wrapper as per Maarten's suggestion
Changes since V3:
 - Change failure return from ERANGE to EINVAL
Changes since V4:
 - Rebase based on previous patch changes
Changes since V5:
 - return EINVAL instead of continue (Maarten)
Changes since V6:
 - Improve commit message
 - Address review comment
Changes since V7:
 - use !enable instead of !active
 - rename config variable for consistency (Maarten)

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170526151546.25025-4-mahesh1.kumar@intel.com
(cherry picked from commit 73b0ca8ec76d593d8ebb9d3a5e4021da852310e7)
from drm-intel-next-2017-06-19
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=With a 4K capable Youtube video with no UI(annotations, subtitles
turned off, which results into a switch to plane OVL), _no_ zoom in happens
with higher resolutions i.e 1080p, 1440p and 2160p.
TEST=With a 4K capable Youtube video running in Ultra HD (2160p) and no
UI (plane OVL), a switch to full screen mode doesn't results into any visual
artifacts.
TEST=No regressions in KBL/APL/BYT

Change-Id: I5e0da3439318e7bcb0bbcf017f7b01d4633cc326
Reviewed-on: https://chromium-review.googlesource.com/588605
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Tested-by: Daniele Castagna <dcastagna@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db/drivers/gpu/drm/i915/intel_pm.c
[modify] https://crrev.com/ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db/drivers/gpu/drm/i915/intel_drv.h

Labels: Merge-Request-61
Status: Fixed (was: Started)
Labels: -Merge-Request-61 Merge-Approved-61
Approving merge to M61 Chrome OS.
Project Member

Comment 54 by bugdroid1@chromium.org, Aug 3 2017

Labels: merge-merged-release-R61-9765.B-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/00721a89840b153b471af087afe9c825c8abc98e

commit 00721a89840b153b471af087afe9c825c8abc98e
Author: Arthur Heymans <arthur@aheymans.xyz>
Date: Thu Aug 03 18:28:52 2017

BACKPORT: drm/i915: Get correct display clock on 945gm

This is according to Mobile Intel 945 Express Chipset
Family datasheet.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Link: http://patchwork.freedesktop.org/patch/msgid/20170131235026.26003-1-arthur@aheymans.xyz
Reviewed-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
(cherry picked from commit 6248017ae5301ccb51cda92c4117b573b9aff6bb)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "2a307c2 drm/i915: add some more "i" in platform
		 names for consistency" is very messy and we don't
		 really need it]
	drivers/gpu/drm/i915/intel_display.c

 Modified: [Tarun: Get back to using IS_845G to compensate for the above
		 conflict resolution]
 	drivers/gpu/drm/i915/intel_display.c

Change-Id: I273e7729d5ff5a86a1d4d9867729924a99f6b413
Reviewed-on: https://chromium-review.googlesource.com/588066
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit b1b2e0fb3fe0e9e0fe196e72efc8531a7d2fe51d)
Reviewed-on: https://chromium-review.googlesource.com/600808
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/00721a89840b153b471af087afe9c825c8abc98e/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/00721a89840b153b471af087afe9c825c8abc98e/drivers/gpu/drm/i915/i915_reg.h

Project Member

Comment 55 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e9758f1ccb4daf04cb9b23315c7d857813e0e97a

commit e9758f1ccb4daf04cb9b23315c7d857813e0e97a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Aug 03 18:31:28 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-21-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit e084e1b9cc1bb0717aaeccccec640e28cc141560)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Icee6b52d54d892113133d341ca6f5efd2e338cb3
Reviewed-on: https://chromium-review.googlesource.com/588587
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit a64a1174581e5e1bd229af475260008256701328)
Reviewed-on: https://chromium-review.googlesource.com/600809
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/e9758f1ccb4daf04cb9b23315c7d857813e0e97a/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 56 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f90b7ca4806e7c3847d1510429c7561474e66cbf

commit f90b7ca4806e7c3847d1510429c7561474e66cbf
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Aug 03 18:31:32 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-20-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit 95cac28301072f884fe4b759d9022c002cb4c518)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Id4dbf91de596fb9c31ae786f788cd2f2691953f0
Reviewed-on: https://chromium-review.googlesource.com/588588
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 53a156a5c1c348f8f0c212a132ca7f2fa9a503b0)
Reviewed-on: https://chromium-review.googlesource.com/600810
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/f90b7ca4806e7c3847d1510429c7561474e66cbf/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 57 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e6528e81edc0fe49cc8f0a6a6c12070ec73aac38

commit e6528e81edc0fe49cc8f0a6a6c12070ec73aac38
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 18:34:20 2017

BACKPORT: drm/i915: s/get_display_clock_speed/get_cdclk/

Rename the .get_display_clock_speed() hook to .get_cdclk().
.get_cdclk() is more specific (which clock) and it's much
shorter.

v2: Deal with IS_GEN9_BC()
v3: Deal with i945gm_get_display_clock_speed()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183146.19420-1-ville.syrjala@linux.intel.com
(cherry picked from commit c49a0d054a054cc07f9ef4982a72e55a710e87d0)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Macro related ctx delta due to the following. All of
		 these are naming related changes and shouldn't affect
		 functionality. Plus, they are messy to backport so we
		 can avoid them]

		 ["c0f8683 drm/i915: rename BROADWATER and CRESTLINE to
		 I965G and I965GM, respectively"]
		 ["2a307c2 drm/i915: add some more "i" in platform names
		 for consistency"]
		 ["b976dc5 drm/i915: Introduce IS_GEN9_BC for Skylake
		 and Kabylake"]
		 ["3e4274f drm/i915/glk: Add a IS_GEN9_LP() macro"]

	drivers/gpu/drm/i915/intel_display.c

Change-Id: I7051fe2d2731ba85954e74396a0990e6ae3c8013
Reviewed-on: https://chromium-review.googlesource.com/588591
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 513360234f2f9f8ee5f2d84eee756e75176e0e7f)
Reviewed-on: https://chromium-review.googlesource.com/600930
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/e6528e81edc0fe49cc8f0a6a6c12070ec73aac38/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/e6528e81edc0fe49cc8f0a6a6c12070ec73aac38/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/e6528e81edc0fe49cc8f0a6a6c12070ec73aac38/drivers/gpu/drm/i915/intel_runtime_pm.c

Project Member

Comment 58 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/106bcda53aec0078caa08c55888a9532848b55de

commit 106bcda53aec0078caa08c55888a9532848b55de
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Aug 03 18:34:24 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-22-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit e24ca054b065bf1dd5e36da7a29301e8797636ae)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I8bd961cb577a8463d7998df40346770ddaed0df4
Reviewed-on: https://chromium-review.googlesource.com/588589
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 94a7db5ac53438f2bf6141f0b790d82de010110e)
Reviewed-on: https://chromium-review.googlesource.com/600811
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/106bcda53aec0078caa08c55888a9532848b55de/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 59 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f80060e73cc3f7c9fd8b37f3dc5a020e41480a46

commit f80060e73cc3f7c9fd8b37f3dc5a020e41480a46
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Aug 03 18:34:29 2017

UPSTREAM: drm/i915: Convert wait_for(I915_READ(reg)) to intel_wait_for_register()

By using the out-of-line intel_wait_for_register() not only do we can
efficiency from using the hybrid wait_for() contained within, but we
avoid code bloat from the numerous inlined loops, in total (all patches):

   text    data     bss     dec     hex filename
1078551    4557     416 1083524  108884 drivers/gpu/drm/i915/i915.ko
1070775    4557     416 1075748  106a24 drivers/gpu/drm/i915/i915.ko

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1467297225-21379-23-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit 8ad32a05b5f0bc28144d79e2b1ef36f8159cca38)
from drm-intel-next-2016-07-11
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ib33ec99f974d64fcb637ee068c0e1a47cafc9a89
Reviewed-on: https://chromium-review.googlesource.com/588590
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 604d7c48ef01e510c634f0f8ca98a1636cae8b21)
Reviewed-on: https://chromium-review.googlesource.com/600588
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/f80060e73cc3f7c9fd8b37f3dc5a020e41480a46/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 60 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f0296354f2b14821839f6ef7e937c7b7f2582a5b

commit f0296354f2b14821839f6ef7e937c7b7f2582a5b
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 18:39:48 2017

BACKPORT: drm/i915: Clean up the .get_cdclk() assignment if ladder

Let's clean up the mess we have in the if ladder that assigns the
.get_cdclk() hooks. The grouping of the platforms by the function
results in a thing that's not really legible, so let's do it the
other way around and order the if ladder by platform and duplicate
whatever assignments we need.

To further avoid confusion with the function names let's rename
them to just fixed_<freq>_get_cdclk(). The other option would
be to duplicate the functions entirely but it seems quite
pointless to do that since each one just returns a fixed value.

v2: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183226.19537-1-ville.syrjala@linux.intel.com
(cherry picked from commit 4717e8bb7341a00f44da3d1814ac53c5a2a1ce75)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Macro ctx delta b/c of "drm/i915: rename BROADWATER
		 and CRESTLINE to I965G and I965GM, respectively" and
		 "2a307c2 drm/i915: add some more "i" in platform names
		 for consistency". Both are messy to backport and not
		 needed here.]

	drivers/gpu/drm/i915/intel_display.c

Change-Id: I2e7e4afe91b8a49fe33b58539f79f429bccbf776
Reviewed-on: https://chromium-review.googlesource.com/588592
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 75d0b72d533f360dfe952f99ca855e1acada8666)
Reviewed-on: https://chromium-review.googlesource.com/600828
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/f0296354f2b14821839f6ef7e937c7b7f2582a5b/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 61 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/20ab4598c6b7c10ef518142c0eb7ad1079f4eabc

commit 20ab4598c6b7c10ef518142c0eb7ad1079f4eabc
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:00 2017

UPSTREAM: drm/i915: Drop checks for max_pixclk failures in cdclk computation

commit 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
removed the possibility that intel_mode_max_pixclk() or
ilk_max_pixel_rate() might return an error, so let's get rid of the
error checks in the callers as well.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1462995892-32416-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit e1ff5f0126cd83b149060171a84a4b33972ea28b)
from drm-intel-next-2016-05-22
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I46502c85ba372c02f3f9b45f626ee6ad95fad316
Reviewed-on: https://chromium-review.googlesource.com/588063
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 9462bcbd381fbaecf962ce8059fb616e893ee850)
Reviewed-on: https://chromium-review.googlesource.com/601147
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/20ab4598c6b7c10ef518142c0eb7ad1079f4eabc/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 62 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/702424187bcab85a4e3aee082321e0dfecd5442b

commit 702424187bcab85a4e3aee082321e0dfecd5442b
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:04 2017

UPSTREAM: drm/i915: Extract broadwell_calc_cdclk()

Try to reduce the amount of duplicated cdclk magic numbers by
moving the max_pixclk->cdclk conversion into a helper.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1462995892-32416-3-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit 587c7914154921ffa819aa61ef9057e68e9ad73f)
from drm-intel-next-2016-05-22
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Id6ae993dfac95a9c26debeceb6982c747a9425f8
Reviewed-on: https://chromium-review.googlesource.com/588064
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 9a33dfea4cdd3a09d1d23e2e9b54b48612fa22e9)
Reviewed-on: https://chromium-review.googlesource.com/601148
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/702424187bcab85a4e3aee082321e0dfecd5442b/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 63 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e2e74b7fdcea8b8d34be88b534f9aba256478fa8

commit e2e74b7fdcea8b8d34be88b534f9aba256478fa8
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:07 2017

UPSTREAM: drm/i915: Make 308 and 671 MHz cdclks more accurate on SKL

The SKL 308.57 MHz cdclk is probably 8640/28 = ~308.571 Mhz.
Similartly the 617.14 MHz cdclk is probably 8640/14 = ~617.143 MHz.
Let's use the slightly more accurate numbers. Potentially we might
change to computing all of these based on dividers, but let's
stick to the current theme for now..

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1463172100-24715-13-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
(cherry picked from commit 487ed2e4e9d62363ddd5fab2407100d3436fd0c9)
from drm-intel-next-2016-06-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ia64751c58541e918bfa1bca895bb68e1bf0b736c
Reviewed-on: https://chromium-review.googlesource.com/588065
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 4ae8f090820c2b98146b1cc54ebee019ef9e302b)
Reviewed-on: https://chromium-review.googlesource.com/601149
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/e2e74b7fdcea8b8d34be88b534f9aba256478fa8/drivers/gpu/drm/i915/intel_display.c

Project Member

Comment 64 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bd98a736f0229760b7d200d7748aaf31ffdfcdec

commit bd98a736f0229760b7d200d7748aaf31ffdfcdec
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:11 2017

BACKPORT: drm/i915: Move most cdclk/rawclk related code to intel_cdclk.c

Let's try to shrink intel_display.c a bit by moving the cdclk/rawclk
stuff to a new file. It's all reasonably self contained so we don't
even have to add that many non-static symbols.

We'll also take the opportunity to shuffle around the functions a bit
to get things in a more consistent order based on the platform.

v2: Add kernel-docs (Ander)
v3: Deal with IS_GEN9_BC()
v4: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183305.19656-1-ville.syrjala@linux.intel.com
(cherry picked from commit 7ff89ca2135814db74d7a1706b9abfb1448b8bed)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: Tons of ctx delta due to Macro renaming and GLK
		 code, both of which are not required. Below is the
		 summary of thecommits that create this ctx delta.]

		 ["c0f8683 drm/i915: rename BROADWATER and CRESTLINE to
		 I965G and I965GM, respectively"]
		 ["2a307c2 drm/i915: add some more "i" in platform names
		 for consistency"]
		 ["b976dc5 drm/i915: Introduce IS_GEN9_BC for Skylake
		 and Kabylake"]
		 ["3e4274f drm/i915/glk: Add a IS_GEN9_LP() macro"]
		 ["89b3c3c drm/i915/glk: Reuse broxton's cdclk code for GLK"]
	drivers/gpu/drm/i915/intel_display.c

		["d4438f89e9d1 FROMGIT: drm/i915: Consistently use enum
		pipe for PCH transcoders"]
	drivers/gpu/drm/i915/intel_drv.h

 Modified: [Tarun: Modify as per intel_display.c conflict resolution]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ie396a325fdc6cb57567bd2136df937ca1f145edb
Reviewed-on: https://chromium-review.googlesource.com/588593
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 755c3c35cce35c88aed908152ec98e4e6993cfe4)
Reviewed-on: https://chromium-review.googlesource.com/601150
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/bd98a736f0229760b7d200d7748aaf31ffdfcdec/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/bd98a736f0229760b7d200d7748aaf31ffdfcdec/drivers/gpu/drm/i915/Makefile
[add] https://crrev.com/bd98a736f0229760b7d200d7748aaf31ffdfcdec/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/bd98a736f0229760b7d200d7748aaf31ffdfcdec/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/bd98a736f0229760b7d200d7748aaf31ffdfcdec/Documentation/gpu/i915.rst

Project Member

Comment 65 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/676c997126346d00368fbf5a8eda9a848c5a2f01

commit 676c997126346d00368fbf5a8eda9a848c5a2f01
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:15 2017

BACKPORT: drm/i915: Pass computed vco to bxt_set_cdclk()

Rather than compute the vco inside bxt_set_cdclk() let's precompute it
outside and pass it in. A small step towards a fully precomputed cdclk
state.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170120182205.8141-7-ville.syrjala@linux.intel.com
(cherry picked from commit 8f0cfa4d2a628a53e469f98aff7988555d654bc6)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
		 for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

 Modified: [Tarun: Use variables for cdclk and vco as done in commit 89b3c3c]
 	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ibd5b24769a54721cdd5d365d55a437fa0639cf19
Reviewed-on: https://chromium-review.googlesource.com/588594
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit a64ffc45710643242a3b55394a14cfe6f6ab3492)
Reviewed-on: https://chromium-review.googlesource.com/601151
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/676c997126346d00368fbf5a8eda9a848c5a2f01/drivers/gpu/drm/i915/intel_cdclk.c

Project Member

Comment 66 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94

commit 621d3254b7ea42ad97c9ec2811ddf2941f5c3f94
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:18 2017

BACKPORT: drm/i915: Start moving the cdclk stuff into a distinct state structure

Introduce intel_cdclk state which for now will track the cdclk
frequency, the vco frequency and the reference frequency (not sure we
want the last one, but I put it there anyway). We'll also make the
.get_cdclk() function fill out this state structure rather than
just returning the current cdclk frequency.

One immediate benefit is that calling .get_cdclk() will no longer
clobber state stored under dev_priv unless ex[plicitly told to do
so. Previously it clobbered the vco and reference clocks stored
there on some platforms.

We'll expand the use of this structure to actually precomputing the
state and whatnot later.

v2: Constify intel_cdclk_state_compare()
v3: Document intel_cdclk_state_compare()
v4: Deal with i945gm_get_cdclk()

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207183345.19763-1-ville.syrjala@linux.intel.com
(cherry picked from commit 49cd97a35d9041b53ecf39d447f6a0f8f2de75eb)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
 		for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: I15542058d0b6de08141ddc5f1f5a70efcd2e166e
Reviewed-on: https://chromium-review.googlesource.com/588595
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit a0f8320e214f8957237917509fccbdc6341d98d3)
Reviewed-on: https://chromium-review.googlesource.com/601152
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_audio.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_runtime_pm.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/i915_debugfs.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_panel.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_dp.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/621d3254b7ea42ad97c9ec2811ddf2941f5c3f94/drivers/gpu/drm/i915/intel_fbc.c

Project Member

Comment 67 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/64edbe22cea521d2691086cf925cf68b7f626dc4

commit 64edbe22cea521d2691086cf925cf68b7f626dc4
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:22 2017

BACKPORT: drm/i915: Track full cdclk state for the logical and actual cdclk frequencies

The current dev_cdclk vs. cdclk vs. atomic_cdclk_freq is quite a mess.
So here I'm introducing the "actual" and "logical" naming for our
cdclk state. "actual" is what we'll bash into the hardware and "logical"
is what everyone should use for state computaion/checking and whatnot.
We'll track both using the intel_cdclk_state as both will need other
differing parameters than just the actual cdclk frequency.

While doing that we can at the same time unify the appearance of the
.modeset_calc_cdclk() implementations a little bit.

v2: Commit dev_priv->cdclk.actual since that already has the
    new state by the time .modeset_commit_cdclk() is called.
v3: s/locical/logical/ and improve the docs a bit

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170120182205.8141-9-ville.syrjala@linux.intel.com
(cherry picked from commit bb0f4aab0e7677e91cde443fecc18e71fbb85038)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

 Conflicts: [Tarun: "89b3c3c drm/i915/glk: Reuse broxton's cdclk code
 		for GLK" has to do with GLK and hence isn't needed]
	drivers/gpu/drm/i915/intel_cdclk.c

Change-Id: Ifcf29d806fb383e96e2a4eb6d669779bd8659546
Reviewed-on: https://chromium-review.googlesource.com/588596
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit cc1ac04b1599cf25752f5b1af0a0f6c185cae2b6)
Reviewed-on: https://chromium-review.googlesource.com/601153
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/intel_drv.h
[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/intel_dp.c
[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/intel_cdclk.c
[modify] https://crrev.com/64edbe22cea521d2691086cf925cf68b7f626dc4/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 68 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1ea06361398f755ed015ced965d6dbc51b6176e9

commit 1ea06361398f755ed015ced965d6dbc51b6176e9
Author: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Date: Thu Aug 03 21:32:25 2017

UPSTREAM: drm/i915/glk: Pass dev_priv to intel_atomic_setup_scalers()

Pass dev_priv to intel_atomic_setup_scalers(). The next patch will need
a dev_priv pointer.

Cc: Ville Syrjl <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223071600.14356-4-ander.conselvan.de.oliveira@intel.com
(cherry picked from commit 6ebc69238df36bc61380a68f607a1c2039af134f)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ib0f5cda36f154e426d8643659ce592fb7a2fb7dd
Reviewed-on: https://chromium-review.googlesource.com/588597
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit a2b107735d6450d7987173d40e2aeab9e5afb0da)
Reviewed-on: https://chromium-review.googlesource.com/601154
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/1ea06361398f755ed015ced965d6dbc51b6176e9/drivers/gpu/drm/i915/intel_atomic.c
[modify] https://crrev.com/1ea06361398f755ed015ced965d6dbc51b6176e9/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/1ea06361398f755ed015ced965d6dbc51b6176e9/drivers/gpu/drm/i915/intel_drv.h

Project Member

Comment 69 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/4f8a9596fddc30b52af00a135b0447219bbd4162

commit 4f8a9596fddc30b52af00a135b0447219bbd4162
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:29 2017

UPSTREAM: drm/i915: Fix legacy cursor vs. watermarks for ILK-BDW

In order to make cursor updates actually safe wrt. watermark programming
we have to clear the legacy_cursor_update flag in the atomic state. That
will cause the regular atomic update path to do the necessary vblank
wait after the plane update if needed, otherwise the vblank wait would
be skipped and we'd feed the optimal watermarks to the hardware before
the plane update has actually happened.

To make the slow vs. fast path determination in
intel_legacy_cursor_update() a little simpler we can ignore the actual
visibility of the plane (which can only get computed once we've already
chosen out path) and instead we simply check whether the fb is being
set or cleared by the user. This means a fully clipped but logically
visible cursor will be considered visible as far as watermark
programming is concerned. We can do that for the cursor since it's a
fixed size plane and the clipped size doesn't play a role in the
watermark computation.

This should fix underruns that can occur when the cursor gets
enable/disabled or the size gets changed. Hopefully it's good enough
that only pure cursor movement and flips go through unthrottled.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Uwe Kleine-Knig <uwe@kleine-koenig.org>
Reported-by: Uwe Kleine-Knig <uwe@kleine-koenig.org>
Fixes: f79f26921ee1 ("drm/i915: Add a cursor hack to allow converting legacy page flip to atomic, v3.")
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170217150159.11683-1-ville.syrjala@linux.intel.com
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tested-by: Rafael Ristovski <rafael.ristovski@gmail.com>
(cherry picked from commit a5509abda48ecfc133fac6268e83fc1a93dba039)
from drm-intel-next-2017-03-06
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I241f1c4cf9284164f6ab401cf7ac570858ca7af7
Reviewed-on: https://chromium-review.googlesource.com/588598
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit aa5d5e561fda5a0dfa3dadf11d4dd414763de8e6)
Reviewed-on: https://chromium-review.googlesource.com/601155
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/4f8a9596fddc30b52af00a135b0447219bbd4162/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/4f8a9596fddc30b52af00a135b0447219bbd4162/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 70 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e0f19d5befbdd25bc153a40d148e091a5475bbf8

commit e0f19d5befbdd25bc153a40d148e091a5475bbf8
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:33 2017

UPSTREAM: drm/i915: Extract intel_wm_plane_visible()

All platforms that lack double buffered watermarks will need to
handle the legacy cursor updates in the same way. So let's extract the
logic to determine the plane visibility into a small helper. For
simplicity we'll make the function DTRT for any plane, but only apply
the special sauce for cursor planes.

Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314151050.12194-1-ville.syrjala@linux.intel.com
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
(cherry picked from commit 24304d81930fdee0784ac27c0bf8d6a27f529382)
from drm-intel-next-2017-04-03
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I39efb678bea7ea007580d71a0b4a3c772fe7c713
Reviewed-on: https://chromium-review.googlesource.com/588599
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit b346789c54488fd8a6949b35d97b3dd6e625de87)
Reviewed-on: https://chromium-review.googlesource.com/601156
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/e0f19d5befbdd25bc153a40d148e091a5475bbf8/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 71 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/02a8da868fd3b4a94ddee51c2c312eb8d3654f6b

commit 02a8da868fd3b4a94ddee51c2c312eb8d3654f6b
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Thu Aug 03 21:32:36 2017

UPSTREAM: drm/i915: Fix SKL cursor watermarks

Use intel_wm_plane_visible() to determine cursor visibility for SKL+
also. Previously SKL+ would check the actual visibility which now
conflicts with the assumptions in intel_legacy_cursor_update().

We also change SKL+ to compute the cursor watermarks based on the
unclipped cursor size, just as we do on all the other platforms.
Using the clipped size could now result in garbage results.

Testcase: igt/kms_chv_cursor_fail
Fixes: a5509abda48e ("drm/i915: Fix legacy cursor vs. watermarks for ILK-BDW")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100195
Signed-off-by: Ville Syrjl <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314151050.12194-2-ville.syrjala@linux.intel.com
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@collabora.co.uk>
Tested-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
(cherry picked from commit 93aa2a1c25e562cc0ca69c3175333fe33fdf055b)
from drm-intel-next-2017-04-03
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: Ica3bffc40d919b5715e7b6ff0125e037b1fe1dd7
Reviewed-on: https://chromium-review.googlesource.com/588600
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 2b71422202c17bea17daff7041d9075631b3f303)
Reviewed-on: https://chromium-review.googlesource.com/601157
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/02a8da868fd3b4a94ddee51c2c312eb8d3654f6b/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 72 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1c0a1b631a100614193d9de597541be7f9059fb2

commit 1c0a1b631a100614193d9de597541be7f9059fb2
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 21:32:40 2017

UPSTREAM: drm/i915: fix naming of fixed_16_16 wrapper.

fixed_16_16_div_round_up(_u64), wrapper for fixed_16_16 division
operation don't really round_up the result. Wrapper round_up only the
fraction part of the result to make it 16-bit.
This patch eliminates round_up keyword from the wrapper.

Later patch will introduce the new wrapper to do rounding-off the result
and give unt32_t output to cleanup mix use of fixed_16_16_t & uint32_t
variables.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-2-mahesh1.kumar@intel.com
(cherry picked from commit afbc95cd0c4792a72f384bbcb98251617db40107)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I26b35e2a8dda7e9772a9dce813866d97bfced320
Reviewed-on: https://chromium-review.googlesource.com/588601
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 6c160c74dc68ce1763543aa9be6bc8a53d7a3590)
Reviewed-on: https://chromium-review.googlesource.com/601158
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/1c0a1b631a100614193d9de597541be7f9059fb2/drivers/gpu/drm/i915/i915_drv.h
[modify] https://crrev.com/1c0a1b631a100614193d9de597541be7f9059fb2/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 73 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1d537e86a64da5f4d0a76ff02aff3e24ca7550d1

commit 1d537e86a64da5f4d0a76ff02aff3e24ca7550d1
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 21:32:44 2017

UPSTREAM: drm/i915: Add more wrapper for fixed_point_16_16 operations

This patch adds few wrapper to perform fixed_point_16_16 operations
mul_round_up_u32_fixed16 : Multiplies u32 and fixed_16_16_t variables
			   & returns u32 result with rounding-up.
mul_fixed16 : Multiplies two fixed_16_16_t variable & returns fixed_16_16
div_round_up_fixed16 : Perform division operation on fixed_16_16_t
		       variables & return u32 result with round-off
div_round_up_u32_fixed16 : devide uint32_t variable by fixed_16_16 variable
			   and round_up the result to uint32_t.

These wrappers will be used by later patches in the series.

Changes from V1:
 - Rename wrapper as per Matt's comment
Changes from V2:
 - Fix indentation

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-3-mahesh1.kumar@intel.com
(cherry picked from commit a9d055de65a714f67a3b47dcceee1dc450743c83)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I943375ea9633cf4ea6a30a5f5612384ad76bed3d
Reviewed-on: https://chromium-review.googlesource.com/588602
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit b6d8c19754f6c728e922ea208457e0a2e8c92a37)
Reviewed-on: https://chromium-review.googlesource.com/601159
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/1d537e86a64da5f4d0a76ff02aff3e24ca7550d1/drivers/gpu/drm/i915/i915_drv.h

Project Member

Comment 74 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/28cdfb625c1700aa9f460f1b76e0ab29f5a6406f

commit 28cdfb625c1700aa9f460f1b76e0ab29f5a6406f
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 21:32:47 2017

UPSTREAM: drm/i915: Use fixed_16_16 wrapper for division operation

Don't use fixed_16_16 structure members directly, instead use wrapper to
perform fixed_16_16 division operation.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-4-mahesh1.kumar@intel.com
(cherry picked from commit d273ecce3dde63168ed7840e2b8e5659da0df0f5)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I0f5092c19435797e0a4cb8053e92c62a6cb05dd6
Reviewed-on: https://chromium-review.googlesource.com/588603
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit 7ab076aba671d9fc56eb779d9a96c992183ec83f)
Reviewed-on: https://chromium-review.googlesource.com/601160
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/28cdfb625c1700aa9f460f1b76e0ab29f5a6406f/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 75 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/415bf757fb0c159538d92811a7cb15b3d9e865e4

commit 415bf757fb0c159538d92811a7cb15b3d9e865e4
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date: Thu Aug 03 21:32:51 2017

UPSTREAM: drm/i915/skl+: calculate pixel_rate & relative_data_rate in fixed point

This patch make changes to calculate adjusted plane pixel rate &
plane downscale amount using fixed_point functions available.
This patch will give uniformity in code, & will help to avoid mixing of
32bit uint32_t variable for fixed-16.16 with fixed_16_16_t variables in
later patch in the series.

Changes from V1:
 - Rebase based on wrapper name change
 - Remove unnecessary comment

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170517115831.13830-5-mahesh1.kumar@intel.com
(cherry picked from commit 7084b50bdd8f8b8fc232fb8642d83de913575baa)
from drm-intel-next-2017-05-29
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=No regressions in KBL/APL/BYT

Change-Id: I519bec99187d6122dbfe2bc8389c0bad27ed0c31
Reviewed-on: https://chromium-review.googlesource.com/588604
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit c37390ca1fd8223ba01d7d22409254c86e36fcb4)
Reviewed-on: https://chromium-review.googlesource.com/601161
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/415bf757fb0c159538d92811a7cb15b3d9e865e4/drivers/gpu/drm/i915/intel_pm.c

Project Member

Comment 76 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1339e618dcd8d09ed028b2ee9442355fd3e9d5ca

commit 1339e618dcd8d09ed028b2ee9442355fd3e9d5ca
Author: Mahesh Kumar <mahesh1.kumar@intel.com>
Date: Thu Aug 03 21:32:54 2017

UPSTREAM: drm/i915/skl+: consider max supported plane pixel rate while scaling

A display resolution is only supported if it meets all the restrictions
below for Maximum Pipe Pixel Rate.

The display resolution must fit within the maximum pixel rate output
from the pipe. Make sure that the display pipe is able to feed pixels at
a rate required to support the desired resolution.
For each enabled plane on the pipe {
    If plane scaling enabled {
	Horizontal down scale amount = Maximum[1, plane horizontal size /
		    scaler horizontal window size]
	Vertical down scale amount = Maximum[1, plane vertical size /
		    scaler vertical window size]
	Plane down scale amount = Horizontal down scale amount *
		    Vertical down scale amount
	Plane Ratio = 1 / Plane down scale amount
    }
    Else {
	Plane Ratio = 1
    }
    If plane source pixel format is 64 bits per pixel {
	Plane Ratio = Plane Ratio * 8/9
    }
}

Pipe Ratio = Minimum Plane Ratio of all enabled planes on the pipe

If pipe scaling is enabled {
    Horizontal down scale amount = Maximum[1, pipe horizontal source size /
		scaler horizontal window size]
    Vertical down scale amount = Maximum[1, pipe vertical source size /
		scaler vertical window size]
    Note: The progressive fetch - interlace display mode is equivalent to a
		2.0 vertical down scale
    Pipe down scale amount = Horizontal down scale amount *
		Vertical down scale amount
    Pipe Ratio = Pipe Ratio / Pipe down scale amount
}

Pipe maximum pixel rate = CDCLK frequency * Pipe Ratio

In this patch our calculation is based on pipe downscale amount
(plane max downscale amount * pipe downscale amount) instead of Pipe
Ratio. So,
max supported crtc clock with given scaling = CDCLK / pipe downscale.
Flip will fail if,
current crtc clock > max supported crct clock with given scaling.

Changes since V1:
 - separate out fixed_16_16 wrapper API definition
Changes since V2:
 - Fix buggy crtc !active condition (Maarten)
 - use intel_wm_plane_visible wrapper as per Maarten's suggestion
Changes since V3:
 - Change failure return from ERANGE to EINVAL
Changes since V4:
 - Rebase based on previous patch changes
Changes since V5:
 - return EINVAL instead of continue (Maarten)
Changes since V6:
 - Improve commit message
 - Address review comment
Changes since V7:
 - use !enable instead of !active
 - rename config variable for consistency (Maarten)

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170526151546.25025-4-mahesh1.kumar@intel.com
(cherry picked from commit 73b0ca8ec76d593d8ebb9d3a5e4021da852310e7)
from drm-intel-next-2017-06-19
Signed-off-by: Tarun <tarun.vyas@intel.com>

BUG= chromium:746068 
TEST=With a 4K capable Youtube video with no UI(annotations, subtitles
turned off, which results into a switch to plane OVL), _no_ zoom in happens
with higher resolutions i.e 1080p, 1440p and 2160p.
TEST=With a 4K capable Youtube video running in Ultra HD (2160p) and no
UI (plane OVL), a switch to full screen mode doesn't results into any visual
artifacts.
TEST=No regressions in KBL/APL/BYT

Change-Id: I5e0da3439318e7bcb0bbcf017f7b01d4633cc326
Reviewed-on: https://chromium-review.googlesource.com/588605
Commit-Ready: Tarun Vyas <tarun.vyas@intel.com>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Tested-by: Daniele Castagna <dcastagna@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Casey G Bowman <casey.g.bowman@intel.com>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
(cherry picked from commit ee7645a9c5429025a1ce9bf7d5bcf5cc37b198db)
Reviewed-on: https://chromium-review.googlesource.com/601162
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/1339e618dcd8d09ed028b2ee9442355fd3e9d5ca/drivers/gpu/drm/i915/intel_display.c
[modify] https://crrev.com/1339e618dcd8d09ed028b2ee9442355fd3e9d5ca/drivers/gpu/drm/i915/intel_pm.c
[modify] https://crrev.com/1339e618dcd8d09ed028b2ee9442355fd3e9d5ca/drivers/gpu/drm/i915/intel_drv.h

Have the patches been merged to M61?
I think so.
"UPSTREAM: drm/i915/skl+: consider max supported plane pixel rate while scaling" was what the last patch of the series we needed and it was merged in release-R61-9765.B-chromeos-4.4

Project Member

Comment 79 by sheriffbot@chromium.org, Aug 7 2017

Cc: kbleicher@google.com
This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Merge-Merged
Manually adding the label Merge-Merged.
Project Member

Comment 81 by sheriffbot@chromium.org, Aug 11 2017

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Approved-61
Cc: vsu...@chromium.org avkodipelli@chromium.org
Status: Verified (was: Fixed)
Verified based on repo steps in crbug.com/750194 on eve 9765.30.0, 61.0.3163.51. 

Sign in to add a comment