diff options
author | Michael Thayer <michael.thayer@oracle.com> | 2016-09-30 08:02:09 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-02-08 12:04:42 -0500 |
commit | ecd0a62323f26b333c49bddd7237dd5118482a35 (patch) | |
tree | 46eaca034dbea2f69f97b81823c26931cfc5f005 | |
parent | c02f6a687c3d6bd0727322b055ee788f8fefa005 (diff) |
modesetting: Immediately handle failure to set HW cursor, v5
Based on v4 by Alexandre Courbot <acourbot@nvidia.com>
There is currently no reliable way to report failure to set a HW
cursor. Still such failures can happen if e.g. the MODE_CURSOR DRM
ioctl fails (which currently happens at least with modesetting on Tegra
for format incompatibility reasons).
As failures are currently handled by setting the HW cursor size to
(0,0), the fallback to SW cursor will not happen until the next time the
cursor changes and xf86CursorSetCursor() is called again. In the
meantime, the cursor will be invisible to the user.
This patch addresses that by adding _xf86CrtcFuncs::set_cursor_check and
_xf86CursorInfoRec::ShowCursorCheck hook variants that return booleans.
This allows to propagate errors up to xf86CursorSetCursor(), which can
then fall back to using the SW cursor immediately.
v5:
- Removed parts of patch already committed as part of 14c21ea1.
- Adjusted code slightly to match surrounding code.
- Effectively reverted af916477 which is made unnecessary by this patch.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
-rw-r--r-- | hw/xfree86/drivers/modesetting/drmmode_display.c | 15 | ||||
-rw-r--r-- | hw/xfree86/drivers/modesetting/drmmode_display.h | 1 |
2 files changed, 5 insertions, 11 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 6e755e948..9d28068fa 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -813,13 +813,8 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image) for (i = 0; i < ms->cursor_width * ms->cursor_height; i++) ptr[i] = image[i]; // cpu_to_le32(image[i]); - if (drmmode_crtc->cursor_up || !drmmode_crtc->first_cursor_load_done) { - Bool ret = drmmode_set_cursor(crtc); - if (!drmmode_crtc->cursor_up) - drmmode_hide_cursor(crtc); - drmmode_crtc->first_cursor_load_done = TRUE; - return ret; - } + if (drmmode_crtc->cursor_up) + return drmmode_set_cursor(crtc); return TRUE; } @@ -835,12 +830,12 @@ drmmode_hide_cursor(xf86CrtcPtr crtc) ms->cursor_width, ms->cursor_height); } -static void +static Bool drmmode_show_cursor(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc->cursor_up = TRUE; - drmmode_set_cursor(crtc); + return drmmode_set_cursor(crtc); } static void @@ -1108,7 +1103,7 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = { .set_mode_major = drmmode_set_mode_major, .set_cursor_colors = drmmode_set_cursor_colors, .set_cursor_position = drmmode_set_cursor_position, - .show_cursor = drmmode_show_cursor, + .show_cursor_check = drmmode_show_cursor, .hide_cursor = drmmode_hide_cursor, .load_cursor_argb_check = drmmode_load_cursor_argb_check, diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h index 50976b849..3b0eb2bea 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.h +++ b/hw/xfree86/drivers/modesetting/drmmode_display.h @@ -93,7 +93,6 @@ typedef struct { struct dumb_bo *cursor_bo; Bool cursor_up; Bool set_cursor2_failed; - Bool first_cursor_load_done; uint16_t lut_r[256], lut_g[256], lut_b[256]; drmmode_bo rotate_bo; |