diff options
author | Thierry Reding <treding@nvidia.com> | 2014-02-19 13:03:59 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-07-09 11:44:56 +0200 |
commit | c1827943a811ace288a56b5ce9711e7bd86def9d (patch) | |
tree | e7b985b8bbbdfa0cd9abdb5c076abaa4720ca9c0 | |
parent | a307cef92d0f0427b13b59c861d5dfee6b9494f1 (diff) |
Detect absence of hardware cursor support early
If detection of hardware cursor support (or lack thereof) is delayed
until the first time the cursor is actually set, X will not display the
cursor until it is moved or the user performs a click.
By detecting the absence of hardware cursor support this glitch can be
prevented.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | src/driver.c | 9 | ||||
-rw-r--r-- | src/drmmode_display.c | 20 | ||||
-rw-r--r-- | src/drmmode_display.h | 3 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/driver.c b/src/driver.c index dbd5747..377939e 100644 --- a/src/driver.c +++ b/src/driver.c @@ -403,7 +403,7 @@ TegraPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; if (xf86ReturnOptValBool(tegra->Options, OPTION_SW_CURSOR, FALSE)) - tegra->drmmode.sw_cursor = TRUE; + tegra->drmmode.want_sw_cursor = TRUE; ret = drmGetCap(tegra->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value); if (!ret) @@ -423,6 +423,9 @@ TegraPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } + if (tegra->drmmode.need_sw_cursor) + tegra->drmmode.want_sw_cursor = TRUE; + /* * If the driver can do gamma correction, it should call xf86SetGamma() here. */ @@ -524,7 +527,7 @@ TegraCreateScreenResources(ScreenPtr pScreen) drmmode_uevent_init(pScrn, &tegra->drmmode); - if (!tegra->drmmode.sw_cursor) + if (!tegra->drmmode.want_sw_cursor) drmmode_map_cursor_bos(pScrn, &tegra->drmmode); pixels = drmmode_map_front_bo(&tegra->drmmode); @@ -697,7 +700,7 @@ TegraScreenInit(SCREEN_INIT_ARGS_DECL) miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Need to extend HWcursor support to handle mask interleave */ - if (!tegra->drmmode.sw_cursor) + if (!tegra->drmmode.want_sw_cursor) xf86_cursors_init(pScreen, 64, 64, HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_ARGB); diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 849e143..17ca446 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -409,7 +409,7 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; cursor_info->MaxWidth = cursor_info->MaxHeight = 0; - drmmode_crtc->drmmode->sw_cursor = TRUE; + drmmode_crtc->drmmode->want_sw_cursor = TRUE; /* fallback to swcursor */ } } @@ -511,17 +511,25 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = { static void drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) { + uint32_t crtc_id = drmmode->mode_res->crtcs[num]; + drmmode_crtc_private_ptr priv; xf86CrtcPtr crtc; - drmmode_crtc_private_ptr drmmode_crtc; + int err; crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs); if (crtc == NULL) return; - drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1); - drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, drmmode->mode_res->crtcs[num]); - drmmode_crtc->drmmode = drmmode; - crtc->driver_private = drmmode_crtc; + priv = xnfcalloc(sizeof(*priv), 1); + priv->mode_crtc = drmModeGetCrtc(drmmode->fd, crtc_id); + priv->drmmode = drmmode; + crtc->driver_private = priv; + + if (!drmmode->want_sw_cursor && !drmmode->need_sw_cursor) { + err = drmModeSetCursor(drmmode->fd, crtc_id, 0, 64, 64); + if (err < 0) + drmmode->need_sw_cursor = TRUE; + } } static xf86OutputStatus diff --git a/src/drmmode_display.h b/src/drmmode_display.h index e98c555..8ca89c7 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -69,7 +69,8 @@ typedef struct { #endif drmEventContext event_context; struct dumb_bo *front_bo; - Bool sw_cursor; + Bool need_sw_cursor; + Bool want_sw_cursor; Bool shadow_enable; void *shadow_fb; |