[xserver] xfree86/modes: Make sure the HW cursor is hidden when it should be

Submitted by Michel Dänzer on March 24, 2016, 8:34 a.m.

Details

Message ID 1458808463-16255-1-git-send-email-michel@daenzer.net
State Accepted
Commit 418fe365b45a143680d3b4143dc60f7cdc5a3507
Headers show
Series "xfree86/modes: Make sure the HW cursor is hidden when it should be" ( rev: 1 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Michel Dänzer March 24, 2016, 8:34 a.m.
From: Michel Dänzer <michel.daenzer@amd.com>

When the HW cursor is hidden (e.g. because xf86CursorResetCursor
triggers a switch from HW cursor to SW cursor), the driver isn't
notified of this for disabled CRTCs. If the HW cursor was shown when the
CRTC was disabled, it may still be displayed when the CRTC is enabled
again.

Prevent this by explicitly hiding the HW cursor again after setting a
mode if it's currently supposed to be hidden.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94560
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 hw/xfree86/modes/xf86Crtc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 2639a30..6091b5e 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -368,6 +368,12 @@  xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
             xf86CrtcSetScreenSubpixelOrder(scrn->pScreen);
         if (scrn->ModeSet)
             scrn->ModeSet(scrn);
+
+        /* Make sure the HW cursor is hidden if it's supposed to be, in case
+         * it was hidden while the CRTC was disabled
+         */
+        if (!xf86_config->cursor_on)
+            xf86_hide_cursors(scrn);
     }
     else {
         crtc->x = saved_x;

Comments

Looks good to me, but I don't feel I'm quite familiar enough with the 
code to give a full "reviewed-by".

Regards,

Michael

On 24.03.2016 09:34, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> When the HW cursor is hidden (e.g. because xf86CursorResetCursor
> triggers a switch from HW cursor to SW cursor), the driver isn't
> notified of this for disabled CRTCs. If the HW cursor was shown when the
> CRTC was disabled, it may still be displayed when the CRTC is enabled
> again.
>
> Prevent this by explicitly hiding the HW cursor again after setting a
> mode if it's currently supposed to be hidden.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94560
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> ---
>   hw/xfree86/modes/xf86Crtc.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
> index 2639a30..6091b5e 100644
> --- a/hw/xfree86/modes/xf86Crtc.c
> +++ b/hw/xfree86/modes/xf86Crtc.c
> @@ -368,6 +368,12 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
>               xf86CrtcSetScreenSubpixelOrder(scrn->pScreen);
>           if (scrn->ModeSet)
>               scrn->ModeSet(scrn);
> +
> +        /* Make sure the HW cursor is hidden if it's supposed to be, in case
> +         * it was hidden while the CRTC was disabled
> +         */
> +        if (!xf86_config->cursor_on)
> +            xf86_hide_cursors(scrn);
>       }
>       else {
>           crtc->x = saved_x;
>