From f70d7a0fd9ac3659d93511ab362eb80a7ff49777 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 13 Mar 2009 12:56:29 +1000 Subject: r600: reload shaders into VRAM on resume As VRAM gets zeroed out over s/r, we need to reload the shaders. --- src/r600_exa.c | 20 ++++++++++++++++---- src/radeon.h | 1 + src/radeon_driver.c | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/r600_exa.c b/src/r600_exa.c index 3a4dc8df..f16e040f 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -1963,12 +1963,11 @@ R600Sync(ScreenPtr pScreen, int marker) } static Bool -R600LoadShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen) +R600AllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen) { RADEONInfoPtr info = RADEONPTR(pScrn); struct radeon_accel_state *accel_state = info->accel_state; - RADEONChipFamily ChipSet = info->ChipFamily; - uint32_t *shader; + /* 512 bytes per shader for now */ int size = 512 * 9; @@ -1979,6 +1978,16 @@ R600LoadShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen) if (accel_state->shaders == NULL) return FALSE; + return TRUE; +} + +Bool +R600LoadShaders(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + struct radeon_accel_state *accel_state = info->accel_state; + RADEONChipFamily ChipSet = info->ChipFamily; + uint32_t *shader; shader = (pointer)((char *)info->FB + accel_state->shaders->offset); @@ -2117,7 +2126,10 @@ R600DrawInit(ScreenPtr pScreen) info->accel_state->XInited3D = FALSE; info->accel_state->copy_area = NULL; - if (!R600LoadShaders(pScrn, pScreen)) + if (!R600AllocShaders(pScrn, pScreen)) + return FALSE; + + if (!R600LoadShaders(pScrn)) return FALSE; exaMarkSync(pScreen); diff --git a/src/radeon.h b/src/radeon.h index 4c966ec0..7bb720a0 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -1084,6 +1084,7 @@ extern void RADEONDoPrepareCopyMMIO(ScrnInfoPtr pScrn, uint32_t datatype, int rop, Pixel planemask); extern Bool R600DrawInit(ScreenPtr pScreen); +extern Bool R600LoadShaders(ScrnInfoPtr pScrn); #endif #if defined(XF86DRI) && defined(USE_EXA) diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 2456dc58..c0f5e7bf 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -5663,6 +5663,8 @@ Bool RADEONEnterVT(int scrnIndex, int flags) #ifdef XF86DRI if (info->directRenderingEnabled) { + if (info->ChipFamily >= CHIP_FAMILY_R600) + R600LoadShaders(pScrn); RADEONCP_START(pScrn, info); DRIUnlock(pScrn->pScreen); } -- cgit v1.2.3