All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: dri-devel@lists.freedesktop.org
Cc: sam@ravnborg.org, david@lechnology.com
Subject: [PATCH v3 0/2] drm: Add shmem GEM library
Date: Tue, 11 Sep 2018 14:43:58 +0200	[thread overview]
Message-ID: <20180911124400.40588-1-noralf@tronnes.org> (raw)

This patchset adds a library for shmem backed GEM objects and makes use
of it in tinydrm.

When I made tinydrm I used the CMA helper because it was very easy to
use. July last year I learned that this limits which drivers to PRIME
import from, since CMA requires continuous memory. tinydrm drivers don't
require that. So I set out to change that looking first at shmem, but
that wasn't working since shmem didn't work with fbdev deferred I/O.
Then I did a vmalloc buffer attempt which worked with deferred I/O, but
maybe wouldn't be of so much use as a library for other drivers to use.
As my work to split out stuff from the CMA helper for shared use came to
an end, I had a generic fbdev emulation that uses a shadow buffer for
deferred I/O.
This means that I can now use shmem buffers after all.

I have looked at the other drivers that use drm_gem_get_pages() and
several supports different cache modes so I've done that even though
tinydrm only uses the cached one.

tinydrm can both use vmalloc and shmem buffers, it doesn't matter as far
as I can see. So the question is what will benefit the rest of DRM the most.

Note:
Sparse has this complaint, but the problem is in kvmalloc_array():
include/linux/mm.h:592:13: error: undefined identifier '__builtin_mul_overflow'

Noralf.

Changes since version 2:
- Grammar (Sam Ravnborg)
- s/drm_gem_shmem_put_pages_unlocked/drm_gem_shmem_put_pages_locked/
  (Sam Ravnborg)
- Add debug ouput in error path (Sam Ravnborg)

Changes since version 1:
- Fix missing argument in docs (kbuild test robot)
- Fix: sparse: expression using sizeof(void) (kbuild test robot)
- Rebasing gave a new checkpatch warning, so I changed to bitfields:
  CHECK: Avoid using bool structure members because of possible alignment
  issues - see: https://lkml.org/lkml/2017/11/21/384
  #834: FILE: include/drm/drm_gem_shmem_helper.h:84:
  +       bool pages_mark_dirty_on_put;
  #841: FILE: include/drm/drm_gem_shmem_helper.h:91:
  +       bool pages_mark_accessed_on_put;

Noralf Trønnes (2):
  drm: Add library for shmem backed GEM objects
  drm/tinydrm: Switch from CMA to shmem buffers

 Documentation/gpu/drm-kms-helpers.rst          |  12 +
 drivers/gpu/drm/Kconfig                        |   6 +
 drivers/gpu/drm/Makefile                       |   1 +
 drivers/gpu/drm/drm_gem_shmem_helper.c         | 678 +++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/Kconfig                |   2 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c    |  91 +---
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c |   5 +
 drivers/gpu/drm/tinydrm/ili9225.c              |  14 +-
 drivers/gpu/drm/tinydrm/ili9341.c              |   6 +-
 drivers/gpu/drm/tinydrm/mi0283qt.c             |   6 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c             |  38 +-
 drivers/gpu/drm/tinydrm/repaper.c              |  24 +-
 drivers/gpu/drm/tinydrm/st7586.c               |  15 +-
 drivers/gpu/drm/tinydrm/st7735r.c              |   6 +-
 include/drm/drm_gem_shmem_helper.h             | 198 ++++++++
 include/drm/tinydrm/tinydrm.h                  |  36 +-
 16 files changed, 984 insertions(+), 154 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_gem_shmem_helper.c
 create mode 100644 include/drm/drm_gem_shmem_helper.h

-- 
2.15.1

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

             reply	other threads:[~2018-09-11 12:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 12:43 Noralf Trønnes [this message]
2018-09-11 12:43 ` [PATCH v3 1/2] drm: Add library for shmem backed GEM objects Noralf Trønnes
2018-09-13  1:33   ` David Lechner
2018-09-14 10:10     ` Eric Engestrom
2018-09-14 16:37       ` Noralf Trønnes
2018-09-11 12:44 ` [PATCH v3 2/2] drm/tinydrm: Switch from CMA to shmem buffers Noralf Trønnes
2018-09-13  1:35   ` David Lechner
2018-09-14 15:48 ` [PATCH v3 0/2] drm: Add shmem GEM library Thomas Hellstrom
2018-09-14 16:13   ` Daniel Vetter
2018-09-14 16:51     ` Noralf Trønnes
2018-09-14 17:11       ` Thomas Hellstrom
2018-09-14 18:09         ` Noralf Trønnes
2018-09-14 20:13           ` Thomas Hellstrom

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=20180911124400.40588-1-noralf@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sam@ravnborg.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 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.