diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-22 06:50:11 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-25 10:03:22 -0500 |
commit | 312817a39f17dbb4de000165b5b724e3728cd91c (patch) | |
tree | 30a279343f39e7e4c56bfb428b1becb41e9a9c77 /drivers/gpu/drm/i915 | |
parent | c6642782b988e907bb50767eab50042f4947e163 (diff) |
drm/i915: Only save and restore fences for UMS
With KMS, we can simply relinquish the fence when we idle the GPU and
reassign it upon first use.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_suspend.c | 89 |
2 files changed, 61 insertions, 53 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 1e9cf2bf9ba4..939c9e34ce96 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1905,11 +1905,22 @@ static void i915_gem_reset_ring_lists(struct drm_i915_private *dev_priv, | |||
1905 | } | 1905 | } |
1906 | } | 1906 | } |
1907 | 1907 | ||
1908 | static void i915_gem_reset_fences(struct drm_device *dev) | ||
1909 | { | ||
1910 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1911 | int i; | ||
1912 | |||
1913 | for (i = 0; i < 16; i++) { | ||
1914 | struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; | ||
1915 | if (reg->obj) | ||
1916 | i915_gem_clear_fence_reg(reg->obj); | ||
1917 | } | ||
1918 | } | ||
1919 | |||
1908 | void i915_gem_reset(struct drm_device *dev) | 1920 | void i915_gem_reset(struct drm_device *dev) |
1909 | { | 1921 | { |
1910 | struct drm_i915_private *dev_priv = dev->dev_private; | 1922 | struct drm_i915_private *dev_priv = dev->dev_private; |
1911 | struct drm_i915_gem_object *obj; | 1923 | struct drm_i915_gem_object *obj; |
1912 | int i; | ||
1913 | 1924 | ||
1914 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->render_ring); | 1925 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->render_ring); |
1915 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->bsd_ring); | 1926 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->bsd_ring); |
@@ -1940,15 +1951,7 @@ void i915_gem_reset(struct drm_device *dev) | |||
1940 | } | 1951 | } |
1941 | 1952 | ||
1942 | /* The fence registers are invalidated so clear them out */ | 1953 | /* The fence registers are invalidated so clear them out */ |
1943 | for (i = 0; i < 16; i++) { | 1954 | i915_gem_reset_fences(dev); |
1944 | struct drm_i915_fence_reg *reg; | ||
1945 | |||
1946 | reg = &dev_priv->fence_regs[i]; | ||
1947 | if (!reg->obj) | ||
1948 | continue; | ||
1949 | |||
1950 | i915_gem_clear_fence_reg(reg->obj); | ||
1951 | } | ||
1952 | } | 1955 | } |
1953 | 1956 | ||
1954 | /** | 1957 | /** |
@@ -4706,6 +4709,8 @@ i915_gem_idle(struct drm_device *dev) | |||
4706 | } | 4709 | } |
4707 | } | 4710 | } |
4708 | 4711 | ||
4712 | i915_gem_reset_fences(dev); | ||
4713 | |||
4709 | /* Hack! Don't let anybody do execbuf while we don't control the chip. | 4714 | /* Hack! Don't let anybody do execbuf while we don't control the chip. |
4710 | * We need to replace this with a semaphore, or something. | 4715 | * We need to replace this with a semaphore, or something. |
4711 | * And not confound mm.suspended! | 4716 | * And not confound mm.suspended! |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 42729d25da58..011325e51e3a 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -235,6 +235,7 @@ static void i915_restore_vga(struct drm_device *dev) | |||
235 | static void i915_save_modeset_reg(struct drm_device *dev) | 235 | static void i915_save_modeset_reg(struct drm_device *dev) |
236 | { | 236 | { |
237 | struct drm_i915_private *dev_priv = dev->dev_private; | 237 | struct drm_i915_private *dev_priv = dev->dev_private; |
238 | int i; | ||
238 | 239 | ||
239 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 240 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
240 | return; | 241 | return; |
@@ -367,6 +368,28 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
367 | } | 368 | } |
368 | i915_save_palette(dev, PIPE_B); | 369 | i915_save_palette(dev, PIPE_B); |
369 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); | 370 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); |
371 | |||
372 | /* Fences */ | ||
373 | switch (INTEL_INFO(dev)->gen) { | ||
374 | case 6: | ||
375 | for (i = 0; i < 16; i++) | ||
376 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | ||
377 | break; | ||
378 | case 5: | ||
379 | case 4: | ||
380 | for (i = 0; i < 16; i++) | ||
381 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); | ||
382 | break; | ||
383 | case 3: | ||
384 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | ||
385 | for (i = 0; i < 8; i++) | ||
386 | dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); | ||
387 | case 2: | ||
388 | for (i = 0; i < 8; i++) | ||
389 | dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); | ||
390 | break; | ||
391 | } | ||
392 | |||
370 | return; | 393 | return; |
371 | } | 394 | } |
372 | 395 | ||
@@ -375,10 +398,33 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
375 | struct drm_i915_private *dev_priv = dev->dev_private; | 398 | struct drm_i915_private *dev_priv = dev->dev_private; |
376 | int dpll_a_reg, fpa0_reg, fpa1_reg; | 399 | int dpll_a_reg, fpa0_reg, fpa1_reg; |
377 | int dpll_b_reg, fpb0_reg, fpb1_reg; | 400 | int dpll_b_reg, fpb0_reg, fpb1_reg; |
401 | int i; | ||
378 | 402 | ||
379 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 403 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
380 | return; | 404 | return; |
381 | 405 | ||
406 | /* Fences */ | ||
407 | switch (INTEL_INFO(dev)->gen) { | ||
408 | case 6: | ||
409 | for (i = 0; i < 16; i++) | ||
410 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); | ||
411 | break; | ||
412 | case 5: | ||
413 | case 4: | ||
414 | for (i = 0; i < 16; i++) | ||
415 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]); | ||
416 | break; | ||
417 | case 3: | ||
418 | case 2: | ||
419 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | ||
420 | for (i = 0; i < 8; i++) | ||
421 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]); | ||
422 | for (i = 0; i < 8; i++) | ||
423 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]); | ||
424 | break; | ||
425 | } | ||
426 | |||
427 | |||
382 | if (HAS_PCH_SPLIT(dev)) { | 428 | if (HAS_PCH_SPLIT(dev)) { |
383 | dpll_a_reg = PCH_DPLL_A; | 429 | dpll_a_reg = PCH_DPLL_A; |
384 | dpll_b_reg = PCH_DPLL_B; | 430 | dpll_b_reg = PCH_DPLL_B; |
@@ -788,28 +834,6 @@ int i915_save_state(struct drm_device *dev) | |||
788 | for (i = 0; i < 3; i++) | 834 | for (i = 0; i < 3; i++) |
789 | dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); | 835 | dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); |
790 | 836 | ||
791 | /* Fences */ | ||
792 | switch (INTEL_INFO(dev)->gen) { | ||
793 | case 6: | ||
794 | for (i = 0; i < 16; i++) | ||
795 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | ||
796 | break; | ||
797 | case 5: | ||
798 | case 4: | ||
799 | for (i = 0; i < 16; i++) | ||
800 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); | ||
801 | break; | ||
802 | case 3: | ||
803 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | ||
804 | for (i = 0; i < 8; i++) | ||
805 | dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); | ||
806 | case 2: | ||
807 | for (i = 0; i < 8; i++) | ||
808 | dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); | ||
809 | break; | ||
810 | |||
811 | } | ||
812 | |||
813 | return 0; | 837 | return 0; |
814 | } | 838 | } |
815 | 839 | ||
@@ -823,27 +847,6 @@ int i915_restore_state(struct drm_device *dev) | |||
823 | /* Hardware status page */ | 847 | /* Hardware status page */ |
824 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); | 848 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); |
825 | 849 | ||
826 | /* Fences */ | ||
827 | switch (INTEL_INFO(dev)->gen) { | ||
828 | case 6: | ||
829 | for (i = 0; i < 16; i++) | ||
830 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); | ||
831 | break; | ||
832 | case 5: | ||
833 | case 4: | ||
834 | for (i = 0; i < 16; i++) | ||
835 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]); | ||
836 | break; | ||
837 | case 3: | ||
838 | case 2: | ||
839 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | ||
840 | for (i = 0; i < 8; i++) | ||
841 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]); | ||
842 | for (i = 0; i < 8; i++) | ||
843 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]); | ||
844 | break; | ||
845 | } | ||
846 | |||
847 | i915_restore_display(dev); | 850 | i915_restore_display(dev); |
848 | 851 | ||
849 | /* Interrupt state */ | 852 | /* Interrupt state */ |