diff options
-rw-r--r-- | src/legacy_crtc.c | 24 | ||||
-rw-r--r-- | src/radeon.h | 1 | ||||
-rw-r--r-- | src/radeon_driver.c | 22 |
3 files changed, 39 insertions, 8 deletions
diff --git a/src/legacy_crtc.c b/src/legacy_crtc.c index 489fecf6..590a445d 100644 --- a/src/legacy_crtc.c +++ b/src/legacy_crtc.c @@ -51,6 +51,9 @@ #include "radeon_dri.h" #include "radeon_sarea.h" #include "sarea.h" +#ifdef DRM_IOCTL_MODESET_CTL +#include <sys/ioctl.h> +#endif #endif /* Write common registers */ @@ -615,6 +618,21 @@ RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) } void +radeon_crtc_modeset_ioctl(xf86CrtcPtr crtc, Bool post) +{ +#if defined(XF86DRI) && defined(DRM_IOCTL_MODESET_CTL) + RADEONInfoPtr info = RADEONPTR(crtc->scrn); + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + struct drm_modeset_ctl modeset; + + modeset.crtc = radeon_crtc->crtc_id; + modeset.cmd = post ? _DRM_POST_MODESET : _DRM_PRE_MODESET; + + ioctl(info->drmFD, DRM_IOCTL_MODESET_CTL, &modeset); +#endif +} + +void legacy_crtc_dpms(xf86CrtcPtr crtc, int mode) { int mask; @@ -625,6 +643,8 @@ legacy_crtc_dpms(xf86CrtcPtr crtc, int mode) mask = radeon_crtc->crtc_id ? (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS | RADEON_CRTC2_DISP_REQ_EN_B) : (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS); + if (mode == DPMSModeOff) + radeon_crtc_modeset_ioctl(crtc, FALSE); switch(mode) { case DPMSModeOn: @@ -661,8 +681,10 @@ legacy_crtc_dpms(xf86CrtcPtr crtc, int mode) break; } - if (mode != DPMSModeOff) + if (mode != DPMSModeOff) { + radeon_crtc_modeset_ioctl(crtc, TRUE); radeon_crtc_load_lut(crtc); + } } diff --git a/src/radeon.h b/src/radeon.h index a5c0cd63..94611a8a 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -881,6 +881,7 @@ extern void RADEONWaitForIdleMMIO(ScrnInfoPtr pScrn); /* radeon_crtc.c */ extern void radeon_crtc_load_lut(xf86CrtcPtr crtc); +extern void radeon_crtc_modeset_ioctl(xf86CrtcPtr crtc, Bool post); extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn, int mask); extern void RADEONBlank(ScrnInfoPtr pScrn); extern void RADEONComputePLL(RADEONPLLPtr pll, unsigned long freq, diff --git a/src/radeon_driver.c b/src/radeon_driver.c index cb460230..64010fa4 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -5321,6 +5321,8 @@ Bool RADEONEnterVT(int scrnIndex, int flags) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; uint32_t mem_size; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "RADEONEnterVT\n"); @@ -5368,6 +5370,9 @@ Bool RADEONEnterVT(int scrnIndex, int flags) if (IS_R300_VARIANT || IS_RV100_VARIANT) RADEONForceSomeClocks(pScrn); + for (i = 0; i < config->num_crtc; i++) + radeon_crtc_modeset_ioctl(config->crtc[i], TRUE); + pScrn->vtSema = TRUE; if (!xf86SetDesiredModes(pScrn)) @@ -5416,10 +5421,8 @@ void RADEONLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); -#ifndef HAVE_FREE_SHADOW - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - int o; -#endif + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "RADEONLeaveVT\n"); @@ -5442,7 +5445,9 @@ void RADEONLeaveVT(int scrnIndex, int flags) RADEONSAREAPrivPtr pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScrn->pScreen); drmTextureRegionPtr list = pSAREAPriv->texList[0]; - int age = ++pSAREAPriv->texAge[0], i = 0; + int age = ++pSAREAPriv->texAge[0]; + + i = 0; do { list[i].age = age; @@ -5453,8 +5458,8 @@ void RADEONLeaveVT(int scrnIndex, int flags) #endif #ifndef HAVE_FREE_SHADOW - for (o = 0; o < config->num_crtc; o++) { - xf86CrtcPtr crtc = config->crtc[o]; + for (i = 0; i < config->num_crtc; i++) { + xf86CrtcPtr crtc = config->crtc[i]; if (crtc->rotatedPixmap || crtc->rotatedData) { crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap, @@ -5471,6 +5476,9 @@ void RADEONLeaveVT(int scrnIndex, int flags) RADEONRestore(pScrn); + for (i = 0; i < config->num_crtc; i++) + radeon_crtc_modeset_ioctl(config->crtc[i], FALSE); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Ok, leaving now...\n"); } |