summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-12-21 17:54:36 +0100
committerMichel Dänzer <michel@daenzer.net>2018-12-28 12:09:09 +0100
commit92df709786830d4e30a106dd49d8e0355c50c8f0 (patch)
treec22292c14d6d52ca4f7b731b77c5bf8f7a52f0bf /src
parente14c3d2f86c7be2b5c3d06a47bf0abe954207d0b (diff)
Use drmIoctl in drmmode_show_cursor
This should be functionally equivalent to what drmModeSetCursor(2) do behind the scenes, but allows for new tricks in following changes. (Ported from amdgpu commit b344e1559e936046ef02c777fc4f6bcefa3830bc)
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ef235bd2..c2a59da7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1202,8 +1202,16 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
RADEONInfoPtr info = RADEONPTR(pScrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- uint32_t handle = drmmode_crtc->cursor_bo->handle;
static Bool use_set_cursor2 = TRUE;
+ struct drm_mode_cursor2 arg;
+
+ memset(&arg, 0, sizeof(arg));
+
+ arg.handle = drmmode_crtc->cursor_bo->handle;
+ arg.flags = DRM_MODE_CURSOR_BO;
+ arg.crtc_id = drmmode_crtc->mode_crtc->crtc_id;
+ arg.width = info->cursor_w;
+ arg.height = info->cursor_h;
if (use_set_cursor2) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
@@ -1240,18 +1248,17 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
}
}
- ret =
- drmModeSetCursor2(pRADEONEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
- handle, info->cursor_w, info->cursor_h,
- xhot, yhot);
+ arg.hot_x = xhot;
+ arg.hot_y = yhot;
+
+ ret = drmIoctl(pRADEONEnt->fd, DRM_IOCTL_MODE_CURSOR2, &arg);
if (ret == -EINVAL)
use_set_cursor2 = FALSE;
else
return;
}
- drmModeSetCursor(pRADEONEnt->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
- info->cursor_w, info->cursor_h);
+ drmIoctl(pRADEONEnt->fd, DRM_IOCTL_MODE_CURSOR, &arg);
}
/* Xorg expects a non-NULL return value from drmmode_crtc_shadow_allocate, and