modesetting: add cursor fallback if kernel rejects cursor.

If the kernel rejects a cursor, cause a fallback, this isn't 100% as
we can lose the initial cursor, but it works fine once wm starts.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2011-11-14 11:22:44 +00:00
parent 594b3c4d6f
commit d94b3eaba9
3 changed files with 15 additions and 3 deletions

View File

@ -477,7 +477,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
ms->SWCursor = TRUE;
ms->drmmode.sw_cursor = TRUE;
}
ms->shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, TRUE);
@ -681,7 +681,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
/* Need to extend HWcursor support to handle mask interleave */
if (!ms->SWCursor)
if (!ms->drmmode.sw_cursor)
xf86_cursors_init(pScreen, 64, 64,
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
HARDWARE_CURSOR_ARGB);

View File

@ -402,12 +402,23 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
int i;
uint32_t *ptr;
uint32_t handle = drmmode_crtc->cursor_bo->handle;
int ret;
/* cursor should be mapped already */
ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);
for (i = 0; i < 64 * 64; i++)
ptr[i] = image[i];// cpu_to_le32(image[i]);
ret = drmModeSetCursor(drmmode_crtc->drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, 64, 64);
if (ret) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
drmmode_crtc->drmmode->sw_cursor = TRUE;
/* fallback to swcursor */
}
}

View File

@ -53,6 +53,7 @@ typedef struct {
#endif
drmEventContext event_context;
struct dumb_bo *front_bo;
Bool sw_cursor;
} drmmode_rec, *drmmode_ptr;
typedef struct {