From: Lyude Paul <lyude@redhat.com>
To: Simon Ser <contact@emersion.fr>, nouveau@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [Nouveau] [PATCH v2] nouveau/dispnv50: add cursor pitch check
Date: Fri, 05 Feb 2021 16:18:33 -0500 [thread overview]
Message-ID: <d61cece3230a5e3a16612655a7571bfa7626daba.camel@redhat.com> (raw)
In-Reply-To: <20210205210044.2665-1-contact@emersion.fr>
On Fri, 2021-02-05 at 22:00 +0100, Simon Ser wrote:
> The hardware needs a FB which is packed. Add checks to make sure
> this is the case.
>
> While at it, add debug logs for the existing checks. This allows
> user-space to more easily figure out why a configuration is
> rejected.
>
> v2:
> - Use drm_format_info instead of hardcoding bytes-per-pixel (Ilia)
> - Remove unnecessary size check (Ilia)
>
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
> drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 21 +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
> b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
> index 54fbd6fe751d..00f09c9a8d15 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
> @@ -30,6 +30,7 @@
>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_plane_helper.h>
> +#include <drm/drm_fourcc.h>
>
> bool
> curs507a_space(struct nv50_wndw *wndw)
> @@ -99,6 +100,8 @@ 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;
> + struct drm_framebuffer *fb = asyw->state.fb;
> int ret;
>
> ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
> @@ -109,12 +112,26 @@ 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.pitch[0] != asyw->image.w * fb->format->cpp[0]) {
> + 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);
> - if (ret)
> + if (ret) {
> + drm_dbg_atomic(dev,
> + "Invalid cursor image size: unsupported size
> %dx%d",
> + asyw->image.w, asyw->image.h);
> return ret;
> + }
Oh-some things I forgot to mention:
- You're missing some newlines in your debug messages
- Also, NV_ATOMIC() is a thing
With those two fixed:
Reviewed-by: Lyude Paul <lyude@redhat.com>
>
> return head->func->curs_format(head, asyw, asyh);
> }
--
Sincerely,
Lyude Paul (she/her)
Software Engineer at Red Hat
Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've
asked me a question, are waiting for a review/merge on a patch, etc. and I
haven't responded in a while, please feel free to send me another email to check
on my status. I don't bite!
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2021-02-05 21:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 21:00 [Nouveau] [PATCH v2] nouveau/dispnv50: add cursor pitch check Simon Ser
2021-02-05 21:18 ` Lyude Paul [this message]
2021-02-05 21:50 ` Ilia Mirkin
2021-02-05 22:15 ` Simon Ser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d61cece3230a5e3a16612655a7571bfa7626daba.camel@redhat.com \
--to=lyude@redhat.com \
--cc=bskeggs@redhat.com \
--cc=contact@emersion.fr \
--cc=nouveau@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).