linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] drm: add gem ttm helpers
Date: Wed, 7 Aug 2019 10:28:00 +0200	[thread overview]
Message-ID: <CAKMK7uFyKd71w4H8nFk=WPSHL3KMwQ6kLwAMXTd_TAkrkJ++KQ@mail.gmail.com> (raw)
In-Reply-To: <20190807072654.arqvx37p4yxhegcu@sirius.home.kraxel.org>

On Wed, Aug 7, 2019 at 9:29 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> > > +/**
> > > + * drm_gem_ttm_mmap_offset() - Returns a GEM ttm object's mmap offset
> > > + * @gbo:   the GEM ttm object
> > > + *
> > > + * See drm_vma_node_offset_addr() for more information.
> > > + *
> > > + * Returns:
> > > + * The buffer object's offset for userspace mappings on success, or
> > > + * 0 if no offset is allocated.
> > > + */
> > > +u64 drm_gem_ttm_mmap_offset(struct ttm_buffer_object *bo)
> > > +{
> > > +   return drm_vma_node_offset_addr(&bo->base.vma_node);
> >
> > Why do we need a new one here, can't we use the existing gem
> > implementation for this (there really should only be one I hope, but I
> > didn't check).
>
> Havn't found one.

It got reverted out again:

commit 415d2e9e07574d3de63b8df77dc686e0ebf64865
Author: Rob Herring <robh@kernel.org>
Date:   Wed Jul 3 16:38:50 2019 -0600

    Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()"


> But maybe we don't need this as separate function and can simply move
> the drm_vma_node_offset_addr() call into
> drm_gem_ttm_driver_dumb_mmap_offset().
>
> > > +int drm_gem_ttm_driver_dumb_mmap_offset(struct drm_file *file,
> > > +                                    struct drm_device *dev,
> > > +                                    uint32_t handle, uint64_t *offset)
> > > +{
> > > +   struct drm_gem_object *gem;
> > > +   struct ttm_buffer_object *bo;
> > > +
> > > +   gem = drm_gem_object_lookup(file, handle);
> > > +   if (!gem)
> > > +           return -ENOENT;
> > > +
> > > +   bo = drm_gem_ttm_of_gem(gem);
> > > +   *offset = drm_gem_ttm_mmap_offset(bo);
> > > +
> > > +   drm_gem_object_put_unlocked(gem);
> > > +
> > > +   return 0;
> > > +}
> > > +EXPORT_SYMBOL(drm_gem_ttm_driver_dumb_mmap_offset);
> >
> > Same for this, you're just upcasting to ttm_bo and then downcasting to
> > gem_bo again ... I think just a series to roll out the existing gem
> > helpers everywhere should work?
>
> I don't think so.  drm_gem_dumb_map_offset() calls
> drm_gem_create_mmap_offset(), which I think is not correct for ttm
> objects because ttm_bo_init() handles vma_node initialization.

More code to unify first? This should work exactly the same way for
all gem based drivers I think ... Only tricky bit is making sure
vmwgfx keeps working correctly.
-Daniel

>
> cheers,
>   Gerd
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2019-08-07  8:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190806133454.8254-1-kraxel@redhat.com>
2019-08-06 13:34 ` [PATCH 1/3] drm: add gem ttm helpers Gerd Hoffmann
2019-08-06 13:54   ` Daniel Vetter
2019-08-07  7:26     ` Gerd Hoffmann
2019-08-07  8:28       ` Daniel Vetter [this message]
2019-08-07 10:36         ` Gerd Hoffmann
2019-08-07 11:40           ` Daniel Vetter
2019-08-07 11:51             ` Gerd Hoffmann
2019-08-07 21:08               ` Daniel Vetter
2019-08-06 15:46   ` Sam Ravnborg
2019-08-06 15:51   ` Sam Ravnborg
2019-08-06 13:34 ` [PATCH 2/3] drm/vram: switch vram helpers to use the new " Gerd Hoffmann
2019-08-06 13:34 ` [PATCH 3/3] drm/qxl: switch qxl " Gerd Hoffmann

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='CAKMK7uFyKd71w4H8nFk=WPSHL3KMwQ6kLwAMXTd_TAkrkJ++KQ@mail.gmail.com' \
    --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=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --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).