diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2014-11-17 12:32:29 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2014-11-17 12:32:29 +0900 |
commit | c9f8f642fd495937400618a4fc25ecae3f8888fc (patch) | |
tree | 097b19a5b8cb7eacd07828a622581e4cd765b97e | |
parent | 2f11dcd43966cf2ee26e61960fd72e6644f5e037 (diff) |
Prefer drmModeSetCursor2 over drmModeSetCursor
The former includes information about the position of the hotspot within
the cursor image.
Copied from xf86-video-modesetting.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index a7b75f0c..72e13a47 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -32,6 +32,7 @@ #include <errno.h> #include <sys/ioctl.h> #include <time.h> +#include "cursorstr.h" #include "micmap.h" #include "xf86cmap.h" #include "radeon.h" @@ -634,6 +635,22 @@ drmmode_show_cursor (xf86CrtcPtr crtc) drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; uint32_t handle = drmmode_crtc->cursor_bo->handle; + static Bool use_set_cursor2 = TRUE; + + if (use_set_cursor2) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); + CursorPtr cursor = xf86_config->cursor; + int ret; + + ret = + drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, + handle, info->cursor_w, info->cursor_h, + cursor->bits->xhot, cursor->bits->yhot); + if (ret == -EINVAL) + use_set_cursor2 = FALSE; + else + return; + } drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, info->cursor_w, info->cursor_h); |