Skip to content

Commit

Permalink
Enable hardware mouse cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
OtherCrashOverride committed Apr 8, 2017
1 parent d365c61 commit ab86780
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/drmmode_display.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ drmmode_cursor_init_plane(ScreenPtr pScreen)
drmModePlane *ovr;
int w, h, pad;
uint32_t handles[4], pitches[4], offsets[4]; /* we only use [0] */
struct drm_set_client_cap cap;
int io;

if (drmmode->cursor) {
INFO_MSG("cursor already initialized");
Expand All @@ -649,6 +651,17 @@ drmmode_cursor_init_plane(ScreenPtr pScreen)
return FALSE;
}

/* Enable universal planes capability */
cap.capability = DRM_CLIENT_CAP_UNIVERSAL_PLANES;
cap.value = 1;

io = drmIoctl(drmmode->fd, DRM_IOCTL_SET_CLIENT_CAP, &cap);
if (io < 0)
{
ERROR_MSG("DRM_IOCTL_SET_CLIENT_CAP failed.");
return FALSE;
}

/* find an unused plane which can be used as a mouse cursor. Note
* that we cheat a bit, in order to not burn one overlay per crtc,
* and only show the mouse cursor on one crtc at a time
Expand All @@ -666,7 +679,8 @@ drmmode_cursor_init_plane(ScreenPtr pScreen)
return FALSE;
}

ovr = drmModeGetPlane(drmmode->fd, plane_resources->planes[0]);
/* TODO: loop through planes and find the cursor plane */
ovr = drmModeGetPlane(drmmode->fd, plane_resources->planes[1]);
if (!ovr) {
ERROR_MSG("HW cursor: drmModeGetPlane failed: %s",
strerror(errno));
Expand Down

0 comments on commit ab86780

Please sign in to comment.