From: Daniel Vetter <daniel@ffwll.ch>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
open list <linux-kernel@vger.kernel.org>,
dri-devel@lists.freedesktop.org, David Airlie <airlied@linux.ie>,
tzimmermann@suse.de, Sean Paul <sean@poorly.run>
Subject: Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
Date: Wed, 26 Jun 2019 18:27:54 +0200 [thread overview]
Message-ID: <20190626162754.GV12905@phenom.ffwll.local> (raw)
In-Reply-To: <20190626144013.GB12510@ravnborg.org>
On Wed, Jun 26, 2019 at 04:40:13PM +0200, Sam Ravnborg wrote:
> Hi Gerd.
>
> On Wed, Jun 26, 2019 at 08:55:50AM +0200, Gerd Hoffmann wrote:
> > Store width and height of the bo. Needed in case userspace
> > sets up a framebuffer with fb->width != bo->width..
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> > include/drm/drm_gem_vram_helper.h | 1 +
> > drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
> > index 1a0ea18e7a74..3692dba167df 100644
> > --- a/include/drm/drm_gem_vram_helper.h
> > +++ b/include/drm/drm_gem_vram_helper.h
> > @@ -39,6 +39,7 @@ struct drm_gem_vram_object {
> > struct drm_gem_object gem;
> > struct ttm_buffer_object bo;
> > struct ttm_bo_kmap_obj kmap;
> > + unsigned int width, height;
> >
> > /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */
> > struct ttm_placement placement;
> > diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> > index 4de782ca26b2..c02bf7694117 100644
> > --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> > +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> > @@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
> > gbo = drm_gem_vram_create(dev, bdev, size, pg_align, interruptible);
> > if (IS_ERR(gbo))
> > return PTR_ERR(gbo);
> > + gbo->width = args->width;
> > + gbo->height = args->height;
> >
> > ret = drm_gem_handle_create(file, &gbo->gem, &handle);
> > if (ret)
>
> Be warned, I may have missed something in the bigger picture.
>
> Your patch will set width and height only for dumb bo's
> But we have several users of drm_gem_vram_create() that will
> not set the width and height.
>
> So only in some cases can we rely on them being set.
> Should this be refactored so we always set width, height.
> Or maybe say in a small comment that width,height are only
> set for dumb bo's?
Also for dumb bo allocated buffers if userspace gets the dimensions wrong
between dumb_create and the addfb, something is wrong. Papering over that
by remembering the right dimensions doesn't look like a good solution.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2019-06-26 16:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190626065551.12956-1-kraxel@redhat.com>
2019-06-26 6:55 ` [PATCH 1/2] drm/vram: store dumb bo dimensions Gerd Hoffmann
2019-06-26 14:40 ` Sam Ravnborg
2019-06-26 16:27 ` Daniel Vetter [this message]
2019-07-08 13:39 ` Pekka Paalanen
2019-07-10 15:26 ` Daniel Vetter
2019-06-27 7:57 ` Thomas Zimmermann
2019-06-27 12:10 ` Gerd Hoffmann
2019-06-26 6:55 ` [PATCH 2/2] drm/bochs: fix framebuffer setup Gerd Hoffmann
2019-06-26 16:29 ` 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=20190626162754.GV12905@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--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 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).