From patchwork Fri Sep 23 13:06:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 9348067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 968E36077A for ; Fri, 23 Sep 2016 13:06:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8948B2A1ED for ; Fri, 23 Sep 2016 13:06:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DF912A8CD; Fri, 23 Sep 2016 13:06:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1730A2A1ED for ; Fri, 23 Sep 2016 13:06:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84FBE6EA7C; Fri, 23 Sep 2016 13:06:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7ADB66EA7C for ; Fri, 23 Sep 2016 13:06:53 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 98C2AABCA; Fri, 23 Sep 2016 13:06:50 +0000 (UTC) From: Takashi Iwai To: Alex Deucher Subject: [PATCH] drm/radeon: Fix negative cursor position Date: Fri, 23 Sep 2016 15:06:49 +0200 Message-Id: <20160923130649.17828-1-tiwai@suse.de> X-Mailer: git-send-email 2.10.0 Cc: christian.koenig@amd.com, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP radeon_cursor_move_unlock() contains a workaround for AVIVO chips that are older than DCE6 when the cursor ends on 128 pixel boundary. It decreases the position when the calculated end position is on 128 pixel boundary. However, it hits also the condition where x=-1 and width=1 are passed, since cursor_end is 0 (which is aligned with 128, too). Then the value gets decreased and it hits WARN_ON_ONCE() below, eventually screws up the GPU. The fix is simply to skip the workaround when x is already zero. Also, remove the superfluous WARN_ON_ON() for the negative value check that wouldn't happen any longer after this change. Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000433 Cc: Signed-off-by: Takashi Iwai --- drivers/gpu/drm/radeon/radeon_cursor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index 2a10e24b34b1..4e436eb49a56 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c @@ -193,10 +193,8 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) if (w <= 0) { w = 1; cursor_end = x - xorigin + w; - if (!(cursor_end & 0x7f)) { + if (x > 0 && !(cursor_end & 0x7f)) x--; - WARN_ON_ONCE(x < 0); - } } } }