summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2018-06-27 11:43:37 +0100
committerRussell King <rmk@armlinux.org.uk>2018-06-27 19:17:44 +0100
commita19fb284b28edd13577d63b3af081bf4058a39db (patch)
tree2be67ec503ed5131c691a94077d4d1b050484dde
parent5763fd037eeec4a3ea4ca5b346ec32da44a01149 (diff)
src: implement support for drmModeSetCursor2()
Implement support for passing the cursor hot x/y to the KMS driver using drmModeSetCursor2(). Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--src/common_drm.c19
-rw-r--r--src/common_drm.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/src/common_drm.c b/src/common_drm.c
index 91b33f4..0db9e43 100644
--- a/src/common_drm.c
+++ b/src/common_drm.c
@@ -16,6 +16,7 @@
#include <xf86drmMode.h>
#include "xf86.h"
+#include "cursorstr.h"
#include "boxutil.h"
#include "pixmaputil.h"
@@ -691,10 +692,20 @@ void common_drm_crtc_show_cursor(xf86CrtcPtr crtc)
{
struct common_drm_info *drm = GET_DRM_INFO(crtc->scrn);
struct common_crtc_info *drmc = common_crtc(crtc);
+ uint32_t crtc_id = drmc->mode_crtc->crtc_id;
+ uint32_t handle = drmc->cursor_handle;
+ uint32_t width = drm->cursor_max_width;
+ uint32_t height = drm->cursor_max_height;
- drmModeSetCursor(drmc->drm_fd, drmc->mode_crtc->crtc_id,
- drmc->cursor_handle,
- drm->cursor_max_width, drm->cursor_max_height);
+ if (drmc->has_cursor2) {
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ CursorBitsPtr cursor_bits = config->cursor->bits;
+
+ drmModeSetCursor2(drmc->drm_fd, crtc_id, handle, width, height,
+ cursor_bits->xhot, cursor_bits->yhot);
+ } else {
+ drmModeSetCursor(drmc->drm_fd, crtc_id, handle, width, height);
+ }
}
void common_drm_crtc_hide_cursor(xf86CrtcPtr crtc)
@@ -758,6 +769,8 @@ static Bool common_drm_crtc_init(ScrnInfoPtr pScrn, unsigned num,
/* Test whether hardware cursor is supported */
if (drmModeSetCursor(drmc->drm_fd, id, 0, 0, 0))
drm->has_hw_cursor = FALSE;
+ else if (!drmModeSetCursor2(drmc->drm_fd, id, 0, 0, 0, 0, 0))
+ drmc->has_cursor2 = TRUE;
return TRUE;
}
diff --git a/src/common_drm.h b/src/common_drm.h
index b138daf..14e12c7 100644
--- a/src/common_drm.h
+++ b/src/common_drm.h
@@ -25,6 +25,7 @@ struct common_crtc_info {
uint64_t last_msc;
uint64_t swap_msc;
uint64_t swap_ust;
+ Bool has_cursor2;
};
#define common_crtc(crtc) \
((struct common_crtc_info *)(crtc)->driver_private)