All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "André Almeida" <andrealmeid@igalia.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Melissa Wen" <mwen@igalia.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/vc4: Check for valid formats
Date: Wed, 11 Jan 2023 15:28:12 +0200	[thread overview]
Message-ID: <Y765bF+c2y5b22P4@intel.com> (raw)
In-Reply-To: <a4d642d8-5556-7efb-308f-ab5f9c7284b0@suse.de>

On Mon, Jan 02, 2023 at 03:20:06PM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 02.01.23 um 14:57 schrieb Maíra Canal:
> > Currently, vc4 is not checking valid formats before creating a
> > framebuffer, which is triggering the IGT test
> > igt@kms_addfb_basic@addfb25-bad-modifier to fail, as vc4 accepts
> > to create a framebuffer with an invalid modifier. Therefore, check
> > for valid formats before creating framebuffers on vc4 and vc5 in
> > order to avoid creating framebuffers with invalid formats.
> > 
> > Signed-off-by: Maíra Canal <mcanal@igalia.com>
> > ---
> >   drivers/gpu/drm/vc4/vc4_kms.c | 23 ++++++++++++++++++++++-
> >   1 file changed, 22 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> > index 53d9f30460cf..5d1afd66fcc1 100644
> > --- a/drivers/gpu/drm/vc4/vc4_kms.c
> > +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> > @@ -500,6 +500,27 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev,
> > 		mode_cmd = &mode_cmd_local;
> > 	}
> > 
> > +	if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format,
> > +				      mode_cmd->modifier[0])) {
> > +		drm_dbg_kms(dev, "Unsupported pixel format %p4cc / modifier 0x%llx\n",
> > +			    &mode_cmd->pixel_format, mode_cmd->modifier[0]);
> > +		return ERR_PTR(-EINVAL);
> > +	}
> 
> This might be a stupid question, but why doesn't drm_fbgem_fb_create() 
> do this test already? It seems like a no-brainer and *not* testing for 
> the plane formats should be the exception.

That was the approach I tried originally but there were a bunch of
problems with various drivers it at the time. Dunno if all of those
got sorted out or not. IIRC the idea floating around for ancient
drivers was to skip the check based on plane->format_default. Looks
like we're already using that approach in the setcrtc ioctl.

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2023-01-11 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 13:57 [PATCH] drm/vc4: Check for valid formats Maíra Canal
2023-01-02 14:20 ` Thomas Zimmermann
2023-01-02 14:29   ` Maíra Canal
2023-01-02 15:21     ` Thomas Zimmermann
2023-01-02 15:39       ` Maíra Canal
2023-01-02 15:46         ` Thomas Zimmermann
2023-01-03 10:00       ` Daniel Vetter
2023-01-11 13:28   ` Ville Syrjälä [this message]
2023-01-11 14:32     ` Maíra Canal
2023-01-11 22:16       ` Daniel Vetter

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=Y765bF+c2y5b22P4@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=andrealmeid@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=mcanal@igalia.com \
    --cc=mwen@igalia.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.