Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp914675pxf; Thu, 18 Mar 2021 14:57:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy81fQDJ8Oi8Znx8xk7GgUP9IJQMvT+MfSCj20/I30jNc9O7EjQjyAyTcuruzPtlNPXd/65 X-Received: by 2002:a17:906:4747:: with SMTP id j7mr719351ejs.221.1616104661187; Thu, 18 Mar 2021 14:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616104661; cv=none; d=google.com; s=arc-20160816; b=wms81M9aaJ0HDIXikW29New2Ft0cL6TLitle1tz9TgkI+Ucz330e3p4MDP4NJ1D5TR PdHSfKDyFk4IQBSilNS8MEzqw0S+OZcybiM9uv+EPXG4Qw529o+1qBBQAmWuLqGdtTcP BxWh1C0sl263J0gm9z9XZ1UspzDeGmE8Z5KZvBgtFLfYQXvzoO60oP8bNufgHirrwXlS 5QTIovQf2aM+lHxxa3GftAW5jXIxq3yhjvf3FsnPWrclPRWUhtTI4DUXnnsb8Stzi8nr Wim7Flk4D0SOKfkO/8vKp2sSFhhMgLMYOWjzPDFOhRF0JkGSO2c7iDulNDINg/oHz8pe j8Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+F9WBdvna1lLwOxbPDF5YvSCuQnZUcRY6D1ed3m7rV0=; b=Ri1mjbEtfbdM1k8umRmf+vvhBC4AlrrdMmclhth/dlkNQm7tqPmtHwg5yh7MB+gGlx 0hVR12mcfp10+IrLgz/kRouQegiwNDGchv9BxaiGk8LEXO5y3vo+NE49//4COwOLz7cz NNHYJmcGxYsMt5VtYTUaItemrlGW/cwpOlIHR+f+yGEIFt5+fPbfEt9MYImVB/gwaTBF 9ZqBRb5//MF89RVkAssHdrTNDttuJqnR7B37aH5zYYk68TFVP9kPgDxVsiEYZBgOtvPX SDWxbWBWISp2k0vI8HHKq7R2QUoCzERqwg5AkhvUNXdYCnOB10kYrjl9D+AqoF+xbzEn G+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WV7PWEU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk14si2443329edb.548.2021.03.18.14.57.17; Thu, 18 Mar 2021 14:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WV7PWEU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbhCRV42 (ORCPT + 99 others); Thu, 18 Mar 2021 17:56:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56620 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbhCRVzz (ORCPT ); Thu, 18 Mar 2021 17:55:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616104554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+F9WBdvna1lLwOxbPDF5YvSCuQnZUcRY6D1ed3m7rV0=; b=WV7PWEU3LLglX3hAVRQ21L60aXWSUjolb4bp6n2fZz0YycDOu3JVHdbVWl0oIul4HknGD9 SjA9ehiBJduwYtMkxxkNPCN3XH2neKIgOtb559WhamYH+DjwayH7HPjBull7cVGCXqVwZA W40nSxBDBXGpqWxJ0cQ8XBUCJJsWZJU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-3wuonlc2PaWuoZRdCBN9wA-1; Thu, 18 Mar 2021 17:55:52 -0400 X-MC-Unique: 3wuonlc2PaWuoZRdCBN9wA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE5B38143F2; Thu, 18 Mar 2021 21:55:50 +0000 (UTC) Received: from Whitewolf.lyude.net (ovpn-113-18.rdu2.redhat.com [10.10.113.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32D4C1F070; Thu, 18 Mar 2021 21:55:49 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: Martin Peres , Jeremy Cline , Ben Skeggs , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org (open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/nouveau/kms/nv50-: Check plane size for cursors, not fb size Date: Thu, 18 Mar 2021 17:55:40 -0400 Message-Id: <20210318215545.901756-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Found this while trying to make some changes to the kms_cursor_crc test. curs507a_acquire checks that the width and height of the cursor framebuffer are equal (asyw->image.{w,h}). This is actually wrong though, as we only want to be concerned that the actual width/height of the plane are the same. It's fine if we scan out from an fb that's slightly larger than the cursor plane (in fact, some igt tests actually do this). Note that I'm not entirely sure why this wasn't previously breaking kms_cursor_crc tests - they all set up cursors with the height being one pixel larger than the actual size of the cursor. But this seems to fix things, and the code before was definitely incorrect - so it's not really worth looking into further imho. Signed-off-by: Lyude Paul Cc: Martin Peres Cc: Jeremy Cline --- drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/head507d.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/head917d.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c index 54fbd6fe751d..7a7f80e51ec0 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c +++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c @@ -109,7 +109,7 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, if (ret || !asyh->curs.visible) return ret; - if (asyw->image.w != asyw->image.h) + if (asyw->state.crtc_w != asyw->state.crtc_h) return -EINVAL; ret = head->func->curs_layout(head, asyw, asyh); diff --git a/drivers/gpu/drm/nouveau/dispnv50/head507d.c b/drivers/gpu/drm/nouveau/dispnv50/head507d.c index 09b89983864b..3d230ca488c9 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head507d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head507d.c @@ -176,7 +176,7 @@ int head507d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw, struct nv50_head_atom *asyh) { - switch (asyw->image.w) { + switch (asyw->state.crtc_w) { case 32: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W32_H32; break; case 64: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W64_H64; break; default: diff --git a/drivers/gpu/drm/nouveau/dispnv50/head917d.c b/drivers/gpu/drm/nouveau/dispnv50/head917d.c index 4ce47b55f72c..caa7d633691b 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head917d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head917d.c @@ -103,7 +103,7 @@ int head917d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw, struct nv50_head_atom *asyh) { - switch (asyw->state.fb->width) { + switch (asyw->state.crtc_w) { case 32: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W32_H32; break; case 64: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W64_H64; break; case 128: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W128_H128; break; -- 2.29.2