Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp49156pxf; Wed, 24 Mar 2021 20:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5iA42omsf2svv0mGZK1GFfsUElI5+OXtTjjEyLY3xyxeDCkaqyGxvCJfCxdazFN7MPHNz X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr6642468edb.373.1616643423284; Wed, 24 Mar 2021 20:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643423; cv=none; d=google.com; s=arc-20160816; b=AFZDWCxbzJwyYRfa9ehfT/f4tkyga0S9WnBwlMtSFOsCTFYjISvw4zOD9kWL0kqtlm +qvTM13AOpZOy33y51nOkEvPe5RcRF7MoybYb1WQi+o4lLyEEUu+Uq7R3A983ZZRYTgg 5Yyx1W2sF1z9OQKMtV6ALQeW5iRSl9K3EkK3HCdZmvczpjgu0ty6cer3Jt34s9raKci7 asrY2FALH6AXB4tIDS/OqIp7pyLzJFmLmI3sevU89/7osJMMhYk5DPsiMhU35xbPNNjb 6ErbUHZahugSwNuR8DoRwcOCfA7qxRuq+3Gehn3VtUSfvnX8VtZYGWjibm1YT9YXQj2z NgxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=q43DZqTfht3NrCwrhOoH0GTpptu7qHLVnI4+js1qVVg=; b=kK7rzTr7xmF3HeHAA1uo8lvBxRQ7VFOqFREgprWdAuO0kqWFFf2WG3crkQTMtdxfg9 V4yqohLUKYqg5a/l4djIKRO3p0W9KdYuewRu3opgAPgv+M4rGyJewVun+wq25pfuupxh tRa5pTsc/91Gasgn27Pg8Nqf9jHTSNG3062pvHCFlKmWsQaeCRsPceF5y8CqHq/KT/T+ +zFvJq1FHNvzS/6GXNm/7FQ9Gl1g3W2+clhY4B2NA+yuJoaiZ6Gvo+gkIvEyM4AUzX4z re10IOFV/R3QAACAwMJ2vGz0sq3aSSIZl7aD/ra1V9dlboTXOE1huXDLy+N5yYFtpdq1 71KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LEmqw7ac; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si3281709edi.290.2021.03.24.20.36.41; Wed, 24 Mar 2021 20:37:03 -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=@gmail.com header.s=20161025 header.b=LEmqw7ac; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233830AbhCXXYk (ORCPT + 99 others); Wed, 24 Mar 2021 19:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhCXXYU (ORCPT ); Wed, 24 Mar 2021 19:24:20 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E6FC06174A for ; Wed, 24 Mar 2021 16:24:20 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id j2so341046ybj.8 for ; Wed, 24 Mar 2021 16:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q43DZqTfht3NrCwrhOoH0GTpptu7qHLVnI4+js1qVVg=; b=LEmqw7acR1vo3ktaHg+ANOGf5OggOojszFWfBM09wKWmGvFqAmt8EToX8JUX7hasCc nOBhZR2AOq7mV7XtzdIXizoLYCckYM3k1HjPqQ7jBn1cuICTyAyRkoTvJEYrr4TdGP85 P1jf265cj82sWOjWAXoLxddhlzA9Kpfv4MWVsSnnDsx7AA5xfbw4G0+Mmsx7yegWu/0Y uWaqH4jBKT6kZ0WFA2i2vmBIlGEbkRVc1605Qi34pMLGtO2Snm7pbh2yw8fpqr8MNWS9 VGfahqS9yw+xKDtUP6t94++csS81Kh9T0Lk80egnjnAycqJFPIJy+NdI0xNXmMZf8IW0 z6kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q43DZqTfht3NrCwrhOoH0GTpptu7qHLVnI4+js1qVVg=; b=qvhNcfRgPMFn5t8KVgL+a1fLyMVEU0eziBdR7QXOlBoFm8IiUEf1NK8pSFPnPXWvLB /bmBHMQUJLj9Dv7K+y6UM7/i3f/nXkuH6eAzXDBDLBCzzFsmv4t1Y+PCFfkNdN9djh43 sU8eqy5J+ti6O3tAVl/MElY1u3SguurO3eb/e4NSZlgX/HYxgG8ovLZyk0nIai4v16BQ qm1xpfWXjAkGtoqBh6I97s2bMp9uZCLGJiIUpuItjtTOMzzqLupIJBl4bBYyPG8UGSEZ FXpAdjuzlDpEJb9lxa3Lbz0yYkB4jBiL3lf1MIbYAtPJGKihDg+wxSkcykaI4/l7/B71 McXg== X-Gm-Message-State: AOAM533AA6lIqtDre06sZJkVFzWMJ67hnhNWoDmx7OtRA53l/bCvR7yx g2zlTl2XJf/XrfUIi6zyMN0kXLG0ATGm/D4L9UMlMmETBKY= X-Received: by 2002:a25:6003:: with SMTP id u3mr8605761ybb.96.1616628259668; Wed, 24 Mar 2021 16:24:19 -0700 (PDT) MIME-Version: 1.0 References: <20210318230351.982064-1-lyude@redhat.com> In-Reply-To: <20210318230351.982064-1-lyude@redhat.com> From: Ben Skeggs Date: Thu, 25 Mar 2021 09:24:08 +1000 Message-ID: Subject: Re: [PATCH v2] drm/nouveau/kms/nv50-: Correct size checks for cursors To: Lyude Paul Cc: ML nouveau , David Airlie , open list , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , Jeremy Cline , Ben Skeggs , Martin Peres Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Mar 2021 at 09:04, Lyude Paul wrote: > > 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 isn't entirely correct though, as the > height of the cursor can be larger than the size of the cursor, as long as > the width is the same as the cursor size and there's no framebuffer offset. > > 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. > > Changes since v1: > * Don't use crtc_w everywhere for determining cursor layout, just use fb > size again > * Change check so that we only check that the w/h of the cursor plane is > the same, the width of the scanout surface is the same as the framebuffer > width, and that there's no offset being used for the cursor surface. > > Signed-off-by: Lyude Paul > Cc: Martin Peres > Cc: Jeremy Cline Thanks Lyude! > --- > drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > index 54fbd6fe751d..00e19fd959ea 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > @@ -98,6 +98,7 @@ static int > curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, > struct nv50_head_atom *asyh) > { > + struct nouveau_drm *drm = nouveau_drm(wndw->plane.dev); > struct nv50_head *head = nv50_head(asyw->state.crtc); > int ret; > > @@ -109,8 +110,20 @@ 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) { > + NV_ATOMIC(drm, "Plane width/height must be equal for cursors\n"); > return -EINVAL; > + } > + > + if (asyw->image.w != asyw->state.crtc_w) { > + NV_ATOMIC(drm, "Plane width must be equal to fb width for cursors (height can be larger though)\n"); > + return -EINVAL; > + } > + > + if (asyw->state.src_x || asyw->state.src_y) { > + NV_ATOMIC(drm, "Cursor planes do not support framebuffer offsets\n"); > + return -EINVAL; > + } > > ret = head->func->curs_layout(head, asyw, asyh); > if (ret) > -- > 2.29.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel