public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] drm: add SimpleDRM driver
Date: Wed, 17 Aug 2016 12:58:40 +0200	[thread overview]
Message-ID: <20160817105840.GU6232@phenom.ffwll.local> (raw)
In-Reply-To: <67173d99-f29d-6f14-b961-53f2966b73bd@tronnes.org>

On Wed, Aug 17, 2016 at 12:19:02PM +0200, Noralf Trønnes wrote:
> 
> Den 17.08.2016 11:30, skrev Daniel Vetter:
> > On Tue, Aug 16, 2016 at 9:38 PM, Noralf Trønnes <noralf@tronnes.org> wrote:
> > > > That's still a lot for what amounts to reimplementing mmap on shmem, but
> > > > badly. What I mean with redirecting is pointing the entire ->mmap
> > > > operation to the mmap implementation for the underlying mmap. Roughly:
> > > > 
> > > >          /* normal gem mmap checks first */
> > > > 
> > > >          /* redirect to shmem mmap */
> > > >          vma->vm_file = obj->filp;
> > > >          vma->vm_pgoff = 0;
> > > > 
> > > >          return obj->filp->f_op->mmap(obj->filp, vma);
> > > > 
> > > > Much less code ;-)
> > > 
> > > obj->filp is NULL in my case.
> > > 
> > > And looking at the docs, that's expected since I have driver specific
> > > backing?
> > > 
> > > /**
> > >   * @filp:
> > >   *
> > >   * SHMEM file node used as backing storage for swappable buffer objects.
> > >   * GEM also supports driver private objects with driver-specific backing
> > >   * storage (contiguous CMA memory, special reserved blocks). In this
> > >   * case @filp is NULL.
> > >   */
> > Hm, I totally misread the driver code. I assumed that we'd just
> > allocate normal shmem gem objects, and then copy them on-demand onto
> > the frontbuffer (in the dirty or plane update callbacks). Essentially
> > treat the firmware fb area as a manual upload display, except that we
> > don't use i2c or spi to do the upload, but normal mmio writes. I think
> > that would greatly simplify the driver, and more important: It would
> > also work like any other kms driver. Currently sdrm is violiting the
> > spec a bit by aliasing all dumb buffers to the same underlying backing
> > storage, and that's a bit evil.
> > 
> > The other bit I noticed (and why I was confused): The prime import
> > code reinvents a lot of wheels, and it digs into the backing storage
> > directly. Instead it should just call dma_buf_vmap/dma_buf_vunmap and
> > let the exporter figure out how it works.
> 
> Is there a driver I can look at that does it the way we want?
> I'm afraid that this gem framework is still over my head.
> Copying code or patterns is easy, starting from scratch demands
> understanding :-)

udl_gem.c is pretty much what I had in mind, including the handling of
dma-bufs and all that. Not sure how much point there is in sharing code,
at least if you can't test udl.

What udl doesn't do is directly redirect the mmap to the shmem node (and
reject the mmap for dma-buf imported buffers, since that's not a good idea
really).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-08-17 11:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 16:52 [PATCH v3 0/3] drm: add SimpleDRM driver Noralf Trønnes
2016-08-14 16:52 ` [PATCH v3 1/3] " Noralf Trønnes
2016-08-15  6:59   ` Daniel Vetter
2016-08-16 12:58     ` Noralf Trønnes
2016-08-16 15:25       ` Daniel Vetter
2016-08-16 19:38         ` Noralf Trønnes
2016-08-17  9:30           ` Daniel Vetter
2016-08-17 10:19             ` Noralf Trønnes
2016-08-17 10:58               ` Daniel Vetter [this message]
2016-08-14 16:52 ` [PATCH v3 2/3] drm: simpledrm: add fbdev fallback support Noralf Trønnes
2016-08-15  6:48   ` Daniel Vetter
2016-08-16 13:10     ` Noralf Trønnes
2016-08-16 15:31       ` Daniel Vetter
2016-08-14 16:52 ` [PATCH v3 3/3] drm: simpledrm: honour remove_conflicting_framebuffers() Noralf Trønnes
2016-08-15  7:12   ` Daniel Vetter
2016-08-15  7:14 ` [PATCH v3 0/3] drm: add SimpleDRM driver 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=20160817105840.GU6232@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.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