aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-05-03 10:43:25 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-06-27 10:49:23 -0400
commitc696e53f78d321999e87ccc0ec25204d385d9137 (patch)
treeaae1d2f363ca1d0768f1d41b6b0e84193ed1e8a0
parentcf0cfdd7a7c87dff0f4ac6084b73fec83caa71a4 (diff)
drm/radeon/kms: fix up dce6 display watermark calc for dpm
Calculate the low and high watermarks based on the low and high clocks for the current power state. The dynamic pm hw will select the appropriate watermark based on the internal dpm state. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/si.c96
1 files changed, 71 insertions, 25 deletions
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 813a8a9ea331..882509ab1668 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -1792,7 +1792,8 @@ static void dce6_program_watermarks(struct radeon_device *rdev,
1792 u32 lb_size, u32 num_heads) 1792 u32 lb_size, u32 num_heads)
1793{ 1793{
1794 struct drm_display_mode *mode = &radeon_crtc->base.mode; 1794 struct drm_display_mode *mode = &radeon_crtc->base.mode;
1795 struct dce6_wm_params wm; 1795 struct dce6_wm_params wm_low, wm_high;
1796 u32 dram_channels;
1796 u32 pixel_period; 1797 u32 pixel_period;
1797 u32 line_time = 0; 1798 u32 line_time = 0;
1798 u32 latency_watermark_a = 0, latency_watermark_b = 0; 1799 u32 latency_watermark_a = 0, latency_watermark_b = 0;
@@ -1808,38 +1809,83 @@ static void dce6_program_watermarks(struct radeon_device *rdev,
1808 priority_a_cnt = 0; 1809 priority_a_cnt = 0;
1809 priority_b_cnt = 0; 1810 priority_b_cnt = 0;
1810 1811
1811 wm.yclk = rdev->pm.current_mclk * 10;
1812 wm.sclk = rdev->pm.current_sclk * 10;
1813 wm.disp_clk = mode->clock;
1814 wm.src_width = mode->crtc_hdisplay;
1815 wm.active_time = mode->crtc_hdisplay * pixel_period;
1816 wm.blank_time = line_time - wm.active_time;
1817 wm.interlaced = false;
1818 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
1819 wm.interlaced = true;
1820 wm.vsc = radeon_crtc->vsc;
1821 wm.vtaps = 1;
1822 if (radeon_crtc->rmx_type != RMX_OFF)
1823 wm.vtaps = 2;
1824 wm.bytes_per_pixel = 4; /* XXX: get this from fb config */
1825 wm.lb_size = lb_size;
1826 if (rdev->family == CHIP_ARUBA) 1812 if (rdev->family == CHIP_ARUBA)
1827 wm.dram_channels = evergreen_get_number_of_dram_channels(rdev); 1813 dram_channels = evergreen_get_number_of_dram_channels(rdev);
1828 else 1814 else
1829 wm.dram_channels = si_get_number_of_dram_channels(rdev); 1815 dram_channels = si_get_number_of_dram_channels(rdev);
1830 wm.num_heads = num_heads; 1816
1817 /* watermark for high clocks */
1818 if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) {
1819 wm_high.yclk =
1820 radeon_dpm_get_mclk(rdev, false) * 10;
1821 wm_high.sclk =
1822 radeon_dpm_get_sclk(rdev, false) * 10;
1823 } else {
1824 wm_high.yclk = rdev->pm.current_mclk * 10;
1825 wm_high.sclk = rdev->pm.current_sclk * 10;
1826 }
1827
1828 wm_high.disp_clk = mode->clock;
1829 wm_high.src_width = mode->crtc_hdisplay;
1830 wm_high.active_time = mode->crtc_hdisplay * pixel_period;
1831 wm_high.blank_time = line_time - wm_high.active_time;
1832 wm_high.interlaced = false;
1833 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
1834 wm_high.interlaced = true;
1835 wm_high.vsc = radeon_crtc->vsc;
1836 wm_high.vtaps = 1;
1837 if (radeon_crtc->rmx_type != RMX_OFF)
1838 wm_high.vtaps = 2;
1839 wm_high.bytes_per_pixel = 4; /* XXX: get this from fb config */
1840 wm_high.lb_size = lb_size;
1841 wm_high.dram_channels = dram_channels;
1842 wm_high.num_heads = num_heads;
1843
1844 /* watermark for low clocks */
1845 if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) {
1846 wm_low.yclk =
1847 radeon_dpm_get_mclk(rdev, true) * 10;
1848 wm_low.sclk =
1849 radeon_dpm_get_sclk(rdev, true) * 10;
1850 } else {
1851 wm_low.yclk = rdev->pm.current_mclk * 10;
1852 wm_low.sclk = rdev->pm.current_sclk * 10;
1853 }
1854
1855 wm_low.disp_clk = mode->clock;
1856 wm_low.src_width = mode->crtc_hdisplay;
1857 wm_low.active_time = mode->crtc_hdisplay * pixel_period;
1858 wm_low.blank_time = line_time - wm_low.active_time;
1859 wm_low.interlaced = false;
1860 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
1861 wm_low.interlaced = true;
1862 wm_low.vsc = radeon_crtc->vsc;
1863 wm_low.vtaps = 1;
1864 if (radeon_crtc->rmx_type != RMX_OFF)
1865 wm_low.vtaps = 2;
1866 wm_low.bytes_per_pixel = 4; /* XXX: get this from fb config */
1867 wm_low.lb_size = lb_size;
1868 wm_low.dram_channels = dram_channels;
1869 wm_low.num_heads = num_heads;
1831 1870
1832 /* set for high clocks */ 1871 /* set for high clocks */
1833 latency_watermark_a = min(dce6_latency_watermark(&wm), (u32)65535); 1872 latency_watermark_a = min(dce6_latency_watermark(&wm_high), (u32)65535);
1834 /* set for low clocks */ 1873 /* set for low clocks */
1835 /* wm.yclk = low clk; wm.sclk = low clk */ 1874 latency_watermark_b = min(dce6_latency_watermark(&wm_low), (u32)65535);
1836 latency_watermark_b = min(dce6_latency_watermark(&wm), (u32)65535);
1837 1875
1838 /* possibly force display priority to high */ 1876 /* possibly force display priority to high */
1839 /* should really do this at mode validation time... */ 1877 /* should really do this at mode validation time... */
1840 if (!dce6_average_bandwidth_vs_dram_bandwidth_for_display(&wm) || 1878 if (!dce6_average_bandwidth_vs_dram_bandwidth_for_display(&wm_high) ||
1841 !dce6_average_bandwidth_vs_available_bandwidth(&wm) || 1879 !dce6_average_bandwidth_vs_available_bandwidth(&wm_high) ||
1842 !dce6_check_latency_hiding(&wm) || 1880 !dce6_check_latency_hiding(&wm_high) ||
1881 (rdev->disp_priority == 2)) {
1882 DRM_DEBUG_KMS("force priority to high\n");
1883 priority_a_cnt |= PRIORITY_ALWAYS_ON;
1884 priority_b_cnt |= PRIORITY_ALWAYS_ON;
1885 }
1886 if (!dce6_average_bandwidth_vs_dram_bandwidth_for_display(&wm_low) ||
1887 !dce6_average_bandwidth_vs_available_bandwidth(&wm_low) ||
1888 !dce6_check_latency_hiding(&wm_low) ||
1843 (rdev->disp_priority == 2)) { 1889 (rdev->disp_priority == 2)) {
1844 DRM_DEBUG_KMS("force priority to high\n"); 1890 DRM_DEBUG_KMS("force priority to high\n");
1845 priority_a_cnt |= PRIORITY_ALWAYS_ON; 1891 priority_a_cnt |= PRIORITY_ALWAYS_ON;