diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-08-01 09:18:54 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-05 13:04:17 -0400 |
commit | b0aea5dca064176a626dc2a83727c60ace31ee6d (patch) | |
tree | f7d8e940e9601d4912eb73f36d6d6a46aa09200a /drivers/gpu/drm/i915/intel_pm.c | |
parent | 3312ba65caa23cf1210cc578755babc394769843 (diff) |
drm/i915: Use the watermark latency values from dev_priv for ILK/SNB/IVB too
Adjust the current ILK/SNB/IVB watermark codepaths to use the
pre-populated latency values from dev_priv instead of reading
them out from the registers every time.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 856c094a35e0..ccaadc87b6bb 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -1680,9 +1680,6 @@ static void i830_update_wm(struct drm_device *dev) | |||
1680 | I915_WRITE(FW_BLC, fwater_lo); | 1680 | I915_WRITE(FW_BLC, fwater_lo); |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | #define ILK_LP0_PLANE_LATENCY 700 | ||
1684 | #define ILK_LP0_CURSOR_LATENCY 1300 | ||
1685 | |||
1686 | /* | 1683 | /* |
1687 | * Check the wm result. | 1684 | * Check the wm result. |
1688 | * | 1685 | * |
@@ -1797,9 +1794,9 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1797 | enabled = 0; | 1794 | enabled = 0; |
1798 | if (g4x_compute_wm0(dev, PIPE_A, | 1795 | if (g4x_compute_wm0(dev, PIPE_A, |
1799 | &ironlake_display_wm_info, | 1796 | &ironlake_display_wm_info, |
1800 | ILK_LP0_PLANE_LATENCY, | 1797 | dev_priv->wm.pri_latency[0] * 100, |
1801 | &ironlake_cursor_wm_info, | 1798 | &ironlake_cursor_wm_info, |
1802 | ILK_LP0_CURSOR_LATENCY, | 1799 | dev_priv->wm.cur_latency[0] * 100, |
1803 | &plane_wm, &cursor_wm)) { | 1800 | &plane_wm, &cursor_wm)) { |
1804 | I915_WRITE(WM0_PIPEA_ILK, | 1801 | I915_WRITE(WM0_PIPEA_ILK, |
1805 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 1802 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
@@ -1811,9 +1808,9 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1811 | 1808 | ||
1812 | if (g4x_compute_wm0(dev, PIPE_B, | 1809 | if (g4x_compute_wm0(dev, PIPE_B, |
1813 | &ironlake_display_wm_info, | 1810 | &ironlake_display_wm_info, |
1814 | ILK_LP0_PLANE_LATENCY, | 1811 | dev_priv->wm.pri_latency[0] * 100, |
1815 | &ironlake_cursor_wm_info, | 1812 | &ironlake_cursor_wm_info, |
1816 | ILK_LP0_CURSOR_LATENCY, | 1813 | dev_priv->wm.cur_latency[0] * 100, |
1817 | &plane_wm, &cursor_wm)) { | 1814 | &plane_wm, &cursor_wm)) { |
1818 | I915_WRITE(WM0_PIPEB_ILK, | 1815 | I915_WRITE(WM0_PIPEB_ILK, |
1819 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 1816 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
@@ -1837,7 +1834,7 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1837 | 1834 | ||
1838 | /* WM1 */ | 1835 | /* WM1 */ |
1839 | if (!ironlake_compute_srwm(dev, 1, enabled, | 1836 | if (!ironlake_compute_srwm(dev, 1, enabled, |
1840 | ILK_READ_WM1_LATENCY() * 500, | 1837 | dev_priv->wm.pri_latency[1] * 500, |
1841 | &ironlake_display_srwm_info, | 1838 | &ironlake_display_srwm_info, |
1842 | &ironlake_cursor_srwm_info, | 1839 | &ironlake_cursor_srwm_info, |
1843 | &fbc_wm, &plane_wm, &cursor_wm)) | 1840 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -1845,14 +1842,14 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1845 | 1842 | ||
1846 | I915_WRITE(WM1_LP_ILK, | 1843 | I915_WRITE(WM1_LP_ILK, |
1847 | WM1_LP_SR_EN | | 1844 | WM1_LP_SR_EN | |
1848 | (ILK_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 1845 | (dev_priv->wm.pri_latency[1] << WM1_LP_LATENCY_SHIFT) | |
1849 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 1846 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
1850 | (plane_wm << WM1_LP_SR_SHIFT) | | 1847 | (plane_wm << WM1_LP_SR_SHIFT) | |
1851 | cursor_wm); | 1848 | cursor_wm); |
1852 | 1849 | ||
1853 | /* WM2 */ | 1850 | /* WM2 */ |
1854 | if (!ironlake_compute_srwm(dev, 2, enabled, | 1851 | if (!ironlake_compute_srwm(dev, 2, enabled, |
1855 | ILK_READ_WM2_LATENCY() * 500, | 1852 | dev_priv->wm.pri_latency[2] * 500, |
1856 | &ironlake_display_srwm_info, | 1853 | &ironlake_display_srwm_info, |
1857 | &ironlake_cursor_srwm_info, | 1854 | &ironlake_cursor_srwm_info, |
1858 | &fbc_wm, &plane_wm, &cursor_wm)) | 1855 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -1860,7 +1857,7 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1860 | 1857 | ||
1861 | I915_WRITE(WM2_LP_ILK, | 1858 | I915_WRITE(WM2_LP_ILK, |
1862 | WM2_LP_EN | | 1859 | WM2_LP_EN | |
1863 | (ILK_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 1860 | (dev_priv->wm.pri_latency[2] << WM1_LP_LATENCY_SHIFT) | |
1864 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 1861 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
1865 | (plane_wm << WM1_LP_SR_SHIFT) | | 1862 | (plane_wm << WM1_LP_SR_SHIFT) | |
1866 | cursor_wm); | 1863 | cursor_wm); |
@@ -1874,7 +1871,7 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1874 | static void sandybridge_update_wm(struct drm_device *dev) | 1871 | static void sandybridge_update_wm(struct drm_device *dev) |
1875 | { | 1872 | { |
1876 | struct drm_i915_private *dev_priv = dev->dev_private; | 1873 | struct drm_i915_private *dev_priv = dev->dev_private; |
1877 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ | 1874 | int latency = dev_priv->wm.pri_latency[0] * 100; /* In unit 0.1us */ |
1878 | u32 val; | 1875 | u32 val; |
1879 | int fbc_wm, plane_wm, cursor_wm; | 1876 | int fbc_wm, plane_wm, cursor_wm; |
1880 | unsigned int enabled; | 1877 | unsigned int enabled; |
@@ -1929,7 +1926,7 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1929 | 1926 | ||
1930 | /* WM1 */ | 1927 | /* WM1 */ |
1931 | if (!ironlake_compute_srwm(dev, 1, enabled, | 1928 | if (!ironlake_compute_srwm(dev, 1, enabled, |
1932 | SNB_READ_WM1_LATENCY() * 500, | 1929 | dev_priv->wm.pri_latency[1] * 500, |
1933 | &sandybridge_display_srwm_info, | 1930 | &sandybridge_display_srwm_info, |
1934 | &sandybridge_cursor_srwm_info, | 1931 | &sandybridge_cursor_srwm_info, |
1935 | &fbc_wm, &plane_wm, &cursor_wm)) | 1932 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -1937,14 +1934,14 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1937 | 1934 | ||
1938 | I915_WRITE(WM1_LP_ILK, | 1935 | I915_WRITE(WM1_LP_ILK, |
1939 | WM1_LP_SR_EN | | 1936 | WM1_LP_SR_EN | |
1940 | (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 1937 | (dev_priv->wm.pri_latency[1] << WM1_LP_LATENCY_SHIFT) | |
1941 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 1938 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
1942 | (plane_wm << WM1_LP_SR_SHIFT) | | 1939 | (plane_wm << WM1_LP_SR_SHIFT) | |
1943 | cursor_wm); | 1940 | cursor_wm); |
1944 | 1941 | ||
1945 | /* WM2 */ | 1942 | /* WM2 */ |
1946 | if (!ironlake_compute_srwm(dev, 2, enabled, | 1943 | if (!ironlake_compute_srwm(dev, 2, enabled, |
1947 | SNB_READ_WM2_LATENCY() * 500, | 1944 | dev_priv->wm.pri_latency[2] * 500, |
1948 | &sandybridge_display_srwm_info, | 1945 | &sandybridge_display_srwm_info, |
1949 | &sandybridge_cursor_srwm_info, | 1946 | &sandybridge_cursor_srwm_info, |
1950 | &fbc_wm, &plane_wm, &cursor_wm)) | 1947 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -1952,14 +1949,14 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1952 | 1949 | ||
1953 | I915_WRITE(WM2_LP_ILK, | 1950 | I915_WRITE(WM2_LP_ILK, |
1954 | WM2_LP_EN | | 1951 | WM2_LP_EN | |
1955 | (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 1952 | (dev_priv->wm.pri_latency[2] << WM1_LP_LATENCY_SHIFT) | |
1956 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 1953 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
1957 | (plane_wm << WM1_LP_SR_SHIFT) | | 1954 | (plane_wm << WM1_LP_SR_SHIFT) | |
1958 | cursor_wm); | 1955 | cursor_wm); |
1959 | 1956 | ||
1960 | /* WM3 */ | 1957 | /* WM3 */ |
1961 | if (!ironlake_compute_srwm(dev, 3, enabled, | 1958 | if (!ironlake_compute_srwm(dev, 3, enabled, |
1962 | SNB_READ_WM3_LATENCY() * 500, | 1959 | dev_priv->wm.pri_latency[3] * 500, |
1963 | &sandybridge_display_srwm_info, | 1960 | &sandybridge_display_srwm_info, |
1964 | &sandybridge_cursor_srwm_info, | 1961 | &sandybridge_cursor_srwm_info, |
1965 | &fbc_wm, &plane_wm, &cursor_wm)) | 1962 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -1967,7 +1964,7 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1967 | 1964 | ||
1968 | I915_WRITE(WM3_LP_ILK, | 1965 | I915_WRITE(WM3_LP_ILK, |
1969 | WM3_LP_EN | | 1966 | WM3_LP_EN | |
1970 | (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 1967 | (dev_priv->wm.pri_latency[3] << WM1_LP_LATENCY_SHIFT) | |
1971 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 1968 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
1972 | (plane_wm << WM1_LP_SR_SHIFT) | | 1969 | (plane_wm << WM1_LP_SR_SHIFT) | |
1973 | cursor_wm); | 1970 | cursor_wm); |
@@ -1976,7 +1973,7 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1976 | static void ivybridge_update_wm(struct drm_device *dev) | 1973 | static void ivybridge_update_wm(struct drm_device *dev) |
1977 | { | 1974 | { |
1978 | struct drm_i915_private *dev_priv = dev->dev_private; | 1975 | struct drm_i915_private *dev_priv = dev->dev_private; |
1979 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ | 1976 | int latency = dev_priv->wm.pri_latency[0] * 100; /* In unit 0.1us */ |
1980 | u32 val; | 1977 | u32 val; |
1981 | int fbc_wm, plane_wm, cursor_wm; | 1978 | int fbc_wm, plane_wm, cursor_wm; |
1982 | int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm; | 1979 | int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm; |
@@ -2046,7 +2043,7 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
2046 | 2043 | ||
2047 | /* WM1 */ | 2044 | /* WM1 */ |
2048 | if (!ironlake_compute_srwm(dev, 1, enabled, | 2045 | if (!ironlake_compute_srwm(dev, 1, enabled, |
2049 | SNB_READ_WM1_LATENCY() * 500, | 2046 | dev_priv->wm.pri_latency[1] * 500, |
2050 | &sandybridge_display_srwm_info, | 2047 | &sandybridge_display_srwm_info, |
2051 | &sandybridge_cursor_srwm_info, | 2048 | &sandybridge_cursor_srwm_info, |
2052 | &fbc_wm, &plane_wm, &cursor_wm)) | 2049 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -2054,14 +2051,14 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
2054 | 2051 | ||
2055 | I915_WRITE(WM1_LP_ILK, | 2052 | I915_WRITE(WM1_LP_ILK, |
2056 | WM1_LP_SR_EN | | 2053 | WM1_LP_SR_EN | |
2057 | (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 2054 | (dev_priv->wm.pri_latency[1] << WM1_LP_LATENCY_SHIFT) | |
2058 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 2055 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
2059 | (plane_wm << WM1_LP_SR_SHIFT) | | 2056 | (plane_wm << WM1_LP_SR_SHIFT) | |
2060 | cursor_wm); | 2057 | cursor_wm); |
2061 | 2058 | ||
2062 | /* WM2 */ | 2059 | /* WM2 */ |
2063 | if (!ironlake_compute_srwm(dev, 2, enabled, | 2060 | if (!ironlake_compute_srwm(dev, 2, enabled, |
2064 | SNB_READ_WM2_LATENCY() * 500, | 2061 | dev_priv->wm.pri_latency[2] * 500, |
2065 | &sandybridge_display_srwm_info, | 2062 | &sandybridge_display_srwm_info, |
2066 | &sandybridge_cursor_srwm_info, | 2063 | &sandybridge_cursor_srwm_info, |
2067 | &fbc_wm, &plane_wm, &cursor_wm)) | 2064 | &fbc_wm, &plane_wm, &cursor_wm)) |
@@ -2069,19 +2066,19 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
2069 | 2066 | ||
2070 | I915_WRITE(WM2_LP_ILK, | 2067 | I915_WRITE(WM2_LP_ILK, |
2071 | WM2_LP_EN | | 2068 | WM2_LP_EN | |
2072 | (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 2069 | (dev_priv->wm.pri_latency[2] << WM1_LP_LATENCY_SHIFT) | |
2073 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 2070 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
2074 | (plane_wm << WM1_LP_SR_SHIFT) | | 2071 | (plane_wm << WM1_LP_SR_SHIFT) | |
2075 | cursor_wm); | 2072 | cursor_wm); |
2076 | 2073 | ||
2077 | /* WM3, note we have to correct the cursor latency */ | 2074 | /* WM3, note we have to correct the cursor latency */ |
2078 | if (!ironlake_compute_srwm(dev, 3, enabled, | 2075 | if (!ironlake_compute_srwm(dev, 3, enabled, |
2079 | SNB_READ_WM3_LATENCY() * 500, | 2076 | dev_priv->wm.pri_latency[3] * 500, |
2080 | &sandybridge_display_srwm_info, | 2077 | &sandybridge_display_srwm_info, |
2081 | &sandybridge_cursor_srwm_info, | 2078 | &sandybridge_cursor_srwm_info, |
2082 | &fbc_wm, &plane_wm, &ignore_cursor_wm) || | 2079 | &fbc_wm, &plane_wm, &ignore_cursor_wm) || |
2083 | !ironlake_compute_srwm(dev, 3, enabled, | 2080 | !ironlake_compute_srwm(dev, 3, enabled, |
2084 | 2 * SNB_READ_WM3_LATENCY() * 500, | 2081 | dev_priv->wm.cur_latency[3] * 500, |
2085 | &sandybridge_display_srwm_info, | 2082 | &sandybridge_display_srwm_info, |
2086 | &sandybridge_cursor_srwm_info, | 2083 | &sandybridge_cursor_srwm_info, |
2087 | &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm)) | 2084 | &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm)) |
@@ -2089,7 +2086,7 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
2089 | 2086 | ||
2090 | I915_WRITE(WM3_LP_ILK, | 2087 | I915_WRITE(WM3_LP_ILK, |
2091 | WM3_LP_EN | | 2088 | WM3_LP_EN | |
2092 | (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) | | 2089 | (dev_priv->wm.pri_latency[3] << WM1_LP_LATENCY_SHIFT) | |
2093 | (fbc_wm << WM1_LP_FBC_SHIFT) | | 2090 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
2094 | (plane_wm << WM1_LP_SR_SHIFT) | | 2091 | (plane_wm << WM1_LP_SR_SHIFT) | |
2095 | cursor_wm); | 2092 | cursor_wm); |
@@ -2833,7 +2830,7 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, | |||
2833 | bool enable, bool scaled) | 2830 | bool enable, bool scaled) |
2834 | { | 2831 | { |
2835 | struct drm_i915_private *dev_priv = dev->dev_private; | 2832 | struct drm_i915_private *dev_priv = dev->dev_private; |
2836 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ | 2833 | int latency = dev_priv->wm.spr_latency[0] * 100; /* In unit 0.1us */ |
2837 | u32 val; | 2834 | u32 val; |
2838 | int sprite_wm, reg; | 2835 | int sprite_wm, reg; |
2839 | int ret; | 2836 | int ret; |
@@ -2873,7 +2870,7 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, | |||
2873 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, | 2870 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
2874 | pixel_size, | 2871 | pixel_size, |
2875 | &sandybridge_display_srwm_info, | 2872 | &sandybridge_display_srwm_info, |
2876 | SNB_READ_WM1_LATENCY() * 500, | 2873 | dev_priv->wm.spr_latency[1] * 500, |
2877 | &sprite_wm); | 2874 | &sprite_wm); |
2878 | if (!ret) { | 2875 | if (!ret) { |
2879 | DRM_DEBUG_KMS("failed to compute sprite lp1 wm on pipe %c\n", | 2876 | DRM_DEBUG_KMS("failed to compute sprite lp1 wm on pipe %c\n", |
@@ -2889,7 +2886,7 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, | |||
2889 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, | 2886 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
2890 | pixel_size, | 2887 | pixel_size, |
2891 | &sandybridge_display_srwm_info, | 2888 | &sandybridge_display_srwm_info, |
2892 | SNB_READ_WM2_LATENCY() * 500, | 2889 | dev_priv->wm.spr_latency[2] * 500, |
2893 | &sprite_wm); | 2890 | &sprite_wm); |
2894 | if (!ret) { | 2891 | if (!ret) { |
2895 | DRM_DEBUG_KMS("failed to compute sprite lp2 wm on pipe %c\n", | 2892 | DRM_DEBUG_KMS("failed to compute sprite lp2 wm on pipe %c\n", |
@@ -2901,7 +2898,7 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, | |||
2901 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, | 2898 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
2902 | pixel_size, | 2899 | pixel_size, |
2903 | &sandybridge_display_srwm_info, | 2900 | &sandybridge_display_srwm_info, |
2904 | SNB_READ_WM3_LATENCY() * 500, | 2901 | dev_priv->wm.spr_latency[3] * 500, |
2905 | &sprite_wm); | 2902 | &sprite_wm); |
2906 | if (!ret) { | 2903 | if (!ret) { |
2907 | DRM_DEBUG_KMS("failed to compute sprite lp3 wm on pipe %c\n", | 2904 | DRM_DEBUG_KMS("failed to compute sprite lp3 wm on pipe %c\n", |