From: Maarten Maathuis Date: Tue, 24 Jun 2008 08:16:52 +0000 (+0200) Subject: NV50: fix cursor hide/show X-Git-Tag: submit/1.0/20121108.012404~642^2~124^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=315fef7ee44f9ca565f158a6a84fd29b34e69fd8;p=profile%2Fivi%2Flibdrm.git NV50: fix cursor hide/show --- diff --git a/linux-core/nv50_cursor.c b/linux-core/nv50_cursor.c index 4196df6..47ae11b 100644 --- a/linux-core/nv50_cursor.c +++ b/linux-core/nv50_cursor.c @@ -126,6 +126,7 @@ static int nv50_cursor_set_bo(struct nv50_crtc *crtc, drm_handle_t handle) crtc->cursor->show(crtc); } } else { + DRM_ERROR("Unable to find cursor bo with handle 0x%X\n", handle); return -EINVAL; } @@ -151,9 +152,6 @@ int nv50_cursor_create(struct nv50_crtc *crtc) crtc->cursor->enable = nv50_cursor_enable; crtc->cursor->disable = nv50_cursor_disable; - /* defaults */ - crtc->cursor->visible = true; /* won't happen until there is a cursor bo */ - return 0; } diff --git a/linux-core/nv50_kms_wrapper.c b/linux-core/nv50_kms_wrapper.c index 529a905..b3d5ce6 100644 --- a/linux-core/nv50_kms_wrapper.c +++ b/linux-core/nv50_kms_wrapper.c @@ -233,20 +233,35 @@ static int nv50_kms_crtc_cursor_set(struct drm_crtc *drm_crtc, uint32_t buffer_h { struct nv50_crtc *crtc = to_nv50_crtc(drm_crtc); struct nv50_display *display = nv50_get_display(crtc->dev); - int rval; + int rval = 0; if (width != 64 || height != 64) return -EINVAL; - rval = crtc->cursor->set_bo(crtc, (drm_handle_t) buffer_handle); + /* set bo before doing show cursor */ + if (buffer_handle) { + rval = crtc->cursor->set_bo(crtc, (drm_handle_t) buffer_handle); + if (rval != 0) + goto out; + } + + if (buffer_handle) { + rval = crtc->cursor->show(crtc); + if (rval != 0) + goto out; + } else { /* no handle implies hiding the cursor */ + rval = crtc->cursor->hide(crtc); + goto out; + } if (rval != 0) return rval; +out: /* in case this triggers any other cursor changes */ display->update(display); - return 0; + return rval; } static int nv50_kms_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y)