mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Michel Dänzer
parent
e95044e453
commit
b344e1559e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user