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:
parent
594b3c4d6f
commit
d94b3eaba9
|
@ -477,7 +477,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, 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);
|
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());
|
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
|
||||||
|
|
||||||
/* Need to extend HWcursor support to handle mask interleave */
|
/* Need to extend HWcursor support to handle mask interleave */
|
||||||
if (!ms->SWCursor)
|
if (!ms->drmmode.sw_cursor)
|
||||||
xf86_cursors_init(pScreen, 64, 64,
|
xf86_cursors_init(pScreen, 64, 64,
|
||||||
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
|
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
|
||||||
HARDWARE_CURSOR_ARGB);
|
HARDWARE_CURSOR_ARGB);
|
||||||
|
|
|
@ -402,12 +402,23 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
|
||||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||||
int i;
|
int i;
|
||||||
uint32_t *ptr;
|
uint32_t *ptr;
|
||||||
|
uint32_t handle = drmmode_crtc->cursor_bo->handle;
|
||||||
|
int ret;
|
||||||
/* cursor should be mapped already */
|
/* cursor should be mapped already */
|
||||||
ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);
|
ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);
|
||||||
|
|
||||||
for (i = 0; i < 64 * 64; i++)
|
for (i = 0; i < 64 * 64; i++)
|
||||||
ptr[i] = image[i];// cpu_to_le32(image[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 */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef struct {
|
||||||
#endif
|
#endif
|
||||||
drmEventContext event_context;
|
drmEventContext event_context;
|
||||||
struct dumb_bo *front_bo;
|
struct dumb_bo *front_bo;
|
||||||
|
Bool sw_cursor;
|
||||||
} drmmode_rec, *drmmode_ptr;
|
} drmmode_rec, *drmmode_ptr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue