From ab5b1e3149b018d4dac699b6af40d48c54165c61 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 9 Aug 2012 13:24:45 -0500 Subject: [PATCH] compositor-drm: don't keep trying if hw doesn't support cursors Not all hw supports hw cursors. Similar to the case with sprites, if the driver does not support it, don't keep trying and spamming the log with error messages. Signed-off-by: Rob Clark --- src/compositor-drm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 8ff7f3bd..fc216bf5 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -99,6 +99,8 @@ struct drm_compositor { struct wl_list sprite_list; int sprites_are_broken; + int cursors_are_broken; + uint32_t prev_state; }; @@ -736,6 +738,8 @@ drm_output_prepare_cursor_surface(struct weston_output *output_base, return NULL; if (es->output_mask != (1u << output_base->id)) return NULL; + if (c->cursors_are_broken) + return; if (es->buffer == NULL || !wl_buffer_is_shm(es->buffer) || es->geometry.width > 64 || es->geometry.height > 64) return NULL; @@ -780,15 +784,20 @@ drm_output_set_cursor(struct drm_output *output) handle = gbm_bo_get_handle(bo).s32; if (drmModeSetCursor(c->drm.fd, - output->crtc_id, handle, 64, 64)) + output->crtc_id, handle, 64, 64)) { weston_log("failed to set cursor: %m\n"); + c->cursors_are_broken = 1; + } } x = es->geometry.x - output->base.x; y = es->geometry.y - output->base.y; if (output->cursor_plane.x != x || output->cursor_plane.y != y) { - if (drmModeMoveCursor(c->drm.fd, output->crtc_id, x, y)) + if (drmModeMoveCursor(c->drm.fd, output->crtc_id, x, y)) { weston_log("failed to move cursor: %m\n"); + c->cursors_are_broken = 1; + } + output->cursor_plane.x = x; output->cursor_plane.y = y; }