summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-16 17:00:55 +0100
committerHans de Goede <hdegoede@redhat.com>2016-07-02 09:26:11 +0200
commitaf916477c65a083ec496ac3f088d766b410e8b6e (patch)
treeed78bb198391a69e7b0b5f7ad80e69d3094f39ca
parent14c21ea1c9496638b1feb8e6145c440fb4f1d14b (diff)
modesetting: Fix hw cursor check at the first call
With the previous patch, the modesetting driver can now return whether the driver supports hw cursor. However, it alone doesn't suffice, unfortunately. drmmode_load_cursor_argb_check() is called in the following chain: xf86CursorSetCursor() -> xf86SetCursor() -> xf86DriverLoadCursorARGB() -> xf86_load_cursor_argb() -> xf86_crtc_load_cursor_argb() -> drmmode_load_cursor_argb_check() *but* at first with drmmode_crtc->cursor_up = FALSE. Then the function doesn't actually set the cursor but returns TRUE unconditionally. The actual call of drmmode_set_cursor() is done at first via the show_cursor callback, and there is no check of sw cursor fallback any longer at this place. Since it's called only once per cursor setup, so the xserver still thinks as if the hw cursor is supported. This patch is an ad hoc fix to correct the behavior somehow: it does call drmmode_set_cursor() at the very first time even if cursor_up is FALSE, then quickly hides again. In that way, whether the hw cursor is supported is evaluated in the right place at the right time. Of course, it might be more elegant if we have a more proper mechanism to fall back to sw cursor at any call path. But it'd need more rework, so I leave this workaround as is for now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index db533c88d..f2a08aebb 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -833,6 +833,7 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
int i;
uint32_t *ptr;
+ static Bool first_time = TRUE;
/* cursor should be mapped already */
ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr);
@@ -840,8 +841,13 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
ptr[i] = image[i]; // cpu_to_le32(image[i]);
- if (drmmode_crtc->cursor_up)
- return drmmode_set_cursor(crtc);
+ if (drmmode_crtc->cursor_up || first_time) {
+ Bool ret = drmmode_set_cursor(crtc);
+ if (!drmmode_crtc->cursor_up)
+ drmmode_hide_cursor(crtc);
+ first_time = FALSE;
+ return ret;
+ }
return TRUE;
}