modesetting: only fall back to drmModeSetCursor() on -EINVAL

This change effectively reverts commit 074cf58.  We were falling back from
drmModeSetCursor2() to drmModeSetCursor() whenever the first failed.  This
fall-back only makes sense on pre-mid-2013 kernels which implemented the
cursor_set hook but not cursor_set2, and in this case the call to
drmModeSetCursor2() will always return -EINVAL.  Specifically, a return
value of -ENXIO usually means that neither are supported.

Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
[hdegoede@redhat.com: initialize ret to -EINVAL]
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Michael Thayer 2016-09-16 17:51:25 +02:00 committed by Adam Jackson
parent 363f4273dd
commit 3abf791ab8

View File

@ -756,7 +756,7 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
drmmode_ptr drmmode = drmmode_crtc->drmmode;
uint32_t handle = drmmode_crtc->cursor_bo->handle;
modesettingPtr ms = modesettingPTR(crtc->scrn);
int ret;
int ret = -EINVAL;
if (!drmmode_crtc->set_cursor2_failed) {
CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen);
@ -768,11 +768,15 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
if (!ret)
return TRUE;
drmmode_crtc->set_cursor2_failed = TRUE;
/* -EINVAL can mean that an old kernel supports drmModeSetCursor but
* not drmModeSetCursor2, though it can mean other things too. */
if (ret == -EINVAL)
drmmode_crtc->set_cursor2_failed = TRUE;
}
ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
ms->cursor_width, ms->cursor_height);
if (ret == -EINVAL)
ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
handle, ms->cursor_width, ms->cursor_height);
if (ret) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);