diff options
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r-- | src/drmmode_display.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 2e9e623..022f107 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1711,14 +1711,21 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc) AMDGPUInfoPtr info = AMDGPUPTR(pScrn); AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - uint32_t bo_handle; static Bool use_set_cursor2 = TRUE; + struct drm_mode_cursor2 arg; - if (!amdgpu_bo_get_handle(drmmode_crtc->cursor_buffer, &bo_handle)) { + memset(&arg, 0, sizeof(arg)); + + if (!amdgpu_bo_get_handle(drmmode_crtc->cursor_buffer, &arg.handle)) { ErrorF("failed to get BO handle for cursor\n"); return; } + 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); CursorPtr cursor = xf86_config->cursor; @@ -1754,19 +1761,17 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc) } } - ret = drmModeSetCursor2(pAMDGPUEnt->fd, - drmmode_crtc->mode_crtc->crtc_id, - bo_handle, - info->cursor_w, info->cursor_h, - xhot, yhot); + arg.hot_x = xhot; + arg.hot_y = yhot; + + ret = drmIoctl(pAMDGPUEnt->fd, DRM_IOCTL_MODE_CURSOR2, &arg); if (ret == -EINVAL) use_set_cursor2 = FALSE; else return; } - drmModeSetCursor(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id, bo_handle, - info->cursor_w, info->cursor_h); + drmIoctl(pAMDGPUEnt->fd, DRM_IOCTL_MODE_CURSOR, &arg); } /* Xorg expects a non-NULL return value from drmmode_crtc_shadow_allocate, and |