Commit 0ddd2060 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer
Browse files

Prefer drmModeSetCursor2 over drmModeSetCursor



The former includes information about the position of the hotspot within
the cursor image.

Copied from xf86-video-modesetting.

(ported from radeon commit c9f8f642fd495937400618a4fc25ecae3f8888fc)
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 83a47c0e
...@@ -801,12 +801,29 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc) ...@@ -801,12 +801,29 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc)
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn); AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
uint32_t bo_handle; uint32_t bo_handle;
static Bool use_set_cursor2 = TRUE;
if (!amdgpu_bo_get_handle(drmmode_crtc->cursor_buffer, &bo_handle)) { if (!amdgpu_bo_get_handle(drmmode_crtc->cursor_buffer, &bo_handle)) {
ErrorF("failed to get BO handle for cursor\n"); ErrorF("failed to get BO handle for cursor\n");
return; return;
} }
if (use_set_cursor2) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
CursorPtr cursor = xf86_config->cursor;
int ret;
ret = drmModeSetCursor2(pAMDGPUEnt->fd,
drmmode_crtc->mode_crtc->crtc_id,
bo_handle,
info->cursor_w, info->cursor_h,
cursor->bits->xhot, cursor->bits->yhot);
if (ret == -EINVAL)
use_set_cursor2 = FALSE;
else
return;
}
drmModeSetCursor(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id, bo_handle, drmModeSetCursor(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id, bo_handle,
info->cursor_w, info->cursor_h); info->cursor_w, info->cursor_h);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment