All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"Huang, Ray" <Ray.Huang@amd.com>,
	"Zhang, Jerry" <Jerry.Zhang@amd.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"z.liuxinliang@hisilicon.com" <z.liuxinliang@hisilicon.com>,
	"zourongrong@gmail.com" <zourongrong@gmail.com>,
	"kong.kongxinwei@hisilicon.com" <kong.kongxinwei@hisilicon.com>,
	"puck.chen@hisilicon.com" <puck.chen@hisilicon.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 00/15] Share TTM code among framebuffer drivers
Date: Mon, 8 Apr 2019 13:59:18 +0200	[thread overview]
Message-ID: <096a70a7-ed24-2161-29e9-1907221b8a64@suse.de> (raw)
In-Reply-To: <d69e0b34-c586-2338-b063-fb758b6465d8@amd.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 7830 bytes --]

Hi

Am 08.04.19 um 13:10 schrieb Koenig, Christian:
> Well first problem is I'm not sure if that is a good idea. Essentially 
> we want to get rid of TTM in the long run.
> 
> On the other hand this work might aid with that goal, so it might be 
> worth a try.

I see. I'm actually interested in porting some of the fbdev driver code
over to DRM. So far, that patch set uses TTM. As there's so much
duplicated code among drivers, I was asked to merge some of the code
into helpers first.

If not for TTM, what would be the alternative? One VMA manager per
memory region per device?

With the patch set applied there are very few TTM calls left in the
drivers and some can even be replaced by helpers. Besides the stronger
cleanup, maybe we can merge these helpers under a different API name?
Something that does not imply a TTM-based implementation? Doing so would
ease a later rewrite with non-TTM code. Suggestions?

> Second is that this might actually not work of hand. The problem is here:
>> +	/* TODO: This test used to be performed by drivers, but can
>> +	 * this actually happen? If so, should we put the check into
>> +	 * drm_gem_ttm_of_gem()? */
>> +	if (!drm_is_gem_ttm(bo))
>> +		return;
> 
> Yeah, this test is mandatory because TTM on itself can present buffer 
> object which doesn't belong to the driver called.
> 
> E.g. we sometimes have BOs which don't belong to the current drivers on 
> a driver specific LRU. A totally brain dead  design if you ask me, but 
> that's how it is.
> 
> Not 100% sure, but by converting all drivers to use a common GEM_TTM 
> backend you might actually break that test.
> 
> I'm not sure if that is actually a problem in the real world, it most 
> likely isn't. But I still won't bet on it without being able to test this.

That's for explaining. So this test should best live in driver-specific
code.

Best regards
Thomas

> Regards,
> Christian.
> 
> Am 08.04.19 um 11:21 schrieb Thomas Zimmermann:
>> Several simple framebuffer drivers copy most of the TTM code from each
>> other. The implementation is always the same; except for the name of
>> some data structures.
>>
>> As recently discussed, this patch set provides generic TTM memory-
>> management code for framebuffers with dedicated video memory. It further
>> converts the respective drivers to the generic code. The shared code
>> is basically the same implementation as the one copied among individual
>> drivers.
>>
>> The patch set contains two major changes: first, it introduces
>> |struct drm_gem_ttm_object| and helpers. It's a GEM object that is
>> backed by TTM-managed memory. The type's purpose is somewhat similar
>> to |struct drm_gem_{cma, shmem}_object|. Second, the patch set
>> introduces |struct drm_simple_ttm| (for the lack of a better name) and
>> helpers. It's an implementation of a basic TTM-based memory manager.
>>
>> Both, GEM TTM and Simple TTM, support VRAM and SYSTEM placements. Support
>> for TT could probably be added if necessary. Both can be used independedly
>> from each other if desired by the DRM driver.
>>
>> Currently ast, bochs, mgag200, vboxvideo and hisilicon/hibmc can use
>> these helpers. Cirrus would also be a candidate, but as it's being
>> rewrtten from scratch, I didn't bother doing the conversion.
>>
>> Future directions: with these changes, the respective drivers can also
>> share some of their mode-setting or fbdev code. GEM TTM could implement
>> PRIME helpers, which would allow for using the generic fbcon.
>>
>> The patch set is against a recent drm-tip.
>>
>> Thomas Zimmermann (15):
>>    drm: Add |struct drm_gem_ttm_object| and helpers
>>    drm: Add |struct drm_gem_ttm_object| callbacks for |struct
>>      ttm_bo_driver|
>>    drm: Add |struct drm_gem_ttm_object| callbacks for |struct drm_driver|
>>    drm: Add drm_gem_ttm_fill_create_dumb() to create dumb buffers
>>    drm: Add Simple TTM, a memory manager for dedicated VRAM
>>    drm/ast: Convert AST driver to |struct drm_gem_ttm_object|
>>    drm/ast: Convert AST driver to Simple TTM
>>    drm/bochs: Convert Bochs driver to |struct drm_gem_ttm_object|
>>    drm/bochs: Convert Bochs driver to Simple TTM
>>    drm/mgag200: Convert mgag200 driver to |struct drm_gem_ttm_object|
>>    drm/mgag200: Convert mgag200 driver to Simple TTM
>>    drm/vboxvideo: Convert vboxvideo driver to |struct drm_gem_ttm_object|
>>    drm/vboxvideo: Convert vboxvideo driver to Simple TTM
>>    drm/hisilicon: Convert hibmc-drm driver to |struct drm_gem_ttm_object|
>>    drm/hisilicon: Convert hibmc-drm driver to Simple TTM
>>
>>   Documentation/gpu/drm-mm.rst                  |  23 +
>>   drivers/gpu/drm/Kconfig                       |  20 +
>>   drivers/gpu/drm/Makefile                      |   5 +
>>   drivers/gpu/drm/ast/Kconfig                   |   3 +-
>>   drivers/gpu/drm/ast/ast_drv.c                 |   4 +-
>>   drivers/gpu/drm/ast/ast_drv.h                 |  58 +-
>>   drivers/gpu/drm/ast/ast_fb.c                  |  18 +-
>>   drivers/gpu/drm/ast/ast_main.c                |  74 +--
>>   drivers/gpu/drm/ast/ast_mode.c                |  78 +--
>>   drivers/gpu/drm/ast/ast_ttm.c                 | 290 +---------
>>   drivers/gpu/drm/bochs/Kconfig                 |   2 +
>>   drivers/gpu/drm/bochs/bochs.h                 |  42 +-
>>   drivers/gpu/drm/bochs/bochs_drv.c             |   4 +-
>>   drivers/gpu/drm/bochs/bochs_kms.c             |  18 +-
>>   drivers/gpu/drm/bochs/bochs_mm.c              | 392 +-------------
>>   drivers/gpu/drm/drm_gem_ttm_helper.c          | 507 ++++++++++++++++++
>>   drivers/gpu/drm/drm_simple_ttm_helper.c       | 191 +++++++
>>   drivers/gpu/drm/drm_ttm_helper_common.c       |   6 +
>>   drivers/gpu/drm/hisilicon/hibmc/Kconfig       |   2 +
>>   .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c    |  19 +-
>>   .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |   4 +-
>>   .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  28 +-
>>   .../gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |  30 +-
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   | 328 +----------
>>   drivers/gpu/drm/mgag200/Kconfig               |   2 +
>>   drivers/gpu/drm/mgag200/mgag200_cursor.c      |  61 ++-
>>   drivers/gpu/drm/mgag200/mgag200_drv.c         |   4 +-
>>   drivers/gpu/drm/mgag200/mgag200_drv.h         |  68 +--
>>   drivers/gpu/drm/mgag200/mgag200_fb.c          |  18 +-
>>   drivers/gpu/drm/mgag200/mgag200_main.c        |  84 +--
>>   drivers/gpu/drm/mgag200/mgag200_mode.c        |  45 +-
>>   drivers/gpu/drm/mgag200/mgag200_ttm.c         | 290 +---------
>>   drivers/gpu/drm/vboxvideo/Kconfig             |   2 +
>>   drivers/gpu/drm/vboxvideo/vbox_drv.c          |   5 +-
>>   drivers/gpu/drm/vboxvideo/vbox_drv.h          |  64 +--
>>   drivers/gpu/drm/vboxvideo/vbox_fb.c           |  22 +-
>>   drivers/gpu/drm/vboxvideo/vbox_main.c         |  70 +--
>>   drivers/gpu/drm/vboxvideo/vbox_mode.c         |  36 +-
>>   drivers/gpu/drm/vboxvideo/vbox_ttm.c          | 344 +-----------
>>   include/drm/drm_gem_ttm_helper.h              | 119 ++++
>>   include/drm/drm_simple_ttm_helper.h           |  74 +++
>>   41 files changed, 1292 insertions(+), 2162 deletions(-)
>>   create mode 100644 drivers/gpu/drm/drm_gem_ttm_helper.c
>>   create mode 100644 drivers/gpu/drm/drm_simple_ttm_helper.c
>>   create mode 100644 drivers/gpu/drm/drm_ttm_helper_common.c
>>   create mode 100644 include/drm/drm_gem_ttm_helper.h
>>   create mode 100644 include/drm/drm_simple_ttm_helper.h
>>
>> --
>> 2.21.0
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

  reply	other threads:[~2019-04-08 11:59 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08  9:21 [PATCH 00/15] Share TTM code among framebuffer drivers Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 01/15] drm: Add |struct drm_gem_ttm_object| and helpers Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 02/15] drm: Add |struct drm_gem_ttm_object| callbacks for |struct ttm_bo_driver| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 03/15] drm: Add |struct drm_gem_ttm_object| callbacks for |struct drm_driver| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 04/15] drm: Add drm_gem_ttm_fill_create_dumb() to create dumb buffers Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 05/15] drm: Add Simple TTM, a memory manager for dedicated VRAM Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 06/15] drm/ast: Convert AST driver to |struct drm_gem_ttm_object| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 07/15] drm/ast: Convert AST driver to Simple TTM Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 08/15] drm/bochs: Convert Bochs driver to |struct drm_gem_ttm_object| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 09/15] drm/bochs: Convert Bochs driver to Simple TTM Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 10/15] drm/mgag200: Convert mgag200 driver to |struct drm_gem_ttm_object| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 11/15] drm/mgag200: Convert mgag200 driver to Simple TTM Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 12/15] drm/vboxvideo: Convert vboxvideo driver to |struct drm_gem_ttm_object| Thomas Zimmermann
2019-04-09  7:09   ` Hans de Goede
2019-04-09  7:09   ` Hans de Goede
2019-04-08  9:21 ` [PATCH 13/15] drm/vboxvideo: Convert vboxvideo driver to Simple TTM Thomas Zimmermann
2019-04-09  7:09   ` Hans de Goede
2019-04-09  7:37     ` Thomas Zimmermann
2019-04-09  7:09   ` Hans de Goede
2019-04-08  9:21 ` [PATCH 14/15] drm/hisilicon: Convert hibmc-drm driver to |struct drm_gem_ttm_object| Thomas Zimmermann
2019-04-08  9:21 ` [PATCH 15/15] drm/hisilicon: Convert hibmc-drm driver to Simple TTM Thomas Zimmermann
2019-04-08 11:10 ` [PATCH 00/15] Share TTM code among framebuffer drivers Koenig, Christian
2019-04-08 11:10 ` Koenig, Christian
2019-04-08 11:59   ` Thomas Zimmermann [this message]
2019-04-09  7:12     ` kraxel
2019-04-09  7:42       ` Dave Airlie
2019-04-09  8:29         ` kraxel
2019-04-09 11:55           ` Christian König
2019-04-09  8:29         ` kraxel
2019-04-09  7:50       ` Thomas Zimmermann
2019-04-15 15:54         ` Daniel Vetter
2019-04-15 15:57           ` Daniel Vetter
2019-04-15 15:57           ` Daniel Vetter
2019-04-15 16:21           ` Thomas Zimmermann
2019-04-15 19:17             ` Daniel Vetter
2019-04-16 10:05               ` Koenig, Christian
2019-04-16 11:03                 ` Daniel Vetter
2019-04-16 11:10                   ` Koenig, Christian
2019-04-16 11:03                 ` Daniel Vetter
2019-04-16 10:05               ` Koenig, Christian
2019-04-15 19:17             ` Daniel Vetter
2019-04-09  7:12     ` kraxel
2019-04-09 13:39     ` Koenig, Christian

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=096a70a7-ed24-2161-29e9-1907221b8a64@suse.de \
    --to=tzimmermann@suse.de \
    --cc=Christian.Koenig@amd.com \
    --cc=Jerry.Zhang@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=kraxel@redhat.com \
    --cc=puck.chen@hisilicon.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=z.liuxinliang@hisilicon.com \
    --cc=zourongrong@gmail.com \
    /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.