From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8816EC433E0 for ; Fri, 5 Feb 2021 17:34:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BDE864DA5 for ; Fri, 5 Feb 2021 17:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BDE864DA5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alum.mit.edu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=nouveau-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E8F46F48D; Fri, 5 Feb 2021 17:34:34 +0000 (UTC) Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 008EF6F48D for ; Fri, 5 Feb 2021 17:34:32 +0000 (UTC) Received: by mail-vs1-f54.google.com with SMTP id n18so3994194vsa.12 for ; Fri, 05 Feb 2021 09:34:32 -0800 (PST) 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=Q4GSt5v04OjoqZmM0ABfrf1M1E/F5sKHykJg0oJZac8=; b=fFic9q1a2ar2Ona0Ix9tqst/tTDjhvyjYkYm6FBxHH/LziA3cyeesrMaxxpxs0Bh3/ We88jwQiz8QYgYfm/YoHXyVAWeKCI8P6xQrfU71Eqv3cTyWOMoiWnSe0r6oni7PfwQNP ruxLQW3KSFRebu5oZEY1V6YHhl+B/ytLyzCcNfeAJnyN0HP8NJ7XwqIKvG9z2n2jGo51 jZ7qt28PxJYRfoUjkj6iKzJFsC6/bmFShke400qwbd2TmKKB7o2EEQ9Bw2RByzfBE9W2 QN/0IU/AalAiJ5Ce7fAEo2+XWVdvP7K9IYP/dqWgziOzj1YKYjBuiFY+AyBlIjCHOUIa HUXw== X-Gm-Message-State: AOAM532qy+qShHgJBBo6qAHP6OebSrghFywRPwsj2ibVuFzK8kf/BFbJ SZZ632NdAyeB2niGSZcs+khwpCGcbjOyfY8QHQ8= X-Google-Smtp-Source: ABdhPJy+9DJ4eO0q+KaOhz9E/72q06yJtJ8MznokxwTTsZXh5a1YXnyLvO1aw8sm/839TQzLKzzmd2C0NOsvoPUTBEE= X-Received: by 2002:a67:7992:: with SMTP id u140mr4333817vsc.2.1612546472029; Fri, 05 Feb 2021 09:34:32 -0800 (PST) MIME-Version: 1.0 References: <20210205164515.4622-1-contact@emersion.fr> In-Reply-To: <20210205164515.4622-1-contact@emersion.fr> From: Ilia Mirkin Date: Fri, 5 Feb 2021 12:34:20 -0500 Message-ID: To: Simon Ser Subject: Re: [Nouveau] [PATCH] nouveau/dispnv50: add cursor size/pitch checks X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nouveau , Ben Skeggs Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Fri, Feb 5, 2021 at 11:45 AM Simon Ser wrote: > > The hardware needs a FB which is packed and not too large. Add > checks to make sure this is the case. > > While at it, add a debug log for the existing check. This allows > user-space to more easily figure out why a configuration is > rejected. > > This commit depends on "drm/nouveau/kms/nv50-: Report max cursor > size to userspace", otherwise mode_config.cursor_{width,height} > is zero. > > Signed-off-by: Simon Ser > Cc: Lyude Paul > Cc: Ben Skeggs > Cc: Ilia Mirkin > --- > drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 22 ++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > index 54fbd6fe751d..9a401751c56d 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c > @@ -99,6 +99,7 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, > struct nv50_head_atom *asyh) > { > struct nv50_head *head = nv50_head(asyw->state.crtc); > + struct drm_device *dev = head->base.base.dev; > int ret; > > ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state, > @@ -109,8 +110,27 @@ 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->image.w != asyw->image.h) { > + drm_dbg_atomic(dev, > + "Invalid cursor image size: width (%d) must match height (%d)", > + asyw->image.w, asyw->image.h); > return -EINVAL; > + } > + if (asyw->image.w > dev->mode_config.cursor_width || > + asyw->image.h > dev->mode_config.cursor_height) { > + drm_dbg_atomic(dev, > + "Invalid cursor image size: too large (%dx%d > %dx%d)", > + asyw->image.w, asyw->image.h, > + dev->mode_config.cursor_width, > + dev->mode_config.cursor_height); > + return -EINVAL; > + } > + if (asyw->image.pitch[0] != asyw->image.w * 4) { Rather than hard-coding to 4, make this look at the format (or cpp, which should be available somewhere too I think). (Yeah, currently we only expose RGBA8, but we should also be doing RGB5A1.) > + drm_dbg_atomic(dev, > + "Invalid cursor image pitch: image must be packed (pitch = %d, width = %d)", > + asyw->image.pitch[0], asyw->image.w); > + return -EINVAL; > + } > > ret = head->func->curs_layout(head, asyw, asyh); And this will fail due to the width/height not being supported, right? -ilia _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau