drm/radeon/kms: disable VGA rendering engine before taking over VRAM
authorDave Airlie <airlied@linux.ie>
Fri, 18 Sep 2009 04:16:38 +0000 (14:16 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 18 Sep 2009 06:13:11 +0000 (16:13 +1000)
Before we use any of VRAM, we need to disable the VGA rendering
engine, this render text mode into a graphical framebuffer
for scanout, however it does this on vblank, and can end up
overwriting the GART table and r600 shader objects.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/avivod.h
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/rs600.c
drivers/gpu/drm/radeon/rv770.c

index d4e6e6e4a93888a14a738dd3484279d4f5e28d9c..e2b92c445baba24a8f650b2636ce2e8405723b0c 100644 (file)
 #define        VGA_RENDER_CONTROL                              0x0300
 #define                VGA_VSTATUS_CNTL_MASK                           0x00030000
 
+/* AVIVO disable VGA rendering */
+static inline void radeon_avivo_vga_render_disable(struct radeon_device *rdev)
+{
+       u32 vga_render;
+       vga_render = RREG32(VGA_RENDER_CONTROL);
+       vga_render &= ~VGA_VSTATUS_CNTL_MASK;
+       WREG32(VGA_RENDER_CONTROL, vga_render);
+}
+
 #endif
index 1e1cab5ef1e4635d1ab796efcf31bf79117226f8..aafdb8edc11d4daf5c48d2c99f24923a4f216842 100644 (file)
@@ -340,6 +340,10 @@ static void r600_mc_resume(struct radeon_device *rdev)
        WREG32(D1VGA_CONTROL, d1vga_control);
        WREG32(D2VGA_CONTROL, d2vga_control);
        WREG32(VGA_RENDER_CONTROL, vga_render_control);
+
+       /* we need to own VRAM, so turn off the VGA renderer here
+        * to stop it overwriting our objects */
+       radeon_avivo_vga_render_disable(rdev);
 }
 
 int r600_mc_init(struct radeon_device *rdev)
index 6af0331cae0845afdd7d6feee235bc7db6a9ca21..0e791e26def32f14a9496a2ad3af15b4dd8b1ccf 100644 (file)
@@ -28,6 +28,7 @@
 #include "drmP.h"
 #include "radeon_reg.h"
 #include "radeon.h"
+#include "avivod.h"
 
 #include "rs600_reg_safe.h"
 
@@ -197,6 +198,8 @@ void rs600_mc_disable_clients(struct radeon_device *rdev)
                       "programming pipes. Bad things might happen.\n");
        }
 
+       radeon_avivo_vga_render_disable(rdev);
+
        tmp = RREG32(AVIVO_D1VGA_CONTROL);
        WREG32(AVIVO_D1VGA_CONTROL, tmp & ~AVIVO_DVGA_CONTROL_MODE_ENABLE);
        tmp = RREG32(AVIVO_D2VGA_CONTROL);
index 8bab6b4f05d1e553bde4aa46a50285ca1b6ebcb2..47427623a84c2216367751462ebd4724206dd8ba 100644 (file)
@@ -229,6 +229,10 @@ static void rv770_mc_resume(struct radeon_device *rdev)
        WREG32(D1VGA_CONTROL, d1vga_control);
        WREG32(D2VGA_CONTROL, d2vga_control);
        WREG32(VGA_RENDER_CONTROL, vga_render_control);
+
+       /* we need to own VRAM, so turn off the VGA renderer here
+        * to stop it overwriting our objects */
+       radeon_avivo_vga_render_disable(rdev);
 }