drm/nouveau: make cursor_set implementation consistent with other drivers
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 1 May 2011 21:49:04 +0000 (23:49 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 16 May 2011 00:51:05 +0000 (10:51 +1000)
When xorg state tracker wants to hide the cursor it calls set_cursor
with NULL buffer_handle and size=0x0, but nouveau refuses to hide it
because size is not 64x64... which is a bit odd. Both radeon and intel
check buffer_handle before validating size of cursor, so make nouveau
implementation consistent with them.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nv04_crtc.c
drivers/gpu/drm/nouveau/nv50_crtc.c

index cc3cd175ab9d5de0bdc2413578249bd7cb1cafc6..3c78bc81357e0e838ec933e330748d9bd019f661 100644 (file)
@@ -943,14 +943,14 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
        struct drm_gem_object *gem;
        int ret = 0;
 
-       if (width != 64 || height != 64)
-               return -EINVAL;
-
        if (!buffer_handle) {
                nv_crtc->cursor.hide(nv_crtc, true);
                return 0;
        }
 
+       if (width != 64 || height != 64)
+               return -EINVAL;
+
        gem = drm_gem_object_lookup(dev, file_priv, buffer_handle);
        if (!gem)
                return -ENOENT;
index b522a3a534c61cb11e422223acd285797d5284d1..ebabacf38da9ff02ae5f2f0f2503e1ffb3fd0ce5 100644 (file)
@@ -349,14 +349,14 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
        struct drm_gem_object *gem;
        int ret = 0, i;
 
-       if (width != 64 || height != 64)
-               return -EINVAL;
-
        if (!buffer_handle) {
                nv_crtc->cursor.hide(nv_crtc, true);
                return 0;
        }
 
+       if (width != 64 || height != 64)
+               return -EINVAL;
+
        gem = drm_gem_object_lookup(dev, file_priv, buffer_handle);
        if (!gem)
                return -ENOENT;