xfree86: Disable cursor whenever turning off CRTC during modeset

This makes sure the CRTC's cursor is hidden before we hand the CRTC
over to some other application.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Keith Packard 2017-12-21 18:54:39 -08:00 committed by Adam Jackson
parent 29f79bedf2
commit 4d5aab66c0
3 changed files with 19 additions and 5 deletions

View File

@ -2651,6 +2651,14 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
return success; return success;
} }
/* Turn a CRTC off, using the DPMS function and disabling the cursor */
static void
xf86DisableCrtc(xf86CrtcPtr crtc)
{
crtc->funcs->dpms(crtc, DPMSModeOff);
xf86_crtc_hide_cursor(crtc);
}
/* /*
* Check the CRTC we're going to map each output to vs. it's current * Check the CRTC we're going to map each output to vs. it's current
* CRTC. If they don't match, we have to disable the output and the CRTC * CRTC. If they don't match, we have to disable the output and the CRTC
@ -2706,9 +2714,9 @@ xf86PrepareCrtcs(ScrnInfoPtr scrn)
* we need to disable it * we need to disable it
*/ */
if (desired_outputs != current_outputs || !desired_outputs) if (desired_outputs != current_outputs || !desired_outputs)
(*crtc->funcs->dpms) (crtc, DPMSModeOff); xf86DisableCrtc(crtc);
#else #else
(*crtc->funcs->dpms) (crtc, DPMSModeOff); xf86DisableCrtc(crtc);
#endif #endif
} }
} }
@ -3004,7 +3012,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
xf86CrtcPtr crtc = xf86_config->crtc[c]; xf86CrtcPtr crtc = xf86_config->crtc[c];
if (!crtc->enabled) { if (!crtc->enabled) {
crtc->funcs->dpms(crtc, DPMSModeOff); xf86DisableCrtc(crtc);
memset(&crtc->mode, 0, sizeof(crtc->mode)); memset(&crtc->mode, 0, sizeof(crtc->mode));
xf86RotateDestroy(crtc); xf86RotateDestroy(crtc);
crtc->active = FALSE; crtc->active = FALSE;
@ -3455,7 +3463,7 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
RRCrtcDetachScanoutPixmap(crtc->randr_crtc); RRCrtcDetachScanoutPixmap(crtc->randr_crtc);
/* dpms off */ /* dpms off */
(*crtc->funcs->dpms) (crtc, DPMSModeOff); xf86DisableCrtc(crtc);
/* force a reset the next time its used */ /* force a reset the next time its used */
crtc->randr_crtc->mode = NULL; crtc->randr_crtc->mode = NULL;
crtc->mode.HDisplay = 0; crtc->mode.HDisplay = 0;

View File

@ -998,6 +998,12 @@ static _X_INLINE _X_DEPRECATED void xf86_reload_cursors(ScreenPtr screen) {}
extern _X_EXPORT Bool extern _X_EXPORT Bool
xf86_show_cursors(ScrnInfoPtr scrn); xf86_show_cursors(ScrnInfoPtr scrn);
/**
* Called by the driver to turn a single crtc's cursor off
*/
extern _X_EXPORT void
xf86_crtc_hide_cursor(xf86CrtcPtr crtc);
/** /**
* Called by the driver to turn cursors off * Called by the driver to turn cursors off
*/ */

View File

@ -320,7 +320,7 @@ xf86_set_cursor_colors(ScrnInfoPtr scrn, int bg, int fg)
} }
} }
static void void
xf86_crtc_hide_cursor(xf86CrtcPtr crtc) xf86_crtc_hide_cursor(xf86CrtcPtr crtc)
{ {
if (crtc->cursor_shown) { if (crtc->cursor_shown) {